Recentre a released stick, slow extractors again, and unbreak the lab layout
Both sticks float - the base jumps to wherever the finger lands, so a player does not have to hit an exact spot on a screen they cannot feel. Releasing put only the KNOB back onto the base and left the base parked wherever that touch had been, so an idle stick sat off-centre in a different place every time and read as a control still in use. Release now returns base and knob to the middle of the rect. Extractors produce at 0.5 ore per second, halved again: at 1.0 they still outran the rest of the economy. An extractor now pays back its 25-ore cost in fifty seconds rather than twelve. The ship lab and the crafter were both overlapping themselves. Enlarging the shared resource table to 136px (so it could breathe and show bigger type) pushed its bottom edge 34px into the vessel row beneath it in one and the status text in the other - my regression, visible immediately on a real screen and not at all in any test. The lab's second row of upgrade cards was also already running into the detail text below it, by 13px, before any of this. Both menus are re-spaced end to end rather than nudged, since moving one collision into another is how the second one got there. Two tests carried waits tuned to an extraction rate that has now changed twice. Both derive them from EXTRACTOR_RATE instead, so the next balance pass does not report a broken extractor that is working perfectly - the same fix test_extractor_income already needed one round ago, in the file next to it. Suite 112/112. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
4cc9c417ca
commit
b999031e6a
8 changed files with 220 additions and 102 deletions
|
|
@ -1,29 +1,22 @@
|
|||
extends Node2D
|
||||
|
||||
# Preview, not a test - #71's ship lab layout with all 7 vessels present,
|
||||
# checking the vessel-name row no longer overlaps itself.
|
||||
# Preview, not a test - the ship lab at the real 720x1280 viewport, with a
|
||||
# vessel selected and its upgrades listed.
|
||||
#
|
||||
# bash tests/screenshot.sh res://tests/_lab_menu_preview.tscn /tmp/lab.png 20 720x1280
|
||||
|
||||
var configured: bool = false
|
||||
# bash tests/screenshot.sh res://tests/_lab_menu_preview.tscn /tmp/lab.png 25 720x1280
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if configured:
|
||||
return
|
||||
configured = true
|
||||
func _ready() -> void:
|
||||
GameState.buildings.clear()
|
||||
GameState.extractors.clear()
|
||||
GameState.transporters.clear()
|
||||
GameState.rocks = 500
|
||||
GameState.research_points = 5
|
||||
GameState.reset_progression()
|
||||
GameState.bank_inventory.set_amount(GameState.RESOURCE_ORE, 310)
|
||||
GameState.fleet_inventory.set_amount(GameState.RESOURCE_ORE, 47)
|
||||
GameState.research_points = 4
|
||||
var main: Node = load("res://Main.tscn").instantiate()
|
||||
add_child(main)
|
||||
main.get_node("EnemySpawner").set_process(false)
|
||||
main.get_node("AsteroidField").set_process(false)
|
||||
main.get_node("BuildingField").place(GameState.BUILDING_SHIP_LAB, Vector2(400.0, 0.0))
|
||||
var lab_id: int = int(GameState.buildings[-1].id)
|
||||
var bc: Node = main.get_node("BuildController")
|
||||
bc.lab_building_id = lab_id
|
||||
main.get_node("UI/LabMenu").visible = true
|
||||
bc._refresh_lab()
|
||||
var build: Node = main.get_node("BuildController")
|
||||
build.lab_menu.visible = true
|
||||
build._refresh_lab()
|
||||
|
|
|
|||
1
tests/test_asteroid_mining.gd.uid
Normal file
1
tests/test_asteroid_mining.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cx1x1mb4d614u
|
||||
|
|
@ -179,7 +179,13 @@ func _process(delta: float) -> bool:
|
|||
return false
|
||||
2:
|
||||
# Mining is local, exactly like ore - no black-hole-specific code.
|
||||
if elapsed < 1.2:
|
||||
# DERIVED from the extraction rate, not a fixed 1.2s. That was
|
||||
# long enough only while an extractor produced 2 a second; the
|
||||
# rate has since been quartered, and a wait tuned to the old one
|
||||
# reported a broken extractor that was working perfectly. What is
|
||||
# under test is that dark matter accumulates LOCALLY rather than
|
||||
# banking itself - not how quickly it arrives.
|
||||
if elapsed < 1.0 / GameState.EXTRACTOR_RATE + 0.4:
|
||||
return false
|
||||
var mined: int = game_state.extractor_resource(extractor_index, GameState.RESOURCE_DARK_MATTER)
|
||||
if mined <= 0:
|
||||
|
|
|
|||
99
tests/test_joystick_recentres.gd
Normal file
99
tests/test_joystick_recentres.gd
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
extends SceneTree
|
||||
|
||||
# Headless test: run with
|
||||
# godot --headless -s res://tests/test_joystick_recentres.gd
|
||||
# Both sticks float: the base jumps to wherever the finger lands, so a player
|
||||
# does not have to hit an exact spot on a screen they cannot feel. Releasing
|
||||
# used to put only the KNOB back onto the base, leaving the base parked
|
||||
# wherever that touch had been - so an idle stick sat off-centre, in a
|
||||
# different place every time, and read as a control still in use.
|
||||
#
|
||||
# Covers, for the movement stick AND the fire stick:
|
||||
# A. an untouched stick sits in the middle of its own rect
|
||||
# B. pressing off-centre moves the base there - the floating behaviour is
|
||||
# still intact, which is the thing this must not break
|
||||
# C. releasing puts base AND knob back in the middle
|
||||
# D. releasing also clears the reported direction, so nothing keeps acting
|
||||
# on a stick nobody is holding
|
||||
|
||||
const OFFSET := Vector2(-58.0, 41.0)
|
||||
|
||||
var main: Node
|
||||
var stage: int = 0
|
||||
var elapsed: float = 0.0
|
||||
|
||||
|
||||
func _initialize() -> void:
|
||||
main = load("res://Main.tscn").instantiate()
|
||||
root.add_child(main)
|
||||
current_scene = main
|
||||
|
||||
|
||||
func _check(stick: Control, label: String) -> bool:
|
||||
var home: Vector2 = stick.home_pos()
|
||||
|
||||
# --- A. idle means centred -------------------------------------------
|
||||
if stick.base_pos.distance_to(home) > 0.01 or stick.knob_pos.distance_to(home) > 0.01:
|
||||
return _fail("%s starts at base %s knob %s, expected both at %s" \
|
||||
% [label, stick.base_pos, stick.knob_pos, home])
|
||||
|
||||
# --- B. it still floats to the finger ---------------------------------
|
||||
var press := InputEventScreenTouch.new()
|
||||
press.index = 2
|
||||
press.pressed = true
|
||||
press.position = stick.global_position + home + OFFSET
|
||||
if not stick.handle_touch(press):
|
||||
return _fail("%s refused a touch inside its own rect" % label)
|
||||
if stick.base_pos.distance_to(home + OFFSET) > 0.01:
|
||||
return _fail("%s did not float its base to the finger: base %s, expected %s" \
|
||||
% [label, stick.base_pos, home + OFFSET])
|
||||
|
||||
var drag := InputEventScreenDrag.new()
|
||||
drag.index = 2
|
||||
drag.position = press.position + Vector2(stick.max_radius, 0.0)
|
||||
stick.handle_drag(drag)
|
||||
if stick.direction == Vector2.ZERO:
|
||||
return _fail("%s reported no direction while pushed" % label)
|
||||
if stick.knob_pos.distance_to(stick.base_pos) < stick.max_radius * 0.5:
|
||||
return _fail("%s knob barely moved while pushed" % label)
|
||||
|
||||
# --- C/D. release recentres everything and stops reporting ------------
|
||||
var release := InputEventScreenTouch.new()
|
||||
release.index = 2
|
||||
release.pressed = false
|
||||
release.position = drag.position
|
||||
stick.handle_touch(release)
|
||||
if stick.base_pos.distance_to(home) > 0.01:
|
||||
return _fail("%s left its base at %s after release, expected %s" \
|
||||
% [label, stick.base_pos, home])
|
||||
if stick.knob_pos.distance_to(home) > 0.01:
|
||||
return _fail("%s left its knob at %s after release, expected %s" \
|
||||
% [label, stick.knob_pos, home])
|
||||
if stick.direction != Vector2.ZERO:
|
||||
return _fail("%s still reports %s after release" % [label, stick.direction])
|
||||
if stick.is_active():
|
||||
return _fail("%s still claims to be held after release" % label)
|
||||
print("%s: floats to the finger, and returns to centre on release" % label)
|
||||
return true
|
||||
|
||||
|
||||
func _process(delta: float) -> bool:
|
||||
elapsed += delta
|
||||
if stage != 0:
|
||||
return false
|
||||
if elapsed < 0.2:
|
||||
return false
|
||||
stage = 1
|
||||
if not _check(main.get_node("UI/Joystick"), "movement stick"):
|
||||
return true
|
||||
if not _check(main.get_node("UI/FireStick"), "fire stick"):
|
||||
return true
|
||||
print("TEST_JOYSTICK_RECENTRES: PASS")
|
||||
quit(0)
|
||||
return true
|
||||
|
||||
|
||||
func _fail(message: String) -> bool:
|
||||
print("TEST_JOYSTICK_RECENTRES: FAIL (%s)" % message)
|
||||
quit(1)
|
||||
return false
|
||||
1
tests/test_joystick_recentres.gd.uid
Normal file
1
tests/test_joystick_recentres.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bk2jy7bvfm51b
|
||||
Loading…
Reference in a new issue