The loose end from #24. withdraw_to_fleet, unload_into_building and deliver_cargo were the old one-way moves behind "Load ore" and "Store ore here"; every one of them is a special case of transfer_to_building / transfer_to_fleet, and none had a caller left outside tests. The cargo_delivered signal had no listeners at all. Not just tidying: unload_into_building routed through deposit_to_building, which does NOT special-case the mothership - it writes b.stock, while building_holdings() returns `rocks` for a mothership and ignores stock entirely. So unload_into_building( mothership_id) would have parked ore in a field nothing reads, with no error. Nothing called it that way, but it is a plausibly-named function sitting there to be reached for later. transfer_to_building handles it. CARGO_LOAD_BATCH stays - the transfer menu's batch buttons use it; only its role as withdraw_to_fleet's default argument is gone. The #24 note expected folding these in to be costly for test_cargo_readout, which places no buildings. It is not: the transfer primitives work off GameState records rather than spawned nodes, so a single add_building() in setup is enough and it stays a display test. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
32 lines
1.2 KiB
GDScript
32 lines
1.2 KiB
GDScript
extends Node2D
|
|
|
|
# Preview, not a test. The ship lab's upgrade screen (#5), so its layout can
|
|
# be checked on a real viewport - headless draws no pixels.
|
|
#
|
|
# bash tests/screenshot.sh res://tests/_lab_menu_preview.tscn /tmp/lab.png 20 720x1280
|
|
|
|
|
|
func _ready() -> void:
|
|
GameState.buildings.clear()
|
|
GameState.extractors.clear()
|
|
GameState.transporters.clear()
|
|
GameState.reset_progression()
|
|
GameState.rocks = 240
|
|
GameState.unlocked = ["shipyards", "vessel_science"]
|
|
var main: Node = load("res://Main.tscn").instantiate()
|
|
add_child(main)
|
|
main.get_node("BuildingField").place(GameState.BUILDING_SHIP_LAB, Vector2(400.0, 0.0))
|
|
var lab_id: int = int(GameState.buildings[-1].id)
|
|
GameState.deposit_to_building(lab_id, 18)
|
|
GameState.fleet_cargo = 12
|
|
# A level already bought, so the list shows both a researched and an
|
|
# unresearched line rather than a uniform page of zeroes.
|
|
GameState.vessel_levels["int_damage"] = 1
|
|
var bc: Node = main.get_node("BuildController")
|
|
# The shared header (#24) hides its HERE column when it has no building,
|
|
# so bind it the way opening the panel from the building does.
|
|
for bar in bc.resource_bars:
|
|
bar.building_id = lab_id
|
|
main.get_node("UI/LabMenu").visible = true
|
|
bc.lab_vessel = GameState.VESSEL_INTERCEPTOR
|
|
bc._refresh_lab()
|