Add traps
This commit is contained in:
@@ -5,7 +5,7 @@ use crate::particle_system::ParticleBuilder;
|
||||
use crate::{
|
||||
components::{Monster, Position, Viewshed, WantsToMelee},
|
||||
map::Map,
|
||||
Confusion, RunState,
|
||||
Confusion, EntityMoved, RunState,
|
||||
};
|
||||
|
||||
pub struct MonsterAI {}
|
||||
@@ -24,6 +24,7 @@ impl<'a> System<'a> for MonsterAI {
|
||||
WriteStorage<'a, WantsToMelee>,
|
||||
WriteStorage<'a, Confusion>,
|
||||
WriteExpect<'a, ParticleBuilder>,
|
||||
WriteStorage<'a, EntityMoved>,
|
||||
);
|
||||
|
||||
fn run(&mut self, data: Self::SystemData) {
|
||||
@@ -39,6 +40,7 @@ impl<'a> System<'a> for MonsterAI {
|
||||
mut wants_to_melee,
|
||||
mut confused,
|
||||
mut particle_builder,
|
||||
mut entity_moved,
|
||||
) = data;
|
||||
|
||||
if *runstate != RunState::MonsterTurn {
|
||||
@@ -96,6 +98,10 @@ impl<'a> System<'a> for MonsterAI {
|
||||
idx = map.xy_idx(pos.x, pos.y);
|
||||
map.blocked[idx] = true;
|
||||
viewshed.dirty = true;
|
||||
|
||||
entity_moved
|
||||
.insert(entity, EntityMoved {})
|
||||
.expect("Unable to insert entity moved");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user