runs effects queue immediately before/after player turn
precaution against the effects queue unordering itself, etc.
This commit is contained in:
parent
0925cda599
commit
5f23822f62
1 changed files with 8 additions and 0 deletions
|
|
@ -225,7 +225,11 @@ 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
|
||||||
|
// still be in the queue, just to make 100% sure that
|
||||||
|
// there are no lingering effects from the last tick.
|
||||||
self.run_map_index();
|
self.run_map_index();
|
||||||
|
effects::run_effects_queue(&mut self.ecs);
|
||||||
// Sanity-checking that the player actually *should*
|
// Sanity-checking that the player actually *should*
|
||||||
// be taking a turn before giving them one. If they
|
// be taking a turn before giving them one. If they
|
||||||
// don't have a turn component, go back to ticking.
|
// don't have a turn component, go back to ticking.
|
||||||
|
|
@ -242,6 +246,10 @@ impl GameState for State {
|
||||||
} else {
|
} else {
|
||||||
new_runstate = RunState::Ticking;
|
new_runstate = RunState::Ticking;
|
||||||
}
|
}
|
||||||
|
// Fire the events queue immediately after the player
|
||||||
|
// turn, just to make 100% sure that everything happens
|
||||||
|
// as the player was expecting it to.
|
||||||
|
effects::run_effects_queue(&mut self.ecs);
|
||||||
}
|
}
|
||||||
RunState::Ticking => {
|
RunState::Ticking => {
|
||||||
while new_runstate == RunState::Ticking {
|
while new_runstate == RunState::Ticking {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue