Restrict speed boost to space
This commit is contained in:
parent
9864e59efc
commit
2ecd61de98
5 changed files with 24 additions and 60 deletions
|
|
@ -6,6 +6,7 @@ extends SceneTree
|
|||
|
||||
const DASH_COST: int = 15
|
||||
const DASH_DISTANCE: float = 520.0
|
||||
const DASH_SETTLE_TIME: float = 0.3
|
||||
|
||||
var state: Node
|
||||
var main: Node
|
||||
|
|
@ -71,7 +72,7 @@ func _process(delta: float) -> bool:
|
|||
elapsed = 0.0
|
||||
return false
|
||||
1:
|
||||
if elapsed < 0.7:
|
||||
if elapsed < DASH_SETTLE_TIME:
|
||||
return false
|
||||
var moved: Vector2 = fleet.get_centroid() - first_origin
|
||||
if absf(moved.x - DASH_DISTANCE) > 8.0 or absf(moved.y) > 8.0:
|
||||
|
|
@ -92,7 +93,7 @@ func _process(delta: float) -> bool:
|
|||
elapsed = 0.0
|
||||
return false
|
||||
2:
|
||||
if elapsed < 0.7:
|
||||
if elapsed < DASH_SETTLE_TIME:
|
||||
return false
|
||||
var moved: Vector2 = fleet.get_centroid() - second_origin
|
||||
if absf(moved.y + DASH_DISTANCE) > 8.0 or absf(moved.x) > 8.0:
|
||||
|
|
@ -104,6 +105,8 @@ func _process(delta: float) -> bool:
|
|||
var surface: Node = load("res://surface/PlanetSurface.tscn").instantiate()
|
||||
if not surface.has_node("DashController") or not surface.has_node("UI/DashButton"):
|
||||
return _fail("planet surface does not carry the dash ability")
|
||||
if surface.has_node("UI/SpeedFader"):
|
||||
return _fail("planet surface still carries the sustained speed multiplier")
|
||||
surface.free()
|
||||
print("two aimed dashes moved %.0f units, preserved formation, and cooled down per Propulser" \
|
||||
% DASH_DISTANCE)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue