rott/kf_sources/ScrnStoryGame/Classes/ACTION_AddShield.uc
2026-07-14 20:27:09 +07:00

44 lines
953 B
Ucode

// adds health and shields to possesed Pawn or to matching Tag
class ACTION_AddShield extends ScriptedAction;
var(Action) class<Pawn> PawnClass; // leave none to heal possed pawn
var(Action) name PawnTag;
var(Action) int ShieldToAdd;
var(Action) int HealthToAdd;
var(Action) bool bDelayedHealing; // use GiveHealth() for KFPawns
function ProceedPawn(Pawn P)
{
if ( HealthToAdd > 0 ) {
if ( bDelayedHealing && KFPawn(P) != none )
KFPawn(P).GiveHealth(HealthToAdd, P.HealthMax);
else
P.Health = min(P.HealthMax, P.Health + HealthToAdd);
}
if ( ShieldToAdd > 0 )
P.AddShieldStrength(ShieldToAdd);
}
function bool InitActionFor(ScriptedController C)
{
local Actor A;
if ( PawnClass == none ) {
ProceedPawn(C.Pawn);
}
else {
ForEach C.DynamicActors(PawnClass, A, PawnTag)
ProceedPawn(Pawn(A));
}
return false;
}
defaultproperties
{
ActionString="add health and armor"
}