veloren/world/src/site2/plot.rs

36 lines
690 B
Rust
Raw Normal View History

2021-03-04 18:23:13 +00:00
mod castle;
pub mod dungeon;
mod house;
pub use self::{castle::Castle, dungeon::Dungeon, house::House};
use super::*;
2021-02-04 12:47:46 +00:00
use crate::util::DHashSet;
2021-02-17 01:47:16 +00:00
use common::path::Path;
2021-02-06 23:53:25 +00:00
use vek::*;
2020-12-26 15:53:06 +00:00
pub struct Plot {
2021-02-17 01:47:16 +00:00
pub(crate) kind: PlotKind,
pub(crate) root_tile: Vec2<i32>,
pub(crate) tiles: DHashSet<Vec2<i32>>,
pub(crate) seed: u32,
2021-02-04 12:47:46 +00:00
}
impl Plot {
pub fn find_bounds(&self) -> Aabr<i32> {
self.tiles
.iter()
2021-02-06 23:53:25 +00:00
.fold(Aabr::new_empty(self.root_tile), |b, t| {
b.expanded_to_contain_point(*t)
})
2021-02-04 12:47:46 +00:00
}
2020-12-26 15:53:06 +00:00
}
pub enum PlotKind {
House(House),
2021-02-17 01:47:16 +00:00
Plaza,
2021-03-04 18:23:13 +00:00
Castle(Castle),
2021-02-17 01:47:16 +00:00
Road(Path<Vec2<i32>>),
Dungeon(Dungeon),
2020-12-26 15:53:06 +00:00
}