From 1c47ea05f1451256e085f30c89646ceece02e913 Mon Sep 17 00:00:00 2001 From: Bram Dingelstad Date: Tue, 7 Dec 2021 22:03:51 +0100 Subject: [PATCH] fix: made some minor adjustments: added is_blocked --- addons/Wol/Wol.gd | 6 ++++-- addons/Wol/core/VirtualMachine.gd | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/addons/Wol/Wol.gd b/addons/Wol/Wol.gd index a0585c1..7a6c719 100644 --- a/addons/Wol/Wol.gd +++ b/addons/Wol/Wol.gd @@ -24,8 +24,6 @@ export var auto_substitute = true export(Dictionary) var variable_storage = {} -var running = false - const Constants = preload('res://addons/Wol/core/Constants.gd') const Compiler = preload('res://addons/Wol/core/compiler/Compiler.gd') const Library = preload('res://addons/Wol/core/Library.gd') @@ -53,6 +51,7 @@ func set_path(_path): path = _path if not Engine.editor_hint and virtual_machine and not path.empty(): + print('recompiling') var compiler = Compiler.new(path) virtual_machine.program = compiler.compile() @@ -103,6 +102,9 @@ func select_option(id): func pause(): virtual_machine.call_deferred('pause') +func is_blocked(): + return virtual_machine.execution_state == Constants.ExecutionState.WaitingForOption + func start(node = starting_node): running = true emit_signal('started') diff --git a/addons/Wol/core/VirtualMachine.gd b/addons/Wol/core/VirtualMachine.gd index ad66224..c986b25 100644 --- a/addons/Wol/core/VirtualMachine.gd +++ b/addons/Wol/core/VirtualMachine.gd @@ -156,6 +156,9 @@ func run_instruction(instruction): Constants.ByteCode.RunLine: # Lookup string and give back as line var key = instruction.operands[0].value + if not program.strings.has(key): + printerr('Cant find line for "%s"' % key) + return var line = program.strings[key].clone() # The second operand is the expression count of format function