- Added more A_Damage functions:

- A_DamageTarget
- A_DamageTracer
-Both take a number for how much damage to deal and the damagetype to
inflict. Negative numbers means healing.
This commit is contained in:
MajorCooke 2014-09-25 23:12:25 -05:00
parent b1f87295b8
commit 422e83a1b9
2 changed files with 61 additions and 5 deletions

View file

@ -5017,3 +5017,57 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageSelf)
P_GiveBody(self, amount);
}
}
//===========================================================================
//
// A_DamageTarget (int amount, str damagetype)
// Damages the target of the actor by the specified amount. Negative values heal.
//
//===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageTarget)
{
ACTION_PARAM_START(2);
ACTION_PARAM_INT(amount, 0);
ACTION_PARAM_NAME(DamageType, 1);
if (self->target != NULL)
{
if (amount > 0)
{
P_DamageMobj(self->target, self, self, amount, DamageType, DMG_NO_ARMOR);
}
else if (amount < 0)
{
amount = -amount;
P_GiveBody(self->target, amount);
}
}
}
//===========================================================================
//
// A_DamageTracer (int amount, str damagetype)
// Damages the tracer of the actor by the specified amount. Negative values heal.
//
//===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageTracer)
{
ACTION_PARAM_START(2);
ACTION_PARAM_INT(amount, 0);
ACTION_PARAM_NAME(DamageType, 1);
if (self->target != NULL)
{
if (amount > 0)
{
P_DamageMobj(self->tracer, self, self, amount, DamageType, DMG_NO_ARMOR);
}
else if (amount < 0)
{
amount = -amount;
P_GiveBody(self->tracer, amount);
}
}
}

View file

@ -305,6 +305,8 @@ ACTOR Actor native //: Thinker
action native A_DropItem(class<Actor> item, int dropamount = -1, int chance = 256);
action native A_SetSpeed(float speed);
action native A_DamageSelf(int amount, name damagetype = "none");
action native A_DamageTarget(int amount, name damagetype = "none");
action native A_DamageTracer(int amount, name damagetype = "none");
action native A_CheckSightOrRange(float distance, state label);
action native A_CheckRange(float distance, state label);