small fixes

This commit is contained in:
Isse 2023-11-06 07:22:41 +01:00
parent ee4c6d006f
commit 7a1612aa8a
2 changed files with 63 additions and 8 deletions

View File

@ -593,12 +593,12 @@ impl Site {
site.make_plaza(land, &mut rng);
let build_chance = Lottery::from(vec![
// (64.0, 1),
// (5.0, 2),
// (8.0, 3),
// (5.0, 4),
// (5.0, 5),
// (15.0, 6),
(64.0, 1),
(5.0, 2),
(8.0, 3),
(5.0, 4),
(5.0, 5),
(15.0, 6),
(15.0, 7),
]);
@ -607,6 +607,8 @@ impl Site {
let mut workshops = 0;
let mut airship_docks = 0;
let mut taverns = 0;
for _ in 0..(size * 200.0) as i32 {
match *build_chance.choose_seeded(rng.gen()) {
// Workshop
@ -924,7 +926,7 @@ impl Site {
}
}
},
7 if size > 0.125 => {
7 if (size > 0.125 && taverns < 2) => {
let size = (3.5 + rng.gen::<f32>().powf(5.0) * 2.0).round() as u32;
if let Some((aabr, door_tile, door_dir)) = attempt(32, || {
site.find_roadside_aabr(
@ -955,7 +957,8 @@ impl Site {
plot: Some(plot),
hard_alt: Some(tavern_alt),
});
workshops += 1;
taverns += 1;
} else {
site.make_plaza(land, &mut rng);
}

View File

@ -1075,6 +1075,58 @@ impl Structure for Tavern {
dir,
)
.fill(wall_fill.clone());
painter
.aabb(aabb(Aabb {
min: (dir.select_aabr_with(roof.bounds, roof.bounds.min + 1)
- dir.to_vec2())
.with_z(roof.min_z),
max: (dir.select_aabr_with(roof.bounds, roof.bounds.max - 1)
- dir.to_vec2())
.with_z(roof.min_z),
}))
.fill(wall_detail_fill.clone());
let center_bounds = Aabr {
min: (dir.select_aabr_with(roof.bounds, roof.bounds.center())
- dir.to_vec2()),
max: (dir.select_aabr_with(
roof.bounds,
(roof.bounds.min + roof.bounds.max + 1) / 2,
) - dir.to_vec2()),
};
painter
.aabb(aabb(Aabb {
min: center_bounds.min.with_z(roof.min_z),
max: center_bounds.max.with_z(max_z - 1),
}))
.fill(wall_detail_fill.clone());
for d in [dir.orthogonal(), -dir.orthogonal()] {
let hgt = max_z - roof.min_z;
let half_size = d.select(roof.bounds.size() + 1) / 2;
let e = half_size - hgt + 1;
let e = e - e % 2;
let f = half_size - e;
let hgt = (hgt - 1).min(e - f % 2) - (d.signum() - 1) / 2;
let mut aabr = Aabr {
min: d.select_aabr_with(center_bounds, center_bounds.min),
max: d.select_aabr_with(center_bounds, center_bounds.max)
+ d.to_vec2() * hgt,
}
.made_valid();
aabr.max += 1;
painter
.plane(
aabr,
aabr.min
.with_z(if d.signum() < 0 {
roof.min_z + hgt
} else {
roof.min_z
})
.as_(),
d.to_vec2().as_(),
)
.fill(wall_detail_fill.clone());
}
painter
.gable(
aabb(Aabb {