player turn awaits empty particle queue

This commit is contained in:
Llywelwyn 2023-08-30 05:58:08 +01:00
parent b5c4cb1fb5
commit 8eb98b5baa

View file

@ -246,26 +246,28 @@ impl GameState for State {
new_runstate = RunState::AwaitingInput; new_runstate = RunState::AwaitingInput;
} }
RunState::AwaitingInput => { RunState::AwaitingInput => {
// We refresh the index, and run anything that might while particle_system::check_queue(&self.ecs) {
// still be in the queue, just to make 100% sure that // We refresh the index, and run anything that might
// there are no lingering effects from the last tick. // still be in the queue, just to make 100% sure that
self.refresh_indexes(); // there are no lingering effects from the last tick.
effects::run_effects_queue(&mut self.ecs); self.refresh_indexes();
// Sanity-checking that the player actually *should* effects::run_effects_queue(&mut self.ecs);
// be taking a turn before giving them one. If they // Sanity-checking that the player actually *should*
// don't have a turn component, go back to ticking. // be taking a turn before giving them one. If they
let mut can_act = false; // don't have a turn component, go back to ticking.
{ let mut can_act = false;
let player_entity = self.ecs.fetch::<Entity>(); {
let turns = self.ecs.read_storage::<TakingTurn>(); let player_entity = self.ecs.fetch::<Entity>();
if let Some(_) = turns.get(*player_entity) { let turns = self.ecs.read_storage::<TakingTurn>();
can_act = true; if let Some(_) = turns.get(*player_entity) {
can_act = true;
}
}
if can_act {
new_runstate = player_input(self, ctx);
} else {
new_runstate = RunState::Ticking;
} }
}
if can_act {
new_runstate = player_input(self, ctx);
} else {
new_runstate = RunState::Ticking;
} }
} }
RunState::Ticking => { RunState::Ticking => {