Skip to main content

Ifo

Struct Ifo 

Source
pub struct Ifo {
Show 56 fields pub is_save_game: bool, pub is_nwm_file: bool, pub nwm_res_name: String, pub module_id: Vec<u8>, pub creator_id: i32, pub version: u32, pub tag: String, pub name: GffLocalizedString, pub description: GffLocalizedString, pub start_movie: ResRef, pub entry_area: ResRef, pub entry_x: f32, pub entry_y: f32, pub entry_z: f32, pub entry_dir_x: f32, pub entry_dir_y: f32, pub min_per_hour: u8, pub dawn_hour: u8, pub dusk_hour: u8, pub xp_scale: u8, pub start_year: u32, pub start_month: u8, pub start_day: u8, pub start_hour: u8, pub start_minute: u16, pub start_second: u16, pub start_millisecond: u16, pub transition: u32, pub pause_time: u32, pub pause_day: u32, pub effect_next_id: u64, pub next_char_id_0: u32, pub next_char_id_1: u32, pub next_obj_id_0: u32, pub next_obj_id_1: u32, pub hak: String, pub on_heartbeat: ResRef, pub on_user_defined: ResRef, pub on_mod_load: ResRef, pub on_mod_start: ResRef, pub on_client_enter: ResRef, pub on_client_leave: ResRef, pub on_activate_item: ResRef, pub on_acquire_item: ResRef, pub on_unacquire_item: ResRef, pub on_player_death: ResRef, pub on_player_dying: ResRef, pub on_spawn_btn_down: ResRef, pub on_player_rest: ResRef, pub on_player_level_up: ResRef, pub on_equip_item: ResRef, pub areas: Vec<IfoArea>, pub expansion_list: Vec<IfoExpansion>, pub cutscene_list: Vec<IfoCutScene>, pub player_list: Vec<IfoPlayer>, pub tokens: Vec<IfoToken>,
}
Expand description

Typed IFO model built from/to [Gff] data.

Fields§

§is_save_game: bool

Whether this is a save game (Mod_IsSaveGame).

§is_nwm_file: bool

Whether this is an NWM file (Mod_IsNWMFile).

§nwm_res_name: String

NWM resource name, only meaningful when is_nwm_file is true (Mod_NWMResName). If empty when flagged as NWM, execution becomes unstable.

§module_id: Vec<u8>

Module ID blob (Mod_ID), kept at whatever length the file carries.

Vanilla module.ifo carries 16 bytes; every savegame module.ifo carries 32. The difference is an engine artefact rather than a format rule: the loader reads this into a fixed 32-byte buffer it never zeroes, and the writer always emits all 32 back, so a vanilla module widens to 32 the first time the game saves it and the upper half is whatever was in that memory.

Do not pad short values to 32 bytes to match. That reproduces the engine’s own bug, and it is the tempting move for anyone who checks only savegames, where 32 looks canonical. Reading 16 and writing 16 leaves the file exactly as its author wrote it. The engine never consumes or compares this value, so neither behaviour affects play.

§creator_id: i32

Creator ID (Mod_Creator_ID).

§version: u32

Module version (Mod_Version).

§tag: String

Module tag (Mod_Tag).

§name: GffLocalizedString

Localized module name (Mod_Name).

§description: GffLocalizedString

Localized module description (Mod_Description).

§start_movie: ResRef

Introductory movie (Mod_StartMovie).

§entry_area: ResRef

Entry area resref (Mod_Entry_Area).

§entry_x: f32

Entry X coordinate (Mod_Entry_X).

§entry_y: f32

Entry Y coordinate (Mod_Entry_Y).

§entry_z: f32

Entry Z coordinate (Mod_Entry_Z).

§entry_dir_x: f32

Entry facing direction X (Mod_Entry_Dir_X). If X and Y are both 0.0, engine locks spawn facing east (1.0, 0.0).

§entry_dir_y: f32

Entry facing direction Y (Mod_Entry_Dir_Y). If X and Y are both 0.0, engine locks spawn facing east (1.0, 0.0).

§min_per_hour: u8

Minutes per game hour (Mod_MinPerHour). If missing, defaults to 2.

§dawn_hour: u8

Dawn hour (Mod_DawnHour). If equal to dusk hour, module is locked into perpetual daylight. If missing, defaults to 6.

§dusk_hour: u8

Dusk hour (Mod_DuskHour). If equal to dawn hour, module is locked into perpetual daylight. If missing, defaults to 18. Engine derives a continuous day/night state flag from dawn_hour, dusk_hour, and the current hour: 1 = Day, 2 = Night, 3 = Dawn, 4 = Dusk.

§xp_scale: u8

XP scale multiplier (Mod_XPScale). Setting to 0 completely halts localized XP acquisition. If missing, defaults to 10.

