Skip to main content

SavedCreature

Struct SavedCreature 

Source
pub struct SavedCreature {
Show 98 fields pub common: GitCreatureCommon, pub object_id: ObjectId, pub ai_state: i32, pub age: i32, pub ambient_anim_state: u8, pub animation: i32, pub appearance_head: u8, pub appearance_type: u16, pub area_id: u32, pub armor_class: i16, pub body_bag: u8, pub charisma: u8, pub challenge_rating: f32, pub classes: Vec<SavedClass>, pub color_hair: u8, pub color_skin: u8, pub color_tattoo1: u8, pub color_tattoo2: u8, pub commandable: u8, pub constitution: u8, pub conversation: ResRef, pub creation_script_fired: u8, pub creature_size: i32, pub current_force: i16, pub current_hit_points: i16, pub dead_selectable: u8, pub deity: String, pub description: GffLocalizedString, pub detect_mode: u8, pub dexterity: u8, pub disarmable: u8, pub duplicating_head: u8, pub equipment: Vec<SavedItem>, pub experience: u32, pub faction_id: u16, pub feats: Vec<u16>, pub first_name: GffLocalizedString, pub force_points: i16, pub fort_save_throw: i8, pub gender: u8, pub gold: u32, pub good_evil: u8, pub hit_points: i16, pub intelligence: u8, pub interruptable: u8, pub is_destroyable: u8, pub is_pc: u8, pub is_raiseable: u8, pub inventory: Vec<SavedItem>, pub joining_xp: i32, pub last_name: GffLocalizedString, pub listening: u8, pub multiclass_level_up_in: u8, pub max_force_points: i16, pub max_hit_points: i16, pub min1_hp: u8, pub movement_rate: u8, pub natural_ac: u8, pub not_reorienting: u8, pub is_disguised: u8, pub party_interact: u8, pub phenotype: i32, pub plot: u8, pub portrait_id: u16, pub pregame_current: i16, pub race: u8, pub ref_save_throw: i8, pub on_attacked: ResRef, pub on_damaged: ResRef, pub on_death: ResRef, pub on_dialog: ResRef, pub on_disturbed: ResRef, pub on_end_dialog: ResRef, pub on_end_round: ResRef, pub on_heartbeat: ResRef, pub on_blocked: ResRef, pub on_notice: ResRef, pub on_rested: ResRef, pub on_spawn: ResRef, pub on_spell: ResRef, pub on_user_defined: ResRef, pub skills: UtcSkills, pub skill_points: u16, pub sound_set_file: u16, pub starting_package: u8, pub stealth_mode: u8, pub strength: u8, pub subrace: String, pub subrace_index: u8, pub tag: String, pub tail: u8, pub use_backup_head: u8, pub will_save_throw: i8, pub wings: u8, pub wisdom: u8, pub fort_bonus: i16, pub ref_bonus: i16, pub will_bonus: i16,
}
Expand description

A creature as stored inside a save game’s module GIT.

Fields§

§common: GitCreatureCommon

The 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.

§object_id: ObjectId

Runtime object id (ObjectId).

§ai_state: i32

AI state (AIState).

§age: i32

Age (Age).

§ambient_anim_state: u8

Ambient animation state (AmbientAnimState).

§animation: i32

Current animation (Animation).

§appearance_head: u8

Head appearance (Appearance_Head).

§appearance_type: u16

Appearance row (Appearance_Type).

§area_id: u32

Runtime area id the creature belongs to (AreaId).

§armor_class: i16

Computed armour class (ArmorClass). Rebuilt on load from armour tables, natural AC, the Dexterity modifier, feats and active effects.

§body_bag: u8

Corpse body-bag appearance (BodyBag).

§charisma: u8

Charisma (Cha).

§challenge_rating: f32

Challenge rating (ChallengeRating).

§classes: Vec<SavedClass>

Class levels and known powers (ClassList).

§color_hair: u8

Hair colour index (Color_Hair).

§color_skin: u8

Skin colour index (Color_Skin).

§color_tattoo1: u8

First tattoo colour index (Color_Tattoo1).

