|
This article or section is incomplete. It doesn't have all of the necessary core information on this topic. Please help the SRB2 Wiki by finishing this article.
|
A_JetJawChomp is an action which is used as the attacking thinker for the Jet Jaw. The actor will chase the player, moving a distance of Speed
fracunits each time the action is used and turning to face the player. If the actor's target has died, can't be seen, or doesn't exist, it will return to its SpawnState
.
Object property |
Use
|
SpawnState |
Goes back to this state if target has died, can't be seen, or doesn't exist
|
Speed |
Distance to move, measured in fracunits
|
Code – A_JetJawChomp
|
|
// Function: A_JetJawChomp
//
// Description: Chase and chomp at the target, as long as it is in view
//
// var1 = unused
// var2 = unused
//
void A_JetJawChomp(mobj_t *actor)
{
INT32 delta;
#ifdef HAVE_BLUA
if (LUA_CallAction("A_JetJawChomp", actor))
return;
#endif
// turn towards movement direction if not there yet
if (actor->movedir < NUMDIRS)
{
actor->angle &= (7<<29);
delta = actor->angle - (actor->movedir << 29);
if (delta > 0)
actor->angle -= ANGLE_45;
else if (delta < 0)
actor->angle += ANGLE_45;
}
// Stop chomping if target's dead or you can't see it
if (!actor->target || !(actor->target->flags & MF_SHOOTABLE)
|| actor->target->health <= 0 || !P_CheckSight(actor, actor->target))
{
P_SetMobjStateNF(actor, actor->info->spawnstate);
return;
}
// chase towards player
if (--actor->movecount < 0 || !P_Move(actor, actor->info->speed))
P_NewChaseDir(actor);
}
|
|