From 9733cbc0af9f56996b0a0ae7648b5168b2edf936 Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Sun, 24 May 2026 22:51:51 +0200 Subject: [PATCH] fix(client): visual_capture Protocol decode in -s mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit visual_capture.gd runs via `godot -s`, where the `class_name` registry isn't populated — so the bare `Protocol.decode_snapshot()` reference failed to compile, breaking ALL --screenshot/--movie/golden captures (not just the replay scenarios that use it). Instantiate the script and call the static decoder on the instance (then free), matching the file's existing -s-mode load() workaround for VisualScenarios. Co-Authored-By: Claude Opus 4.7 (1M context) --- client/tests/visual_capture.gd | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/tests/visual_capture.gd b/client/tests/visual_capture.gd index 64665a89f..92acec8b3 100644 --- a/client/tests/visual_capture.gd +++ b/client/tests/visual_capture.gd @@ -184,7 +184,12 @@ func _run_scenario(_main_node: Node) -> void: rf.close() # Decode through Protocol.decode_snapshot() — same as live IPC receive path. # This exercises: msgpack decode → entity decode → tile_kind→type mapping → etc. - var replay_data: Variant = Protocol.decode_snapshot(replay_bytes) + # class_name `Protocol` isn't resolvable in -s mode (see header note); + # instantiate the script and call the static decoder on the instance, + # then free it — the decoded Dictionary is independent of the node. + var protocol_node: Node = load("res://scripts/protocol/protocol.gd").new() + var replay_data: Variant = protocol_node.decode_snapshot(replay_bytes) + protocol_node.free() if replay_data == null or not replay_data is Dictionary: push_error("visual_capture: Protocol.decode_snapshot failed for %s" % abs_path) quit(1)