spaceship/tests/_berths.gd

21 lines
976 B
GDScript3
Raw Normal View History

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))