diff options
Diffstat (limited to 'addons/escoria-core/testing/ashes/interpreter/support/commands')
6 files changed, 65 insertions, 0 deletions
diff --git a/addons/escoria-core/testing/ashes/interpreter/support/commands/test_delayed_set_global.gd b/addons/escoria-core/testing/ashes/interpreter/support/commands/test_delayed_set_global.gd new file mode 100644 index 0000000..c0463b2 --- /dev/null +++ b/addons/escoria-core/testing/ashes/interpreter/support/commands/test_delayed_set_global.gd @@ -0,0 +1,16 @@ +class_name TestDelayedSetGlobalCommand +extends ESCBaseCommand + + +func configure() -> ESCCommandArgumentDescriptor: + return ESCCommandArgumentDescriptor.new( + 3, + [[TYPE_STRING], [TYPE_STRING], [TYPE_FLOAT, TYPE_INT]], + [null, null, null] + ) + + +func run(command_params: Array) -> int: + await escoria.get_tree().create_timer(float(command_params[2])).timeout + escoria.globals_manager.set_global(command_params[0], command_params[1]) + return ESCExecution.RC_OK diff --git a/addons/escoria-core/testing/ashes/interpreter/support/commands/test_delayed_set_global.gd.uid b/addons/escoria-core/testing/ashes/interpreter/support/commands/test_delayed_set_global.gd.uid new file mode 100644 index 0000000..f844e2a --- /dev/null +++ b/addons/escoria-core/testing/ashes/interpreter/support/commands/test_delayed_set_global.gd.uid @@ -0,0 +1 @@ +uid://b21sl821n61w4 diff --git a/addons/escoria-core/testing/ashes/interpreter/support/commands/test_interruptible_set_global.gd b/addons/escoria-core/testing/ashes/interpreter/support/commands/test_interruptible_set_global.gd new file mode 100644 index 0000000..2ea34a9 --- /dev/null +++ b/addons/escoria-core/testing/ashes/interpreter/support/commands/test_interruptible_set_global.gd @@ -0,0 +1,32 @@ +class_name TestInterruptibleSetGlobalCommand +extends ESCBaseCommand + + +var _interrupted := false + + +func configure() -> ESCCommandArgumentDescriptor: + return ESCCommandArgumentDescriptor.new( + 4, + [[TYPE_STRING], [TYPE_STRING], [TYPE_STRING], [TYPE_FLOAT, TYPE_INT]], + [null, null, null, null] + ) + + +func run(command_params: Array) -> int: + _interrupted = false + + var deadline_usec := Time.get_ticks_usec() + int(float(command_params[3]) * 1000000.0) + while Time.get_ticks_usec() < deadline_usec and not _interrupted: + await escoria.get_tree().create_timer(0.01).timeout + + if _interrupted: + escoria.globals_manager.set_global(command_params[2], true) + return ESCExecution.RC_OK + + escoria.globals_manager.set_global(command_params[0], command_params[1]) + return ESCExecution.RC_OK + + +func interrupt(): + _interrupted = true diff --git a/addons/escoria-core/testing/ashes/interpreter/support/commands/test_interruptible_set_global.gd.uid b/addons/escoria-core/testing/ashes/interpreter/support/commands/test_interruptible_set_global.gd.uid new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/addons/escoria-core/testing/ashes/interpreter/support/commands/test_interruptible_set_global.gd.uid diff --git a/addons/escoria-core/testing/ashes/interpreter/support/commands/test_set_global.gd b/addons/escoria-core/testing/ashes/interpreter/support/commands/test_set_global.gd new file mode 100644 index 0000000..41bd624 --- /dev/null +++ b/addons/escoria-core/testing/ashes/interpreter/support/commands/test_set_global.gd @@ -0,0 +1,15 @@ +class_name TestSetGlobalCommand +extends ESCBaseCommand + + +func configure() -> ESCCommandArgumentDescriptor: + return ESCCommandArgumentDescriptor.new( + 2, + [[TYPE_STRING], [TYPE_STRING]], + [null, null] + ) + + +func run(command_params: Array) -> int: + escoria.globals_manager.set_global(command_params[0], command_params[1]) + return ESCExecution.RC_OK diff --git a/addons/escoria-core/testing/ashes/interpreter/support/commands/test_set_global.gd.uid b/addons/escoria-core/testing/ashes/interpreter/support/commands/test_set_global.gd.uid new file mode 100644 index 0000000..b273d48 --- /dev/null +++ b/addons/escoria-core/testing/ashes/interpreter/support/commands/test_set_global.gd.uid @@ -0,0 +1 @@ +uid://chb08gv4i2nlw |
