21 lines
717 B
GDScript
21 lines
717 B
GDScript
extends SceneTree
|
|
|
|
func _init() -> void:
|
|
var args: PackedStringArray = OS.get_cmdline_user_args()
|
|
var next_is_map = false
|
|
for arg in args:
|
|
if next_is_map:
|
|
rebuild_map(arg)
|
|
return
|
|
elif arg == "--map":
|
|
next_is_map = true
|
|
print("No map provided. (Make sure to include e.g. '-- --map two_towers' after the godot invocation)")
|
|
quit(2)
|
|
|
|
func rebuild_map(name: String) -> void:
|
|
var map_scene_path: String = "res://maps/" + name + "/" + name + ".tscn"
|
|
var scene: Resource = load(map_scene_path) as PackedScene
|
|
var instantiated_scene = scene.instantiate(PackedScene.GEN_EDIT_STATE_MAIN)
|
|
print("TODO: Rebuild the map & whatever post-processing, and save this back to disk: ", instantiated_scene)
|
|
quit(0)
|