A_RingExplode is an action that makes the actor explode like an Explosion Ring or Grenade Ring. The actor spawns a NiGHTS paraloop-style explosion of MT_NIGHTSPARKLE
Objects, plays the sfx_prloop
sound, and damages any nearby players and other Objects with the flag MF_SHOOTABLE
. PainChance
sets both the range to damage Objects in and the size of the paraloop explosion created; distances in fracunits must be given as a multiple of FRACUNIT
. If an Object is found that can be damaged, MF2_DEBRIS
will be set in the actor's secondary Object flags.
Code – A_RingExplode
|
|
// Function: A_RingExplode
//
// Description: An explosion ring exploding
//
// var1 = unused
// var2 = unused
//
void A_RingExplode(mobj_t *actor)
{
mobj_t *mo2;
thinker_t *th;
angle_t d;
#ifdef HAVE_BLUA
if (LUA_CallAction("A_RingExplode", actor))
return;
#endif
for (d = 0; d < 16; d++)
P_SpawnParaloop(actor->x, actor->y, actor->z + actor->height, FixedMul(actor->info->painchance, actor->scale), 16, MT_NIGHTSPARKLE, S_NULL, d*(ANGLE_22h), true);
S_StartSound(actor, sfx_prloop);
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
if (mo2 == actor) // Don't explode yourself! Endless loop!
continue;
if (P_AproxDistance(P_AproxDistance(mo2->x - actor->x, mo2->y - actor->y), mo2->z - actor->z) > FixedMul(actor->info->painchance, actor->scale))
continue;
if (mo2->flags & MF_SHOOTABLE)
{
actor->flags2 |= MF2_DEBRIS;
P_DamageMobj(mo2, actor, actor->target, 1, 0);
continue;
}
}
return;
}
|
|