feat(perception): add observation event generator

Implements ticket #239 for Sprint 3:
- ObservationTrigger enum: RoutineDeviation (NPC not at expected
  routine location), Absence (expected location visible but NPC
  missing), NewEntity (unknown entity in LOS)
- ObservationEventQueue resource with push/drain/len/is_empty
- generate_observation_events system runs after emit_observation_events
  but before process_knowledge_events so it can compare current
  snapshot against previous-tick knowledge state
- Populate PerceptionPlugin with ObservationEventQueue resource and
  system registration with correct ordering constraints

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-12 17:52:02 +01:00
co-authored by Claude Opus 4.6
parent 0b599ed662
commit 9c3c32e854
2 changed files with 462 additions and 2 deletions
+10 -2
View File
@@ -3,7 +3,9 @@
// Generates ObserverSnapshot for client rendering
use bevy_app::prelude::*;
use bevy_ecs::schedule::IntoScheduleConfigs;
pub mod interpretation;
pub mod observation;
pub mod observer;
pub mod shadowcast;
@@ -14,8 +16,14 @@ pub mod vision_cone;
pub struct PerceptionPlugin;
impl Plugin for PerceptionPlugin {
fn build(&self, _app: &mut App) {
// Stub implementation - will be populated in phase 2
fn build(&self, app: &mut App) {
app.init_resource::<interpretation::ObservationEventQueue>()
.add_systems(
Update,
interpretation::generate_observation_events
.after(observation::emit_observation_events)
.before(crate::knowledge::events::process_knowledge_events),
);
tracing::debug!("PerceptionPlugin initialized");
}
}