A_CheckBlock

From ZDoom Wiki
Jump to: navigation, search

state A_CheckBlock (str block [, int flags [, pointer ptr [, float xofs [, float yofs [, float zofs [, float angle]]]]]]])

Note: Jump functions perform differently inside of anonymous functions.

Usage

Performs a check and jumps to block state based upon if an actor or a line is blocking the caller. This checks the current actor's flags and all THRU flags to see if it is currently being blocked from properly moving with A_Chase or similar.

Parameters

  • block: State jump the calling actor goes to if a line or actor is blocking it. Unlike other jump functions, leaving this empty ("") will NOT cause the function to do nothing, depending on flags. No jump is made if the actor is clear of blockage.
  • flags: The following can be combined with a ('|') symbol (logical or)
    • CBF_NOLINES - The caller never jumps if any lines are blocking it.
    • CBF_SETTARGET - If an actor is blocking the caller/pointer, sets it as the calling actor's target. Can be used to determine through other pointer checking functions to determine the difference between line and actor blocking, as the pointer will change.
    • CBF_SETMASTER - Same, but for master.
    • CBF_SETTRACER - Same, but for tracer.
    • CBF_SETONPTR - By default, the calling actor is the one to set the blocking actor as it's target/master/tracer regardless of who blocks it. This inverses that behavior so the pointer gets the actor blocking the caller or itself instead. Does nothing if none of the other pointer manipulating flags are present.
    • CBF_DROPOFF - Checks to see if the pointer is standing on or stuck in a tall dropoff.
    • CBF_NOACTORS - The caller never jumps if any actors are blocking it.
    • CBF_ABSOLUTEPOS - Use x/y/zofs as absolute coordinates.
    • CBF_ABSOLUTEANGLE - Use the angle parameter as an absolute angle instead of an offset to add/subtract from.
  • ptr: Defaults to AAPTR_TARGET. Checks the following actor pointer. Can take any pointer except AAPTR_NULL.
  • x/y/zofs: Offsets the position to check by this much. Behaves similarly to A_SpawnItemEx. Default is 0.
  • angle: Offsets the angle to turn the x/y/z offsets. Default is 0.

Examples

This zombie is very nevrous: he starts run around if anything disturbed him.

Actor NevrousZombie4ZDWiki: Zombieman replaces Zombieman
{
  States
  {
  See:
    POSS AA 4 Fast A_Chase
    POSS A 0 A_CheckBlock( "Nevrous", CBF_SETTARGET )
    POSS BB 4 Fast A_Chase
    POSS B 0 A_CheckBlock( "Nevrous", CBF_SETTARGET )
    POSS CC 4 Fast A_Chase
    POSS C 0 A_CheckBlock( "Nevrous", CBF_SETTARGET )
    POSS DD 4 Fast A_Chase
    POSS D 0 A_CheckBlock( "Nevrous", CBF_SETTARGET )
    Loop
  Pain:
    POSS G 3
    POSS G 3 A_Pain
    Goto Nevrous
  Nevrous:
    POSS AABBCCDD 2 Fast A_Wander
    POSS A 0 A_Jump( 63, "See" )
    Loop
  }
}