re-added explicit starting

This commit is contained in:
Bram Dingelstad 2021-11-21 15:06:39 +01:00
parent 9f60bbfd23
commit 15a9f79712
2 changed files with 10 additions and 1 deletions

View file

@ -99,7 +99,7 @@ func start(node = start_node):
emit_signal('started') emit_signal('started')
virtual_machine.set_node(node) virtual_machine.set_node(node)
virtual_machine.resume() virtual_machine.start()
func resume(): func resume():
virtual_machine.call_deferred('resume') virtual_machine.call_deferred('resume')

View file

@ -95,6 +95,11 @@ func get_next_instruction():
return current_node.instructions[state.programCounter + 1] return current_node.instructions[state.programCounter + 1]
return return
func start():
if execution_state == Constants.ExecutionState.Stopped:
execution_state = Constants.ExecutionState.Suspended
resume()
func resume(): func resume():
if current_node == null: if current_node == null:
printerr('Cannot run dialogue with no node selected') printerr('Cannot run dialogue with no node selected')
@ -104,6 +109,10 @@ func resume():
printerr('Cannot run while waiting for option') printerr('Cannot run while waiting for option')
return false return false
if execution_state == Constants.ExecutionState.Stopped:
printerr('Dialogue is stopped, explicitely start it before resuming')
return false
execution_state = Constants.ExecutionState.Running execution_state = Constants.ExecutionState.Running
#execute instruction until something cool happens #execute instruction until something cool happens