diff --git a/world/src/site/settlement/building/archetype/house.rs b/world/src/site/settlement/building/archetype/house.rs index 8317a42c44..836cafe3bc 100644 --- a/world/src/site/settlement/building/archetype/house.rs +++ b/world/src/site/settlement/building/archetype/house.rs @@ -7,6 +7,7 @@ use crate::{ IndexRef, }; use common::{ + calendar::Calendar, make_case_elim, terrain::{Block, BlockKind, SpriteKind}, }; @@ -107,6 +108,7 @@ pub struct House { pub noise: RandomField, pub roof_ribbing: bool, pub roof_ribbing_diagonal: bool, + pub christmas_decorations: bool, } #[derive(Copy, Clone)] @@ -180,7 +182,7 @@ impl Attr { impl Archetype for House { type Attr = Attr; - fn generate(rng: &mut R) -> (Self, Skeleton) { + fn generate(rng: &mut R, calendar: Option<&Calendar>) -> (Self, Skeleton) { let len = rng.gen_range(-8..24).clamped(0, 20); let locus = 6 + rng.gen_range(0..5); let branches_per_side = 1 + len as usize / 20; @@ -239,6 +241,7 @@ impl Archetype for House { noise: RandomField::new(rng.gen()), roof_ribbing: rng.gen(), roof_ribbing_diagonal: rng.gen(), + christmas_decorations: calendar.map(|c| c.is_event(CalendarEvent::Christmas)), }; (this, skel) @@ -261,7 +264,7 @@ impl Archetype for House { let roof_color = *self.colors.roof.elim_case_pure(&colors.roof); let wall_color = *self.colors.wall.elim_case_pure(&colors.wall); let support_color = *self.colors.support.elim_case_pure(&colors.support); - let christmas_theme = true; // calendar.map_or(false, |c| c.is_event(CalendarEvent::Christmas)); + let christmas_theme = self.christmas_decorations; let profile = Vec2::new(bound_offset.x, z); diff --git a/world/src/site/settlement/building/archetype/keep.rs b/world/src/site/settlement/building/archetype/keep.rs index cd68d8662f..065d34dd53 100644 --- a/world/src/site/settlement/building/archetype/keep.rs +++ b/world/src/site/settlement/building/archetype/keep.rs @@ -5,6 +5,7 @@ use crate::{ IndexRef, }; use common::{ + calendar::Calendar, make_case_elim, terrain::{Block, BlockKind, SpriteKind}, }; @@ -56,7 +57,7 @@ make_case_elim!( impl Archetype for Keep { type Attr = Attr; - fn generate(rng: &mut R) -> (Self, Skeleton) { + fn generate(rng: &mut R, _calendar: Option<&Calendar>) -> (Self, Skeleton) { let len = rng.gen_range(-8..24).max(0); let storeys = rng.gen_range(1..3); let skel = Skeleton { diff --git a/world/src/site/settlement/building/archetype/mod.rs b/world/src/site/settlement/building/archetype/mod.rs index 169b8e06ed..e09a59205f 100644 --- a/world/src/site/settlement/building/archetype/mod.rs +++ b/world/src/site/settlement/building/archetype/mod.rs @@ -3,6 +3,7 @@ pub mod keep; use super::skeleton::*; use crate::{site::BlockMask, IndexRef}; +use common::calendar::Calendar; use rand::prelude::*; use serde::Deserialize; use vek::*; @@ -16,7 +17,7 @@ pub struct Colors { pub trait Archetype { type Attr; - fn generate(rng: &mut R) -> (Self, Skeleton) + fn generate(rng: &mut R, calendar: Option<&Calendar>) -> (Self, Skeleton) where Self: Sized; diff --git a/world/src/site/settlement/building/mod.rs b/world/src/site/settlement/building/mod.rs index b7170277a6..4f0a290957 100644 --- a/world/src/site/settlement/building/mod.rs +++ b/world/src/site/settlement/building/mod.rs @@ -29,7 +29,7 @@ impl Building { where A: Sized, { - let (archetype, skel) = A::generate(rng); + let (archetype, skel) = A::generate(rng, calendar); Self { skel, archetype,