refactor: remove deprecated debug command

This commit is contained in:
Balloonpopper
2022-04-15 12:49:01 +10:00
committed by Julian Murgia
parent 9f4a5d53c6
commit eeea2d0e5a
6 changed files with 19 additions and 29 deletions

View File

@@ -23,5 +23,6 @@ func configure() -> ESCCommandArgumentDescriptor:
# Run the command
func run(command_params: Array) -> int:
print(command_params[0])
# Replace the names of any globals in "{ }" with their value
print(escoria.logger.replace_globals(command_params[0]))
return ESCExecution.RC_OK

View File

@@ -95,7 +95,8 @@ func run(command_params: Array) -> int:
)
return ESCExecution.RC_ERROR
command_params[1] = _replace_globals(command_params[1])
# Replace the names of any globals in "{ }" with their value
command_params[1] = escoria.logger.replace_globals(command_params[1])
escoria.dialog_player.say(
command_params[0],
@@ -105,16 +106,3 @@ func run(command_params: Array) -> int:
yield(escoria.dialog_player, "say_finished")
escoria.current_state = escoria.GAME_STATE.DEFAULT
return ESCExecution.RC_OK
# Replaces terms in braces with the value of the matching global (or Null
# if none exists)
func _replace_globals(string: String):
for result in globals_regex.search_all(string):
var globresult = escoria.globals_manager.get_global(
str(result.get_string())
)
string = string.replace(
"{" + result.get_string() + "}", str(globresult)
)
return string

View File

@@ -21,7 +21,7 @@ signal background_event_finished(return_code, event_name, channel_name)
# Pre-defined ESC events
const EVENT_DEBUG = "debug"
const EVENT_PRINT = "print"
const EVENT_EXIT_SCENE = "exit_scene"
const EVENT_INIT = "init"
const EVENT_LOAD = "load"

View File

@@ -65,7 +65,7 @@ func _init():
# #### Parameters
#
# * string: Text to log
func _replace_globals(string: String) -> String:
func replace_globals(string: String) -> String:
for result in globals_regex.search_all(string):
var globresult = escoria.globals_manager.get_global(
str(result.get_string())
@@ -88,7 +88,7 @@ func _replace_globals(string: String) -> String:
func trace(string: String, args = []):
if _get_log_level() >= LOG_TRACE and !crashed:
var argsstr = str(args) if !args.empty() else ""
string = _replace_globals(string)
string = replace_globals(string)
_log("(T)\t" + string + " \t" + argsstr)
@@ -104,7 +104,7 @@ func trace(string: String, args = []):
# * args: Additional information
func debug(string: String, args = []):
if _get_log_level() >= LOG_DEBUG and !crashed:
string = _replace_globals(string)
string = replace_globals(string)
var argsstr = str(args) if !args.empty() else ""
_log("(D)\t" + string + " \t" + argsstr)
@@ -128,7 +128,7 @@ func info(string: String, args = []):
argsstr.append(p.global_id)
else:
argsstr.append(str(arg))
string = _replace_globals(string)
string = replace_globals(string)
_log("(I)\t" + string + " \t" + str(argsstr))
@@ -145,7 +145,7 @@ func info(string: String, args = []):
func warning(string: String, args = []):
if _get_log_level() >= LOG_WARNING and !crashed:
var argsstr = str(args) if !args.empty() else ""
string = _replace_globals(string)
string = replace_globals(string)
_log("(W)\t" + string + " \t" + argsstr, true)
if escoria.project_settings_manager.get_setting(
@@ -180,7 +180,7 @@ func warning(string: String, args = []):
func error(string: String, args = [], do_savegame: bool = true):
if _get_log_level() >= LOG_ERROR and !crashed:
var argsstr = str(args) if !args.empty() else ""
string = _replace_globals(string)
string = replace_globals(string)
_log("(E)\t" + string + " \t" + argsstr, true)
if escoria.project_settings_manager.get_setting(