A_SearchForPlayers is an action that checks if the actor has targeted a vulnerable player, i.e. a player with the MF_SHOOTABLE flag. If not, it will search the map for a new player to target. If none is found and Var1 is set to 0, the action will call the state specified by Var2.
This action originates from the v2.0 modification SRB2Morphed and was added to SRB2 itself in v2.1.
Code – A_SearchForPlayers
|
|
|
// Function: A_SearchForPlayers
//
// Description: Checks if the actor has targeted a vulnerable player. If not a new player will be searched all around. If no players are available the object can call a specific state. (Useful for not moving enemies)
//
// var1:
// if var1 == 0, if necessary call state with same state number as var2
// else, do not call a specific state if no players are available
// var2 = state number
//
void A_SearchForPlayers(mobj_t *actor)
{
INT32 locvar1 = var1;
INT32 locvar2 = var2;
#ifdef HAVE_BLUA
if (LUA_CallAction("A_SearchForPlayers", actor))
return;
#endif
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
if(locvar1==0)
{
P_SetMobjStateNF(actor, locvar2);
return;
}
}
}
|
|