ESCEventManager
Extends: Node
Description
A manager for running events There are different “channels” an event can run on. The usual events happen in the foreground channel _front, but additional event queues can be added as required. Additionally, events can be scheduled to be queued in the future
Constants Descriptions
CHANNEL_FRONT
const CHANNEL_FRONT: String = "_front"
Event channel names
EVENT_CANT_REACH
const EVENT_CANT_REACH: String = "cant_reach"
EVENT_EXIT_SCENE
const EVENT_EXIT_SCENE: String = "exit_scene"
EVENT_INIT
const EVENT_INIT: String = "init"
EVENT_LOAD
const EVENT_LOAD: String = "load"
EVENT_NEW_GAME
const EVENT_NEW_GAME: String = "newgame"
EVENT_PRINT
const EVENT_PRINT: String = "print"
Pre-defined ESC events
EVENT_READY
const EVENT_READY: String = "ready"
EVENT_ROOM_SELECTOR
const EVENT_ROOM_SELECTOR: String = "room_selector"
EVENT_SETUP
const EVENT_SETUP: String = "setup"
EVENT_TRANSITION_IN
const EVENT_TRANSITION_IN: String = "transition_in"
EVENT_TRANSITION_OUT
const EVENT_TRANSITION_OUT: String = "transition_out"
Property Descriptions
scheduled_events
var scheduled_events: Array
A list of currently scheduled events
events_queue
var events_queue: Dictionary
A list of constantly running events in multiple background channels
Method Descriptions
queue_event_from_esc
func queue_event_from_esc(script_object: ESCScript, event: String, channel: String, block: bool) -> var
Queue a new event based on input from an ESC command, most likely “queue_event”
Parameters
script_object: Compiled script object, i.e. the one with the event to queue
event: Name of the event to queue
channel: Channel to run the event on (default:
_front
)block: Whether to wait for the queue to finish. This is only possible, if the queued event is not to be run on the same event as this command (default:
false
)
Returns indicator of success/status
queue_event
func queue_event(event: ESCEvent, force: bool = false) -> void
Queue a new event to run in the foreground
Parameters
event: Event to run
schedule_event
func schedule_event(event: ESCEvent, timeout: float) -> void
Schedule an event to run after a timeout
Parameters
event: Event to run
timeout: Number of seconds to wait before adding the event to the front queue
queue_background_event
func queue_background_event(channel_name: String, event: ESCEvent) -> void
Queue the run of an event in a background channel
Parameters
channel_name: Name of the channel to use
event: Event to run
interrupt
func interrupt(exceptions: PoolStringArray) -> void
Interrupt the events currently running and any that are pending.
Parameters
exceptions: an optional list of events which should be left running or queued
clear_event_queue
func clear_event_queue()
Clears the event queues.
is_channel_free
func is_channel_free(name: String) -> bool
Check whether a channel is free to run more events
Parameters
name: Name of the channel to test Returns Whether the channel can currently accept a new event
get_running_event
func get_running_event(name: String) -> ESCEvent
Get the currently running event in a channel
Parameters
name: Name of the channel Returns The currently running event or null
set_changing_scene
func set_changing_scene(p_is_changing_scene: bool) -> void
Setter for _changing_scene.
Parameterse
value: boolean value to set _changing_scene to
Signals
signal event_started(event_name): Emitted when the event started execution
signal background_event_started(channel_name, event_name): Emitted when an event is started in a channel of the background queue
signal event_finished(return_code, event_name): Emitted when the event did finish running
signal background_event_finished(return_code, event_name, channel_name): Emitted when a background event was finished