RewindableAction

Inherits: Node

Represents actions that may or may not happen, in a way compatible with rollback.

Tutorials

Methods

Return Type Name
String status_string(int status) static
void set_active(bool active, int tick)
bool is_active(int tick)
int get_status(int tick)
bool has_confirmed()
bool has_cancelled()
String get_status_string(int tick)
bool has_context(int tick)
Variant get_context(int tick)
void set_context(Variant value, int tick)
void erase_context(int tick)
void mutate(Object target)
void dont_mutate(Object target)

Constants

INACTIVE = 0


CONFIRMING = 1


ACTIVE = 2


CANCELLING = 3


Method Descriptions

String status_string ( int status ) static

Returns the status enum as string


void set_active ( bool active, int tick )

Toggles the action for a given tick


bool is_active ( int tick )

Check if the action is happening for the given tick


int get_status ( int tick )

Check the action's status for the given tick

Returns ACTIVE if the action is happening.
Returns INACTIVE if the action is not happening.
Returns CONFIRMING if the action was previously known as not happening, but now it is.
Returns CANCELLING if the action was previously known to be happening, but now it is not.

The CONFIRMING and CANCELLING statuses may occur if the action was just toggled, or data was received from the action's authority.


bool has_confirmed ( )

Returns true if the action has been in CONFIRMING status during the last tick loop


bool has_cancelled ( )

Returns true if the action has been in CANCELLING status during the last tick loop


String get_status_string ( int tick )

Get the action's current status as a string

See also: get_status


bool has_context ( int tick )

Returns true if the action has any stored context for the given tick


Variant get_context ( int tick )

Get the context stored for the given tick, or null


void set_context ( Variant value, int tick )

Store value as the context for the given tick


void erase_context ( int tick )

Erase the context for the given tick


void mutate ( Object target )

Whenever the action happens, mutate the target object

See also: _NetworkRollback.mutate()


void dont_mutate ( Object target )

Remove the target object from the list of objects to mutate()

See also: _NetworkRollback.mutate()