#227: resume at the mothership, with the crew the save had
Loading a save fell through to the brand-new-game branch in PlanetAtmosphereController, which spawns STARTING_SHIP_COUNT interceptors at the world origin. So resuming stranded the player in empty space with the wrong ships while their base sat wherever they had left it - thousands of units away on a charted map. fleet_position was in the save all along, but nothing ever read it: only Fleet writes it, as a mirror for payment-range checks. A resumed run now spawns at get_mothership_position(). That is already the canonical home - BuildController._check_fleet_wipe rebuilds a wiped fleet there - so this is the existing answer to "where does the fleet belong", not a new one. It falls back to the position the save was written at, and only then to the origin, because a run can have no mothership standing. resumed_from_save is a one-shot handoff like has_return_position, and is deliberately NOT saved: it describes this launch, not the run. Verified by reverting the branch: "resumed at (0.0, -48.0), but the mothership is at (7400.0, -3100.0)". One note for whoever writes the next fleet test: asserting a three-ship crew proves nothing without capacity. Since #219 the fleet holds BASE_FLEET_SIZE (1) plus one berth per supplied fleet office, so spawn_ships clamps to 1 and the assertion passes against the wrong number. Case A gives the save two offices and checks max_fleet_size() first. 176/176 at JOBS=3. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019AJMdB7iuHuLFZM1aBu3GD
This commit is contained in:
parent
d4ece16377
commit
62acb0052c
4 changed files with 172 additions and 0 deletions
|
|
@ -39,6 +39,23 @@ func _ready() -> void:
|
|||
camera.position = GameState.return_world_position
|
||||
camera.zoom = Vector2(GameState.return_camera_zoom, GameState.return_camera_zoom)
|
||||
GameState.has_return_position = false
|
||||
elif GameState.resumed_from_save:
|
||||
# #227: a resumed run used to fall through to the brand-new-game
|
||||
# branch below, which put the STARTING fleet at the world origin -
|
||||
# so loading a save stranded the player in empty space with the
|
||||
# wrong ships while their base sat wherever they had left it.
|
||||
#
|
||||
# The mothership is where a wiped-out fleet is already rebuilt (see
|
||||
# BuildController._check_fleet_wipe), so it is the run's home whether
|
||||
# or not this is a resume. Falls back to the position the save was
|
||||
# written at, and only then to the origin, because a run can have no
|
||||
# mothership standing.
|
||||
var home: Variant = GameState.get_mothership_position()
|
||||
var at: Vector2 = home if home != null else GameState.fleet_position
|
||||
fleet.spawn_ships(GameState.fleet_vessel_types.size(), at,
|
||||
GameState.fleet_vessel_types)
|
||||
camera.position = at
|
||||
GameState.resumed_from_save = false
|
||||
elif GameState.intro_active:
|
||||
# #108: the prologue opens with a convoy, and crews it itself. This
|
||||
# node still runs first, so spawning the ordinary opening fleet here
|
||||
|
|
|
|||
Loading…
Reference in a new issue