1
0
mirror of https://github.com/JohnBreaux/Boat-Battle.git synced 2024-11-15 05:25:57 +00:00

Debug: Actually add nop, fix formatting, remove unused variables.

This commit is contained in:
John 2021-10-31 19:57:47 -05:00
parent 29f643de20
commit 3cf2335dd8

View File

@ -1,10 +1,7 @@
extends Control extends Control
var debug_output
var debug_line = 0
var debug_canvas var debug_canvas
var debug_transform
var debug_active = false var debug_active = false
var menu_position = 0.0 var menu_position = 0.0
@ -35,6 +32,8 @@ var helptext = {
"command_restart": ["", "Kill the current scene tree and plant a new Root.\n" ], "command_restart": ["", "Kill the current scene tree and plant a new Root.\n" ],
"command_exit": ["", "Quits the program.\n" ], "command_exit": ["", "Quits the program.\n" ],
"command_empty": ["", "No Operation.\n" ],
} }
# List of debug commands accessed by alias # List of debug commands accessed by alias
@ -60,7 +59,9 @@ var commands = {
["restart", "killall"]: "command_restart", ["restart", "killall"]: "command_restart",
["exit", "quit"]: "command_exit", ["exit", "quit"]: "command_exit",
}
[""]: "command_empty"
}
onready var present_working_node = get_node("/root/Main") onready var present_working_node = get_node("/root/Main")
@ -84,8 +85,6 @@ signal history_event(text)
# returns: void # returns: void
func _ready(): func _ready():
debug_canvas = get_node("debug_canvas") debug_canvas = get_node("debug_canvas")
debug_transform = debug_canvas.get_transform()
debug_output = get_node("debug_canvas/VBoxContainer/TextEdit")
command_help([""]) command_help([""])
debug_print_line("> ") debug_print_line("> ")
@ -129,7 +128,8 @@ func _input(event):
# params: line: Line of text entered by user # params: line: Line of text entered by user
# returns: void # returns: void
func _on_LineEdit_text_entered(line): func _on_LineEdit_text_entered(line):
history_append(line) if line != "":
history_append(line)
emit_signal("clear_in") emit_signal("clear_in")
debug_print_line(line + "\n") debug_print_line(line + "\n")
var command = line.split(' ', true, 1) var command = line.split(' ', true, 1)
@ -147,6 +147,7 @@ func _on_LineEdit_text_entered(line):
func history_append(text): func history_append(text):
history.resize(history_pos + 2) history.resize(history_pos + 2)
history[history_pos] = text history[history_pos] = text
history[history_pos + 1] = ""
history_pos += 1 history_pos += 1
# history_move: Traverse the history and update the user input box # history_move: Traverse the history and update the user input box
@ -220,7 +221,7 @@ func command_start (command):
if command.size() > 1: if command.size() > 1:
var pack = load("res://scenes/" + command[1] + ".tscn"); var pack = load("res://scenes/" + command[1] + ".tscn");
present_working_node.add_child(pack.instance()); present_working_node.add_child(pack.instance());
debug_print_line("start '" + command[1] + "'\n") debug_print_line("started '" + command[1] + "'\n")
else: else:
debug_print_line(get_usage(command[0])) debug_print_line(get_usage(command[0]))
@ -347,7 +348,7 @@ func command_history(_command):
if line: if line:
debug_print_line(String(lnum) + ": " + line + "\n") debug_print_line(String(lnum) + ": " + line + "\n")
lnum += 1 lnum += 1
debug_print_line("history_pos = " + String(history_pos) + "\n") #debug_print_line("history_pos = " + String(history_pos) + "\n")
# perf: Print the value of a Godot Engine performance counter # perf: Print the value of a Godot Engine performance counter
func command_perf(command): func command_perf(command):
@ -375,3 +376,7 @@ func perf(attribute):
"resources": "resources":
return Performance.get_monitor(Performance.OBJECT_RESOURCE_COUNT) return Performance.get_monitor(Performance.OBJECT_RESOURCE_COUNT)
return "" return ""
# empty: No command
func command_empty(_command):
pass