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