unbanished_game/work/construction/site/progress.rs
1//! A site's construction progress (ConstructionComponent).
2
3use super::*;
4
5/// The job manager, professions, workforce and every construction site.
6#[derive(Debug, Clone, Default)]
7pub struct Construction {
8 // +0x1b8; +0x190
9 /// The town's commute optimisation (StockManager).
10 pub commute: crate::behaviour::commute::Commute,
11 /// The job manager.
12 pub jobs: Jobs,
13 /// The professions.
14 pub professions: Professions,
15 /// The citizens' workplaces and professions.
16 pub workforce: Workforce,
17 /// The building templates, as construction reads them.
18 pub templates: Vec<SiteTemplate>,
19 /// Entity → site.
20 pub sites: BTreeMap<usize, Site>,
21 // Game +0xf0 → +0xd0
22 /// `Game →`: sites in their gathering and building states.
23 pub site_list: Vec<usize>,
24 /// Sites placed since the last iteration (activated before the next one).
25 pub placed: Vec<usize>,
26 /// Player commands for the next iteration.
27 pub commands: Vec<Command>,
28 /// Loose raw-material piles (RawMaterialComponent), by entity.
29 pub piles: BTreeMap<usize, Pile>,
30 /// NaturalResourceComponent flag `0x100000`: a removal sequence holds the resource.
31 pub claimed_resources: BTreeSet<usize>,
32 /// Piles created since the last iteration (registered with the entity manager and
33 /// activated after the citizens' update).
34 pub new_piles: Vec<usize>,
35 /// Entities were created or removed (the models need refreshing).
36 pub models_dirty: bool,
37 /// Entities the player destroyed (RemovalTool cancel), before the next iteration.
38 pub destroy: Vec<usize>,
39 /// Finished residences' ResidenceComponents, by entity.
40 pub homes: BTreeMap<usize, crate::people::life::Home>,
41 // +0x60
42 /// AttendanceComponents, by entity, and the town manager's registry.
43 pub attendance: BTreeMap<usize, Attendance>,
44 /// The town manager's list of schools, chapels and doctors.
45 pub attendance_list: Vec<usize>,
46 // +0x70
47 /// The town manager's HealerComponents.
48 pub healers: Vec<usize>,
49 // +0x50
50 /// The town manager's registered HappinessComponents, by entity.
51 pub happiness: Vec<usize>,
52 // Game +0x128 → +8; +0
53 /// The calendar's seconds into the year, set before each iteration.
54 pub calendar: f32,
55 /// The calendar's year, set before each iteration.
56 pub year: u32,
57 /// FruitComponents of orchard trees, by entity.
58 pub fruits: BTreeMap<usize, crate::production::orchard::Fruit>,
59 // +0x2d
60 /// NaturalResourceComponent set by a crop field: whether harvesting leaves a pile.
61 pub keep_piles: BTreeMap<usize, bool>,
62 /// Event-log entries the sites posted: type, severity, entity; the game formats them with the
63 /// entity's toolbar name.
64 ///
65 /// Original: `FUN_14009a2d0`.
66 pub site_events: Vec<(i32, i32, usize)>,
67 // +0x00
68 /// StorageLocationComponents joining (`true`) or leaving the town's storages, in order; the
69 /// town applies them after the iteration's update.
70 pub storage_changes: Vec<(usize, bool)>,
71 // +0x40
72 /// The town's cemeteries, in order.
73 pub cemeteries: Vec<usize>,
74 // +0x28
75 /// TombstoneComponents and the time each has left.
76 pub tombstones: BTreeMap<usize, i64>,
77 /// Burials decided at a death (cemetery, grave cell), placed after the citizens' update.
78 pub burials: Vec<(usize, i32, i64)>,
79 /// Entities a DestroyComponent puts in a torn-down building's place, created by the town after
80 /// the update.
81 ///
82 /// Original: `FUN_1400c9d70`.
83 pub rebuilds: Vec<crate::work::destroy::Rebuild>,
84 /// The town's water sources (built with the map).
85 ///
86 /// Original: `FUN_1400a43f0`.
87 pub water: crate::disasters::fire::Water,
88 // Game +0xd0; FUN_14009d530 sets 0xf0 with disasters off, else 0.
89 /// The game's flags (for example, disasters off).
90 pub game_flags: u32,
91 /// The sky's state is precipitation, set before each iteration.
92 pub precipitation: bool,
93 // +0xa8
94 /// Town manager: the population, set before each update.
95 pub population: i32,
96 // +0x1a8; +0x1a0
97 /// Town manager /: the visitors' disease risk and how long it lasts.
98 pub visitors: (f32, i64),
99 // +0x1b0
100 /// Town manager: nomads taken in.
101 pub nomads_admitted: i32,
102 // +0x30
103 /// Town manager: the trading posts.
104 pub trading_posts: Vec<usize>,
105 // +0x1ac
106 /// Town manager: the value traded away.
107 pub trade_value: i32,
108 // +0xe8
109 /// Map: the cells with a planned road, and their BuildRoad works.
110 pub pending_roads: BTreeMap<i32, i32>,
111 /// Tunnels to dig or fill back (TerraformComponent event 4 and removal), for the terrain's
112 /// owner, and each terraformed entity's kept heights and cells.
113 pub terraform_requests: Vec<crate::world::terraform::Terraform>,
114 /// Requests to flatten the ground: cell rectangles (`x0, y0, x1, y1`, inclusive) whose
115 /// cells' low corners go to height 0. They are applied to the terrain after the iteration.
116 ///
117 /// Original: `FUN_1400a35b0`.
118 pub flatten_requests: Vec<[i32; 4]>,
119 /// The tornadoes by entity, and the citizens they killed this iteration (death code 5; the
120 /// citizens' pass applies it).
121 pub tornadoes: BTreeMap<usize, crate::disasters::tornado::Tornado>,
122 /// The citizens killed by tornadoes this iteration.
123 pub tornado_kills: Vec<usize>,
124 /// TrackerComponents by entity, and the stock manager's made/used counters.
125 pub trackers: BTreeMap<usize, crate::work::tracker::Tracker>,
126 /// DecalComponents that left their setup state, by entity (the others show at their
127 /// description's alpha with material 0).
128 pub decals: BTreeMap<usize, Decal>,
129 /// What the town made and used since the last sample.
130 pub counters: crate::work::tracker::StockCounters,
131 /// The terraforming state of tunnels, by entity.
132 pub terraforms: BTreeMap<usize, crate::world::terraform::TerraformState>,
133 /// Built road cells Remove Roads marked, for the town to place their markers (cell,
134 /// marker template).
135 pub road_markers: Vec<(i32, usize)>,
136 /// The goods with a ValueDescription, in the factory's order (`GameResources`).
137 pub trade_goods: Vec<crate::commerce::trade::TradeGood>,
138 // +0x1e0
139 /// MapComponent 's first river centre line, the trader boats' way.
140 pub river: Vec<[f32; 2]>,
141 /// `Game/Names/Male` and `Female`, for the merchants' names.
142 pub names: Option<
143 std::sync::Arc<(
144 unbanished_formats::names::NameDatabase,
145 unbanished_formats::names::NameDatabase,
146 )>,
147 >,
148 /// The town manager's known crops, orchard trees and livestock, as placed-object templates.
149 ///
150 /// Original: `FUN_140096ef0`.
151 pub known: Vec<usize>,
152 // +0x110
153 /// The stock manager's known raw materials: the start profile's, then each as its first pile is
154 /// set up or it is traded for.
155 ///
156 /// Original: `FUN_140097330`.
157 pub known_materials: Vec<usize>,
158}