autumn leaves

This commit is contained in:
Isse 2022-10-13 21:15:22 +02:00 committed by flo666
parent 9c4736f47b
commit 3b2eba1457
2 changed files with 30 additions and 20 deletions

View File

@ -265,6 +265,19 @@ pub fn block_from_structure(
&& field.chance(pos + structure_pos, 0.025)
{
Block::new(BlockKind::GlowingWeakRock, Rgb::new(255, 0, 0))
} else if calendar.map_or(false, |c| c.is_event(CalendarEvent::Halloween))
&& sblock != StructureBlock::PineLeaves
{
let (c0, c1) = match structure_seed % 6 {
0 => (Rgb::new(165.0, 150.0, 11.0), Rgb::new(170.0, 165.0, 16.0)),
1 | 2 => (Rgb::new(218.0, 53.0, 3.0), Rgb::new(226.0, 62.0, 5.0)),
_ => (Rgb::new(230.0, 120.0, 20.0), Rgb::new(242.0, 130.0, 25.0)),
};
Block::new(
BlockKind::Leaves,
Rgb::<f32>::lerp(c0, c1, lerp).map(|e| e as u8),
)
} else {
Block::new(
BlockKind::Leaves,

View File

@ -286,26 +286,23 @@ pub fn apply_scatter_to(canvas: &mut Canvas, rng: &mut impl Rng, calendar: Optio
kind: Pumpkin,
water_mode: Ground,
permit: |b| matches!(b, BlockKind::Grass),
f: if calendar.map_or(false, |calendar| calendar.is_event(CalendarEvent::Halloween)) {
|_, _| {
(
0.1,
Some((0.0003, 128.0, 0.1)),
)
}
} else {
|_, col| {
(
close(col.temp, CONFIG.temperate_temp, 0.5).min(close(
col.humidity,
CONFIG.forest_hum,
0.5,
)) * MUSH_FACT
* 500.0,
Some((0.0, 512.0, 0.05)),
)
}
},
f: if calendar.map_or(false, |calendar| {
calendar.is_event(CalendarEvent::Halloween)
}) {
|_, _| (0.1, Some((0.0003, 128.0, 0.1)))
} else {
|_, col| {
(
close(col.temp, CONFIG.temperate_temp, 0.5).min(close(
col.humidity,
CONFIG.forest_hum,
0.5,
)) * MUSH_FACT
* 500.0,
Some((0.0, 512.0, 0.05)),
)
}
},
},
// Collectable Objects
// Only spawn twigs in temperate forests