Changed debug control to winodw

- Changed debug control into custom window dialog.
- Reworked "whereyoufrom" cheat
- Changed how the money cheat works
This commit is contained in:
Tony Bark 2021-05-20 22:16:43 -04:00
parent f6438a9bee
commit e86dd64b8b
5 changed files with 54 additions and 30 deletions

View file

@ -8,13 +8,14 @@ enum {
}
const valid_commands = [
["motherlode", [null],
["whereyoufrom", [ARG_STRING]]
]
["money", [ARG_INT] ],
["whereyoufrom", [ARG_STRING] ]
]
func motherlode():
SimData.budget += 50000
func money(value):
SimData.budget += int(value)
return "Budget changed to " + str(value)
func whereyoufrom(city_name):
SimData.city_name = city_name
func whereyoufrom(value):
SimData.city_name = str(value)
return "Changed city name to: " + str(value)

View file

@ -8,6 +8,5 @@ func _ready():
advisor.show()
func _process(delta):
if Input.is_action_just_released("ui_cheats"):
if Input.is_action_pressed("ui_cheats"):
debug_console.show()
get_tree().paused = true

View file

@ -1,4 +1,4 @@
extends Control
extends WindowDialog
onready var input_box = $Input
onready var output_box = $Output
@ -28,8 +28,8 @@ func process_command(text: String):
for i in range(words.size()):
if not check_type(words[i], cmd[1][i]):
output_text(str('Failure executing command "', cmd_word, '", parameter ', (i + 1),
' ("', words[i], '") is of the wrong type'))
output_text(str('Failure executing command "', cmd_word,
'", parameter ', (i + 1), ' ("', words[i], '") is of the wrong type'))
return
output_text(command_handler.callv(cmd_word, words))
@ -52,12 +52,13 @@ func check_type(string: String, type):
return false
func output_text(text):
output_box.text = str(output_box.text + "\n", text)
func _on_Input_text_entered(new_text):
input_box.clear()
process_command(new_text)
func _on_SubmitBtn_pressed():
input_box.clear()
process_command(input_box.text)