Skip to main content

rakata_generics/
lib.rs

1//! Higher-level typed wrappers around GFF-backed game resources.
2//!
3//! This crate hosts strongly typed structures such as `ARE`, `UTC`, and
4//! related conversion helpers.
5//!
6//! ## Clone discipline in `to_gff()` methods
7//!
8//! Serialization methods take `&self` and must hand owned data to
9//! `GffValue` variants (which store owned `String`, `GffLocalizedString`,
10//! `Vec<_>`, etc.). Cloning is necessary because `&self` cannot move
11//! fields out. This is a uniform pattern across all typed generics and
12//! is not flagged per-clone.
13
14#![forbid(unsafe_code)]
15#![warn(clippy::as_conversions)]
16#![deny(missing_docs)]
17
18mod gff_helpers;
19
20/// Typed ARE (`.are`) model and conversion helpers.
21pub mod are;
22/// Table-backed decoded views over typed generic models.
23pub mod decoded;
24/// Typed DLG (`.dlg`) model and conversion helpers.
25pub mod dlg;
26/// Typed FAC (`.fac`) faction table and conversion helpers.
27pub mod fac;
28/// Typed GIT (`.git`) model and conversion helpers.
29pub mod git;
30/// Typed IFO (`.ifo`) model and conversion helpers.
31pub mod ifo;
32/// Saved creature snapshots from a save game's module GIT.
33/// Doors as stored inside a save game.
34/// Items as stored inside a save game.
35/// Placeables as stored inside a save game.
36/// Sound emitters as stored inside a save game.
37/// Merchant stores as stored inside a save game.
38/// Triggers as stored inside a save game.
39/// Shared typed components reused across generic wrappers.
40pub mod shared;
41/// Typed UTC (`.utc`) model and conversion helpers.
42pub mod utc;
43/// Typed UTD (`.utd`) model and conversion helpers.
44pub mod utd;
45/// Typed UTE (`.ute`) model and conversion helpers.
46pub mod ute;
47/// Typed UTI (`.uti`) model and conversion helpers.
48pub mod uti;
49/// Typed UTM (`.utm`) model and conversion helpers.
50pub mod utm;
51/// Typed UTP (`.utp`) model and conversion helpers.
52pub mod utp;
53/// Typed UTS (`.uts`) model and conversion helpers.
54pub mod uts;
55/// Typed UTT (`.utt`) model and conversion helpers.
56pub mod utt;
57/// Typed UTW (`.utw`) model and conversion helpers.
58pub mod utw;
59
60/// Reads typed ARE data from a reader.
61pub use are::read_are;
62/// Reads typed ARE data from bytes.
63pub use are::read_are_from_bytes;
64/// Writes typed ARE data to a writer.
65pub use are::write_are;
66/// Writes typed ARE data to bytes.
67pub use are::write_are_to_vec;
68/// Typed ARE model.
69pub use are::Are;
70/// Errors produced while reading/writing typed ARE data.
71pub use are::AreError;
72pub use are::AreMap;
73/// Typed mini-game model for ARE resources.
74pub use are::AreMiniGame;
75/// Ballistics of one mini-game gun bank.
76pub use are::AreMiniGameBullet;
77/// Typed mini-game enemy model for ARE resources.
78pub use are::AreMiniGameEnemy;
79/// One weapon hardpoint on a mini-game vehicle.
80pub use are::AreMiniGameGunBank;
81/// Typed mini-game model entry for ARE resources.
82pub use are::AreMiniGameModel;
83/// Typed mini-game mouse settings for ARE resources.
84pub use are::AreMiniGameMouse;
85/// Base script slots shared by every mini-game object.
86pub use are::AreMiniGameObjectScripts;
87/// Typed mini-game obstacle model for ARE resources.
88pub use are::AreMiniGameObstacle;
89/// Typed mini-game player model for ARE resources.
90pub use are::AreMiniGamePlayer;
91/// Engine and destruction sounds on a mini-game vehicle.
92pub use are::AreMiniGameSounds;
93/// AI aiming parameters on an enemy gun bank.
94pub use are::AreMiniGameTargeting;
95/// Fields shared by the mini-game player and every enemy.
96pub use are::AreMiniGameVehicle;
97/// Script slots a mini-game vehicle adds over the base set.
98pub use are::AreMiniGameVehicleScripts;
99/// Typed nested room model for ARE resources.
100pub use are::AreRoom;
101/// The `BankID` value meaning the engine skips a gun bank.
102pub use are::BANK_ID_NONE;
103/// Categorical filter for [`UtcResolved::has_class`].
104pub use decoded::ClassKindFilter;
105/// One decoded UTC class entry surfaced via [`UtcResolved::classes`].
106pub use decoded::DecodedClass;
107/// One decoded UTC feat entry surfaced via [`UtcResolved::feats`].
108pub use decoded::DecodedFeat;
109/// One decoded item-property entry surfaced via [`UtiProjection`] /
110/// [`UtiResolved`].
111pub use decoded::DecodedProperty;
112/// One decoded UTC special-ability entry surfaced via
113/// [`UtcResolved::special_abilities`].
114pub use decoded::DecodedSpecialAbility;
115/// Family / aggregation filter for [`UtcResolved::has_feat`].
116pub use decoded::FeatKindFilter;
117/// Categorical filter for [`UtiResolved::has_property_kind`].
118pub use decoded::PropertyKindFilter;
119/// File-native projection of a [`Utc`] (wraps the source UTC ready to
120/// feed one or more per-scope resolutions).
121pub use decoded::UtcProjection;
122/// Per-scope resolved view of a [`Utc`] built from a [`UtcProjection`] and
123/// a 2DA cache; queries read from cached resolutions and take `&self`.
124pub use decoded::UtcResolved;
125/// File-native projection of a [`Uti`] (typed-variant dispatch only,
126/// no per-scope resolution).
127pub use decoded::UtiProjection;
128/// Per-scope resolved view of a [`Uti`] built from a [`UtiProjection`] and
129/// a 2DA cache; queries read from cached resolutions and take `&self`.
130pub use decoded::UtiResolved;
131/// Reads typed DLG data from a reader.
132pub use dlg::read_dlg;
133/// Reads typed DLG data from bytes.
134pub use dlg::read_dlg_from_bytes;
135/// Writes typed DLG data to a writer.
136pub use dlg::write_dlg;
137/// Writes typed DLG data to bytes.
138pub use dlg::write_dlg_to_vec;
139/// Typed DLG model.
140pub use dlg::Dlg;
141/// Typed DLG animation entry model.
142pub use dlg::DlgAnimation;
143/// Errors produced while reading/writing typed DLG data.
144pub use dlg::DlgError;
145/// Typed DLG link model.
146pub use dlg::DlgLink;
147/// Typed DLG dialogue node model.
148pub use dlg::DlgNode;
149/// Typed DLG cutscene stunt model.
150pub use dlg::DlgStunt;
151/// Reads typed FAC data from a reader.
152pub use fac::read_fac;
153/// Reads typed FAC data from bytes.
154pub use fac::read_fac_from_bytes;
155/// Writes typed FAC data to a writer.
156pub use fac::write_fac;
157/// Writes typed FAC data to bytes.
158pub use fac::write_fac_to_vec;
159/// Typed FAC faction-table model.
160pub use fac::Fac;
161/// Errors produced while reading/writing typed FAC data.
162pub use fac::FacError;
163/// One faction from a FAC `FactionList`.
164pub use fac::FacFaction;
165/// Reaction band a faction standing falls into.
166pub use fac::FacReaction;
167/// One stored standing from a FAC `RepList`.
168pub use fac::FacReputation;
169/// One class entry from a saved creature's ClassList.
170pub use git::creature::SavedClass;
171/// A creature as stored inside a save game's module GIT.
172pub use git::creature::SavedCreature;
173/// A door as stored inside a save game's module GIT.
174pub use git::door::SavedDoor;
175/// One item as stored in a save.
176pub use git::item::SavedItem;
177/// A placeable as stored inside a save game's module GIT.
178pub use git::placeable::SavedPlaceable;
179/// Reads typed GIT data from a reader.
180pub use git::read_git;
181/// Reads typed GIT data from bytes.
182pub use git::read_git_from_bytes;
183/// A sound emitter as stored inside a save game's module GIT.
184pub use git::sound::SavedSound;
185/// A merchant store as stored inside a save game's module GIT.
186pub use git::store::SavedStore;
187/// A trigger as stored inside a save game's module GIT.
188pub use git::trigger::SavedTrigger;
189/// Writes typed GIT data to a writer.
190pub use git::write_git;
191/// Writes typed GIT data to bytes.
192pub use git::write_git_to_vec;
193/// Typed GIT model.
194pub use git::Git;
195/// Typed GIT area-of-effect instance model.
196pub use git::GitAreaEffect;
197/// The dimensions an area-of-effect object covers.
198pub use git::GitAreaEffectShape;
199/// Typed GIT area properties model.
200pub use git::GitAreaProperties;
201/// Typed GIT camera model.
202pub use git::GitCamera;
203/// Typed GIT creature instance model.
204pub use git::GitCreature;
205/// The two forms a GIT `Creature List` can take.
206pub use git::GitCreatures;
207/// Typed GIT door instance model.
208pub use git::GitDoor;
209/// Typed GIT encounter instance model.
210pub use git::GitEncounter;
211/// Typed GIT encounter geometry point model.
212pub use git::GitEncounterPoint;
213/// Errors produced while reading/writing typed GIT data.
214pub use git::GitError;
215/// Typed GIT item instance model.
216pub use git::GitItem;
217/// A waypoint map note.
218pub use git::GitMapNote;
219/// The two forms any GIT object list can take.
220pub use git::GitObjects;
221/// Typed GIT placeable instance model.
222pub use git::GitPlaceable;
223/// Typed GIT sound instance model.
224pub use git::GitSound;
225/// Typed GIT spawn point model.
226pub use git::GitSpawnPoint;
227/// Typed GIT store instance model.
228pub use git::GitStore;
229/// Typed GIT trigger instance model.
230pub use git::GitTrigger;
231/// Typed GIT waypoint instance model.
232pub use git::GitWaypoint;
233/// Reads typed IFO data from a reader.
234pub use ifo::read_ifo;
235/// Reads typed IFO data from bytes.
236pub use ifo::read_ifo_from_bytes;
237/// Writes typed IFO data to a writer.
238pub use ifo::write_ifo;
239/// Writes typed IFO data to bytes.
240pub use ifo::write_ifo_to_vec;
241/// Typed IFO model.
242pub use ifo::Ifo;
243/// Typed IFO area list entry model.
244pub use ifo::IfoArea;
245/// Typed IFO cutscene list entry model.
246pub use ifo::IfoCutScene;
247/// Errors produced while reading/writing typed IFO data.
248pub use ifo::IfoError;
249/// Typed IFO expansion list entry model.
250pub use ifo::IfoExpansion;
251/// Typed IFO player list entry model.
252pub use ifo::IfoPlayer;
253/// Typed IFO token entry model.
254pub use ifo::IfoToken;
255/// Shared script hook bundle for door/placeable trap-related scripts.
256pub use shared::CommonTrapScripts;
257/// Typed GIT trigger geometry point model.
258pub use shared::GitTriggerPoint;
259/// Shared inventory grid/repository position.
260pub use shared::InventoryGridPosition;
261/// Typed nested map model for ARE resources.
262/// A runtime object handle, defaulting to the engine's invalid placeholder.
263pub use shared::ObjectId;
264/// How a saved object names its portrait.
265pub use shared::SavedPortrait;
266/// Shared trap settings block used by multiple generic wrappers.
267pub use shared::TrapSettings;
268/// Reads typed UTC data from a reader.
269pub use utc::read_utc;
270/// Reads typed UTC data from bytes.
271pub use utc::read_utc_from_bytes;
272/// Writes typed UTC data to a writer.
273pub use utc::write_utc;
274/// Writes typed UTC data to bytes.
275pub use utc::write_utc_to_vec;
276/// Typed UTC model.
277pub use utc::Utc;
278/// Typed UTC class entry model.
279pub use utc::UtcClass;
280/// Errors produced while reading/writing typed UTC data.
281pub use utc::UtcError;
282/// Typed UTC skill set model.
283pub use utc::UtcSkills;
284/// Reads typed UTD data from a reader.
285pub use utd::read_utd;
286/// Reads typed UTD data from bytes.
287pub use utd::read_utd_from_bytes;
288/// Writes typed UTD data to a writer.
289pub use utd::write_utd;
290/// Writes typed UTD data to bytes.
291pub use utd::write_utd_to_vec;
292/// Typed UTD model.
293pub use utd::Utd;
294/// Errors produced while reading/writing typed UTD data.
295pub use utd::UtdError;
296/// Reads typed UTE data from a reader.
297pub use ute::read_ute;
298/// Reads typed UTE data from bytes.
299pub use ute::read_ute_from_bytes;
300/// Writes typed UTE data to a writer.
301pub use ute::write_ute;
302/// Writes typed UTE data to bytes.
303pub use ute::write_ute_to_vec;
304/// Typed UTE model.
305pub use ute::Ute;
306/// Typed UTE area list entry model.
307pub use ute::UteAreaEntry;
308/// Typed UTE creature entry model.
309pub use ute::UteCreature;
310/// Errors produced while reading/writing typed UTE data.
311pub use ute::UteError;
312/// Typed UTE geometry vertex model.
313pub use ute::UteGeometryVertex;
314/// Typed UTE spawn entry model.
315pub use ute::UteSpawnEntry;
316/// Typed UTE spawn point model.
317pub use ute::UteSpawnPoint;
318/// Reads typed UTI data from a reader.
319pub use uti::read_uti;
320/// Reads typed UTI data from bytes.
321pub use uti::read_uti_from_bytes;
322/// Writes typed UTI data to a writer.
323pub use uti::write_uti;
324/// Writes typed UTI data to bytes.
325pub use uti::write_uti_to_vec;
326/// Typed UTI model.
327pub use uti::Uti;
328/// Errors produced while reading/writing typed UTI data.
329pub use uti::UtiError;
330/// Typed UTI property entry model.
331pub use uti::UtiProperty;
332/// Reads typed UTM data from a reader.
333pub use utm::read_utm;
334/// Reads typed UTM data from bytes.
335pub use utm::read_utm_from_bytes;
336/// Writes typed UTM data to a writer.
337pub use utm::write_utm;
338/// Writes typed UTM data to bytes.
339pub use utm::write_utm_to_vec;
340/// Typed UTM model.
341pub use utm::Utm;
342/// Errors produced while reading/writing typed UTM data.
343pub use utm::UtmError;
344/// Typed UTM inventory entry model.
345pub use utm::UtmInventoryItem;
346/// Reads typed UTP data from a reader.
347pub use utp::read_utp;
348/// Reads typed UTP data from bytes.
349pub use utp::read_utp_from_bytes;
350/// Writes typed UTP data to a writer.
351pub use utp::write_utp;
352/// Writes typed UTP data to bytes.
353pub use utp::write_utp_to_vec;
354/// Typed UTP model.
355pub use utp::Utp;
356/// Errors produced while reading/writing typed UTP data.
357pub use utp::UtpError;
358/// Typed UTP inventory entry model.
359pub use utp::UtpInventoryItem;
360/// Reads typed UTS data from a reader.
361pub use uts::read_uts;
362/// Reads typed UTS data from bytes.
363pub use uts::read_uts_from_bytes;
364/// Writes typed UTS data to a writer.
365pub use uts::write_uts;
366/// Writes typed UTS data to bytes.
367pub use uts::write_uts_to_vec;
368/// Typed UTS model.
369pub use uts::Uts;
370/// Errors produced while reading/writing typed UTS data.
371pub use uts::UtsError;
372/// Typed UTS sound entry model.
373pub use uts::UtsSound;
374/// Reads typed UTT data from a reader.
375pub use utt::read_utt;
376/// Reads typed UTT data from bytes.
377pub use utt::read_utt_from_bytes;
378/// Writes typed UTT data to a writer.
379pub use utt::write_utt;
380/// Writes typed UTT data to bytes.
381pub use utt::write_utt_to_vec;
382/// Typed UTT model.
383pub use utt::Utt;
384/// Errors produced while reading/writing typed UTT data.
385pub use utt::UttError;
386/// Reads typed UTW data from a reader.
387pub use utw::read_utw;
388/// Reads typed UTW data from bytes.
389pub use utw::read_utw_from_bytes;
390/// Writes typed UTW data to a writer.
391pub use utw::write_utw;
392/// Writes typed UTW data to bytes.
393pub use utw::write_utw_to_vec;
394/// Typed UTW model.
395pub use utw::Utw;
396/// Errors produced while reading/writing typed UTW data.
397pub use utw::UtwError;