extends Node ## Quick look-dev captures from the real game camera (G2 iteration aid, not an acceptance ## tool). Every shot is "name@x,z,zoom[,yaw_steps]" in world metres; shots are separated by ";". ## Run: godot --path . --resolution 1920x1080 res://tools/luneraria/g2_probe.tscn -- --out=/tmp/probe/ \ ## --shots="grotto@-13.5,-13.5,20;gate@-18,-18,16,2" [--hud=0] [--round=10] [--wait=1.5] ## [--boss-claim=0|1] [--hp=id:fraction,...] [--combat=seconds] const Game = preload("res://scripts/luneraria/lune_game.gd") var out: String = "/tmp/probe/" var shots: Array = [] var hud: bool = true var round_number: int = -1 var wait_seconds: float = 1.2 var claim: int = -1 var hp: Dictionary = {} var combat_seconds: float = -1.0 var game: Node3D func _ready() -> void: for arg: String in OS.get_cmdline_user_args(): var value: String = arg.get_slice("=", 1) if arg.begins_with("--out="): out = value if value.ends_with("/") else value + "/" elif arg.begins_with("--shots="): for spec: String in value.split(";", false): var name: String = spec.get_slice("@", 0) var numbers: PackedFloat64Array = [] for part: String in spec.get_slice("@", 1).split(","): numbers.append(float(part)) shots.append([name, numbers]) elif arg.begins_with("--hud="): hud = value != "0" elif arg.begins_with("--round="): round_number = int(value) elif arg.begins_with("--wait="): wait_seconds = float(value) elif arg.begins_with("--boss-claim="): claim = int(value) elif arg.begins_with("--combat="): combat_seconds = float(value) elif arg.begins_with("--hp="): for pair: String in value.split(",", false): hp[pair.get_slice(":", 0)] = float(pair.get_slice(":", 1)) call_deferred("run") func run() -> void: Soundscape.enabled = false game = Game.new() add_child(game) game.start({"seed": 4, "human_slot": 1, "bunds": ["wurzelbund", "wurzelbund", "glutpakt", "glutpakt", "wurzelbund", "glutpakt"]}) await get_tree().process_frame var state: LuneMatch = game.match_state if round_number > 0: state.round_number = round_number if claim >= 0: state.boss.claim = {"team": claim, "won_round": state.round_number - 1, "deploy_round": state.round_number, "chooser_slot": claim * 3, "lane": "top"} state.boss.next_available_round = state.round_number + 3 for id: String in hp: state.building_hp[id] = float(state.map.building_def(id).max_hp) * float(hp[id]) if combat_seconds >= 0.0: game._on_ready() await get_tree().process_frame while state.phase == LuneMatch.Phase.COMBAT and state.combat.elapsed < combat_seconds: for i: int in range(20): state.step_combat() await get_tree().process_frame game.paused = true game.hud.visible = hud for shot: Array in shots: var numbers: PackedFloat64Array = shot[1] if numbers.size() > 3: game.camera._goal_yaw = numbers[3] * PI * .25 game.camera.look_at_point(Vector3(numbers[0], 0, numbers[1]), numbers[2], true) await get_tree().create_timer(wait_seconds).timeout await RenderingServer.frame_post_draw DirAccess.make_dir_recursive_absolute(out) get_viewport().get_texture().get_image().save_png(out + str(shot[0]) + ".png") print("PROBE ", shot[0]) get_tree().quit()