§color_tattoo2: u8

Second tattoo colour index (Color_Tattoo2).

§commandable: u8

Player-commandable flag (Commandable).

§constitution: u8

Constitution (Con).

§conversation: ResRef

Dialogue this creature opens (Conversation). Not a script hook.

§creation_script_fired: u8

Spawn-script-fired flag (CreatnScrptFird).

§creature_size: i32

Creature size row (CreatureSize).

§current_force: i16

Current Force pool (CurrentForce).

§current_hit_points: i16

Live hit points (CurrentHitPoints).

§dead_selectable: u8

Corpse-selectable flag (DeadSelectable).

§deity: String

Deity name (Deity).

§description: GffLocalizedString

Localized description (Description).

§detect_mode: u8

Detect mode (DetectMode). The loader reads the byte only to step past it and resets every restored creature to mode 1.

§dexterity: u8

Dexterity (Dex).

§disarmable: u8

Disarmable flag (Disarmable).

§duplicating_head: u8

Head-duplication flag (DuplicatingHead).

§equipment: Vec<SavedItem>

Equipped items (Equip_ItemList).

Hand-written both ways because the element’s struct id is the equipment slot: the engine reads it off the header and no label repeats it, so a generated codec has nowhere to take it from and nothing to put it back.

§experience: u32

Accumulated experience (Experience).

§faction_id: u16

Faction id indexing the session faction table (FactionID).

§feats: Vec<u16>

Feat ids (FeatList).

§first_name: GffLocalizedString

Localized first name (FirstName).

§force_points: i16

Live Force points (ForcePoints).

§fort_save_throw: i8

Computed Fortitude save total (FortSaveThrow). Rebuilt on load.

§gender: u8

Gender row (Gender).

§gold: u32

Carried gold (Gold). Skipped on load for creatures currently in the party, whose wealth lives in the shared party pool instead.

§good_evil: u8

Alignment on the light/dark axis (GoodEvil). The engine clamps this to a maximum of 100.

§hit_points: i16

Base hit points carried from the template (HitPoints).

§intelligence: u8

Intelligence (Int).

§interruptable: u8

Interruptable flag (Interruptable).

§is_destroyable: u8

Destroyable flag (IsDestroyable).

§is_pc: u8

Player-character flag (IsPC).

§is_raiseable: u8

Raiseable flag (IsRaiseable).

§inventory: Vec<SavedItem>

Carried inventory (ItemList).

Every element is struct id 0, not its index. The two readings agree on a one-item inventory and most of them hold one item, which is what kept the wrong one standing; the multi-element lists in the save corpus are all zero throughout.

§joining_xp: i32

Joining experience (JoiningXP). Read only by the fresh-spawn path, so it resets to zero when a save is continued.

§last_name: GffLocalizedString

Localized last name (LastName).

§listening: u8

Listening flag (Listening).

§multiclass_level_up_in: u8

Multiclass level-up bookkeeping (MClassLevUpIn). Written on every save and read by nothing.

§max_force_points: i16

Computed maximum Force points (MaxForcePoints).

§max_hit_points: i16

Computed maximum hit points (MaxHitPoints). Rebuilt on load from class levels and the Constitution modifier, so an edit here does nothing.

§min1_hp: u8

Minimum-one-hit-point flag (Min1HP).

§movement_rate: u8

Movement rate row (MovementRate). A blueprint spells this WalkRate.

§natural_ac: u8

Natural armour class (NaturalAC).

§not_reorienting: u8

Orientation-lock flag (NotReorienting).

§is_disguised: u8

Party-member disguise flag (PM_IsDisguised).

§party_interact: u8

Party-interaction flag (PartyInteract).

§phenotype: i32

Body-model phenotype (Phenotype).

§plot: u8

Plot-protection flag (Plot).

§portrait_id: u16

Portrait row (PortraitId). A snapshot carries only the id; a blueprint additionally carries a Portrait resref.

§pregame_current: i16

Current-HP mirror (PregameCurrent). Written on every save and read by nothing.

§race: u8

Race row (Race).

