feat(client): sync protocol to v8 — dialogue_response + Interact encoding

Bump PROTOCOL_VERSION from 7 to 8 to match server. Three changes:

1. Add dialogue_response field decoding (DialogueResponseEvent with
   line_id, text, speaker_entity_id) from server #305/D-028.

2. Fix Interact encoding: server changed PlayerAction::Interact from
   unit variant to struct variant with {target_entity_id, verb}.
   Extract _encode_action() helper to handle this consistently.

3. Update all test assertions that checked version=7 or expected
   Interact as a bare string.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-18 01:41:27 +01:00
co-authored by Claude Opus 4.6
parent dcb76d1221
commit 674c7147de
5 changed files with 50 additions and 27 deletions
+7 -7
View File
@@ -26,17 +26,17 @@ func _load_fixture(name: String) -> PackedByteArray:
# -- Protocol version upgrade -------------------------------------------------
func test_protocol_version_is_7() -> void:
assert_that(Protocol.PROTOCOL_VERSION).is_equal(7)
func test_protocol_version_is_8() -> void:
assert_that(Protocol.PROTOCOL_VERSION).is_equal(8)
func test_fixtures_at_protocol_version_7() -> void:
# All regenerated fixtures should be at v7
func test_fixtures_at_protocol_version_8() -> void:
# All regenerated fixtures should be at v8
for fixture_name in ["snapshot_one_npc", "snapshot_empty", "snapshot_player", "snapshot_multi_entity"]:
var bytes = _load_fixture(fixture_name)
var snapshot = Protocol.decode_snapshot(bytes)
assert_that(snapshot).is_not_null()
assert_that(snapshot.version).is_equal(7)
assert_that(snapshot.version).is_equal(8)
func test_rejects_version_6() -> void:
@@ -282,10 +282,10 @@ func test_sim_bridge_test_snapshot_has_player_inventory() -> void:
assert_that(snap.player_inventory is Array).is_true()
func test_sim_bridge_test_snapshot_version_7() -> void:
func test_sim_bridge_test_snapshot_version_8() -> void:
SimBridge.reset_test_state()
var snap = SimBridge._test_snapshot()
assert_that(snap.version).is_equal(7)
assert_that(snap.version).is_equal(8)
# -- Fixture: v6 snapshots include new fields ----------------------------------