60 lines
1.3 KiB
Ucode
60 lines
1.3 KiB
Ucode
class ACTION_KillPawn extends ScriptedAction;
|
|
|
|
/**
|
|
* Who killed pawn?
|
|
* KILLER_None - nobody (none)
|
|
* KILLER_Instigator - ScriptedController.Instigator.Controller
|
|
* KILLER_Myself - ScriptedController
|
|
* KILLER_Suicide - Victim's controller
|
|
*/
|
|
enum EKiller
|
|
{
|
|
KILLER_None,
|
|
KILLER_Instigator,
|
|
KILLER_Myself,
|
|
KILLER_Suicide
|
|
};
|
|
|
|
var(Action) class<Pawn> VictimClass;
|
|
var(Action) name VictimTag;
|
|
var(Action) class<DamageType> DamageType;
|
|
var(Action) EKiller Killer;
|
|
|
|
function bool InitActionFor(ScriptedController C)
|
|
{
|
|
local Actor A;
|
|
local Pawn Victim;
|
|
local Controller KillerController;
|
|
|
|
switch ( Killer ) {
|
|
case KILLER_Instigator:
|
|
if ( C.Instigator != none )
|
|
KillerController = C.Instigator.Controller;
|
|
break;
|
|
|
|
case KILLER_Myself:
|
|
KillerController = C;
|
|
break;
|
|
}
|
|
|
|
ForEach C.DynamicActors(VictimClass, A, VictimTag) {
|
|
Victim = Pawn(A);
|
|
if ( Killer == KILLER_Suicide )
|
|
KillerController = Victim.Controller;
|
|
Victim.Died(KillerController, DamageType, Victim.Location);
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
function string GetActionString()
|
|
{
|
|
return ActionString @ GetItemName(String(VictimClass)) @ VictimTag;
|
|
}
|
|
|
|
defaultproperties
|
|
{
|
|
VictimClass=Class'Old2k4.Monster'
|
|
ActionString="Kill pawn"
|
|
}
|