Space-time distorder drains energy while boosting (#62)

GameState._advance_distorder_drain() runs in GameState._process() -
not the distorder component's tick() - alongside extractor mining and
production, so it (and the fleet's travel) keeps working across the
space<->surface scene swap. Drain scales with how far above 1.0 the
multiplier is: (fleet_speed_multiplier - 1.0) / (MAX - 1.0) *
ENERGY_DRAIN_PER_SECOND (2.0 at full boost), accumulated fractionally
the same way extractor mining_progress is so small multipliers still
drain a nonzero amount instead of rounding to zero every frame.

Running the fleet hold's energy to exactly zero force-resets
fleet_speed_multiplier to 1.0 and raises a one-shot
boost_depleted_notice flag, since GameState can't reach into whichever
scene's SpeedFader may or may not currently exist. SpeedFader.gd
consumes the flag on its next _process(), snaps its knob down (it was
already reading the multiplier live, so this falls out for free) and
shows "Out of energy!" - also clearing active_touch_index so a
still-held drag can't immediately re-boost from the position the
finger never moved away from.

test_space_time_distorder.gd (#59) updated to stock fleet energy
first, for the same reason #60/#61 needed it: boosting is no longer
free, and that test's own multi-second boosted phases would otherwise
get cut short mid-measurement by running out.
This commit is contained in:
Loïc Wisniewski 2026-08-16 19:21:54 +02:00
commit 651f8b787e
4 changed files with 211 additions and 1 deletions

View file

@ -37,6 +37,13 @@ func _initialize() -> void:
game_state.stored_vessels.clear()
game_state.reset_progression()
game_state.vessel_levels["unlock_distorder"] = 1
# #62: sustaining a boost now drains fleet energy continuously - stock
# plenty so this test's own boosted phases aren't cut short by running
# out mid-measurement. Set BEFORE the first spawn_ships() call (inside
# Main.tscn's own _ready(), triggered by instantiate() below): the fleet
# hold has no capacity cap yet at this point, so this can't be clamped
# by the soon-to-exist fleet's cargo capability.
game_state.deposit_fleet_resource(GameState.RESOURCE_ENERGY, 500)
main = load("res://Main.tscn").instantiate()
root.add_child(main)
fleet = main.get_node("Fleet")