1
0
KF2-Dev-Scripts/KFGame/Classes/KFAffliction_Snare.uc
2022-11-28 00:49:25 +03:00

53 lines
1.4 KiB
Ucode

//=============================================================================
// KFAffliction_Snare
//=============================================================================
// The snare (slowing down) affliction
//=============================================================================
// Killing Floor 2
// Copyright (C) 2016 Tripwire Interactive LLC
// - Christian "schneidzekk" Schneider
//=============================================================================
class KFAffliction_Snare extends KFAfflictionAdvanced;
var float SnareSpeedModifier;
function Init(KFPawn P, EAfflictionType Type, KFPerk InstigatorPerk)
{
Super.Init(P, Type, InstigatorPerk);
SnareSpeedModifier = 1.f;
if (InstigatorPerk != none)
{
SnareSpeedModifier = InstigatorPerk.GetSnareSpeedModifier();
}
}
/** */
function Activate(KFPerk InstigatorPerk, optional class<KFDamageType> DamageType = none)
{
if( !bIsActive )
{
super.Activate(InstigatorPerk, DamageType);
PawnOwner.SetTimer(Duration, false, nameof(DeActivate), self);
bIsActive = true;
PawnOwner.SetAfflictionSpeedModifier();
}
}
function DeActivate()
{
bIsActive = false;
`log(self@"was deactivaed", bDebug);
PawnOwner.SetAfflictionSpeedModifier();
}
/** Accessor to get known affliction speed modifier */
function float GetSpeedModifier()
{
return bIsActive ? SnareSpeedModifier : 1.f;
}
defaultproperties
{
}