Skip to main content

SavedCreature

Struct SavedCreature 

Source
pub struct SavedCreature {
Show 103 fields pub tag: String, pub first_name: GffLocalizedString, pub last_name: GffLocalizedString, pub description: GffLocalizedString, pub object_id: ObjectId, pub area_id: u32, pub conversation: ResRef, pub x_position: f32, pub y_position: f32, pub z_position: f32, pub x_orientation: f32, pub y_orientation: f32, pub z_orientation: f32, pub appearance_type: u16, pub appearance_head: u8, pub portrait_id: u16, pub phenotype: i32, pub color_skin: u8, pub color_hair: u8, pub color_tattoo1: u8, pub color_tattoo2: u8, pub duplicating_head: u8, pub use_backup_head: u8, pub is_disguised: u8, pub body_bag: u8, pub strength: u8, pub dexterity: u8, pub constitution: u8, pub intelligence: u8, pub wisdom: u8, pub charisma: u8, pub current_hit_points: i16, pub hit_points: i16, pub max_hit_points: i16, pub pregame_current: i16, pub force_points: i16, pub current_force: i16, pub max_force_points: i16, pub armor_class: i16, pub ref_save_throw: i8, pub will_save_throw: i8, pub fort_save_throw: i8, pub ref_bonus: i16, pub will_bonus: i16, pub fort_bonus: i16, pub natural_ac: u8, pub experience: u32, pub gold: u32, pub skill_points: u16, pub multiclass_level_up_in: u8, pub joining_xp: i32, pub starting_package: u8, pub challenge_rating: f32, pub age: i32, pub race: u8, pub subrace: String, pub subrace_index: u8, pub deity: String, pub gender: u8, pub good_evil: u8, pub faction_id: u16, pub sound_set_file: u16, pub ai_state: i32, pub not_reorienting: u8, pub detect_mode: u8, pub stealth_mode: u8, pub commandable: u8, pub listening: u8, pub party_interact: u8, pub plot: u8, pub min1_hp: u8, pub interruptable: u8, pub disarmable: u8, pub is_destroyable: u8, pub is_raiseable: u8, pub dead_selectable: u8, pub is_pc: u8, pub creation_script_fired: u8, pub ambient_anim_state: u8, pub animation: i32, pub creature_size: i32, pub movement_rate: u8, pub classes: Vec<SavedClass>, pub feats: Vec<u16>, pub skills: UtcSkills, pub inventory: Vec<SavedItem>, pub equipment: Vec<SavedItem>, pub tail: u8, pub wings: u8, 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,
}
Expand description

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

Fields§

§tag: String

Object tag (Tag).

§first_name: GffLocalizedString

Localized first name (FirstName).

§last_name: GffLocalizedString

Localized last name (LastName).

§description: GffLocalizedString

Localized description (Description).

§object_id: ObjectId

Runtime object id (ObjectId).

§area_id: u32

Runtime area id the creature belongs to (AreaId).

§conversation: ResRef

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

§x_position: f32

World X position (XPosition).

§y_position: f32

World Y position (YPosition).

§z_position: f32

World Z position (ZPosition).

§x_orientation: f32

Facing X component (XOrientation).

§y_orientation: f32

Facing Y component (YOrientation).

§z_orientation: f32

Facing Z component (ZOrientation).

§appearance_type: u16

Appearance row (Appearance_Type).

§appearance_head: u8

Head appearance (Appearance_Head).

§portrait_id: u16

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

§phenotype: i32

Body-model phenotype (Phenotype).

§color_skin: u8

Skin colour index (Color_Skin).

§color_hair: u8

Hair colour index (Color_Hair).

§color_tattoo1: u8

First tattoo colour index (Color_Tattoo1).

§color_tattoo2: u8

Second tattoo colour index (Color_Tattoo2).

§duplicating_head: u8

Head-duplication flag (DuplicatingHead).

§use_backup_head: u8

Backup-head flag (UseBackupHead).

§is_disguised: u8

Party-member disguise flag (PM_IsDisguised).

§body_bag: u8

Corpse body-bag appearance (BodyBag).

