fix: made some minor adjustments: added is_blocked

This commit is contained in:
Bram Dingelstad 2021-12-07 22:03:51 +01:00
parent 94dc4e774e
commit 1c47ea05f1
2 changed files with 7 additions and 2 deletions

View file

@ -24,8 +24,6 @@ export var auto_substitute = true
export(Dictionary) var variable_storage = {} export(Dictionary) var variable_storage = {}
var running = false
const Constants = preload('res://addons/Wol/core/Constants.gd') const Constants = preload('res://addons/Wol/core/Constants.gd')
const Compiler = preload('res://addons/Wol/core/compiler/Compiler.gd') const Compiler = preload('res://addons/Wol/core/compiler/Compiler.gd')
const Library = preload('res://addons/Wol/core/Library.gd') const Library = preload('res://addons/Wol/core/Library.gd')
@ -53,6 +51,7 @@ func set_path(_path):
path = _path path = _path
if not Engine.editor_hint and virtual_machine and not path.empty(): if not Engine.editor_hint and virtual_machine and not path.empty():
print('recompiling')
var compiler = Compiler.new(path) var compiler = Compiler.new(path)
virtual_machine.program = compiler.compile() virtual_machine.program = compiler.compile()
@ -103,6 +102,9 @@ func select_option(id):
func pause(): func pause():
virtual_machine.call_deferred('pause') virtual_machine.call_deferred('pause')
func is_blocked():
return virtual_machine.execution_state == Constants.ExecutionState.WaitingForOption
func start(node = starting_node): func start(node = starting_node):
running = true running = true
emit_signal('started') emit_signal('started')

View file

@ -156,6 +156,9 @@ func run_instruction(instruction):
Constants.ByteCode.RunLine: Constants.ByteCode.RunLine:
# Lookup string and give back as line # Lookup string and give back as line
var key = instruction.operands[0].value 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() var line = program.strings[key].clone()
# The second operand is the expression count of format function # The second operand is the expression count of format function