§ref_save_throw: i8

Computed Reflex save total (RefSaveThrow). Rebuilt on load.

§on_attacked: ResRef

On-attacked script (ScriptAttacked).

§on_damaged: ResRef

On-damaged script (ScriptDamaged).

§on_death: ResRef

On-death script (ScriptDeath).

§on_dialog: ResRef

On-dialogue script (ScriptDialogue).

§on_disturbed: ResRef

On-disturbed script (ScriptDisturbed).

§on_end_dialog: ResRef

On-end-dialog script (ScriptEndDialogu).

§on_end_round: ResRef

On-end-round script (ScriptEndRound).

§on_heartbeat: ResRef

On-heartbeat script (ScriptHeartbeat).

§on_blocked: ResRef

On-blocked script (ScriptOnBlocked).

§on_notice: ResRef

On-notice script (ScriptOnNotice).

§on_rested: ResRef

On-rested script (ScriptRested).

§on_spawn: ResRef

On-spawn script (ScriptSpawn).

§on_spell: ResRef

On-spell-at script (ScriptSpellAt).

§on_user_defined: ResRef

On-user-defined script (ScriptUserDefine).

§skills: UtcSkills

Skill ranks (SkillList), in the fixed order the engine stores them.

The order is the meaning: index zero is computer use and index seven is treat injury, with no label naming which skill an element is. The element’s struct id carries nothing and is zero throughout.

§skill_points: u16

Unspent skill points (SkillPoints).

§sound_set_file: u16

Sound-set row (SoundSetFile).

§starting_package: u8

Starting package row (StartingPackage).

§stealth_mode: u8

Stealth mode (StealthMode).

§strength: u8

Strength (Str).

§subrace: String

Subrace name (Subrace).

§subrace_index: u8

Subrace row (SubraceIndex).

§tag: String

Object tag (Tag).

§tail: u8

Tail appearance (Tail). Hardcoded to zero on read; written anyway.

§use_backup_head: u8

Backup-head flag (UseBackupHead).

§will_save_throw: i8

Computed Will save total (WillSaveThrow). Rebuilt on load.

§wings: u8

Wing appearance (Wings). Hardcoded to zero on read; written anyway.

§wisdom: u8

Wisdom (Wis).

§fort_bonus: i16

Permanent Fortitude bonus (fortbonus). Read back on load.

§ref_bonus: i16

Permanent Reflex bonus (refbonus). Unlike the total above, this is an input the engine reads back.

§will_bonus: i16

Permanent Will bonus (willbonus). Read back on load.

Implementations§

Source§

impl SavedCreature

Source

pub const SCHEMA: [Field; 97]

This view’s schema, one entry per declared field.

Source

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.

Source

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.

Source

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 SavedCreature

Maps each element of a list field through build, or yields nothing when the field is absent or not a list.

Source

pub fn read_element(structure: &GffStruct) -> Self

Reads one saved creature.

Three lists the model unwraps rather than mirrors, which is why the derive supplies neither element half: the skills are a fixed-size positional array by name, and the feats and the per-class power lists are one-field elements the model holds as bare ids.

Source

pub fn write_element(&self, structure: &mut GffStruct)

Writes one saved creature.

Trait Implementations§

Source§

impl Clone for SavedCreature

Source§

fn clone(&self) -> SavedCreature

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SavedCreature

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SavedCreature

Source§

fn default() -> Self

What a file omitting every label loads to, which is what makes an authored file land in a known state rather than at zero.

Source§

impl GitElement for SavedCreature

Source§

fn read(structure: &GffStruct) -> Self

Reads one element.
Source§

fn write(&self, id: i32) -> GffStruct

Writes one element into a struct carrying the list’s own id.
Source§

impl HasSchema for SavedCreature

Source§

fn schema() -> &'static [Field]

The root field schema for this resource type.
Source§

fn parts() -> &'static [&'static [Field]]

The same schema in parts, own fields first. Read more
Source§

impl PartialEq for SavedCreature

Source§

fn eq(&self, other: &SavedCreature) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for SavedCreature

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.