Debug menu, reorganized game scene

This commit is contained in:
gamer147
2026-04-05 20:53:04 -04:00
parent eb5bf32bb8
commit 1973d93b16
17 changed files with 816 additions and 1 deletions

View File

@@ -0,0 +1,15 @@
class_name HelpCommand extends ConsoleCommand
func get_command_name() -> String:
return "help"
func get_help_text() -> String:
return "Lists all available commands"
func run(args: Array, context: Dictionary) -> String:
var commands: Array = context["commands"]
var lines: PackedStringArray = []
for command: ConsoleCommand in commands:
lines.append("%s - %s" % [command.get_command_name(), command.get_help_text()])
lines.append("Any other input is evaluated as a GDScript expression.")
return "\n".join(lines)

View File

@@ -0,0 +1 @@
uid://bvat5xgudptct

View File

@@ -0,0 +1,14 @@
class_name ListScenesCommand extends ConsoleCommand
func get_command_name() -> String:
return "list_scenes"
func get_help_text() -> String:
return "Lists available scenes for swapping"
func run(args: Array, context: Dictionary) -> String:
var registry: Array = context["scene_registry"]
var lines: PackedStringArray = []
for entry: Dictionary in registry:
lines.append(entry["name"])
return "\n".join(lines)

View File

@@ -0,0 +1 @@
uid://b51b3np7lxd3v

View File

@@ -0,0 +1,21 @@
class_name SwapCommand extends ConsoleCommand
func get_command_name() -> String:
return "swap"
func get_help_text() -> String:
return "swap <name> - Swap to a scene by name (use list_scenes to see options)"
func run(args: Array, context: Dictionary) -> String:
if args.size() == 0:
return "Usage: swap <scene name>"
var search_name := " ".join(args).to_lower()
var registry: Array = context["scene_registry"]
for entry: Dictionary in registry:
if entry["name"].to_lower() == search_name:
var debug_menu: Node = context["debug_menu"]
debug_menu.swap_scene(entry)
return ""
return "Scene not found: %s" % search_name

View File

@@ -0,0 +1 @@
uid://b56j4uyjiaku1

View File

@@ -0,0 +1,10 @@
class_name ConsoleCommand extends RefCounted
func get_command_name() -> String:
return ""
func get_help_text() -> String:
return ""
func run(args: Array, context: Dictionary) -> String:
return ""

View File

@@ -0,0 +1 @@
uid://b2kk8l3kumxpr