extends SceneTree
## Probe: screenshot the Settings panel as a player sees it (settings page audit,
## 2026-10-03). Loads the real game scene, opens Settings, saves a PNG.
## HYPERTPS_DAEMON_TCP=127.0.0.1:1 "$HYPER_TPS_GODOT" --path . --script res://scenes/test/_probe_settings_shot.gd -- --out DIR
const ProbeWindow := preload("res://scenes/test/probe_window.gd")
const SIZE := Vector2i(1600, 900)
var _out := "/tmp"
var _ws := ""
var _next_i3 := 0
var _ready_frames := 0
var _n := 0
var _menu: Node
func _initialize() -> void:
var args := OS.get_cmdline_user_args()
var i := args.find("--out")
if i >= 0 and i + 1 < args.size():
_out = args[i + 1]
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
DisplayServer.window_set_size(SIZE)
_ws = ProbeWindow.free_workspace()
root.add_child((load("res://scenes/game/game.tscn") as PackedScene).instantiate())
func _process(_d: float) -> bool:
if _ready_frames < 20:
if _ws != "" and _ready_frames == 0 and Time.get_ticks_msec() >= _next_i3:
_next_i3 = Time.get_ticks_msec() + 1000
ProbeWindow.move_to(_ws, SIZE)
if ProbeWindow.drawing(root):
_ready_frames += 1
elif Time.get_ticks_msec() > 30000:
print("PROBE FAIL window never drew")
quit(1)
return true
return false
_n += 1
if _n == 30:
_menu = root.find_child("MenuMain", true, false)
if _menu == null:
print("PROBE FAIL no MenuMain")
quit(1)
return true
if _menu.has_method("show_menu"):
_menu.call("show_menu")
_menu.call("_show_settings")
var ti := OS.get_cmdline_user_args().find("--tab")
if ti >= 0:
var tc: Node = _menu.find_child("SettingsTabs", true, false)
if tc is TabContainer:
(tc as TabContainer).current_tab = int(OS.get_cmdline_user_args()[ti + 1])
elif _n == 60:
var p: Control = _menu.get("settings_panel")
print("PROBE panel rect %s viewport %s" % [p.get_global_rect(), root.size])
var path := _out.path_join("settings_panel.png")
root.get_texture().get_image().save_png(path)
print("PROBE saved %s" % path)
return true
return false