shut meanrepinfo / removes bleed on heal fix

This commit is contained in:
Shtoyan 2022-01-23 17:08:46 +04:00
parent 5aa528995d
commit 45d331ab09
4 changed files with 10 additions and 98 deletions

View File

@ -49,12 +49,12 @@ final private function bool bIsBleeding(ScrnHumanPawn pwn)
return false;
}
function PostRender(Canvas C){
function PostRender(Canvas C)
{
local int i;
local NicePack niceMutator;
local NiceHumanPawn nicePawn;
local class<NiceVeterancyTypes> niceVet;
local MeanReplicationInfo szRI;
local NiceWeapon niceWeap;
local NicePlayerController nicePlayer;
local ScrnHUD scrnHUDInstance;

View File

@ -405,12 +405,12 @@ simulated event Destroyed(){
// Screw that
simulated function ClientWeaponDestroyed(class<Weapon> WClass){}
// This event is generated when new pawn spawns
function PawnSpawned(){
function PawnSpawned()
{
local bool bFoundExp;
local float convertedExp;
local ClientPerkRepLink R;
local SRCustomProgress exp;
local MeanReplicationInfo meanRI;
local NicePack.PlayerRecord record;
//local NiceHumanPawn nicePawn;
// Make sure our health is at it's top
@ -498,10 +498,6 @@ function PawnSpawned(){
exp.IncrementProgress(convertedExp);
}
}
// Stop after-death bleeding
meanRI = class'MeanReplicationInfo'.static.findSZri(PlayerReplicationInfo);
if(meanRI != none)
meanRI.stopBleeding();
// Give necessary dosh to the player
if(NicePackMutator != none)
NicePackMutator.GiveProgressiveDosh(self);

View File

@ -185,25 +185,19 @@ simulated function HandleNiceHealingMechanicsAndSkills
simulated function RemovePoisonAndBleed(NiceHumanPawn healed)
{
local Inventory I;
local MeanReplicationInfo MRI;
local Inventory I;
// log spam fix
if (healed == none)
return;
// No bleeding
MRI = class'MeanReplicationInfo'.static.
findSZri(healed.PlayerReplicationInfo);
if (MRI != none)
MRI.stopBleeding();
// No poison
// No poison and bleed
if (healed.inventory == none)
return;
for (I = healed.inventory; I != none; I = I.inventory)
{
if (MeanPoisonInventory(I) != none)
if (MeanPoisonInventory(I) != none || MeanBleedInventory(I) != none)
I.Destroy();
}
}

View File

@ -1,82 +1,4 @@
// Copy pasted from super zombies mutator with small alterations
// no use atm
class MeanReplicationInfo extends ReplicationInfo;
struct BleedingState {
var float nextBleedTime;
var Pawn instigator;
var int count;
};
var PlayerReplicationInfo ownerPRI;
var bool isBleeding;
var int maxBleedCount;
var BleedingState bleedState;
var float bleedPeriod;
var float bleedLevel;
replication {
reliable if (bNetDirty && Role == ROLE_Authority)
isBleeding, ownerPRI;
}
// Returns bleed damage, corresponding to given bleed level and damage scale.
// Rand(7) should be used as a scale.
// Separate function created to allow for lowest/highest damage value computing.
function int calcBleedDamage(float level, int scale){
return level * (3 + scale);
}
function Tick(float DeltaTime) {
local PlayerController ownerCtrllr;
local bool amAlive;
local float bleedDamage;
ownerCtrllr = PlayerController(Owner);
amAlive = ownerCtrllr != none && ownerCtrllr.Pawn != none && ownerCtrllr.Pawn.Health > 0;
if(amAlive && bleedState.count > 0) {
if(bleedState.nextBleedTime < Level.TimeSeconds) {
bleedState.count--;
bleedState.nextBleedTime+= bleedPeriod;
// Fix bleeding when stalker dies
bleedDamage = calcBleedDamage(bleedLevel, rand(7));
if(bleedDamage < 1.0)
stopBleeding();
if(bleedState.instigator != none)
ownerCtrllr.Pawn.TakeDamage(bleedDamage, bleedState.instigator, ownerCtrllr.Pawn.Location,
vect(0, 0, 0), class'NiceDamTypeStalkerBleed');
else
ownerCtrllr.Pawn.TakeDamage(bleedDamage, ownerCtrllr.Pawn, ownerCtrllr.Pawn.Location,
vect(0, 0, 0), class'NiceDamTypeStalkerBleed');
if (ownerCtrllr.Pawn.isA('KFPawn')) {
KFPawn(ownerCtrllr.Pawn).HealthToGive -= 2 * bleedLevel;
}
}
} else {
isBleeding= false;
}
}
function stopBleeding(){
isBleeding = false;
bleedState.count = 0;
}
function setBleeding(Pawn instigator, float effectStrenght) {
// Can max possible damage do anything? If no, then don't even bother.
if(calcBleedDamage(effectStrenght, 7) < 1.0)
return;
bleedState.instigator = instigator;
bleedState.count = maxBleedCount;
bleedLevel = effectStrenght;
if(!isBleeding){
bleedState.nextBleedTime = Level.TimeSeconds;
isBleeding = true;
}
}
static function MeanReplicationInfo findSZri(PlayerReplicationInfo pri) {
local MeanReplicationInfo repInfo;
if(pri == none)
return none;
foreach pri.DynamicActors(Class'MeanReplicationInfo', repInfo)
if(repInfo.ownerPRI == pri)
return repInfo;
return none;
}
defaultproperties
{
maxBleedCount=7
bleedPeriod=1.500000
}
defaultproperties{}