Restrict speed boost to space
This commit is contained in:
parent
9864e59efc
commit
2ecd61de98
5 changed files with 24 additions and 60 deletions
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=21 format=3]
|
||||
[gd_scene load_steps=20 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://controllers/GameController.gd" id="1"]
|
||||
[ext_resource type="PackedScene" path="res://surface/SurfaceBackground.tscn" id="3"]
|
||||
|
|
@ -13,7 +13,6 @@
|
|||
[ext_resource type="Script" path="res://controllers/LaserController.gd" id="16"]
|
||||
[ext_resource type="Script" path="res://controllers/DashController.gd" id="dash_ctrl"]
|
||||
[ext_resource type="Script" path="res://ui/AbilityButtonLayout.gd" id="ability_layout"]
|
||||
[ext_resource type="Script" path="res://ui/SpeedFader.gd" id="17"]
|
||||
[ext_resource type="Script" path="res://surface/CaptureLabel.gd" id="15"]
|
||||
[ext_resource type="Script" path="res://ui/NarrationBanner.gd" id="banner"]
|
||||
[ext_resource type="Script" path="res://world/QuestDirector.gd" id="quest_dir"]
|
||||
|
|
@ -173,32 +172,6 @@ offset_right = -12
|
|||
offset_top = -430
|
||||
offset_bottom = -80
|
||||
|
||||
[node name="SpeedFader" type="Control" parent="UI"]
|
||||
visible = false
|
||||
mouse_filter = 2
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -94
|
||||
offset_right = -24
|
||||
offset_top = -720
|
||||
offset_bottom = -560
|
||||
script = ExtResource("17")
|
||||
glow_color = Color(0.5, 0.18, 0.6, 1)
|
||||
core_color = Color(0.02, 0.09, 0.15, 1)
|
||||
|
||||
[node name="Label" type="Label" parent="UI/SpeedFader"]
|
||||
mouse_filter = 2
|
||||
offset_left = -20
|
||||
offset_right = 90
|
||||
offset_top = -32
|
||||
offset_bottom = -4
|
||||
theme_override_font_sizes/font_size = 20
|
||||
theme_override_colors/font_color = Color(0.7, 0.3, 1, 1)
|
||||
horizontal_alignment = 1
|
||||
text = "x1.0"
|
||||
|
||||
[node name="LaserButton" type="Control" parent="UI"]
|
||||
visible = false
|
||||
mouse_filter = 2
|
||||
|
|
|
|||
|
|
@ -27,6 +27,10 @@ var transitioning: bool = false
|
|||
func _ready() -> void:
|
||||
var planet_definition: Resource = PLANET_DEFINITIONS.get_definition(GameState.planet_definition_id)
|
||||
_compose_surface(SURFACE_PROFILES.get_profile(planet_definition.surface_profile_id))
|
||||
# The Distorder's sustained travel boost is a space-navigation tool. A
|
||||
# landing always returns the fleet to normal surface speed; the separate
|
||||
# aimed dash remains available through its own ability button.
|
||||
GameState.set_fleet_speed_multiplier(1.0)
|
||||
fleet.spawn_ships(GameState.surviving_ship_count, Vector2.ZERO,
|
||||
GameState.surviving_vessel_types)
|
||||
camera.position = Vector2.ZERO
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ var steer_direction: Vector2 = Vector2.ZERO
|
|||
var dash_direction: Vector2 = Vector2.ZERO
|
||||
var dash_remaining: float = 0.0
|
||||
|
||||
const DASH_SPEED: float = 1400.0
|
||||
const DASH_SPEED: float = 2800.0
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
|
|
|||
Loading…
Reference in a new issue