Restrict speed boost to space

This commit is contained in:
Loïc Wisniewski 2026-09-03 23:14:02 +02:00
commit 2ecd61de98
5 changed files with 24 additions and 60 deletions

View file

@ -11,9 +11,8 @@ extends SceneTree
# B. dragging it up measurably increases distance travelled per second;
# at 1.0 the fleet moves exactly as it does today
# C. formation holds together under boost - ships stay near their slot
# D. losing the vessel resets the multiplier and hides the fader
# E. the multiplier survives the space -> surface scene swap (it lives
# in the autoload)
# D. losing the vessel resets the multiplier
# E. landing disables the space-only multiplier and surface fader
var game_state: Node
var main: Node
@ -192,22 +191,11 @@ func _process(delta: float) -> bool:
release.pressed = false
main._handle_touch(release)
# --- E. survives the space -> surface scene swap -------------------
# Done here, with the distorder ship still crewed and the fleet
# still boosted: tearing this scene down while nothing else
# changes the fleet's own composition proves the multiplier
# lives in the autoload rather than being reset as a side effect
# of the old scene's own SpeedFader still ticking once more
# during teardown (it would, correctly, self-reset the instant
# it next saw a fleet with no distorder ship - not a real
# scenario here since this fleet keeps its distorder ship the
# whole way across the swap, via GameState.surviving_vessel_types
# exactly like every other vessel type).
# Check the premise before relying on it. Everything below is about
# the multiplier surviving a scene swap, which is only meaningful
# while the fleet still crews a distorder vessel - so if the fleet
# lost one on the way here, say THAT rather than reporting a reset
# multiplier as if the swap were at fault.
# --- E. landing disables the space-only sustained boost ------------
# Keep the Distorder crewed and the boost active across teardown so
# the landed surface itself has to enforce the boundary.
# Check the premise before relying on it: landing should reset the
# boost even though the fleet still owns the vessel that enables it.
if not fleet.has_capability("distorder"):
return _fail_now("the fleet lost its distorder vessel before the scene swap, so the multiplier reset is expected rather than a bug")
game_state.surviving_ship_count = fleet.ships.size()
@ -225,26 +213,22 @@ func _process(delta: float) -> bool:
root.add_child(main)
current_scene = main
fleet = main.get_node("Fleet")
fader = main.get_node("UI/SpeedFader")
elapsed = 0.0
stage = 6
return false
6:
if elapsed < 0.3:
return false
if not is_equal_approx(game_state.fleet_speed_multiplier, 3.0):
return _fail_now("multiplier did not survive the space -> surface swap: %f" \
if not is_equal_approx(game_state.fleet_speed_multiplier, 1.0):
return _fail_now("landing did not reset the space-only multiplier: %f" \
% game_state.fleet_speed_multiplier)
fader._process(0.0)
if not fader.visible:
return _fail_now("the surface scene's fader did not show the surviving distorder ship")
print("multiplier and fader both survived the space -> surface swap")
if main.get_node_or_null("UI/SpeedFader") != null:
return _fail_now("the space-only speed fader is present on the planet")
print("landing reset the multiplier and omitted its space-only fader")
# --- D. losing the vessel resets the multiplier -------------------
game_state.set_fleet_speed_multiplier(GameState.MAX_FLEET_SPEED_MULTIPLIER)
fleet.spawn_ships(1, fleet.get_centroid(), PackedStringArray([GameState.VESSEL_INTERCEPTOR]))
fader._process(0.0)
if fader.visible:
return _fail_now("fader stayed visible after losing the last distorder ship")
if not is_equal_approx(game_state.fleet_speed_multiplier, 1.0):
return _fail_now("multiplier was not reset after losing the distorder ship: %f" \
% game_state.fleet_speed_multiplier)