feat(simulation): extend monologue event generation with new triggers (#119)
Add observe_npc, hear_sound, observe_anomaly, witness_interaction, and post_conversation triggers to monologue system. trigger_event_monologue system fires after sound collection, NPC conversations, and walk-away. Context tags (location, situation, character_state) populated for D-035 content pool matching. COOLDOWN_TICKS=300 anti-spam guard respected. witness_interaction fires after overheard NPC-to-NPC conversation per D-078. Voice sounds and ambient sounds correctly excluded from hear_sound trigger. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -68,6 +68,12 @@ impl ObservationEventQueue {
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.events.is_empty()
|
||||
}
|
||||
|
||||
/// Iterate over observation events without draining.
|
||||
/// Used by monologue trigger system (#119) to react to previous-tick events.
|
||||
pub fn iter(&self) -> impl Iterator<Item = &ObservationEvent> {
|
||||
self.events.iter()
|
||||
}
|
||||
}
|
||||
|
||||
/// System: interpret visible snapshot against known routines and knowledge.
|
||||
|
||||
@@ -587,6 +587,7 @@ pub fn process_walk_away(
|
||||
mut commands: Commands,
|
||||
mut event_queue: ResMut<crate::knowledge::KnowledgeEventQueue>,
|
||||
mut trust_queue: ResMut<TrustEventQueue>,
|
||||
mut post_conv_queue: ResMut<crate::simulation::monologue::PostConversationQueue>,
|
||||
time: Res<SimulationTime>,
|
||||
query: Query<(Entity, Option<&ActiveDialogue>, &WalkAwayRequest), With<PlayerCharacter>>,
|
||||
mut npc_mem_query: Query<Option<&mut InteractionMemory>>,
|
||||
@@ -635,6 +636,9 @@ pub fn process_walk_away(
|
||||
});
|
||||
}
|
||||
|
||||
// Post-conversation monologue trigger (#119, D-035)
|
||||
post_conv_queue.push(target);
|
||||
|
||||
tracing::debug!(
|
||||
"Walk-away during {:?} dialogue at tick {} (started tick {}): \
|
||||
target {:?} → Tier2 animation + routine deviation",
|
||||
@@ -1121,6 +1125,7 @@ mod tests {
|
||||
world.init_resource::<EntityRegistry>();
|
||||
world.init_resource::<crate::knowledge::KnowledgeEventQueue>();
|
||||
world.init_resource::<TrustEventQueue>();
|
||||
world.init_resource::<crate::simulation::monologue::PostConversationQueue>();
|
||||
world
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user