pub struct Uti {Show 27 fields
pub template_resref: ResRef,
pub base_item: i32,
pub name: GffLocalizedString,
pub description_unidentified: GffLocalizedString,
pub description_identified: GffLocalizedString,
pub tag: String,
pub charges: u8,
pub max_charges: u8,
pub cost: u32,
pub stack_size: u16,
pub plot: bool,
pub add_cost: u32,
pub palette_id: u8,
pub comment: String,
pub model_variation: u8,
pub body_variation: u8,
pub texture_variation: u8,
pub upgrade_level: u8,
pub stolen: bool,
pub identified: bool,
pub droppable: bool,
pub pickpocketable: bool,
pub non_equippable: bool,
pub new_item: bool,
pub deleting: bool,
pub upgrades: u32,
pub properties: Vec<UtiProperty>,
}Expand description
Typed UTI model built from/to Gff data.
Fields§
§template_resref: ResRefItem template resref (TemplateResRef). Never read by the K1 engine.
base_item: i32Base item identifier (BaseItem).
name: GffLocalizedStringLocalized item name (LocalizedName).
description_unidentified: GffLocalizedStringLocalized description shown before identification (Description). If description_identified is missing, the engine duplicates this string into it so identification mechanics never crash.
description_identified: GffLocalizedStringLocalized description shown when identified (DescIdentified). If description_unidentified is missing, the engine duplicates this string into it so identification mechanics never crash.
tag: StringItem tag (Tag).
charges: u8Charges (Charges).
max_charges: u8Maximum charges (MaxCharges).
cost: u32Item cost (Cost). Ignored by the engine, which computes item cost dynamically.
stack_size: u16Maximum stack size (StackSize).
plot: boolPlot item flag (Plot).
add_cost: u32Additional cost modifier (AddCost).
palette_id: u8Palette identifier (PaletteID). Never read by the K1 engine.
comment: StringToolset comment (Comment). Never read by the K1 engine.
model_variation: u8Model variation (ModelVariation). If 0, the engine forces this to 1 at runtime.
body_variation: u8Body variation (BodyVariation). Ignored by the engine, which reads from baseitems.2da instead.
texture_variation: u8Texture variation (TextureVar). Only evaluated conditionally if the item’s 2DA model_type is exactly 1.
upgrade_level: u8Upgrade level (UpgradeLevel). Never read by the K1 engine.
stolen: boolStolen flag (Stolen).
identified: boolIdentified flag (Identified). The engine unconditionally hardcodes this to true during SaveItem serialization, so any value other than true is dead data once a save is written.
droppable: boolDroppable flag (Dropable). Explicitly sets bit 3 of the item’s internal memory flags.
pickpocketable: boolPickpocketable flag (Pickpocketable). Explicitly sets bit 4 of the item’s internal memory flags.
non_equippable: boolNon-equippable flag (NonEquippable).
new_item: boolNew-item flag (NewItem).
deleting: boolDeleting flag (DELETING).
upgrades: u32Upgrade bitfield (Upgrades).
properties: Vec<UtiProperty>Item property entries (PropertiesList).
Implementations§
Source§impl Uti
impl Uti
Sourcepub fn project(&self, itempropdef: Option<&TwoDa>) -> UtiProjection<'_>
pub fn project(&self, itempropdef: Option<&TwoDa>) -> UtiProjection<'_>
Builds a UtiProjection of this UTI’s properties using the
supplied itempropdef.2da.
Each UtiProperty is routed by its itempropdef.2da label
to a typed DecodedProperty variant where one exists, or to
DecodedProperty::Unknown otherwise. Pass None for
itempropdef to surface every property as Unknown with
property_label = None; the engine itself tolerates a
missing table the same way.
The projection is the cheap, scope-free intermediate. Use
UtiProjection::snapshot (or Uti::snapshot for the
single-scope shortcut) to resolve it against a per-scope
context.
Sourcepub fn snapshot(&self, cache: &mut TwoDaCache<'_>) -> UtiSnapshot<'_>
pub fn snapshot(&self, cache: &mut TwoDaCache<'_>) -> UtiSnapshot<'_>
Builds a UtiSnapshot of this UTI against the given 2DA
cache. Single-scope shortcut equivalent to
self.project(itempropdef).snapshot(cache), where
itempropdef comes from cache.
Missing or malformed itempropdef.2da / baseitems.2da is
tolerated – the corresponding snapshot state degrades
gracefully (all properties land in Unknown; combat / equip
queries return false / None).
For multi-scope workflows (mod conflict analysis, vanilla vs
modded diffs), call Uti::project once and
UtiProjection::snapshot per scope so the typed-variant
dispatch is not redone for each context.