refactor(server): address PR #16 review feedback
Hoshe + Tyre review items: - Use StableId consistently for wire entity_id (H4) across observer, observation, interpretation, and interaction systems - Make NearbyInteractionBuffer.interactions private with take() (H1/H20) - Add system ordering constraint for compute_nearby_interactions (H5) - Panic on missing PlayerCharacter in input processing (H2) - Remove redundant paused field from GameTime (Tyre8) - Remove #[serde(default)] from nearby_interactions (H3) - Change NearbyInteraction.distance from f32 to u32 (H8) - Add sort stability for equal verb priorities (H6) - Scope constants to pub(crate) (H7) - Add debug_assert for last_observed_tick ordering (H10) - Strengthen unregistered entity handling to debug_assert + error (H11) - Document fractional tick accumulation (Tyre9) - Extract collect_remembered_entities helper (Tyre2/H17) - Add half_rate_no_drift_over_10000_frames test (H14) - Add mid-range and deterministic sort tests (H15) - Add fixture version assertion (H16) - Regenerate msgpack fixtures for wire format changes 146 unit + 19 integration tests pass, zero clippy warnings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -102,7 +102,6 @@ pub fn generate_snapshot(
|
||||
day: time.day(),
|
||||
time_of_day: time.time_of_day_minutes(),
|
||||
day_phase: time.day_phase(),
|
||||
paused: time.paused(),
|
||||
tick_rate: time.tick_rate,
|
||||
};
|
||||
|
||||
@@ -214,7 +213,8 @@ impl Plugin for BridgePlugin {
|
||||
crate::perception::observation::emit_observation_events
|
||||
.after(crate::perception::observer::compute_observer_snapshot),
|
||||
send_bridge_snapshot
|
||||
.after(crate::perception::observer::compute_observer_snapshot),
|
||||
.after(crate::perception::observer::compute_observer_snapshot)
|
||||
.after(crate::simulation::interaction::compute_nearby_interactions),
|
||||
),
|
||||
);
|
||||
tracing::debug!("BridgePlugin initialized");
|
||||
|
||||
@@ -32,7 +32,6 @@ pub struct ObserverSnapshot {
|
||||
pub visible_tiles: Vec<VisibleTile>,
|
||||
/// Entities within interaction range with available verbs (D-060, #404).
|
||||
/// Sorted by distance (nearest first). v0.1 client reads verbs[0] on the nearest entity.
|
||||
#[serde(default)]
|
||||
pub nearby_interactions: Vec<NearbyInteraction>,
|
||||
}
|
||||
|
||||
@@ -46,10 +45,7 @@ pub struct GameTime {
|
||||
pub time_of_day: u64,
|
||||
/// Current day phase (Morning/Afternoon/Evening/Night)
|
||||
pub day_phase: DayPhase,
|
||||
/// Whether simulation is paused (tick_rate == Paused)
|
||||
pub paused: bool,
|
||||
/// Current tick rate state (D-052)
|
||||
#[serde(default)]
|
||||
/// Current tick rate state (D-052). Client derives paused from TickRate::Paused.
|
||||
pub tick_rate: TickRate,
|
||||
}
|
||||
|
||||
@@ -156,8 +152,8 @@ pub struct NearbyInteraction {
|
||||
pub entity_id: u64,
|
||||
/// Entity type for client-side verb display
|
||||
pub entity_type: EntityKind,
|
||||
/// Manhattan distance from player
|
||||
pub distance: f32,
|
||||
/// Manhattan distance from player (integer tiles)
|
||||
pub distance: u32,
|
||||
/// Available verbs sorted by priority (index 0 = highest priority)
|
||||
pub verbs: Vec<VerbOption>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user