Transporter capacity per hub, and research to raise it

Forgejo #20, part 7 of #12 and the last of it. A hub stations
BASE_HUB_CAPACITY (2) transporters. Total berths are hubs x per-hub
capacity, so building another hub or researching "Freight Yards" both
raise it - which is the choice #12 asks the player to make.

Capacity follows the same shape as max_fleet_size() (sum a bonus over
`unlocked`) rather than being a second mechanism doing the same job, so
research applies to hubs already built, not only to ones placed
afterwards.

A queued-but-unbuilt transporter holds its berth. Without that a player
could order ten against two berths and only discover the problem when
they refused to appear. Ordering past the cap is refused outright, and
the two refusals - no hub at all, versus every berth taken - say which,
because "nothing happened" is exactly the bug reported against the
craft button.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Loïc Wisniewski 2026-08-11 19:43:55 +02:00
commit f19807618a
3 changed files with 214 additions and 4 deletions

View file

@ -457,12 +457,14 @@ func _refresh_craft_status() -> void:
var queued: int = GameState.pending_orders(craft_building_id)
var stock: int = GameState.building_stock(craft_building_id)
var queue_text: String = "" if queued == 0 else " Queued %d" % queued
craft_status.text = "Interceptor %d Transporter %d Here %d%s" % [
GameState.SHIP_COST, GameState.TRANSPORTER_COST, stock, queue_text
craft_status.text = "Interceptor %d Transporter %d Here %d%s Transporters %d/%d" % [
GameState.SHIP_COST, GameState.TRANSPORTER_COST, stock, queue_text,
GameState.transporters_claimed(), GameState.transport_capacity()
]
# Nowhere to station one means the order would be refused, so say so
# rather than letting the button look available and do nothing.
craft_transporter_button.enabled = GameState.has_transport_hub()
craft_transporter_button.enabled = GameState.has_transport_hub() \
and GameState.can_station_transporter()
craft_transporter_button.queue_redraw()
craft_store_label.text = "Store ore here\nHold %d" % GameState.fleet_cargo
@ -527,7 +529,12 @@ func _on_craft_transporter() -> void:
if craft_building_id == 0:
return
if not GameState.queue_order(craft_building_id, GameState.PRODUCT_TRANSPORTER):
craft_status.text = "Build a Transport Hub first - a transporter needs somewhere to be stationed"
# Two different refusals, and the player needs to know WHICH.
if not GameState.has_transport_hub():
craft_status.text = "Build a Transport Hub first - a transporter needs somewhere to be stationed"
else:
craft_status.text = "All %d berths are taken - build another hub, or research Freight Yards" % \
GameState.transport_capacity()
return
_refresh_craft_status()