mirror of
https://github.com/JohnBreaux/Boat-Battle.git
synced 2025-02-04 12:28:35 +00:00
Debug: add loading and running scripts\ Ship: Validate alternate implementation of getExtents()
This commit is contained in:
@@ -38,6 +38,7 @@ var helptext = {
|
||||
"command_getprop": [" prop", "Get the value of property prop\n" ],
|
||||
"command_setprop": [" prop value", "Set the property prop to value.\n" ],
|
||||
|
||||
"command_script": [" path", "Load and execute a script at a given path.\n" ],
|
||||
"command_restart": ["", "Kill the current scene tree and plant a new Root.\n" ],
|
||||
"command_exit": ["", "Quits the program.\n" ],
|
||||
|
||||
@@ -70,6 +71,7 @@ var commands = {
|
||||
["getprop","get", "g"]: "command_getprop",
|
||||
["setprop","set", "s"]: "command_setprop",
|
||||
|
||||
["script", "sh"]: "command_script",
|
||||
["restart", "killall"]: "command_restart",
|
||||
["exit", "quit"]: "command_exit",
|
||||
|
||||
@@ -519,6 +521,24 @@ func command_perf(command):
|
||||
else:
|
||||
debug_print_line(get_usage(command[0]))
|
||||
|
||||
# script: run a script from user://
|
||||
func command_script(command):
|
||||
var script = []
|
||||
if (command.size() > 1):
|
||||
var path = "user://" + command[1]
|
||||
var f = File.new()
|
||||
var err = f.open(path, File.READ)
|
||||
if err == OK:
|
||||
while not f.eof_reached():
|
||||
script.push_back(f.get_line())
|
||||
f.close()
|
||||
for cmd in script:
|
||||
_on_LineEdit_text_entered(cmd)
|
||||
else:
|
||||
debug_print_line("File not found: " + command[1] + "\n")
|
||||
else:
|
||||
debug_print_line(get_usage(command[0]))
|
||||
|
||||
func perf(attribute):
|
||||
if attribute.is_valid_integer():
|
||||
return Performance.get_monitor(int(attribute))
|
||||
|
||||
Reference in New Issue
Block a user