From a973e6a444a8f8f8a454c8d7f508c5a9b213fa43 Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Wed, 17 Nov 2021 15:55:48 -0500 Subject: [PATCH] Complete section 3.3 --- src/monster_ai_system.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/monster_ai_system.rs b/src/monster_ai_system.rs index da745ad..4a66562 100644 --- a/src/monster_ai_system.rs +++ b/src/monster_ai_system.rs @@ -1,7 +1,6 @@ use crate::components::{Confusion, Monster, Position, Viewshed, WantsToMelee}; -use crate::{Map, RunState}; - -use rltk::Point; +use crate::{particle_system::ParticleBuilder, Map, RunState}; +use rltk::{Point, RGB}; use specs::prelude::*; pub struct MonsterAI {} @@ -19,6 +18,7 @@ impl<'a> System<'a> for MonsterAI { WriteStorage<'a, Position>, WriteStorage<'a, WantsToMelee>, WriteStorage<'a, Confusion>, + WriteExpect<'a, ParticleBuilder>, ); fn run(&mut self, data: Self::SystemData) { @@ -33,6 +33,7 @@ impl<'a> System<'a> for MonsterAI { mut position, mut wants_to_melee, mut confused, + mut particle_builder, ) = data; if *runstate != RunState::MonsterTurn { @@ -52,6 +53,15 @@ impl<'a> System<'a> for MonsterAI { } can_act = false; + + particle_builder.request( + pos.x, + pos.y, + RGB::named(rltk::MAGENTA), + RGB::named(rltk::BLACK), + rltk::to_cp437('?'), + 200.0, + ); } if can_act {