Lanterns in trees

This commit is contained in:
Joshua Barretto 2021-02-08 11:10:47 +00:00
parent b12f9d1444
commit b2a2106992
7 changed files with 26 additions and 4 deletions

BIN
assets/voxygen/voxel/sprite/lantern/lantern-orange.vox (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -2824,4 +2824,16 @@ SapphireSmall: Some((
], ],
wind_sway: 0.0, wind_sway: 0.0,
)), )),
// Lantern
Lantern: Some((
variations: [
(
model: "voxygen.voxel.sprite.lantern.lantern-orange",
offset: (-2.5, -2.5, 0.0),
lod_axes: (0.0, 0.0, 0.0),
),
],
wind_sway: 0.0,
)),
) )

View File

@ -189,6 +189,7 @@ impl Block {
| SpriteKind::RubySmall | SpriteKind::RubySmall
| SpriteKind::EmeraldSmall | SpriteKind::EmeraldSmall
| SpriteKind::SapphireSmall => Some(3), | SpriteKind::SapphireSmall => Some(3),
SpriteKind::Lantern => Some(24),
_ => None, _ => None,
} }
} }

View File

@ -142,6 +142,7 @@ make_case_elim!(
Seagrass = 0x73, Seagrass = 0x73,
RedAlgae = 0x74, RedAlgae = 0x74,
UnderwaterVent = 0x75, UnderwaterVent = 0x75,
Lantern = 0x76,
} }
); );
@ -201,6 +202,7 @@ impl SpriteKind {
| SpriteKind::DropGate => 1.0, | SpriteKind::DropGate => 1.0,
// TODO: Figure out if this should be solid or not. // TODO: Figure out if this should be solid or not.
SpriteKind::Shelf => 1.0, SpriteKind::Shelf => 1.0,
SpriteKind::Lantern => 0.9,
_ => return None, _ => return None,
}) })
} }
@ -289,6 +291,7 @@ impl SpriteKind {
| SpriteKind::Bowl | SpriteKind::Bowl
| SpriteKind::VialEmpty | SpriteKind::VialEmpty
| SpriteKind::FireBowlGround | SpriteKind::FireBowlGround
| SpriteKind::Lantern
) )
} }
} }

View File

@ -87,4 +87,5 @@ pub struct TreeAttr {
pub seed: u32, pub seed: u32,
pub scale: f32, pub scale: f32,
pub forest_kind: ForestKind, pub forest_kind: ForestKind,
pub lanterns: bool,
} }

View File

@ -60,7 +60,7 @@ pub fn apply_trees_to(canvas: &mut Canvas, dynamic_rng: &mut impl Rng) {
canvas.foreach_col(|canvas, wpos2d, col| { canvas.foreach_col(|canvas, wpos2d, col| {
let trees = info.land().get_near_trees(wpos2d); let trees = info.land().get_near_trees(wpos2d);
for TreeAttr { pos, seed, scale, forest_kind } in trees { for TreeAttr { pos, seed, scale, forest_kind, lanterns } in trees {
let tree = if let Some(tree) = tree_cache.entry(pos).or_insert_with(|| { let tree = if let Some(tree) = tree_cache.entry(pos).or_insert_with(|| {
let col = ColumnGen::new(info.land()).get((pos, info.index()))?; let col = ColumnGen::new(info.land()).get((pos, info.index()))?;
@ -202,8 +202,8 @@ pub fn apply_trees_to(canvas: &mut Canvas, dynamic_rng: &mut impl Rng) {
) )
.map(|block| { .map(|block| {
// Add mushrooms to the tree // Add mushrooms to the tree
if last_block.is_air() && block.kind() == BlockKind::Wood && dynamic_rng.gen_range(0..48) == 0 { if lanterns && last_block.is_air() && block.kind() == BlockKind::Wood && dynamic_rng.gen_range(0..48) == 0 {
canvas.set(wpos + Vec3::unit_z(), Block::air(SpriteKind::CaveMushroom)); canvas.set(wpos + Vec3::unit_z(), Block::air(SpriteKind::Lantern));
// Add a snow covering to the block above under certain circumstances // Add a snow covering to the block above under certain circumstances
} else if col.snow_cover } else if col.snow_cover
&& ((block.kind() == BlockKind::Leaves && is_leaf_top) && ((block.kind() == BlockKind::Leaves && is_leaf_top)

View File

@ -2017,11 +2017,12 @@ impl WorldSim {
.enumerate() .enumerate()
.map(|(i, fk)| { .map(|(i, fk)| {
const CLUSTER_SIZE: f64 = 48.0; const CLUSTER_SIZE: f64 = 48.0;
let nz = (FastNoise2d::new(i as u32).get(pos.map(|e| e as f64) / CLUSTER_SIZE) + 1.0) / 2.0; let nz = (FastNoise2d::new(i as u32 * 37).get(pos.map(|e| e as f64) / CLUSTER_SIZE) + 1.0) / 2.0;
(fk.proclivity(&env) * nz, fk) (fk.proclivity(&env) * nz, fk)
}) })
.collect::<Vec<_>>()) .collect::<Vec<_>>())
.choose_seeded(seed), .choose_seeded(seed),
lanterns: false,
}) })
}); });
@ -2033,6 +2034,7 @@ impl WorldSim {
seed, seed,
scale: 4.0, scale: 4.0,
forest_kind: ForestKind::Giant, forest_kind: ForestKind::Giant,
lanterns: true,
}); });
normal_trees.chain(giant_trees) normal_trees.chain(giant_trees)