diff --git a/server/src/bridge/mod.rs b/server/src/bridge/mod.rs index 59373725f..b37d5e24d 100644 --- a/server/src/bridge/mod.rs +++ b/server/src/bridge/mod.rs @@ -223,19 +223,12 @@ impl Plugin for BridgePlugin { .init_resource::() .init_resource::() // Bridge I/O — PreInput (receive) and PostSnapshot (send) - .add_systems( - Update, - receive_bridge_inputs.in_set(TickPhase::PreInput), - ) - .add_systems( - Update, - send_bridge_snapshot.in_set(TickPhase::PostSnapshot), - ) + .add_systems(Update, receive_bridge_inputs.in_set(TickPhase::PreInput)) + .add_systems(Update, send_bridge_snapshot.in_set(TickPhase::PostSnapshot)) // Debug commands — Snapshot phase .add_systems( Update, - debug::handle_debug_commands - .in_set(TickPhase::Snapshot), + debug::handle_debug_commands.in_set(TickPhase::Snapshot), ) // Monologue chain — Simulation phase, strict intra-phase sequence. // trigger_event_monologue must run after conversations + sound (also Simulation). @@ -270,8 +263,7 @@ impl Plugin for BridgePlugin { // Observer snapshot assembly — Snapshot phase .add_systems( Update, - crate::perception::observer::compute_observer_snapshot - .in_set(TickPhase::Snapshot), + crate::perception::observer::compute_observer_snapshot.in_set(TickPhase::Snapshot), ) // Post-snapshot: emit observation events .add_systems( diff --git a/server/src/lib.rs b/server/src/lib.rs index 89fed76c5..1daca7b8d 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -2,7 +2,6 @@ // Rust/bevy_ecs simulation server for D-010 client-server architecture pub mod bridge; -pub mod tick_phases; pub mod cause_chain; pub mod knowledge; pub mod npc; @@ -10,6 +9,7 @@ pub mod perception; pub mod settings; pub mod simulation; pub mod storyteller; +pub mod tick_phases; pub mod voice; // test_world::reset is always compiled (used by simulation::input). // Room definitions, constants, and setup_gauntlet are gated behind diff --git a/server/src/npc/mod.rs b/server/src/npc/mod.rs index 3506430c6..459782690 100644 --- a/server/src/npc/mod.rs +++ b/server/src/npc/mod.rs @@ -67,17 +67,14 @@ impl Plugin for NpcPlugin { Update, ( vision::compute_npc_vision, - vision::emit_npc_vision_events - .after(vision::compute_npc_vision), - awareness::detect_player_awareness - .after(vision::compute_npc_vision), + vision::emit_npc_vision_events.after(vision::compute_npc_vision), + awareness::detect_player_awareness.after(vision::compute_npc_vision), mood::update_mood, tolerance::check_tolerance_threshold .after(mood::update_mood) .after(awareness::detect_player_awareness), routine::enter_activity, - routine::detect_routine_deviation - .after(routine::enter_activity), + routine::detect_routine_deviation.after(routine::enter_activity), background::background_tick, disclosure::derive_disclosure_candidates, disclosure::process_unprompted_disclosure @@ -88,18 +85,15 @@ impl Plugin for NpcPlugin { // Storyteller: tell state derivation (reads mood + routine deviation) .add_systems( Update, - tell_state::derive_tell_state - .in_set(TickPhase::Storyteller), + tell_state::derive_tell_state.in_set(TickPhase::Storyteller), ) // Knowledge: relationships (trust, propagation, dynamics), vision degradation .add_systems( Update, ( relationships::update_trust, - relationships::propagate_social_actions - .after(relationships::update_trust), - relationships::update_relationship_dynamics - .after(relationships::update_trust), + relationships::propagate_social_actions.after(relationships::update_trust), + relationships::update_relationship_dynamics.after(relationships::update_trust), vision::degrade_npc_inferences, ) .in_set(TickPhase::Knowledge), diff --git a/server/src/perception/mod.rs b/server/src/perception/mod.rs index 45af5ac68..745f5e6fb 100644 --- a/server/src/perception/mod.rs +++ b/server/src/perception/mod.rs @@ -30,8 +30,7 @@ impl Plugin for PerceptionPlugin { Update, ( anomaly::clear_anomaly_markers, - anomaly::detect_anomalies - .after(anomaly::clear_anomaly_markers), + anomaly::detect_anomalies.after(anomaly::clear_anomaly_markers), ) .in_set(TickPhase::Simulation), ) diff --git a/server/src/simulation/mod.rs b/server/src/simulation/mod.rs index 3a411c50d..6dc975f13 100644 --- a/server/src/simulation/mod.rs +++ b/server/src/simulation/mod.rs @@ -6,19 +6,16 @@ use bevy_ecs::schedule::IntoScheduleConfigs; pub mod chunk_streaming; // Phase sub-plugins (#843) -pub mod economy_plugin; -pub mod input_plugin; -pub mod movement_plugin; -pub mod social_plugin; -pub mod time_plugin; pub mod contraband; pub mod conversation; pub mod dialogue; pub mod economy; +pub mod economy_plugin; pub mod examine; pub mod follow; pub mod generator; pub mod input; +pub mod input_plugin; pub mod interaction; pub mod inventory; pub mod knowledge_grant; @@ -27,6 +24,7 @@ pub mod listening; pub mod modification; pub mod monologue; pub mod movement; +pub mod movement_plugin; pub mod npc_knowledge_transfer; pub mod path_follow; pub mod pathfinding; @@ -36,12 +34,14 @@ pub mod pressure; pub mod rng; pub mod save_io; pub mod save_state; +pub mod social_plugin; pub mod sound; pub mod spatial; pub mod stance; pub mod ticker; pub mod tier; pub mod time; +pub mod time_plugin; pub mod triangle; pub mod zone; diff --git a/server/src/simulation/movement_plugin.rs b/server/src/simulation/movement_plugin.rs index 9b035ae50..fe8a290b6 100644 --- a/server/src/simulation/movement_plugin.rs +++ b/server/src/simulation/movement_plugin.rs @@ -21,19 +21,15 @@ impl Plugin for MovementPlugin { ( // Core movement chain (strict sequence) super::pathfinding::compute_paths, - super::path_follow::follow_paths - .after(super::pathfinding::compute_paths), - super::movement::validate_movement - .after(super::path_follow::follow_paths), + super::path_follow::follow_paths.after(super::pathfinding::compute_paths), + super::movement::validate_movement.after(super::path_follow::follow_paths), super::path_follow::cleanup_path_blocked .after(super::movement::validate_movement), // Post-movement indexing (all after validate_movement, parallel with each other) - super::spatial::sync_spatial_index - .after(super::movement::validate_movement), + super::spatial::sync_spatial_index.after(super::movement::validate_movement), super::listening::update_listening_focus .after(super::movement::validate_movement), - super::zone::detect_zone_crossings - .after(super::movement::validate_movement), + super::zone::detect_zone_crossings.after(super::movement::validate_movement), ) .in_set(TickPhase::Movement), ); diff --git a/server/src/simulation/time_plugin.rs b/server/src/simulation/time_plugin.rs index 1f1c76dfc..b66f8d76a 100644 --- a/server/src/simulation/time_plugin.rs +++ b/server/src/simulation/time_plugin.rs @@ -1,9 +1,9 @@ //! Time and streaming plugin — tick advancement, chunk streaming, news ticker. //! -//! Systems span two phases: -//! - [`TickPhase::PreInput`]: chunk_streaming (loads chunks before input processing) -//! - [`TickPhase::TickAdvance`]: advance_tick (must be last in the pipeline) -//! - [`TickPhase::Snapshot`]: tick_news_ticker (assembles display content) +//! Systems span three phases: +//! - PreInput: chunk_streaming (loads chunks before input processing) +//! - Snapshot: tick_news_ticker (assembles display content) +//! - TickAdvance: advance_tick (must be last in the pipeline) use bevy_app::prelude::*; use bevy_ecs::schedule::IntoScheduleConfigs; @@ -20,18 +20,15 @@ impl Plugin for TimePlugin { .init_resource::() .add_systems( Update, - super::chunk_streaming::chunk_streaming - .in_set(TickPhase::PreInput), + super::chunk_streaming::chunk_streaming.in_set(TickPhase::PreInput), ) .add_systems( Update, - super::ticker::tick_news_ticker - .in_set(TickPhase::Snapshot), + super::ticker::tick_news_ticker.in_set(TickPhase::Snapshot), ) .add_systems( Update, - super::time::advance_tick - .in_set(TickPhase::TickAdvance), + super::time::advance_tick.in_set(TickPhase::TickAdvance), ); } } diff --git a/server/src/storyteller/mod.rs b/server/src/storyteller/mod.rs index 4553b2262..8d3255c41 100644 --- a/server/src/storyteller/mod.rs +++ b/server/src/storyteller/mod.rs @@ -371,8 +371,7 @@ impl Plugin for StorytellerPlugin { activation_pass .after(append_player_history) .after(tick_contamination_activation), - escalate_tells_on_activation - .after(activation_pass), + escalate_tells_on_activation.after(activation_pass), expire_routine_deviations, ) .in_set(TickPhase::Storyteller), diff --git a/server/src/tick_phases.rs b/server/src/tick_phases.rs index 3cccddc97..da9705736 100644 --- a/server/src/tick_phases.rs +++ b/server/src/tick_phases.rs @@ -62,8 +62,16 @@ impl TickPhase { app.configure_sets( Update, ( - PreInput, Input, Movement, Simulation, Economy, Storyteller, Snapshot, - PostSnapshot, Knowledge, TickAdvance, + PreInput, + Input, + Movement, + Simulation, + Economy, + Storyteller, + Snapshot, + PostSnapshot, + Knowledge, + TickAdvance, ) .chain(), );