Refactor AI systems into AI module
This commit is contained in:
parent
e50abdb4a0
commit
f558112836
7
src/ai.rs
Normal file
7
src/ai.rs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
mod animal_ai_system;
|
||||||
|
mod bystander_ai_system;
|
||||||
|
mod monster_ai_system;
|
||||||
|
|
||||||
|
pub use animal_ai_system::AnimalAI;
|
||||||
|
pub use bystander_ai_system::BystanderAI;
|
||||||
|
pub use monster_ai_system::MonsterAI;
|
@ -1,10 +1,10 @@
|
|||||||
use ::rltk::{DijkstraMap, DistanceAlg, Point};
|
use ::rltk::{DijkstraMap, DistanceAlg, Point};
|
||||||
use ::specs::prelude::*;
|
use ::specs::prelude::*;
|
||||||
|
|
||||||
use super::{Map, RunState};
|
|
||||||
use crate::components::{
|
use crate::components::{
|
||||||
Carnivore, EntityMoved, Herbivore, Item, Position, Viewshed, WantsToMelee,
|
Carnivore, EntityMoved, Herbivore, Item, Position, Viewshed, WantsToMelee,
|
||||||
};
|
};
|
||||||
|
use crate::{Map, RunState};
|
||||||
|
|
||||||
pub struct AnimalAI {}
|
pub struct AnimalAI {}
|
||||||
|
|
@ -1,9 +1,9 @@
|
|||||||
use ::rltk::{Point, RandomNumberGenerator};
|
use ::rltk::{Point, RandomNumberGenerator};
|
||||||
use specs::prelude::*;
|
use specs::prelude::*;
|
||||||
|
|
||||||
use super::game_log::GameLog;
|
|
||||||
use super::{Map, RunState};
|
|
||||||
use crate::components::{Bystander, EntityMoved, Name, Position, Quips, Viewshed};
|
use crate::components::{Bystander, EntityMoved, Name, Position, Quips, Viewshed};
|
||||||
|
use crate::game_log::GameLog;
|
||||||
|
use crate::{Map, RunState};
|
||||||
|
|
||||||
pub struct BystanderAI {}
|
pub struct BystanderAI {}
|
||||||
|
|
13
src/main.rs
13
src/main.rs
@ -1,5 +1,4 @@
|
|||||||
mod animal_ai_system;
|
mod ai;
|
||||||
mod bystander_ai_system;
|
|
||||||
pub mod camera;
|
pub mod camera;
|
||||||
mod components;
|
mod components;
|
||||||
mod damage_system;
|
mod damage_system;
|
||||||
@ -13,7 +12,6 @@ mod map;
|
|||||||
pub mod map_builders;
|
pub mod map_builders;
|
||||||
mod map_indexing_system;
|
mod map_indexing_system;
|
||||||
mod melee_combat_system;
|
mod melee_combat_system;
|
||||||
mod monster_ai_system;
|
|
||||||
mod particle_system;
|
mod particle_system;
|
||||||
mod player;
|
mod player;
|
||||||
pub mod random_table;
|
pub mod random_table;
|
||||||
@ -31,8 +29,6 @@ extern crate lazy_static;
|
|||||||
use ::rltk::{GameState, Point, RandomNumberGenerator, Rltk};
|
use ::rltk::{GameState, Point, RandomNumberGenerator, Rltk};
|
||||||
use ::specs::prelude::*;
|
use ::specs::prelude::*;
|
||||||
use ::specs::saveload::{SimpleMarker, SimpleMarkerAllocator};
|
use ::specs::saveload::{SimpleMarker, SimpleMarkerAllocator};
|
||||||
use animal_ai_system::AnimalAI;
|
|
||||||
use bystander_ai_system::BystanderAI;
|
|
||||||
use components::*;
|
use components::*;
|
||||||
use damage_system::DamageSystem;
|
use damage_system::DamageSystem;
|
||||||
pub use game_log::GameLog;
|
pub use game_log::GameLog;
|
||||||
@ -43,7 +39,6 @@ use lighting_system::LightingSystem;
|
|||||||
pub use map::*;
|
pub use map::*;
|
||||||
use map_indexing_system::MapIndexingSystem;
|
use map_indexing_system::MapIndexingSystem;
|
||||||
use melee_combat_system::MeleeCombatSystem;
|
use melee_combat_system::MeleeCombatSystem;
|
||||||
use monster_ai_system::MonsterAI;
|
|
||||||
use particle_system::ParticleSpawnSystem;
|
use particle_system::ParticleSpawnSystem;
|
||||||
use player::*;
|
use player::*;
|
||||||
pub use rect::Rect;
|
pub use rect::Rect;
|
||||||
@ -115,16 +110,16 @@ impl State {
|
|||||||
let mut vis = VisibilitySystem {};
|
let mut vis = VisibilitySystem {};
|
||||||
vis.run_now(&self.ecs);
|
vis.run_now(&self.ecs);
|
||||||
|
|
||||||
let mut mob = MonsterAI {};
|
let mut mob = ai::MonsterAI {};
|
||||||
mob.run_now(&self.ecs);
|
mob.run_now(&self.ecs);
|
||||||
|
|
||||||
let mut mapindex = MapIndexingSystem {};
|
let mut mapindex = MapIndexingSystem {};
|
||||||
mapindex.run_now(&self.ecs);
|
mapindex.run_now(&self.ecs);
|
||||||
|
|
||||||
let mut animal = AnimalAI {};
|
let mut animal = ai::AnimalAI {};
|
||||||
animal.run_now(&self.ecs);
|
animal.run_now(&self.ecs);
|
||||||
|
|
||||||
let mut bystander = BystanderAI {};
|
let mut bystander = ai::BystanderAI {};
|
||||||
bystander.run_now(&self.ecs);
|
bystander.run_now(&self.ecs);
|
||||||
|
|
||||||
let mut triggers = TriggerSystem {};
|
let mut triggers = TriggerSystem {};
|
||||||
|
Loading…
Reference in New Issue
Block a user