§start_year: u32

Game calendar year (Mod_StartYear, save-only, default 1340).

§start_month: u8

Calendar month (Mod_StartMonth, save-only, default 6).

§start_day: u8

Calendar day (Mod_StartDay, save-only, default 1).

§start_hour: u8

Calendar hour (Mod_StartHour, save-only, default 23).

§start_minute: u16

Calendar minute (Mod_StartMinute, save-only, default 0).

§start_second: u16

Calendar second (Mod_StartSecond, save-only, default 0).

§start_millisecond: u16

Calendar millisecond (Mod_StartMiliSec, save-only, default 0).

§transition: u32

Transition state (Mod_Transition, save-only, default 0).

§pause_time: u32

Paused time-of-day in milliseconds (Mod_PauseTime, save-only, default 0).

§pause_day: u32

Paused calendar day (Mod_PauseDay, save-only, default 0).

§effect_next_id: u64

Next effect ID counter (Mod_Effect_NxtId, save-only).

§next_char_id_0: u32

Next character ID low word (Mod_NextCharId0, save-only).

§next_char_id_1: u32

Next character ID high word (Mod_NextCharId1, save-only).

§next_obj_id_0: u32

Next object ID low word (Mod_NextObjId0, save-only).

§next_obj_id_1: u32

Next object ID high word (Mod_NextObjId1, save-only).

§hak: String

Hak pack name (Mod_Hak, save-only). The save routine writes this string into save-games as a leftover NWN legacy artifact, but LoadModuleStart completely ignores it - cannot be used to hook custom override archives.

§on_heartbeat: ResRef

On-heartbeat script (Mod_OnHeartbeat).

§on_user_defined: ResRef

On-user-defined script (Mod_OnUsrDefined).

§on_mod_load: ResRef

On-module-load script (Mod_OnModLoad).

§on_mod_start: ResRef

On-module-start script (Mod_OnModStart).

§on_client_enter: ResRef

On-client-enter script (Mod_OnClientEntr).

§on_client_leave: ResRef

On-client-leave script (Mod_OnClientLeav).

§on_activate_item: ResRef

On-activate-item script (Mod_OnActvtItem).

§on_acquire_item: ResRef

On-acquire-item script (Mod_OnAcquirItem).

§on_unacquire_item: ResRef

On-unacquire-item script (Mod_OnUnAqreItem).

§on_player_death: ResRef

On-player-death script (Mod_OnPlrDeath).

§on_player_dying: ResRef

On-player-dying script (Mod_OnPlrDying).

§on_spawn_btn_down: ResRef

On-spawn-button-down script (Mod_OnSpawnBtnDn).

§on_player_rest: ResRef

On-player-rest script (Mod_OnPlrRest).

§on_player_level_up: ResRef

On-player-level-up script (Mod_OnPlrLvlUp).

§on_equip_item: ResRef

On-equip-item script (Mod_OnEquipItem). Asymmetric I/O: the engine loads this during LoadModuleStart but entirely omits it from SaveModuleIFOStart save-game serialization.

§areas: Vec<IfoArea>

Module areas (Mod_Area_list). An empty list will fault the engine load cycle. The format technically supports multiple entries (NWN legacy), but the KOTOR engine strictly enforces a single active area boundary per module.

§expansion_list: Vec<IfoExpansion>

Expansion list (Mod_Expan_List).

§cutscene_list: Vec<IfoCutScene>

Cutscene list (Mod_CutSceneList).

§player_list: Vec<IfoPlayer>

Player list (Mod_PlayerList, save-only).

§tokens: Vec<IfoToken>

Token list (Mod_Tokens).

Implementations§

Source§

impl Ifo

Source

pub fn new() -> Self

Creates an empty IFO value.

Source

pub fn from_gff(gff: &Gff) -> Result<Self, IfoError>

Builds typed IFO data from a parsed GFF container.

Source

pub fn to_gff(&self) -> Gff

Converts this typed IFO value into a GFF container.

Builds the GFF root from scratch using only modeled fields.

Trait Implementations§

Source§

impl Clone for Ifo

Source§

fn clone(&self) -> Ifo

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 Ifo

Source§

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

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

impl Default for Ifo

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl GffSchema for Ifo

Source§

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

Returns the root field schema for this GFF resource type.
Source§

impl PartialEq for Ifo

Source§

fn eq(&self, other: &Ifo) -> 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 Ifo

Auto Trait Implementations§

§

impl Freeze for Ifo

§

impl RefUnwindSafe for Ifo

§

impl Send for Ifo

§

impl Sync for Ifo

§

impl Unpin for Ifo

§

impl UnsafeUnpin for Ifo

§

impl UnwindSafe for Ifo

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.