Files
settled-reach/server/src/simulation/mod.rs
T
jpmschweitzerandClaude Sonnet 4.6 aa0d8ced37 feat(simulation): NPC-to-NPC conversation system (#247, D-078)
Implements server-authoritative per-word occlusion for NPC conversations.
ConversationEventBuffer drains into ObserverSnapshot each tick so the client
receives only words audible from the player's position. Updates test fixtures
to include the new conversation_events and conversation_ended fields.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 18:41:44 +01:00

65 lines
2.4 KiB
Rust

// Simulation module - Core simulation plugin and systems
// Implements deterministic tick-based simulation (D-010 principle 4)
use bevy_app::prelude::*;
use bevy_ecs::schedule::IntoScheduleConfigs;
pub mod contraband;
pub mod conversation;
pub mod dialogue;
pub mod input;
pub mod interaction;
pub mod inventory;
pub mod listening;
pub mod monologue;
pub mod movement;
pub mod path_follow;
pub mod pathfinding;
pub mod rng;
pub mod sound;
pub mod stance;
pub mod tier;
pub mod time;
pub mod zone;
/// Core simulation plugin
/// Manages simulation time, RNG, input processing, and tier transitions
pub struct SimulationPlugin;
impl Plugin for SimulationPlugin {
fn build(&self, app: &mut App) {
// Tier marker components (D-026) — must register before behavior systems
app.add_plugins(tier::TierPlugin);
// Initialize core simulation resources
app.init_resource::<time::SimulationTime>()
.insert_resource(rng::SimRng::new(0))
.init_resource::<input::InputQueue>()
.init_resource::<crate::knowledge::EntityRegistry>()
.init_resource::<sound::SoundEventQueue>()
.add_systems(
Update,
(
input::process_player_input,
pathfinding::compute_paths.after(input::process_player_input),
path_follow::follow_paths.after(pathfinding::compute_paths),
movement::validate_movement.after(path_follow::follow_paths),
path_follow::cleanup_path_blocked.after(movement::validate_movement),
listening::update_listening_focus.after(movement::validate_movement),
contraband::check_contraband_scan
.after(movement::validate_movement)
.before(crate::perception::observer::compute_observer_snapshot),
conversation::run_npc_conversations
.after(movement::validate_movement)
.before(sound::collect_sound_events),
sound::collect_sound_events
.after(movement::validate_movement)
.before(crate::perception::observer::compute_observer_snapshot),
time::advance_tick.after(path_follow::cleanup_path_blocked),
),
);
tracing::debug!("SimulationPlugin initialized");
}
}