Simplify tunnel entity spawning

This commit is contained in:
James Melkonian 2022-02-12 14:21:22 -08:00
parent 8a02a943f4
commit 8da1ae578f

View File

@ -332,33 +332,26 @@ impl GnarlingFortification {
for terminal in &self.tunnels.terminals { for terminal in &self.tunnels.terminals {
if area.contains_point(terminal.xy() - self.origin) { if area.contains_point(terminal.xy() - self.origin) {
let chance = dynamic_rng.gen_range(0..10); let chance = dynamic_rng.gen_range(0..10);
match chance { let entities = match chance {
0..=4 => supplement 0..=4 => vec![mandragora(*terminal - 5 * Vec3::unit_z(), dynamic_rng)],
.add_entity(mandragora(*terminal - 5 * Vec3::unit_z(), dynamic_rng)), 5 => vec![
5 => { mandragora(*terminal - 5 * Vec3::unit_z(), dynamic_rng),
supplement mandragora(*terminal - 5 * Vec3::unit_z(), dynamic_rng),
.add_entity(mandragora(*terminal - 5 * Vec3::unit_z(), dynamic_rng)); ],
supplement 6 => vec![deadwood(*terminal - 5 * Vec3::unit_z(), dynamic_rng)],
.add_entity(mandragora(*terminal - 5 * Vec3::unit_z(), dynamic_rng)); 7 => vec![
}, mandragora(*terminal - 5 * Vec3::unit_z(), dynamic_rng),
6 => { deadwood(*terminal - 5 * Vec3::unit_z(), dynamic_rng),
supplement.add_entity(deadwood(*terminal - 5 * Vec3::unit_z(), dynamic_rng)) ],
}, 8 => vec![
7 => { mandragora(*terminal - 5 * Vec3::unit_z(), dynamic_rng),
supplement mandragora(*terminal - 5 * Vec3::unit_z(), dynamic_rng),
.add_entity(mandragora(*terminal - 5 * Vec3::unit_z(), dynamic_rng)); mandragora(*terminal - 5 * Vec3::unit_z(), dynamic_rng),
supplement ],
.add_entity(deadwood(*terminal - 5 * Vec3::unit_z(), dynamic_rng)); _ => Vec::new(),
}, };
8 => { for entity in entities {
supplement supplement.add_entity(entity)
.add_entity(mandragora(*terminal - 5 * Vec3::unit_z(), dynamic_rng));
supplement
.add_entity(mandragora(*terminal - 5 * Vec3::unit_z(), dynamic_rng));
supplement
.add_entity(mandragora(*terminal - 5 * Vec3::unit_z(), dynamic_rng));
},
_ => {},
} }
} }
} }