only allow interactive spawning at the beginning

This commit is contained in:
Dustin Carlino 2018-10-17 15:01:32 -07:00
parent d897ebfd4b
commit 3968a78166
2 changed files with 7 additions and 1 deletions

View File

@ -99,7 +99,9 @@ impl SimController {
}
} else {
// Interactively spawning stuff would ruin an A/B test, don't allow it
if input.unimportant_key_pressed(Key::S, SIM, "Seed the map with agents") {
if primary.sim.is_empty()
&& input.unimportant_key_pressed(Key::S, SIM, "Seed the map with agents")
{
primary.sim.small_spawn(&primary.map);
primary.recalculate_current_selection = true;
}

View File

@ -265,6 +265,10 @@ impl Sim {
)
}
pub fn is_empty(&self) -> bool {
self.time == Tick::zero() && self.is_done()
}
pub fn is_done(&self) -> bool {
self.driving_state.is_done() && self.walking_state.is_done() && self.spawner.is_done()
}