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)
