|
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_JetgThink is an action that is used as the Jetty-Syn Gunner thinker. Try and get in shooting range, but out of standard attack range. Uses the MissileState
when ready to shoot at the player. If the actor's target doesn't exist or is dead, the actor will look for a new target player; if none can be found, it returns to its SpawnState
.
Object property |
Use
|
SpawnState |
Goes back to this state if no players can be found
|
MissileState |
Goes to this state when ready to shoot
|
Code – A_JetgThink
|
|
// Function: A_JetgThink
//
// Description: Thinker for Jetty-Syn Gunners
//
// var1 = unused
// var2 = unused
//
void A_JetgThink(mobj_t *actor)
{
sector_t *nextsector;
fixed_t thefloor;
#ifdef HAVE_BLUA
if (LUA_CallAction("A_JetgThink", actor))
return;
#endif
if (actor->z >= actor->waterbottom && actor->watertop > actor->floorz
&& actor->z > actor->watertop - FixedMul(256*FRACUNIT, actor->scale))
thefloor = actor->watertop;
else
thefloor = actor->floorz;
if (actor->target)
{
if (P_RandomChance(FRACUNIT/8) && !actor->reactiontime)
P_SetMobjState(actor, actor->info->missilestate);
else
A_JetChase (actor);
}
else if (actor->z - FixedMul((32<<FRACBITS), actor->scale) < thefloor && !(thefloor + FixedMul((32<<FRACBITS), actor->scale)
+ actor->height > actor->ceilingz))
{
actor->z = thefloor + FixedMul((32<<FRACBITS), actor->scale);
}
if (!actor->target || !(actor->target->flags & MF_SHOOTABLE))
{
// look for a new target
if (P_LookForPlayers(actor, true, false, 0))
return; // got a new target
P_SetMobjState(actor, actor->info->spawnstate);
return;
}
nextsector = R_PointInSubsector(actor->x + actor->momx, actor->y + actor->momy)->sector;
// Move downwards or upwards to go through a passageway.
if (nextsector->ceilingheight < actor->z + actor->height)
actor->momz -= FixedMul(5*FRACUNIT, actor->scale);
else if (nextsector->floorheight > actor->z)
actor->momz += FixedMul(5*FRACUNIT, actor->scale);
}
|
|