#97a: buildings have health, and can be destroyed #99

Closed
opened 2026-08-23 11:18:42 +00:00 by metaheavens · 1 comment
Owner

Subticket of #97 - "Waves tries to attack built buildings, so building needs health now."

Foundation for the rest of the wave work: nothing can attack a structure that
cannot be hurt.

  • max_hp on BuildingDefinition, so a mothership is not as fragile as an
    extractor.
  • Current hp on the building RECORD in GameState, not on the node: Main.tscn
    is torn down and rebuilt on every trip to a planet surface, so damage kept
    only on a node would heal itself the moment the player landed.
  • GameState.damage_building(id, amount), returning whether it died, and
    destruction that removes the record, its stored inventory and its queued
    orders.
  • A building at less than full health shows it.
  • Destroying the mothership must not soft-lock the game - decide and pin what
    happens.
Subticket of #97 - "Waves tries to attack built buildings, so building needs health now." Foundation for the rest of the wave work: nothing can attack a structure that cannot be hurt. - `max_hp` on `BuildingDefinition`, so a mothership is not as fragile as an extractor. - Current hp on the building RECORD in `GameState`, not on the node: `Main.tscn` is torn down and rebuilt on every trip to a planet surface, so damage kept only on a node would heal itself the moment the player landed. - `GameState.damage_building(id, amount)`, returning whether it died, and destruction that removes the record, its stored inventory and its queued orders. - A building at less than full health shows it. - Destroying the mothership must not soft-lock the game - decide and pin what happens.
Author
Owner

Done in c221584.

max_hp is per definition - an extractor bolted to a rock is not the
mothership - and the current value lives on the RECORD in GameState, not on the
Building node, because Main.tscn is rebuilt on every landing and damage kept on
a node would heal itself the moment you touched down.

A record written before this carries no hp field at all. That reads as
undamaged rather than as zero, or an existing save would open on a field of
wrecks.

The mothership cannot be destroyed - it floors at 1hp. The bank, the hangar
and research all live there and a wiped fleet rebuilds there, so losing it would
be a soft-lock with no route back. Keyed on the "bank" capability rather than on
the type, so whatever building holds the bank is the one that cannot be lost.

Covered by tests/test_building_health.gd.

Done in c221584. `max_hp` is per definition - an extractor bolted to a rock is not the mothership - and the current value lives on the RECORD in GameState, not on the Building node, because Main.tscn is rebuilt on every landing and damage kept on a node would heal itself the moment you touched down. A record written before this carries no `hp` field at all. That reads as undamaged rather than as zero, or an existing save would open on a field of wrecks. **The mothership cannot be destroyed** - it floors at 1hp. The bank, the hangar and research all live there and a wiped fleet rebuilds there, so losing it would be a soft-lock with no route back. Keyed on the "bank" capability rather than on the type, so whatever building holds the bank is the one that cannot be lost. Covered by `tests/test_building_health.gd`.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
metaheavens/spaceship#99
No description provided.