1use assembly_core::num_derive::{FromPrimitive, ToPrimitive};
2use assembly_core::types::{ObjectID, ObjectTemplate, Quaternion, Vector3f, WorldID};
3use std::collections::HashMap;
4
5#[cfg(feature = "serde-derives")]
6use serde::Serialize;
7
8#[cfg_attr(feature = "serde-derives", derive(Serialize))]
10#[derive(Clone, Debug, FromPrimitive, ToPrimitive)]
11pub struct ZonePathsVersion(u32);
12
13#[cfg_attr(feature = "serde-derives", derive(Serialize))]
15#[derive(Clone, Copy, Debug, FromPrimitive, ToPrimitive)]
16pub struct PathVersion(u32);
17
18impl PathVersion {
19 pub fn min(self, val: u32) -> bool {
20 self.0 >= val
21 }
22}
23
24#[cfg_attr(feature = "serde-derives", derive(Serialize))]
26#[derive(Debug, FromPrimitive, ToPrimitive)]
27pub enum PathType {
28 Movement,
29 MovingPlatform,
30 Property,
31 Camera,
32 Spawner,
33 Showcase,
34 Race,
35 Rail,
36}
37
38#[cfg_attr(feature = "serde-derives", derive(Serialize))]
40#[derive(Debug, FromPrimitive, ToPrimitive)]
41pub enum PathComposition {
42 Polygon,
44 Points,
46 Line,
48}
49
50#[derive(Debug)]
52#[cfg_attr(feature = "serde-derives", derive(Serialize))]
53pub struct PathDataMovement {}
54
55#[derive(Debug)]
57#[cfg_attr(feature = "serde-derives", derive(Serialize))]
58pub struct PathDataMovingPlatform {
59 pub something: Option<u8>,
61 pub platform_travel_sound: Option<String>,
63}
64
65#[derive(Debug, FromPrimitive, ToPrimitive)]
67#[cfg_attr(feature = "serde-derives", derive(Serialize))]
68pub enum PropertyRentalTimeUnit {
69 Forever,
70 Seconds,
71 Minutes,
72 Hours,
73 Days,
74 Weeks,
75 Months,
76 Years,
77}
78
79#[derive(Debug, FromPrimitive, ToPrimitive)]
81#[cfg_attr(feature = "serde-derives", derive(Serialize))]
82pub enum PropertyAchievementRequired {
83 None,
84 Builder,
85 Craftsman,
86 SeniorBuilder,
87 Journeyman,
88 MasterBuilder,
89 Architect,
90 SeniorArchitect,
91 MasterArchitect,
92 Visionary,
93 Exemplar,
94}
95
96#[derive(Debug)]
98#[cfg_attr(feature = "serde-derives", derive(Serialize))]
99pub struct PathDataProperty {
100 pub value_1: u32,
102 pub price: u32,
104 pub rental_time: u32,
106 pub associated_map: WorldID,
108 pub value_2: u32,
110 pub display_name: String,
112 pub display_description: String,
114 pub value_3: u32,
116 pub clone_limit: u32,
118 pub reputation_multiplier: f32,
120 pub rental_time_unit: PropertyRentalTimeUnit,
122 pub achievement_required: PropertyAchievementRequired,
124 pub player_zone_coordinate: Vector3f,
126 pub max_build_height: f32,
128}
129
130#[derive(Debug)]
132#[cfg_attr(feature = "serde-derives", derive(Serialize))]
133pub struct PathDataCamera {
134 pub next_path: String,
136 pub value_1: Option<u8>,
138}
139
140#[derive(Debug)]
142#[cfg_attr(feature = "serde-derives", derive(Serialize))]
143pub struct PathDataSpawner {
144 pub spawned_lot: ObjectTemplate,
146 pub respawn_time: u32,
148 pub max_to_spawn: u32,
150 pub min_to_spawn: u32,
152 pub spawner_obj_id: ObjectID,
154 pub activate_network_on_load: bool,
156}
157
158#[derive(Debug)]
160#[cfg_attr(feature = "serde-derives", derive(Serialize))]
161pub struct PathDataShowcase {}
162
163#[derive(Debug)]
165#[cfg_attr(feature = "serde-derives", derive(Serialize))]
166pub struct PathDataRace {}
167
168#[derive(Debug)]
170#[cfg_attr(feature = "serde-derives", derive(Serialize))]
171pub struct PathDataRail {}
172
173#[derive(Debug)]
175#[cfg_attr(feature = "serde-derives", derive(Serialize))]
176pub struct PathWaypointDataMovement {
177 pub config: WaypointConfig,
178}
179
180#[derive(Debug)]
182#[cfg_attr(feature = "serde-derives", derive(Serialize))]
183pub struct PathWaypointDataMovingPlatformSounds {
184 pub arrive_sound: String,
185 pub depart_sound: String,
186}
187
188#[derive(Debug)]
190#[cfg_attr(feature = "serde-derives", derive(Serialize))]
191pub struct PathWaypointDataMovingPlatform {
192 pub rotation: Quaternion,
193 pub lock_player: bool,
194 pub speed: f32,
195 pub wait: f32,
196 pub sounds: Option<PathWaypointDataMovingPlatformSounds>,
197}
198
199#[derive(Debug)]
201#[cfg_attr(feature = "serde-derives", derive(Serialize))]
202pub struct PathWaypointDataProperty {}
203
204#[derive(Debug)]
206#[cfg_attr(feature = "serde-derives", derive(Serialize))]
207pub struct PathWaypointDataCamera {
208 pub rotation: Quaternion,
209 pub time: f32,
210 pub value_5: f32,
211 pub tension: f32,
212 pub continuity: f32,
213 pub bias: f32,
214}
215
216#[derive(Debug)]
218#[cfg_attr(feature = "serde-derives", derive(Serialize))]
219pub struct PathWaypointDataSpawner {
220 pub rotation: Quaternion,
221 pub config: WaypointConfig,
222}
223
224#[derive(Debug)]
226#[cfg_attr(feature = "serde-derives", derive(Serialize))]
227pub struct PathWaypointDataShowcase {}
228
229#[derive(Debug)]
231#[cfg_attr(feature = "serde-derives", derive(Serialize))]
232pub struct PathWaypointDataRace {
233 pub rotation: Quaternion,
234 pub value_1: u8,
235 pub value_2: u8,
236 pub value_3: f32,
237 pub value_4: f32,
238 pub value_5: f32,
239}
240
241#[derive(Debug)]
243#[cfg_attr(feature = "serde-derives", derive(Serialize))]
244pub struct PathWaypointDataRail {
245 pub rotation: Quaternion,
246 pub speed: Option<f32>,
247 pub config: WaypointConfig,
248}
249
250pub type WaypointConfig = HashMap<String, String>;
252
253#[derive(Debug)]
255#[cfg_attr(feature = "serde-derives", derive(Serialize))]
256pub struct PathWaypointVariant<WaypointType> {
257 pub position: Vector3f,
258 #[cfg_attr(feature = "serde-derives", serde(flatten))]
259 pub data: WaypointType,
260}
261
262pub type PathWaypointVariantMovement = PathWaypointVariant<PathWaypointDataMovement>;
263pub type PathWaypointVariantMovingPlatform = PathWaypointVariant<PathWaypointDataMovingPlatform>;
264pub type PathWaypointVariantProperty = PathWaypointVariant<PathWaypointDataProperty>;
265pub type PathWaypointVariantCamera = PathWaypointVariant<PathWaypointDataCamera>;
266pub type PathWaypointVariantSpawner = PathWaypointVariant<PathWaypointDataSpawner>;
267pub type PathWaypointVariantShowcase = PathWaypointVariant<PathWaypointDataShowcase>;
268pub type PathWaypointVariantRace = PathWaypointVariant<PathWaypointDataRace>;
269pub type PathWaypointVariantRail = PathWaypointVariant<PathWaypointDataRail>;
270
271#[derive(Debug)]
273#[cfg_attr(feature = "serde-derives", derive(Serialize))]
274pub struct PathHeader {
275 pub version: PathVersion,
276 pub path_name: String,
277 pub value_1: u32,
278 pub path_composition: PathComposition,
279}
280
281#[derive(Debug)]
283#[cfg_attr(feature = "serde-derives", derive(Serialize))]
284pub struct PathVariant<DataType, WaypointDataType> {
285 pub header: PathHeader,
286 pub path_data: DataType,
287 pub waypoints: Vec<PathWaypointVariant<WaypointDataType>>,
288}
289
290pub type PathVariantMovement = PathVariant<PathDataMovement, PathWaypointDataMovement>;
291pub type PathVariantMovingPlatform =
292 PathVariant<PathDataMovingPlatform, PathWaypointDataMovingPlatform>;
293pub type PathVariantProperty = PathVariant<PathDataProperty, PathWaypointDataProperty>;
294pub type PathVariantCamera = PathVariant<PathDataCamera, PathWaypointDataCamera>;
295pub type PathVariantSpawner = PathVariant<PathDataSpawner, PathWaypointDataSpawner>;
296pub type PathVariantShowcase = PathVariant<PathDataShowcase, PathWaypointDataShowcase>;
297pub type PathVariantRace = PathVariant<PathDataRace, PathWaypointDataRace>;
298pub type PathVariantRail = PathVariant<PathDataRail, PathWaypointDataRail>;
299
300#[derive(Debug)]
302#[cfg_attr(feature = "serde-derives", derive(Serialize))]
303#[cfg_attr(feature = "serde-derives", serde(tag = "type"))]
304pub enum Path {
305 Movement(PathVariantMovement),
306 MovingPlatform(PathVariantMovingPlatform),
307 Property(PathVariantProperty),
308 Camera(PathVariantCamera),
309 Spawner(PathVariantSpawner),
310 Showcase(PathVariantShowcase),
311 Race(PathVariantRace),
312 Rail(PathVariantRail),
313}
314
315#[derive(Debug)]
317#[cfg_attr(feature = "serde-derives", derive(Serialize))]
318pub struct ZonePaths {
319 pub version: ZonePathsVersion,
320 pub paths: Vec<Path>,
321}