Skip to main content

Module fac

Module fac 

Source
Expand description

Typed FAC (.fac) faction table and conversion helpers. FAC (.fac) typed generic wrapper.

A FAC resource is the whole session’s faction table: the roster of factions and how each one feels about every other. There is one per session, keyed on the resref REPUTE, not one per creature. Objects (.utc, .utd, …) carry only a faction id that indexes into this table.

§Field Layout

FAC root struct
+-- FactionList (List<Struct>)
|   +-- FactionName / FactionParentID / FactionGlobal
+-- RepList     (List<Struct>)
    +-- FactionID1 / FactionID2 / FactionRep

§The sparse matrix

Reputation is stored sparsely, and this is the one thing to get right. An absent pair means 100, which is friendly, not 0, which is hostile. Reading RepList directly and treating misses as zero turns the entire galaxy against the player. Use Fac::reputation, which applies the baseline.

That baseline applies to a pair with no entry at all. A present entry missing only its FactionRep is a different case and lands on 0, which is what FacReputation::standing declares.

docs/src/formats/gff/fac.md has the rule and how the engine rebuilds the full matrix from it.

Structs§

Fac
Typed FAC model built from/to Gff data.
FacFaction
One faction from the FactionList.
FacReputation
One stored standing from the RepList.

Enums§

FacError
Errors produced while reading or writing typed FAC data.
FacReaction
How a standing reads at the script layer.

Constants§

DEFAULT_REPUTATION
Standing applied to any faction pair with no stored RepList entry.

Functions§

author_fac
Authors the FAC file the typed view describes, into a writer.
author_fac_to_vec
Authors the FAC file the typed view describes, as bytes.
read_fac
Reads typed FAC data from a reader at the current stream position.
read_fac_from_bytes
Reads typed FAC data directly from bytes.