§strength: u8

Strength (Str).

§dexterity: u8

Dexterity (Dex).

§constitution: u8

Constitution (Con).

§intelligence: u8

Intelligence (Int).

§wisdom: u8

Wisdom (Wis).

§charisma: u8

Charisma (Cha).

§current_hit_points: i16

Live hit points (CurrentHitPoints).

§hit_points: i16

Base hit points carried from the template (HitPoints).

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

§pregame_current: i16

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

§force_points: i16

Live Force points (ForcePoints).

§current_force: i16

Current Force pool (CurrentForce).

§max_force_points: i16

Computed maximum Force points (MaxForcePoints).

§armor_class: i16

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

§ref_save_throw: i8

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

§will_save_throw: i8

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

§fort_save_throw: i8

Computed Fortitude save total (FortSaveThrow). Rebuilt 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.

§fort_bonus: i16

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

§natural_ac: u8

Natural armour class (NaturalAC).

§experience: u32

Accumulated experience (Experience).

§gold: u32

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

§skill_points: u16

Unspent skill points (SkillPoints).

§multiclass_level_up_in: u8

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

§joining_xp: i32

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

§starting_package: u8

Starting package row (StartingPackage).

§challenge_rating: f32

Challenge rating (ChallengeRating).

§age: i32

Age (Age).

§race: u8

Race row (Race).

§subrace: String

Subrace name (Subrace).

§subrace_index: u8

Subrace row (SubraceIndex).

§deity: String

Deity name (Deity).

§gender: u8

Gender row (Gender).

§good_evil: u8

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

§faction_id: u16

Faction id indexing the session faction table (FactionID).

§sound_set_file: u16

Sound-set row (SoundSetFile).

§ai_state: i32

AI state (AIState).

§not_reorienting: u8

Orientation-lock flag (NotReorienting).

§detect_mode: u8

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

§stealth_mode: u8

Stealth mode (StealthMode).

§commandable: u8

Player-commandable flag (Commandable).

§listening: u8

Listening flag (Listening).

§party_interact: u8

Party-interaction flag (PartyInteract).

§plot: u8

Plot-protection flag (Plot).

§min1_hp: u8

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

§interruptable: u8

Interruptable flag (Interruptable).

§disarmable: u8

Disarmable flag (Disarmable).

§is_destroyable: u8

Destroyable flag (IsDestroyable).

§is_raiseable: u8

Raiseable flag (IsRaiseable).

§dead_selectable: u8

Corpse-selectable flag (DeadSelectable).

§is_pc: u8

Player-character flag (IsPC).

§creation_script_fired: u8

Spawn-script-fired flag (CreatnScrptFird).

§ambient_anim_state: u8

Ambient animation state (AmbientAnimState).

§animation: i32

Current animation (Animation).

§creature_size: i32

Creature size row (CreatureSize).

§movement_rate: u8

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

§classes: Vec<SavedClass>

Class levels and known powers (ClassList).

§feats: Vec<u16>

Feat ids (FeatList).

§skills: UtcSkills

Skill ranks (SkillList), positional as the engine stores them.

§inventory: Vec<SavedItem>

Carried inventory (ItemList).

§equipment: Vec<SavedItem>

Equipped items (Equip_ItemList).

§tail: u8

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

§wings: u8

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

§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).

Implementations§

Source§

impl SavedCreature

Source

pub fn new() -> Self

Creates an empty snapshot.

Source

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

Reads a snapshot from one Creature List element.

Every field is optional: a UseTemplates = 0 element that omits one resolves to the engine’s hardcoded default, which is what the per-field fallbacks here reproduce.

Source

pub fn to_struct(&self, index: usize) -> GffStruct

Writes this snapshot into a Creature List element.

Emits exactly the fields this type models; the runtime lists and nested structs named in the module docs are not written because they are not read.

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() -> SavedCreature

Returns the “default value” for a type. 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> StrictAs for T

Source§

fn strict_as<Dst>(self) -> Dst
where T: StrictCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> StrictCastFrom<Src> for Dst
where Src: StrictCast<Dst>,

Source§

fn strict_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.