pub struct SavedItem {Show 27 fields
pub template_resref: ResRef,
pub body_variation: Option<u8>,
pub texture_var: Option<u8>,
pub infinite: Option<bool>,
pub slot_id: i32,
pub common: GitObjectPlacement,
pub add_cost: u32,
pub base_item: i32,
pub charges: u8,
pub cost: u32,
pub deleting: bool,
pub description_identified: GffLocalizedString,
pub description: GffLocalizedString,
pub droppable: bool,
pub identified: bool,
pub localized_name: GffLocalizedString,
pub max_charges: u8,
pub model_variation: u8,
pub new_item: bool,
pub non_equippable: bool,
pub pickpocketable: bool,
pub plot: bool,
pub properties: Vec<GitItemProperty>,
pub stack_size: u16,
pub stolen: bool,
pub tag: String,
pub upgrades: u32,
}Expand description
One item as stored in a save.
Fields§
§template_resref: ResRefBlueprint this item came from (TemplateResRef).
On the saved type rather than the templated arm alone, because the three nested item lists reach this type directly and the baseline carries the label at all four paths.
Written only where it holds something: no saved entry in the corpus carries the label, so emitting a blank would put a field on every one that never had it.
body_variation: Option<u8>Body variation (BodyVariation), absent on most entries.
texture_var: Option<u8>Texture variation (TextureVar), absent on most entries.
infinite: Option<bool>Whether the stack never depletes (Infinite), absent on most entries.
slot_id: i32Equipment slot, when the list this came out of keys by slot.
The element’s own struct id rather than a label, and no field in the
file repeats it. Only Equip_ItemList reads it as data; the five other
lists carrying this type key by a constant or by position, and leave it
zero. Carried here because a writer that cannot reproduce it moves
every equipped item to slot zero.
common: GitObjectPlacementThe block both forms carry, which the list declares as its element.
No #[gff]: the arm contributes its parts to the split, and the
element is this block, so declaring it here too would make one label
two declarations. The arm’s own codec reads and writes it.
add_cost: u32Additional cost (AddCost).
base_item: i32Base item row (BaseItem).
charges: u8Remaining charges (Charges).
cost: u32Base cost (Cost).
deleting: boolPending-deletion flag (DELETING).
description_identified: GffLocalizedStringIdentified description (DescIdentified).
description: GffLocalizedStringUnidentified description (Description).
droppable: boolDroppable flag (Dropable).
identified: boolIdentified flag (Identified).
localized_name: GffLocalizedStringLocalized name (LocalizedName).
max_charges: u8Maximum charges (MaxCharges).
model_variation: u8Model variation (ModelVariation).
new_item: boolNewly-acquired flag (NewItem).
non_equippable: boolNon-equippable flag (NonEquippable).
pickpocketable: boolPickpocketable flag (Pickpocketable).
plot: boolPlot-item flag (Plot).
properties: Vec<GitItemProperty>Item properties (PropertiesList). The element shape matches a
blueprint’s field for field, so this reuses UtiProperty and its
conversions rather than re-deriving the same reads.
Element ids are the index here, unlike a blueprint .uti’s own
properties list, which writes zero throughout. Which list owns it
decides, not the element type.
stack_size: u16Stack size (StackSize).
stolen: boolStolen flag (Stolen).
tag: StringObject tag (Tag).
upgrades: u32Upgrade bitfield (Upgrades).
Implementations§
Source§impl SavedItem
impl SavedItem
Sourcepub const PARTS: &'static [&'static [Field]]
pub const PARTS: &'static [&'static [Field]]
This type’s schema in parts, which is what a container holding it references.
Own fields first, then one part per flattened child in the order they are declared.
Sourcepub fn read_declared(root: &GffStruct) -> Self
pub fn read_declared(root: &GffStruct) -> Self
Reads every declared field off root.
Absent fields take the entry’s own answer, so a fallback is derived from the declaration rather than restated beside it.
A field declaring a hand-written read is left at that answer for the view to overwrite.
Sourcepub fn write_declared(&self, root: &mut GffStruct)
pub fn write_declared(&self, root: &mut GffStruct)
Writes every declared field onto root, leaving out the ones
their entry says the engine’s own writer leaves out.
A field declaring a hand-written write is not touched here.
Source§impl SavedItem
impl SavedItem
Sourcepub fn read_element(structure: &GffStruct) -> Self
pub fn read_element(structure: &GffStruct) -> Self
Reads one element, with the block the list declares as its element.
Sourcepub fn write_element(&self, structure: &mut GffStruct)
pub fn write_element(&self, structure: &mut GffStruct)
Writes one element, the common block included.