Remove the one-way ore API superseded by the transfer menu
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>
This commit is contained in:
parent
fe1c721d64
commit
b6427b080d
27 changed files with 1085 additions and 275 deletions
|
|
@ -11,33 +11,20 @@ extends Node2D
|
|||
|
||||
var building_scene: PackedScene = preload("res://Building.tscn")
|
||||
var spawned: Array = []
|
||||
# Whether the fleet was already standing on the mothership last frame - see
|
||||
# the edge-triggered delivery in _process().
|
||||
var _was_on_mothership: bool = false
|
||||
|
||||
# Nothing happens here per frame any more. Arriving at the mothership used to
|
||||
# bank the fleet's hold automatically (#14), edge-triggered so that ore
|
||||
# withdrawn while parked was not instantly taken back. #24 removes it
|
||||
# entirely: unloading is now an explicit move in the transfer menu, in both
|
||||
# directions and at every building, so an automatic one-way exception at the
|
||||
# mothership was the odd case out - and it silently overrode a player who had
|
||||
# just loaded the hold in order to carry ore somewhere else.
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
rebuild_all()
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
# Unloading the fleet's hold (#14). Done here because this is the node
|
||||
# that already knows where the buildings are and already answers "is the
|
||||
# fleet standing on one?" - and it uses the fleet CENTROID, the same
|
||||
# stable single-number test Planet and Building already use, rather than
|
||||
# per-ship collision that flickers as ships jostle in formation.
|
||||
# EDGE-triggered on arrival, not continuous. Delivering every frame the
|
||||
# fleet is parked on the mothership would make withdrawing impossible:
|
||||
# ore loaded into the hold at the mothership (#17) would be banked again
|
||||
# the very next frame, and the button would look broken.
|
||||
var under: Node2D = get_building_fleet_is_on()
|
||||
var on_mothership: bool = under != null \
|
||||
and under.building_type == GameState.BUILDING_MOTHERSHIP
|
||||
if on_mothership and not _was_on_mothership and GameState.fleet_cargo > 0:
|
||||
GameState.deliver_cargo()
|
||||
_was_on_mothership = on_mothership
|
||||
|
||||
|
||||
func rebuild_all() -> void:
|
||||
for b in spawned:
|
||||
if is_instance_valid(b):
|
||||
|
|
|
|||
Loading…
Reference in a new issue