From 6758dc048e512becfc18875d533ec347e2ff1461 Mon Sep 17 00:00:00 2001 From: John Breaux Date: Sun, 14 Nov 2021 08:00:56 -0600 Subject: [PATCH] Debug: I lied. Ran into a bug regarding state save/restore when nesting scripts. --- godot_ship/script/debug/debug_menu.gd | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/godot_ship/script/debug/debug_menu.gd b/godot_ship/script/debug/debug_menu.gd index 91da5b4..1b9eb9a 100644 --- a/godot_ship/script/debug/debug_menu.gd +++ b/godot_ship/script/debug/debug_menu.gd @@ -539,16 +539,21 @@ func command_script(command): script.push_back(f.get_line()) f.close() # Save state and turn off echo + var state = {"echo": echo, + "pwn": present_working_node, + "history_pos": history_pos, + "history": history, + "expression": expression} echo = false - var pwn = present_working_node - var h = history_pos # Execute the script for cmd in script: _on_LineEdit_text_entered(cmd) - # Restore state and turn on echo - present_working_node = pwn - history_pos = h - echo = true + # Restore state + echo = state["echo"] + present_working_node = state["pwn"] + history_pos = state["history_pos"] + history = state["history"] + expression = state["expression"] else: debug_print_line("File not found: " + command[1] + "\n") else: