mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fixed pyramid biome bug
This commit is contained in:
parent
09717f1c56
commit
9d1575db3f
@ -22,7 +22,7 @@ impl<'a> ColumnGen<'a> {
|
|||||||
Self { world }
|
Self { world }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_local_structure(&self, wpos: Vec2<i32>, chunk: &SimChunk) -> Option<StructureData> {
|
fn get_local_structure(&self, wpos: Vec2<i32>) -> Option<StructureData> {
|
||||||
let (pos, seed) = self
|
let (pos, seed) = self
|
||||||
.world
|
.world
|
||||||
.sim()
|
.sim()
|
||||||
@ -34,6 +34,8 @@ impl<'a> ColumnGen<'a> {
|
|||||||
.min_by_key(|(pos, _)| pos.distance_squared(wpos))
|
.min_by_key(|(pos, _)| pos.distance_squared(wpos))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
let chunk = self.world.sim().get(pos)?;
|
||||||
|
|
||||||
if seed % 5 == 2 && chunk.temp > CONFIG.desert_temp && chunk.alt > CONFIG.sea_level + 5.0 {
|
if seed % 5 == 2 && chunk.temp > CONFIG.desert_temp && chunk.alt > CONFIG.sea_level + 5.0 {
|
||||||
Some(StructureData {
|
Some(StructureData {
|
||||||
pos,
|
pos,
|
||||||
@ -45,11 +47,7 @@ impl<'a> ColumnGen<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn gen_close_structures(
|
fn gen_close_structures(&self, wpos: Vec2<i32>) -> [Option<StructureData>; 9] {
|
||||||
&self,
|
|
||||||
wpos: Vec2<i32>,
|
|
||||||
chunk: &SimChunk,
|
|
||||||
) -> [Option<StructureData>; 9] {
|
|
||||||
let mut metas = [None; 9];
|
let mut metas = [None; 9];
|
||||||
self.world
|
self.world
|
||||||
.sim()
|
.sim()
|
||||||
@ -60,7 +58,7 @@ impl<'a> ColumnGen<'a> {
|
|||||||
.copied()
|
.copied()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.for_each(|(i, (pos, seed))| {
|
.for_each(|(i, (pos, seed))| {
|
||||||
metas[i] = self.get_local_structure(pos, chunk).or(Some(StructureData {
|
metas[i] = self.get_local_structure(pos).or(Some(StructureData {
|
||||||
pos,
|
pos,
|
||||||
seed,
|
seed,
|
||||||
meta: None,
|
meta: None,
|
||||||
@ -303,7 +301,7 @@ impl<'a> Sampler for ColumnGen<'a> {
|
|||||||
sub_surface_color: dirt,
|
sub_surface_color: dirt,
|
||||||
tree_density,
|
tree_density,
|
||||||
forest_kind: sim_chunk.forest_kind,
|
forest_kind: sim_chunk.forest_kind,
|
||||||
close_structures: self.gen_close_structures(wpos, sim_chunk),
|
close_structures: self.gen_close_structures(wpos),
|
||||||
cave_xy,
|
cave_xy,
|
||||||
cave_alt,
|
cave_alt,
|
||||||
rock,
|
rock,
|
||||||
|
Loading…
Reference in New Issue
Block a user