Fix the stop stutter, and hide unresearched buildings from the menu
Forgejo #13: releasing the stick paused, then moved again before settling. stop() aims each ship at a braking point ahead of it, but the ship's own velocity was ~0 - the anchor had been carrying it - so it started from REST, accelerated into its own stopping distance, and halted a second time. Measured: 0 -> 45 -> 90 -> 135 -> 180 -> brake. stop() now hands the fleet's motion to the ship, so the release is one continuous decelerating coast (222 -> 0) to the identical endpoint. test_joystick_control now asserts the speed one frame after release is a real fraction of cruise, and never rises afterwards. Forgejo #21: unresearched structures are no longer listed greyed out. They are hidden, and the menu repacks around what is left - a fixed grid with entries hidden would otherwise leave holes where they used to be. An entry alone on its row is centred rather than hanging in the left column. Researched-but-not-usable is still shown greyed: an extractor with no planet under the fleet is "not now", not "not yet". This reverses a documented decision (the old comment argued that always listing everything stops the player wondering whether the game has it at all), so test_skill_tree's matching assertion was updated from greyed-but-listed to hidden. The gate itself is unchanged and still refuses a build forced past the menu. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
da8f6a81ea
commit
0e071877e2
6 changed files with 261 additions and 18 deletions
|
|
@ -21,6 +21,11 @@ var elapsed: float = 0.0
|
|||
var start_centroid: Vector2
|
||||
var moving_centroid: Vector2
|
||||
var stop_check_frames: int = 0
|
||||
# Release-coast tracking (Forgejo #13).
|
||||
var released: bool = false
|
||||
var speed_at_release: float = 0.0
|
||||
var previous_speed: float = 0.0
|
||||
var accelerated_after_release: bool = false
|
||||
|
||||
|
||||
func _initialize() -> void:
|
||||
|
|
@ -54,8 +59,27 @@ func _release(local: Vector2) -> void:
|
|||
joystick.handle_touch(ev)
|
||||
|
||||
|
||||
func _max_ship_speed() -> float:
|
||||
var top: float = 0.0
|
||||
for ship in fleet.ships:
|
||||
top = maxf(top, ship.velocity.length())
|
||||
return top
|
||||
|
||||
|
||||
func _process(delta: float) -> bool:
|
||||
elapsed += delta
|
||||
|
||||
# Releasing the stick must be ONE continuous decelerating coast. It used
|
||||
# to stop dead and then accelerate into its own stopping distance,
|
||||
# halting a second time - felt in game as a pause followed by a small
|
||||
# extra lurch (#13). The ships were being aimed at a braking point ahead
|
||||
# while their own velocity was ~0, because the anchor had been carrying
|
||||
# them, so they started from rest.
|
||||
if released:
|
||||
var now: float = _max_ship_speed()
|
||||
if now > previous_speed + 1.0:
|
||||
accelerated_after_release = true
|
||||
previous_speed = now
|
||||
match stage:
|
||||
0:
|
||||
main_scene.get_node("AsteroidField").set_process(false)
|
||||
|
|
@ -104,6 +128,9 @@ func _process(delta: float) -> bool:
|
|||
return true
|
||||
|
||||
_release(joystick.size / 2.0)
|
||||
released = true
|
||||
speed_at_release = _max_ship_speed()
|
||||
previous_speed = speed_at_release
|
||||
if joystick.direction != Vector2.ZERO:
|
||||
print("TEST_JOYSTICK_CONTROL: FAIL (direction not cleared on release)")
|
||||
quit(1)
|
||||
|
|
@ -119,6 +146,20 @@ func _process(delta: float) -> bool:
|
|||
var speed: float = 0.0
|
||||
for ship in fleet.ships:
|
||||
speed = max(speed, ship.velocity.length())
|
||||
# Carrying the fleet's cruise speed, not starting from a standstill.
|
||||
if speed_at_release < fleet.cruise_speed * 0.5:
|
||||
print("speed one frame after release: %.1f (cruising at %.1f)" % [
|
||||
speed_at_release, fleet.cruise_speed
|
||||
])
|
||||
print("TEST_JOYSTICK_CONTROL: FAIL (the fleet stopped dead on release instead of coasting)")
|
||||
quit(1)
|
||||
return true
|
||||
if accelerated_after_release:
|
||||
print("TEST_JOYSTICK_CONTROL: FAIL (the fleet sped up again after release - pause then lurch, #13)")
|
||||
quit(1)
|
||||
return true
|
||||
print("release coast: %.1f -> 0 with no re-acceleration" % speed_at_release)
|
||||
|
||||
var stopped: bool = speed < 1.0
|
||||
# Not merely "moved forward at all": the fleet cruises at
|
||||
# cruise_speed and brakes at Ship.acceleration, so the coast is
|
||||
|
|
|
|||
Loading…
Reference in a new issue