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:
@@ -244,7 +244,9 @@ func test_encode_player_inputs_multiple() -> void:
|
||||
assert_that(raw.status).is_null()
|
||||
assert_that(raw.value.size()).is_equal(3)
|
||||
assert_that(raw.value[0]["action"]).is_equal("MoveNorth")
|
||||
assert_that(raw.value[1]["action"]).is_equal("Interact")
|
||||
# Interact is a struct variant: {"Interact": {"target_entity_id": null, "verb": null}}
|
||||
assert_that(raw.value[1]["action"] is Dictionary).is_true()
|
||||
assert_that(raw.value[1]["action"].has("Interact")).is_true()
|
||||
assert_that(raw.value[2]["action"]).is_equal("MoveSouthwest")
|
||||
|
||||
|
||||
@@ -358,7 +360,9 @@ func test_decode_batch_input_fixture() -> void:
|
||||
assert_that(raw.value[0]["tick"]).is_equal(0)
|
||||
assert_that(raw.value[0]["action"]).is_equal("MoveNorth")
|
||||
assert_that(raw.value[1]["tick"]).is_equal(0)
|
||||
assert_that(raw.value[1]["action"]).is_equal("Interact")
|
||||
# Interact is a struct variant: {"Interact": {"target_entity_id": null, "verb": null}}
|
||||
assert_that(raw.value[1]["action"] is Dictionary).is_true()
|
||||
assert_that(raw.value[1]["action"].has("Interact")).is_true()
|
||||
|
||||
|
||||
# -- Diagonal movement fixtures (D-030 Layer 1 cross-language) -----------------
|
||||
|
||||
Reference in New Issue
Block a user