habs
Data classes and query modules for space bodies, factions, settlements, and hab sites.
tiargus.habs
Data models and SavegameModules for the space colonisation layer.
Provides dataclasses that represent colonisation game entities:
Base— a hab (Outpost/Settlement/Colony surface base, or orbital station) including its installed modules.HabBuilding— an individual building (in-game "hab module") installed in a hab sector.HabSite— a potential hab location with daily resource income.
Each colonisation dataclass has a corresponding SavegameModule that parses
it from the raw gamestate:
BaseModule(key:"bases") — parses every hab plus its modules.HabSiteModule(key:"hab_sites") — depends on SpaceBodyModule,BaseModule, and FactionModule; uses the player faction's intel to filterprospected_hab_sites.
Base
dataclass
A hab — a surface base (Outpost/Settlement/Colony) or an orbital station.
Surface bases occupy a hab site; orbital stations do not
(hab_site_id is None). Use hab_type to distinguish them.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
int
|
Numeric game-state ID of the hab entity. |
display_name |
str
|
Base name as shown in-game. |
template_name |
str
|
Internal template identifier; falls back to
|
hab_site_id |
Optional[int]
|
ID of the HabSite this base
occupies, or |
faction_id |
int
|
ID of the Faction that owns this base. |
tier |
int
|
Hab tier — |
hab_type |
str
|
|
modules |
list[HabBuilding]
|
Installed HabBuilding
buildings (in-game "hab modules"), ordered by |
mine_tier |
Optional[int]
|
Tier ( |
Source code in src/tiargus/habs.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
BaseModule
Bases: SavegameModule
Parses every hab — surface bases and orbital stations — with its modules.
Surface bases reference a hab site (hab_site_id); orbital stations do
not (hab_site_id is None). Callers that only want surface bases can
filter on hab_type == "Base" or on a non-None hab_site_id.
Each hab's installed modules are read from the save's sector and module
states and attached to the Base as its modules
list, ordered by (sector_num, slot). Empty slots are excluded.
Source code in src/tiargus/habs.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | |
bases
property
All habs (surface bases and stations) keyed by their numeric game-state ID.
__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 | |
HabBuilding
dataclass
An individual building installed in one slot of a hab sector.
Terra Invicta calls these "hab modules" in-game; the class is named
HabBuilding to avoid confusion with the *Module
SavegameModule parsers — it is a
game entity, not a parser.
Only built buildings are represented — empty slots (where the save records
an empty templateName) are excluded when a
Base is parsed.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
int
|
Numeric game-state ID of the building. |
template_name |
str
|
Internal building type (e.g. |
display_name |
str
|
Human-readable building name (e.g. |
sector_num |
int
|
Index of the parent sector within the hab. |
slot |
int
|
Slot index within the sector. |
construction_completed |
bool
|
|
powered |
bool
|
|
destroyed |
bool
|
|
Source code in src/tiargus/habs.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
HabSite
dataclass
A potential habitat location on a space body.
Resource fields are daily rates in their native units.
Multiply by 30.44 (or use monthly=True in
generate_site_report) to get
monthly figures.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
int
|
Numeric game-state ID. |
display_name |
str
|
Site name as shown in-game. |
template_name |
str
|
Internal template identifier (e.g. |
body_id |
int
|
ID of the SpaceBody this site belongs to. |
latitude |
float
|
Latitude of the site on its body, in degrees. |
longitude |
float
|
Longitude of the site on its body, in degrees. |
water_day |
float
|
Daily water extraction rate. |
volatiles_day |
float
|
Daily volatiles extraction rate. |
metals_day |
float
|
Daily metals extraction rate. |
nobles_day |
float
|
Daily noble-gas extraction rate. |
fissiles_day |
float
|
Daily fissiles extraction rate. |
base_id |
Optional[int]
|
ID of the occupying Base, or |
pending_hab |
bool
|
|
Source code in src/tiargus/habs.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
HabSiteModule
Bases: SavegameModule
Parses all hab sites with their daily resource income and settlement references.
Depends on SpaceBodyModule, BaseModule, and FactionModule. After parsing, uses the player faction's prospected body IDs to populate prospected_hab_sites.
Source code in src/tiargus/habs.py
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | |
hab_sites
property
All hab sites in the save, keyed by their numeric game-state ID.
prospected_hab_sites
property
Hab sites on bodies the player faction has fully prospected.
__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 | |
SpaceBody
dataclass
A planet, moon, or asteroid present in the save file.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
int
|
Numeric game-state ID used as a foreign key by other entities. |
display_name |
str
|
Human-readable name shown in-game (e.g. |
template_name |
str
|
Internal template identifier used to look up the
region label in the bundled location map (e.g.
|
max_hab_tier |
int
|
Maximum hab tier (1–3) that can be built on this body. |
barycenter_id |
Optional[int]
|
ID of the body this one orbits (its barycenter), or
|
Source code in src/tiargus/solar_system.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
SpaceBodyModule
Bases: SavegameModule
Parses every planet, moon, and asteroid from the save.
Provides display names and template names used by other modules to build location labels and resolve body references.
Source code in src/tiargus/solar_system.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 | |
space_bodies
property
All space bodies keyed by their numeric game-state ID.
__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 | |
sites_dataframe(save, *, monthly=True, all_sites=False)
Build a DataFrame of hab-site resource data from a parsed save.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
save
|
TerraInvictaSave
|
A TerraInvictaSave constructed with at least HabSiteModule. |
required |
monthly
|
bool
|
When |
True
|
all_sites
|
bool
|
When |
False
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
A DataFrame with one row per hab site. Columns: Name, Site, Max Tier, |
DataFrame
|
Location, Water, Vols, Metal, Nobles, Fissiles, Faction, Mine Tier. |
DataFrame
|
Score and Most are not included; those are Excel-formula columns added by |
DataFrame
|
Source code in src/tiargus/habs.py
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | |