diff options
| author | radiohotline <radoihotline@disroot.rg> | 2026-08-25 16:33:56 +0300 |
|---|---|---|
| committer | radiohotline <radoihotline@disroot.rg> | 2026-08-25 16:33:56 +0300 |
| commit | a89e744ed0e8c759caf041a580112365bbfe4303 (patch) | |
| tree | dd61e320904176995727e86a857d00c90d4933ba /addons/escoria-core/testing/ashes/interpreter/support | |
| parent | 6d53d8cac78250dc888aa49d5f9d4175c6652feb (diff) | |
Diffstat (limited to 'addons/escoria-core/testing/ashes/interpreter/support')
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 |
