initiative_core/world/place/building/religious/
mod.rs

1mod shrine;
2use initiative_macros::WordList;
3use rand::Rng;
4use serde::{Deserialize, Serialize};
5
6use crate::world::place::{PlaceData, PlaceType};
7use crate::world::Demographics;
8
9use super::BuildingType;
10
11#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize, WordList)]
12#[serde(into = "&'static str", try_from = "&str")]
13pub enum ReligiousType {
14    Abbey,
15    #[alias = "necropolis"]
16    #[alias = "graveyard"]
17    Cemetery,
18    Crypt,
19    Mausoleum,
20    #[alias = "hermitage"]
21    #[alias = "nunnery"]
22    Monastery,
23    Shrine,
24    #[alias = "church"]
25    #[alias = "mosque"]
26    #[alias = "synagogue"]
27    Temple,
28    Tomb,
29}
30
31impl ReligiousType {
32    pub const fn get_emoji(&self) -> Option<&'static str> {
33        match self {
34            Self::Abbey | Self::Monastery | Self::Shrine | Self::Temple => Some("🙏"),
35            Self::Cemetery | Self::Crypt | Self::Mausoleum | Self::Tomb => Some("🪦"),
36        }
37    }
38}
39
40pub fn generate(place: &mut PlaceData, rng: &mut impl Rng, demographics: &Demographics) {
41    #[expect(clippy::collapsible_match)]
42    if let Some(PlaceType::Building(BuildingType::Religious(subtype))) = place.subtype.value() {
43        #[expect(clippy::single_match)]
44        match subtype {
45            ReligiousType::Shrine => shrine::generate(place, rng, demographics),
46            _ => {}
47        }
48    }
49}