diff --git a/addons/Wol/Wol.gd b/addons/Wol/Wol.gd index 151ef6e..df7eeb0 100644 --- a/addons/Wol/Wol.gd +++ b/addons/Wol/Wol.gd @@ -99,7 +99,7 @@ func start(node = start_node): emit_signal('started') virtual_machine.set_node(node) - virtual_machine.resume() + virtual_machine.start() func resume(): virtual_machine.call_deferred('resume') diff --git a/addons/Wol/core/virtual_machine.gd b/addons/Wol/core/virtual_machine.gd index 7022c76..b8c40d4 100644 --- a/addons/Wol/core/virtual_machine.gd +++ b/addons/Wol/core/virtual_machine.gd @@ -95,6 +95,11 @@ func get_next_instruction(): return current_node.instructions[state.programCounter + 1] return +func start(): + if execution_state == Constants.ExecutionState.Stopped: + execution_state = Constants.ExecutionState.Suspended + resume() + func resume(): if current_node == null: printerr('Cannot run dialogue with no node selected') @@ -104,6 +109,10 @@ func resume(): printerr('Cannot run while waiting for option') return false + if execution_state == Constants.ExecutionState.Stopped: + printerr('Dialogue is stopped, explicitely start it before resuming') + return false + execution_state = Constants.ExecutionState.Running #execute instruction until something cool happens