44 lines
953 B
Ucode
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"
|
|
}
|