35 lines
893 B
GDScript
35 lines
893 B
GDScript
class_name Sequence extends RefCounted
|
|
|
|
static func Call(which: StringName, args: Dictionary) -> Variant:
|
|
var ui_args := {}
|
|
ui_args[&'ui_open_sound_override'] = null
|
|
ui_args[&'ui_close_sound_override'] = null
|
|
ui_args[&'ui_borrow_instead_of_pausing'] = true
|
|
ui_args[&'ui_no_dismiss'] = true
|
|
ui_args[&'sequence'] = load("res://sequences/%s.gd" % which)
|
|
ui_args[&'sequence_args'] = args
|
|
return await UI.Call(
|
|
load("res://sequences/base/SequenceAgent.tscn"),
|
|
ui_args
|
|
)
|
|
|
|
static func Return(whom: Sequence, what: Variant) -> bool:
|
|
var context := UI.context()
|
|
if (
|
|
context and
|
|
context is SequenceAgent and
|
|
context.sequence == whom
|
|
):
|
|
UI.Return(null, what)
|
|
return true
|
|
else:
|
|
push_error(
|
|
"Sequence.Return() called with wrong whom (%s) (what: %s)" % [
|
|
whom, what
|
|
]
|
|
)
|
|
return false
|
|
|
|
func _run(_args: Dictionary) -> Variant:
|
|
return await Promise.dummy().join()
|