Reorganized files, started splitting up unit
This commit is contained in:
21
scripts/debug/console_commands/swap_command.gd
Normal file
21
scripts/debug/console_commands/swap_command.gd
Normal 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: DebugMenu = context["debug_menu"]
|
||||
debug_menu.swap_scene(entry)
|
||||
return ""
|
||||
|
||||
return "Scene not found: %s" % search_name
|
||||
Reference in New Issue
Block a user