feat(client): add interaction prompt system (#405)
Server-driven interaction prompt that displays "E - Talk" when near an interactable NPC. Decodes v4 nearby_interactions from snapshot, stores in GameState, renders via InteractionPrompt UI with fade animation. Extensible interface (get_interaction_target/get_selected_verb) for future radial verb menu (v0.2). - Protocol: decode nearby_interactions array with nested VerbOption structs, entity relationship/observation fields, tick_rate in GameTime - GameState: store/clear nearby_interactions per snapshot - SimBridge: test mode generates v4 format with structured verbs - InteractionPrompt: PanelContainer with fade in/out, polls GameState - Tests: 19 new test cases covering protocol, state, sim bridge, UI, encoding - Fixture assertions updated for v4 protocol version Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ extends Node2D
|
||||
@onready var camera = $Camera2D
|
||||
@onready var hud = $UILayer/HUD
|
||||
@onready var monologue_display = $UILayer/MonologueDisplay
|
||||
@onready var interaction_prompt = $UILayer/InteractionPrompt
|
||||
|
||||
func _ready() -> void:
|
||||
print("The Settled Reach — client initialized")
|
||||
@@ -28,4 +29,12 @@ func _process(_delta: float) -> void:
|
||||
# Send queued input to simulation
|
||||
var inputs = InputMapper.flush_queue()
|
||||
for input in inputs:
|
||||
# TODO: Once server accepts Interact(InteractData), attach target + verb:
|
||||
# if input.action == InputMapper.Action.INTERACT:
|
||||
# var target_id: int = interaction_prompt.get_interaction_target()
|
||||
# if target_id >= 0:
|
||||
# input["action_data"] = {
|
||||
# "target_entity_id": target_id,
|
||||
# "verb": interaction_prompt.get_selected_verb(),
|
||||
# }
|
||||
SimBridge.send_input(input)
|
||||
|
||||
Reference in New Issue
Block a user