// A_RoamingShadowThinker
// Thinker for Midnight Channel's Roaming Shadows:
void A_RoamingShadowThinker(mobj_t *actor)
{
mobj_t *wind;
#ifdef HAVE_BLUA
if (LUA_CallAction("A_RoamingShadowThinker", (actor)))
return;
#endif
// extravalue1 replaces "movetimer"
// extravalue2 replaces "stoptimer"
P_SetScale(actor, FRACUNIT*3/2);
if (!actor->extravalue2)
{
P_InstaThrust(actor, actor->angle, 8<<FRACBITS); // move at 8 fracs / sec
actor->extravalue1 = ((actor->extravalue1) ? (actor->extravalue1-1) : (TICRATE*5+1)); // deplete timer if set, set to 5 ticrate otherwise.
if (actor->extravalue1 == 1) // if timer reaches 1, do a u-turn.
{
actor->extravalue1 = 0;
actor->extravalue2 = 60;
}
// Search for and attack Players venturing too close in front of us.
if (P_LookForPlayers(actor, false, false, 256<<FRACBITS)) // got target
{
if (actor->target && !actor->target->player->powers[pw_flashing]
&& !actor->target->player->kartstuff[k_invincibilitytimer]
&& !actor->target->player->kartstuff[k_growshrinktimer]
&& !actor->target->player->kartstuff[k_spinouttimer])
{
// send them flying and spawn the WIND!
P_InstaThrust(actor->target, 0, 0);
P_DamageMobj(actor->target, actor, actor, 1);
P_SetObjectMomZ(actor->target, 16<<FRACBITS, false);
S_StartSound(actor->target, sfx_wind1);
// Spawn the WIND:
wind = P_SpawnMobj(actor->target->x, actor->target->y, actor->target->z, MT_THOK); // Opaque layer:
P_SetMobjState(wind, S_GARU1);
P_SetScale(wind, FRACUNIT*3/2);
wind = P_SpawnMobj(actor->target->x, actor->target->y, actor->target->z, MT_THOK); // Translucent layer:
P_SetMobjState(wind, S_TGARU0);
P_SetScale(wind, FRACUNIT*3/2);
wind->destscale = 30<<FRACBITS;
}
}
}
else // Handle U-Turn
{
actor->angle += ANG1*3;
actor->extravalue2--;
}
return;
}