Offer only orderable vessels, and read out crew condition
A ship crafter shows what can actually be ordered there: a hull whose research is done, and - for the support craft - one with somewhere to be assigned. A transporter with no hub and a drone with no workshop have nowhere to go and would sit in the hangar as spent resources, so the structure that uses one is part of its availability. Hidden rather than greyed, as the build menu already treats an unresearched structure, and gated in queue_order() too so the model refuses what the menu declines to show. The craft buttons bound their handlers to a definition captured at startup. With a list that changes length that is a live bug - a slot would order whatever hull was there when the menu was built - so they bind to the slot and resolve through the current offer. The hub and workshop crew menus now NAME what is left in each vessel: "TRANSPORTER 2 9 / 20 RUNS", worst first, with one wide bar for the vessel closest to spent. The per-vessel bars they replaced drew about seven pixels tall on a phone and carried no figure, so the number the player is deciding on could not be read. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019AJMdB7iuHuLFZM1aBu3GD
This commit is contained in:
parent
fe3ae97f94
commit
296b49c8b8
10 changed files with 359 additions and 41 deletions
|
|
@ -1683,6 +1683,27 @@ func vessel_is_fleet_eligible(vessel: String) -> bool:
|
|||
return definition != null and definition.fleet_eligible
|
||||
|
||||
|
||||
# What a ship crafter can actually be asked for right now. #216 made support
|
||||
# craft orderable at all; this is the narrower question of whether THIS one
|
||||
# can be ordered today.
|
||||
#
|
||||
# A support vessel is only worth building once there is somewhere to put it:
|
||||
# a transporter with no hub and a repair drone with no workshop have nowhere
|
||||
# to be assigned, so they would sit in the hangar as spent resources. The
|
||||
# structure that uses one is therefore part of its availability, the same way
|
||||
# research is for a fleet hull.
|
||||
func vessel_can_be_crafted(vessel: String) -> bool:
|
||||
var definition: Resource = vessel_definition(vessel)
|
||||
if definition == null or not vessel_is_unlocked(vessel):
|
||||
return false
|
||||
if not (definition.fleet_eligible or definition.support_craftable):
|
||||
return false
|
||||
match vessel:
|
||||
VESSEL_TRANSPORTER: return hub_count() > 0
|
||||
REPAIR_DRONE: return has_workshop()
|
||||
return true
|
||||
|
||||
|
||||
func vessel_is_unlocked(vessel: String) -> bool:
|
||||
var definition: Resource = vessel_definition(vessel)
|
||||
if definition == null:
|
||||
|
|
@ -1981,11 +2002,7 @@ func queue_order(id: int, product: String = PRODUCT_SHIP) -> bool:
|
|||
var b: Dictionary = find_building(id)
|
||||
if b.is_empty() or not can_produce(b.type):
|
||||
return false
|
||||
var definition: Resource = vessel_definition(product)
|
||||
# #216: support craft are orderable here too. They never join the fleet,
|
||||
# so "can the crafter make it" is its own question now.
|
||||
if definition == null or not vessel_is_unlocked(product) \
|
||||
or not (definition.fleet_eligible or definition.support_craftable):
|
||||
if not vessel_can_be_crafted(product):
|
||||
return false
|
||||
(b.orders as Array).append({"product": product, "elapsed": 0.0, "started": false})
|
||||
return true
|
||||
|
|
|
|||
Loading…
Reference in a new issue