mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Abandon tree generation when outside bounds
This commit is contained in:
parent
9b233708e2
commit
1036ce8c7e
@ -7,7 +7,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
use common::{
|
use common::{
|
||||||
terrain::{
|
terrain::{
|
||||||
structure::{Structure, StructureBlock},
|
structure::Structure,
|
||||||
Block,
|
Block,
|
||||||
},
|
},
|
||||||
vol::ReadVol,
|
vol::ReadVol,
|
||||||
@ -109,11 +109,16 @@ pub fn apply_trees_to<'a>(canvas: &mut Canvas) {
|
|||||||
) + Vec3::unit_z() * (wpos.z - tree.pos.z);
|
) + Vec3::unit_z() * (wpos.z - tree.pos.z);
|
||||||
block_from_structure(
|
block_from_structure(
|
||||||
info.index(),
|
info.index(),
|
||||||
tree.model
|
if let Some(block) = tree.model
|
||||||
.get(model_pos)
|
.get(model_pos)
|
||||||
.ok()
|
.ok()
|
||||||
.copied()
|
.copied()
|
||||||
.unwrap_or(StructureBlock::None),
|
{
|
||||||
|
block
|
||||||
|
} else {
|
||||||
|
// If we hit an inaccessible block, we're probably outside the model bounds. Skip this column.
|
||||||
|
break;
|
||||||
|
},
|
||||||
wpos,
|
wpos,
|
||||||
tree.pos.xy(),
|
tree.pos.xy(),
|
||||||
tree.seed,
|
tree.seed,
|
||||||
|
Loading…
Reference in New Issue
Block a user