CheckNoDelay

From ZDoom Wiki
Jump to navigation Jump to search
Note: This feature is for ZScript only.


bool CheckNoDelay()

Usage

Checks to see if the action function set in the Actor's first state should be called on spawn. If so, calls the function. This will not call the function again if it was already handled previously.

Return value

Returns false if the Actor removed itself from the game during the process.

Examples

This check is best done right before changing the tick duration when managing an Actor's state since this is how ZDoom does it internally:

// Previous thinking logic

// Check if we should run the first function (or if the Actor is set not to tick its state)
if (!CheckNoDelay() || tics == -1)
{
    return;
}

// Decrement the Actor's current ticks
--tics;
if (!tics)
{
    SetState(curState.nextState);
}