use bevy::app::App; use bevy::prelude::{Commands, Plugin}; use iyes_loopless::prelude::{AppLooplessStateExt, ConditionSet}; use crate::system::flow::AppState; use crate::world::utils::ActiveLevel; mod debug; mod encounters; mod generators; mod spawning; mod towns; mod trading; mod travel; mod utils; mod world_query; pub struct WorldPlugin; impl Plugin for WorldPlugin { fn build(&self, app: &mut App) { app.init_resource::<TownPaths>() .init_resource::<WorldZones>() .init_resource::<EncounterState>() .add_event::<PopulateWorldEvent>() .add_enter_system(AppState::InGame, |mut commands: Commands| { commands.insert_resource(ActiveLevel::new("Grantswaith")); }) .add_system_set( ConditionSet::new() .run_in_state(AppState::InGame) // .with_system(debug::create_tombstones) .with_system(spawning::spawn_world_data) .with_system(spawning::populate_world) .with_system(travel::tick_travelling_merchant) .with_system(encounters::notify_new_zone) .into(), ); } } pub use encounters::{EncounterState, WorldZones}; pub use towns::{CurrentResidence, PathingResult, TownPaths, TravelPath, TravelTarget}; pub use trading::{HungerState, ItemName, TradeGood, TradingState}; pub use world_query::{CameraBounds, MapQuery}; use crate::world::spawning::PopulateWorldEvent;