1
0
Fork 0
roguelike-game/src/systems/dispatcher.rs

59 lines
1.6 KiB
Rust

#[cfg(target_arch = "wasm32")]
#[macro_use]
mod single_thread;
#[cfg(not(target_arch = "wasm32"))]
#[macro_use]
mod multi_thread;
use ::specs::prelude::World;
#[cfg(not(target_arch = "wasm32"))]
pub use multi_thread::*;
#[cfg(target_arch = "wasm32")]
pub use single_thread::*;
use super::*;
#[cfg(not(target_arch = "wasm32"))]
pub trait UnifiedDispatcher {
fn run_now(&mut self, ecs: &mut World);
}
#[cfg(target_arch = "wasm32")]
pub trait UnifiedDispatcher {
fn run_now(&mut self, ecs: *mut World);
}
construct_dispatcher!(
(MapIndexingSystem, "map_index", &[]),
(VisibilitySystem, "visibility", &[]),
(EncumbranceSystem, "encumbrance", &[]),
(InitiativeSystem, "initiative", &[]),
(TurnStatusSystem, "turnstatus", &[]),
(QuipSystem, "quips", &[]),
(AdjacentAI, "adjacent", &[]),
(VisibleAI, "visible", &[]),
(ApproachAI, "approach", &[]),
(FleeAI, "flee", &[]),
(ChaseAI, "chase", &[]),
(DefaultMoveAI, "default_move", &[]),
(MovementSystem, "movement", &[]),
(TriggerSystem, "triggers", &[]),
(MeleeCombatSystem, "melee", &[]),
(RangedCombatSystem, "ranged", &[]),
(ItemCollectionSystem, "pickup", &[]),
(ItemEquipOnUse, "equip", &[]),
(ItemUseSystem, "use", &[]),
(SpellUseSystem, "spells", &[]),
(ItemIdentificationSystem, "itemid", &[]),
(ItemDropSystem, "drop", &[]),
(ItemRemoveSystem, "remove", &[]),
(HungerSystem, "hunger", &[]),
(ParticleSpawnSystem, "particle_spawn", &[]),
(LightingSystem, "lighting", &[])
);
pub fn new() -> Box<dyn UnifiedDispatcher + 'static> {
new_dispatch()
}