factions
Data model and query module for political factions and player-faction detection.
tiargus.factions
Data model and SavegameModule for political factions.
Provides:
Faction— a political faction, including its exploration intel.FactionModule(key:"factions") — parses every faction and identifies the human player's faction, which determines which bodies count as prospected.
Example
from tiargus import TerraInvictaSave, FactionModule
save = TerraInvictaSave("Autosave.gz", FactionModule)
player = save.get_module(FactionModule).player_faction
print(player.display_name, len(player.prospected_bodies), "bodies prospected")
Faction
dataclass
A political faction as recorded in the save file.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
int
|
Numeric game-state ID. |
display_name |
str
|
Faction name as shown in-game (e.g. |
prospected_bodies |
set[int]
|
IDs of space bodies this faction has fully
prospected (intel value |
Source code in src/tiargus/factions.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
FactionModule
Bases: SavegameModule
Parses all factions and identifies the human player's faction.
The player faction is determined by locating the non-AI player record in the save. This is used by HabSiteModule to filter the list of prospected hab sites.
Source code in src/tiargus/factions.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | |
factions
property
All factions keyed by their numeric game-state ID.
player_faction
property
The Faction belonging to the human player.
player_faction_id
property
Numeric ID of the human player's faction.
__init_subclass__(**kwargs)
Register subclasses in _REGISTRY at definition time.
Raises:
| Type | Description |
|---|---|
TypeError
|
If a subclass does not define |
Source code in src/tiargus/savegame.py
141 142 143 144 145 146 147 148 149 150 | |
requires()
classmethod
Return the KEYs of modules that must be parsed before this one.
Override this in subclasses that need data from other modules.
TerraInvictaSave resolves and parses all declared dependencies
(and their transitive dependencies) before calling parse() on this
module.
Returns:
| Type | Description |
|---|---|
list[str]
|
A list of |
list[str]
|
empty list (no dependencies). |
Source code in src/tiargus/savegame.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |