A_CheckBlock

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's checking point with the specified offset. 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 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 former human is very nervous; it runs around if anything disturbs it.

Actor NervousZombieman : Zombieman
{
    States
    {
    See:
        POSS AA 4 Fast A_Chase
        POSS A 0 A_CheckBlock("Nervous", CBF_SETTARGET, AAPTR_DEFAULT, radius + 1)
        POSS BB 4 Fast A_Chase
        POSS B 0 A_CheckBlock("Nervous", CBF_SETTARGET, AAPTR_DEFAULT, radius + 1)
        POSS CC 4 Fast A_Chase
        POSS C 0 A_CheckBlock("Nervous", CBF_SETTARGET, AAPTR_DEFAULT, radius + 1)
        POSS DD 4 Fast A_Chase
        POSS D 0 A_CheckBlock("Nervous", CBF_SETTARGET, AAPTR_DEFAULT, radius + 1)
        Loop
    Missile:
        POSS E 10 A_FaceTarget
        POSS F 8 A_PosAttack
        POSS E 8
        Goto See
    Pain:
        POSS G 3
        POSS G 3 A_Pain
        Goto Nervous
    Nervous:
        POSS AABBCCDD 2 Fast A_Wander
        POSS A 0 A_Jump(64, "See")
        Loop
    Raise:
        POSS K 5
        POSS JIH 5
        Goto See
    }
}

This article is issued from Zdoom. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.