2.2 KiB
2.2 KiB
ESCGlobalsManager
Extends: Resource
Description
A resource that manages the ESC global states The ESC global state is basically simply a dictionary of keys with values. Values can be bool, integer or strings
Constants Descriptions
RESERVED_GLOBALS
const RESERVED_GLOBALS: Array = ["ESC_LAST_SCENE","BYPASS_LAST_SCENE"]
A list of reserved globals which can not be overridden
Method Descriptions
has
func has(key: String) -> bool
Check if a global was registered
Parameters
- key: The global key to check Returns Wether the global was registered
get_global
func get_global(key: String)
Get the current value of a global
Parameters
- key: The key of the global to return the value Returns The value of the global
filter
func filter(pattern: String) -> Dictionary
Filter the globals and return all matching keys and their values as a dictionary Check out the Godot docs for the pattern format
Parameters
- pattern: The pattern that the keys have to match Returns A dictionary of matching keys and their values
set_global
func set_global(key: String, value, ignore_reserved: bool = false) -> void
Set the value of a global
Parameters
- key: The key of the global to modify
- value: The new value
set_global_wildcard
func set_global_wildcard(pattern: String, value) -> void
Set all globals that match the pattern to the value Check out the Godot docs for the pattern format
Parameters
- pattern: The wildcard pattern to match
- value: The new value
save_game
func save_game(p_savegame: ESCSaveGame) -> void
Save the state of globals in the savegame.
Parameters
- p_savegame: ESCSaveGame resource that holds all data of the save
Signals
- signal global_changed(global, old_value, new_value): Emitted when a global is changed