A_JetgShoot is an action that makes the actor fire an Object defined by the actor's RaiseState
, and plays the actor's AttackSound
. The actor will quickly check how far the target is to it before firing at its target – PainChance
sets the maximum distance limit, measured in fracunits, while the minimum limit is set to 64 fracunits. If the target is in between these limits, the actor will face its target (using A_FaceTarget
) and fire the chosen Object. When the actor fires the chosen Object, the SeeSound
of the fired Object is played. If the actor's reaction time is not 0, the actor doesn't have a target to fire at, or the target is too near to/far away from the actor, this action will not do anything. In SRB2, this action is used by the Jetty-Syn Gunner.
After firing, the actor's reaction time is set to a new value determined by the actor's ReactionTime
. Normally, the reaction time is set to a value of ReactionTime*TICRATE*2
(or 2×ReactionTime
seconds). In Ultimate mode, it is set to ReactionTime*TICRATE
(or ReactionTime
seconds) instead.
Object property
|
Use
|
RaiseState
|
Object type to shoot
|
SeeSound (of Object being shot) |
Played when fired
|
AttackSound
|
Shooting sound
|
PainChance
|
Max shooting distance limit
|
ReactionTime
|
New reaction time (ReactionTime*TICRATE*2 ; ReactionTime*TICRATE in Ultimate mode)
|
Code – A_JetgShoot
|
|
// Function: A_JetgShoot
//
// Description: Firing function for Jetty-Syn gunners.
//
// var1 = unused
// var2 = unused
//
void A_JetgShoot(mobj_t *actor)
{
fixed_t dist;
#ifdef HAVE_BLUA
if (LUA_CallAction("A_JetgShoot", actor))
return;
#endif
if (!actor->target)
return;
if (actor->reactiontime)
return;
dist = P_AproxDistance(actor->target->x - actor->x, actor->target->y - actor->y);
if (dist > FixedMul(actor->info->painchance*FRACUNIT, actor->scale))
return;
if (dist < FixedMul(64*FRACUNIT, actor->scale))
return;
A_FaceTarget(actor);
P_SpawnMissile(actor, actor->target, (mobjtype_t)actor->info->raisestate);
if (ultimatemode)
actor->reactiontime = actor->info->reactiontime*TICRATE;
else
actor->reactiontime = actor->info->reactiontime*TICRATE*2;
if (actor->info->attacksound)
S_StartSound(actor, actor->info->attacksound);
}
|
|