Initial Commit
This commit is contained in:
27
Scripts/Gameplay/CommandLine/Commands/cam.gd
Normal file
27
Scripts/Gameplay/CommandLine/Commands/cam.gd
Normal file
@@ -0,0 +1,27 @@
|
||||
extends Resource
|
||||
var desc: String = "Switch to a camera"
|
||||
var usage: String = "cam <id>"
|
||||
|
||||
func main(args: Array, context: Node) -> void:
|
||||
if args.size() == 0:
|
||||
context._print("Usage: cam <camera_id_or_name>")
|
||||
return
|
||||
|
||||
var input_value = args[0]
|
||||
var cam_id: int = -1
|
||||
|
||||
var int_value = int(input_value)
|
||||
if str(int_value) == input_value:
|
||||
cam_id = int_value
|
||||
else:
|
||||
cam_id = Global.cameraHelper.getID(input_value)
|
||||
|
||||
if cam_id == -1:
|
||||
context._print("Invalid camera ID or name: %s" % input_value)
|
||||
return
|
||||
|
||||
var cam_name = Global.cameraHelper.getName(cam_id)
|
||||
context._print("Camera set to %s" % cam_name.capitalize())
|
||||
|
||||
print(Global.cameraHelper.id_to_name)
|
||||
print(Global.cameraHelper.name_to_id)
|
||||
1
Scripts/Gameplay/CommandLine/Commands/cam.gd.uid
Normal file
1
Scripts/Gameplay/CommandLine/Commands/cam.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://ooovsrvdoq2a
|
||||
18
Scripts/Gameplay/CommandLine/Commands/help.gd
Normal file
18
Scripts/Gameplay/CommandLine/Commands/help.gd
Normal file
@@ -0,0 +1,18 @@
|
||||
extends Resource
|
||||
var desc: String = "Show commands"
|
||||
var usage: String = "help"
|
||||
|
||||
func main(args: Array, context: cCommandLine) -> void:
|
||||
if context.commands.size() == 0:
|
||||
context._print("No commands available.")
|
||||
return
|
||||
|
||||
context._print("Available Commands:")
|
||||
for name in context.commands.keys():
|
||||
var cmd_script = context.commands[name]
|
||||
var cmd_instance = cmd_script.new()
|
||||
|
||||
var cmdDescription = cmd_instance.desc
|
||||
var cmdUsage = "Usage: " + cmd_instance.usage
|
||||
|
||||
context._print("%s: %s\n%s" % [name, cmdDescription, cmdUsage])
|
||||
1
Scripts/Gameplay/CommandLine/Commands/help.gd.uid
Normal file
1
Scripts/Gameplay/CommandLine/Commands/help.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://mbcxt6233xib
|
||||
6
Scripts/Gameplay/CommandLine/Commands/say.gd
Normal file
6
Scripts/Gameplay/CommandLine/Commands/say.gd
Normal file
@@ -0,0 +1,6 @@
|
||||
extends Resource
|
||||
var desc: String = "Repeat your input"
|
||||
var usage: String = "say <text>"
|
||||
|
||||
func main(args: Array, context: Node) -> void:
|
||||
context._print(args)
|
||||
1
Scripts/Gameplay/CommandLine/Commands/say.gd.uid
Normal file
1
Scripts/Gameplay/CommandLine/Commands/say.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dx43e03pno5sw
|
||||
Reference in New Issue
Block a user