A_CrawlaCommanderThink

From SRB2 Wiki
Jump to navigation Jump to search
This article or section is outdated and has not been fully updated to reflect the current version of SRB2.

Please help the Wiki by correcting or removing any misinformation, as well as adding any new information to the page.

To do
Update for 2.2.0 to describe changed behaviour (I'm not actually sure what it does now tbh)

A_CrawlaCommanderThink is an action that is used as the thinker for the Crawla Commander. The actor will look for a player to target if it hasn't got a target already, or its current target isn't shootable; if no players are found, the actor will return to its SpawnState. It will then try to follow the player and perform attacks depending on its health. If Var1 is set to a value other than 0, the actor will randomly fire a missile of an Object type determined by Var1 at the player, but only if the actor has less than 2 health points left.

When the actor has at least 1 health point, it will hover about above the floor, or the top of a water FOF if not too far below it. It does this by thrusting itself upwards if the floor/water surface is close enough, assuming it falls due to gravity (i.e the actor doesn't have MF_NOGRAVITY). As it does this it will face towards its target player, roaming around in its direction. If the player jumps/spins at it, it will retreat backwards to dodge the attack.

The actor's reaction time value will decide what to do next. Each time this action is used, the actor's reaction time will be reduced by 1 – when it is below 70 it will move itself closer to the player if too far away; when it reaches 0 it will thrust itself rapidly towards the player, resetting its reaction time to a random value ranging from 70 to 197.

When the actor's health reaches 1, this action will have it switch to a pogo-ing attack pattern instead – it will bounce up and foward towards its target player at a speed determined by Var2 and its distance from the player. Var2 should be a multiple of FRACUNIT to get the desired pogoing speeds – when far away from the player it will thrust upwards at Var2, and forwards at 2/3×Var2; when close it will thrust upwards at Var2, thrust forward at 1/8×Var2.

If the target player is in or moving towards a different sector to the actor with a floor higher than the actor itself, regardless of the actor's health, the actor will hover up to reach the floor above if it is not too far above the actor.

This action will additionally handle the Crawla Commander's temporary invincibility and flashing behavior for when the actor has been damaged. The actor's temporary invincibility timer is assumed to be controlled by the actor's fuse value. For every odd number the fuse is set to, the secondary Object flag MF2_DONTDRAW will be toggled on; for every even number this flag is turned off – these two behaviors together cause the actor's sprite to appear to flash in and out of existance alternatively every tic the fuse timer goes down. When the actor's fuse goes below 2, the secondary Object flag MF2_FRET is removed and the actor's fuse is stopped. This allows the Crawla Commander to be damaged by the player again and stops the sprite flashing.

Object property Use
SpawnState Goes to this state if no players can be found

  Actions – Enemy thinkers [view]
A_BuzzFlyA_CrawlaCommanderThinkA_DetonChaseA_EggShieldA_FaceStabChaseA_FaceStabRevA_FaceStabHurlA_FaceStabMissA_StatueBurstA_GuardChaseA_HoodThinkA_HoodFallA_JetbThinkA_JetChaseA_JetgShootA_JetgThinkA_JetJawChompA_JetJawRoamA_MinusCheckA_MinusDiggingA_MinusPopupA_PointyThinkA_SharpChaseA_SharpSpinA_SharpDecelA_SkimChaseA_SnailerThinkA_VultureCheckA_VultureVtol