project_teddy/scripts/console.gd

52 lines
1.6 KiB
GDScript3
Raw Normal View History

extends Node
var scenePlayground = "res://scenes/playground.tscn"
var sceneTutorial = "res://scenes/tutorial.tscn"
func _ready():
pass
func _process(delta):
if not Global.consoleOpen:
self.queue_free()
if Input.is_action_just_pressed("console_send"):
Global.consoleCommand = $consoleEdit.text
2023-02-28 11:48:41 -07:00
print ("Console command run: ", Global.consoleCommand)
run_command(Global.consoleCommand)
func run_command(command):
if command == "tele playground":
get_tree().change_scene_to_file(scenePlayground)
Global.consoleOutput = "Teleported to Playground!"
elif command == "tele tutorial":
get_tree().change_scene_to_file(sceneTutorial)
Global.consoleOutput = "Teleported to Tutorial!"
elif command == "which scene":
Global.consoleOutput = get_tree().get_current_scene().get_name()
elif command == "iamgod":
if not Global.godMode:
Global.consoleOutput = "God mode activated"
Global.godMode = true
elif Global.godMode:
Global.consoleOutput = "God mode deactivated"
Global.godMode = false
elif command == "exit":
Global.consoleOutput = "Byeee loser"
get_tree().quit()
elif command == "paul":
Global.consoleOutput = "Yuppp that's me"
elif command == "jayden":
Global.consoleOutput = "That's the noob artist"
2023-02-07 13:22:31 -07:00
elif command == "resetvars":
Global.consoleOutput = "Reset variables"
Global.reset_variables()
elif command in ["suicide", "kill", "die"]:
Global.consoleOutput = "Oh you didn't want to die?"
Global.playerHealth = 0
2023-02-24 13:43:51 -07:00
elif command == "gps":
Global.consoleOutput = str(Global.get_node(Global.selfTeddy).global_position)
else:
Global.consoleOutput = "Unknown cheat code"
$output.text = Global.consoleOutput