Let the fleet grow past twenty vessels

max_fleet_size() clamped itself to DEFAULT_FORMATION.size(), so the ceiling
on the fleet was a property of the LAYOUT - the wedge ran out of authored
positions at twenty - rather than a rule anyone decided on. Capacity is the
supplied Fleet Offices and nothing else now.

Dropping the clamp alone would index off the end of the formation array, so
the wedge continues by rule instead of stopping: formation_slot() grows it
on demand, each further pair stepping 30 further out and 40 further back,
which is what the authored rows already do - the first twenty slots come
back unchanged. A grown slot is rotated by formation_rotation so a fleet
that outgrows the array after the player has pivoted does not sprout hulls
facing the original heading, and that angle is saved with the layout.

Two "fleet is full" messages pointed at the vanished ceiling. Both now say
what actually buys a berth, and the hangar's stops claiming it is research,
which it has not been since #219.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QR2Mdk42ghEpeyXPe4UFyn
This commit is contained in:
Loïc Wisniewski 2026-09-12 19:06:03 +02:00
commit 93bfe62e76
7 changed files with 113 additions and 23 deletions

View file

@ -96,7 +96,7 @@ func spawn_ships(count: int, center: Vector2 = Vector2.ZERO,
spawn_types.append(GameState.VESSEL_INTERCEPTOR)
var n: int = clamp(spawn_types.size(), 1, GameState.max_fleet_size())
for i in range(n):
var offset: Vector2 = GameState.formation[i]
var offset: Vector2 = GameState.formation_slot(i)
var ship: Area2D = ship_scene.instantiate()
ship.vessel_type = spawn_types[i]
ship.position = center + offset
@ -178,7 +178,7 @@ func add_ship(vessel_type: String = GameState.VESSEL_INTERCEPTOR) -> bool:
if not GameState.vessel_is_fleet_eligible(vessel_type) \
or ships.size() >= GameState.max_fleet_size():
return false
var offset: Vector2 = GameState.formation[ships.size()]
var offset: Vector2 = GameState.formation_slot(ships.size())
var ship: Area2D = ship_scene.instantiate()
# Before add_child, so Ship._ready() builds the right vessel - the shield
# ring is created there and only for a shield vessel.
@ -222,9 +222,7 @@ func apply_formation() -> void:
# Without this, editing the layout at a command centre (or pivoting it)
# only affected ships built later, which read as the edit doing nothing.
for i in range(ships.size()):
if i >= GameState.max_fleet_size():
break
formation_offsets[i] = GameState.formation[i]
formation_offsets[i] = GameState.formation_slot(i)
_assign_slot_targets()