project_teddy/scripts/console.gd

70 lines
2.2 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)
2023-04-11 22:37:15 -06:00
elif command == "toggleHUD":
Global.consoleOutput = "HUD toggled!"
var HUD = get_node(str(Global.currentMapNode.get_path()) + str("/HUD"))
print(str(Global.currentMapNode.get_path()) + str("/HUD"))
if HUD.visible == true:
HUD.visible = false
elif HUD.visible == false:
HUD.visible = true
toggle_gun()
else:
Global.consoleOutput = "Unknown cheat code"
$output.text = Global.consoleOutput
func toggle_gun():
var map = Global.currentMapNode.get_path()
var playerID = Global.teddyAuthorityID
var gun = get_node(str(map) + '/' + str(playerID) + '/CollisionShape3D/Neck/Camera3D/Gun')
if gun.visible == true:
gun.visible = false
elif gun.visible == false:
gun.visible = true