Skip to content
Snippets Groups Projects
mod.rs 1.1 KiB
Newer Older
Louis's avatar
Louis committed
use bevy::app::App;
use bevy::prelude::{Commands, Plugin};
use iyes_loopless::prelude::{AppLooplessStateExt, ConditionSet};
Louis's avatar
Louis committed

use crate::system::flow::AppState;
use crate::world::utils::ActiveLevel;
Louis's avatar
Louis committed

mod encounters;
mod generators;
mod spawning;
mod towns;
mod travel;
mod utils;
mod world_query;
Louis's avatar
Louis committed

pub struct WorldPlugin;
impl Plugin for WorldPlugin {
	fn build(&self, app: &mut App) {
		app.init_resource::<TownPaths>()
			.init_resource::<WorldZones>()
			.init_resource::<EncounterState>()
			.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(travel::tick_travelling_merchant)
					.with_system(encounters::notify_new_zone)

Louis's avatar
Louis committed
	}
}
pub use encounters::{EncounterState, WorldZones};
pub use towns::{CurrentResidence, PathingResult, TownPaths, TravelPath, TravelTarget};
pub use world_query::{CameraBounds, MapQuery};