failed attempt at making dungeons avoid caves

This commit is contained in:
Maxicarlos08 2023-07-17 21:21:18 +02:00
parent 0f2db68498
commit 14141ecc80
No known key found for this signature in database
3 changed files with 17 additions and 6 deletions

View File

@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Recipe for a new leather pack
- Keybinds for zooming the camera (Defaults: ']' for zooming in and '[' for zooming out)
- Added the ability to make pets sit, they wont follow nor defend you in this state
- Portals that spawn in place of the last staircase at old style dungeons to prevent stair cheesing
### Changed
@ -53,6 +54,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Fixed wild roaming cyclop loot table to not drop the quarry key
- Dungeons now have an outer wall, preventing them from intersecting with caves or leaving holes in sides of mountains.
## [0.15.0] - 2023-07-01

View File

@ -1884,14 +1884,23 @@ impl SiteKind {
on_land() && {
let land = Land::from_sim(sim);
let loc = loc.map(|v| TerrainChunkSize::RECT_SIZE.y as i32 * v);
let dungeon_aabr = Aabr {
min: loc - Vec2::broadcast(200),
max: loc + Vec2::broadcast(200),
};
// Get shallow caves under the dungeon
let mut tunnels =
cave::tunnels_at(loc /* very surely wrong */, 1, &land)
.chain(cave::tunnels_at(loc, 2, &land));
let mut tunnels = cave::tunnels_at(loc, 1, &land)
.chain(cave::tunnels_at(loc, 2, &land))
.filter(|tunnel| {
dungeon_aabr.collides_with_aabr(Aabr {
min: tunnel.a.wpos,
max: tunnel.b.wpos,
})
});
// Make sure there are no shallow caves near the dungeon
tunnels.next().is_none() || true
tunnels.next().is_none()
}
},
SiteKind::Refactor | SiteKind::Settlement => suitable_for_town(),

View File

@ -76,8 +76,8 @@ pub fn surface_entrances<'a>(land: &'a Land) -> impl Iterator<Item = Vec2<i32>>
}
pub struct Tunnel {
a: Node,
b: Node,
pub a: Node,
pub b: Node,
curve: f32,
}