spaceship/tests/_berths.gd
Loïc Wisniewski 1f5fecd371 Buy fleet berths with Fleet Offices
#219: fleet capacity is a built, supplied thing rather than a researched
one. The eight fleet-size doctrines are gone; capacity is one berth free
plus one per Fleet Office standing. An office charges every 25s for the
vessel in its berth, priced off that vessel's own build cost so an expensive
hull is expensive to keep, and drawn from its own store the way a gas burner
draws gas. An office that cannot pay goes dark, its vessel is scuttled, and
the player is told through the same queue quest lines use - which reaches
them on a planet surface too.

An empty berth is idle rather than starved: an office is only failing while
there is something in it to fail, and holding it disabled would leave a
berth that could never be crewed and so could never be paid for again.

Ships have no hit points and a shield absorbs a hit wholesale, so the lost
vessel is scuttled rather than damaged - otherwise a shielded hull would
survive its own eviction.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019AJMdB7iuHuLFZM1aBu3GD
2026-09-05 17:09:27 +02:00

21 lines
976 B
GDScript

extends RefCounted
# #219 made fleet capacity a BUILT thing: one berth free, one more per Fleet
# Office standing. A test that flies four vessels therefore needs three
# offices, where before it unlocked three doctrines.
#
# Loaded with load() at runtime rather than preloaded at the top of a test -
# these are script-mode entry points, and a top-level preload evaluates during
# their own early compilation, which can happen before the autoloads exist.
#
# The offices are put a long way from the origin so they cannot wander into
# whatever the test is actually looking at, and left unstocked: upkeep is not
# charged until FLEET_OFFICE_UPKEEP_SECONDS has passed, and no test here runs
# that long.
static func grant(game_state: Node, vessels: int) -> void:
var needed: int = maxi(vessels - int(game_state.BASE_FLEET_SIZE), 0)
for i in range(needed):
game_state.add_building(String(game_state.BUILDING_FLEET_OFFICE),
Vector2(40000.0 + 500.0 * float(i), 40000.0))