Three fixes to make the gameplay loop functional end-to-end: - Add Interactable component to NPC spawn so E-prompt detection works - Build monologue trigger system (enter_location + time_idle) with MonologueBuffer/MonologueState components, wire through ObserverSnapshot as current_monologue field, decode on client and display via HUD - Change PlayerAction::Interact from unit to struct variant carrying optional target_entity_id and verb fields Bumps protocol version from 4 to 5. Regenerates MessagePack fixtures. All 200 tests pass (170 unit + 30 integration). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -11,7 +11,7 @@ class_name Protocol
|
||||
|
||||
## Protocol version — must match server PROTOCOL_VERSION in bridge/types.rs.
|
||||
## Reject snapshots where version != this value.
|
||||
const PROTOCOL_VERSION: int = 4
|
||||
const PROTOCOL_VERSION: int = 5
|
||||
|
||||
|
||||
# -- Decode: bytes from server → GDScript types --------------------------------
|
||||
@@ -94,6 +94,16 @@ static func decode_snapshot(bytes: PackedByteArray) -> Variant:
|
||||
if ni != null:
|
||||
nearby_interactions.append(ni)
|
||||
|
||||
# v5: current_monologue (#414)
|
||||
var current_monologue: Variant = null
|
||||
var raw_monologue: Variant = raw.get("current_monologue")
|
||||
if raw_monologue is Dictionary and raw_monologue.has("text"):
|
||||
current_monologue = {
|
||||
"id": str(raw_monologue.get("id", "")),
|
||||
"text": str(raw_monologue["text"]),
|
||||
"duration_seconds": float(raw_monologue.get("duration_seconds", 5.0)),
|
||||
}
|
||||
|
||||
return {
|
||||
"tick": tick,
|
||||
"entities": entities,
|
||||
@@ -103,6 +113,7 @@ static func decode_snapshot(bytes: PackedByteArray) -> Variant:
|
||||
"player_facing": player_facing,
|
||||
"visible_tiles": visible_tiles,
|
||||
"nearby_interactions": nearby_interactions,
|
||||
"current_monologue": current_monologue,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user