fix(client): visual_capture Protocol decode in -s mode
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) <noreply@anthropic.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user