steel_core/worldgen/structure/piece_placer/ocean_monument/
mod.rs1use std::sync::Arc;
2
3use glam::DVec3;
4use steel_registry::blocks::block_state_ext::BlockStateExt as _;
5use steel_registry::{Registry, vanilla_blocks, vanilla_entities};
6use steel_utils::random::Random;
7use steel_utils::random::worldgen_random::WorldgenRandom;
8use steel_utils::{BlockStateId, BoundingBox, Direction};
9
10use crate::entity::{entities::RawEntity, next_entity_id};
11use crate::worldgen::region::WorldGenRegion;
12use steel_worldgen::structure::ocean_monument::{
13 OceanMonumentChildPiece, OceanMonumentChildPieceKind, OceanMonumentPieceData,
14 OceanMonumentRoomData,
15};
16
17use super::StructurePiecePlacer;
18use super::scattered_feature::ScatteredFeaturePlacer;
19
20impl StructurePiecePlacer {
21 pub(super) fn place_ocean_monument_piece(
22 region: &mut WorldGenRegion<'_>,
23 registry: &Registry,
24 bounding_box: BoundingBox,
25 orientation: Option<Direction>,
26 data: &mut OceanMonumentPieceData,
27 clip: BoundingBox,
28 random: &mut WorldgenRandom,
29 ) -> bool {
30 {
31 let mut building_box = bounding_box;
32 let mut placer =
33 ScatteredFeaturePlacer::new(region, registry, &mut building_box, orientation, clip);
34 place_monument_building_shell(&mut placer);
35 }
36
37 for child in &data.child_pieces {
38 if !child.bounding_box.intersects(clip) {
39 continue;
40 }
41
42 let mut child_box = child.bounding_box;
43 let mut placer =
44 ScatteredFeaturePlacer::new(region, registry, &mut child_box, orientation, clip);
45 place_child_piece(&mut placer, child, random);
46 }
47
48 true
49 }
50}
51
52fn place_child_piece(
53 placer: &mut ScatteredFeaturePlacer<'_, '_>,
54 child: &OceanMonumentChildPiece,
55 random: &mut WorldgenRandom,
56) {
57 match &child.kind {
58 OceanMonumentChildPieceKind::EntryRoom { room } => place_entry_room(placer, *room),
59 OceanMonumentChildPieceKind::CoreRoom => place_core_room(placer),
60 OceanMonumentChildPieceKind::DoubleXRoom { west, east } => {
61 place_double_x_room(placer, *west, *east);
62 }
63 OceanMonumentChildPieceKind::DoubleXYRoom {
64 west,
65 east,
66 west_up,
67 east_up,
68 } => place_double_xy_room(placer, *west, *east, *west_up, *east_up),
69 OceanMonumentChildPieceKind::DoubleYRoom { room, above } => {
70 place_double_y_room(placer, *room, *above);
71 }
72 OceanMonumentChildPieceKind::DoubleYZRoom {
73 south,
74 north,
75 south_up,
76 north_up,
77 } => place_double_yz_room(placer, *south, *north, *south_up, *north_up),
78 OceanMonumentChildPieceKind::DoubleZRoom { south, north } => {
79 place_double_z_room(placer, *south, *north);
80 }
81 OceanMonumentChildPieceKind::SimpleRoom { room, main_design } => {
82 place_simple_room(placer, random, *room, *main_design);
83 }
84 OceanMonumentChildPieceKind::SimpleTopRoom { room } => {
85 place_simple_top_room(placer, random, *room);
86 }
87 OceanMonumentChildPieceKind::WingRoom { main_design } => {
88 place_wing_room(placer, *main_design);
89 }
90 OceanMonumentChildPieceKind::Penthouse => place_penthouse(placer),
91 }
92}
93
94mod shell;
95
96use shell::place_monument_building_shell;
97
98mod room_core;
99
100use room_core::{place_core_room, place_entry_room};
101
102mod room_double;
103
104use room_double::{
105 place_double_x_room, place_double_xy_room, place_double_y_room, place_double_yz_room,
106 place_double_z_room,
107};
108
109mod room_simple;
110
111use room_simple::{place_simple_room, place_simple_top_room};
112
113mod room_special;
114
115use room_special::{place_penthouse, place_wing_room};
116
117mod helpers;
118
119use helpers::{
120 base_black, base_gray, base_light, dot_deco, generate_box_on_fill_only, generate_default_floor,
121 generate_water_box, lamp, open, spawn_elder,
122};