Provision transporters with hubs
This commit is contained in:
parent
663648d949
commit
d0a9f5b971
21 changed files with 309 additions and 588 deletions
|
|
@ -62,22 +62,18 @@ const VESSEL_DEFINITIONS = preload("res://VesselDefinitions.gd")
|
|||
@onready var hangar_available_slots: Array = [
|
||||
get_node("../UI/HangarMenu/AvailableInterceptor"),
|
||||
get_node("../UI/HangarMenu/AvailableShield"),
|
||||
get_node("../UI/HangarMenu/AvailableTransporter"),
|
||||
]
|
||||
@onready var hangar_available_labels: Array = [
|
||||
get_node("../UI/HangarMenu/AvailableInterceptorLabel"),
|
||||
get_node("../UI/HangarMenu/AvailableShieldLabel"),
|
||||
get_node("../UI/HangarMenu/AvailableTransporterLabel"),
|
||||
]
|
||||
@onready var hangar_fleet_slots: Array = [
|
||||
get_node("../UI/HangarMenu/FleetInterceptor"),
|
||||
get_node("../UI/HangarMenu/FleetShield"),
|
||||
get_node("../UI/HangarMenu/FleetTransporter"),
|
||||
]
|
||||
@onready var hangar_fleet_labels: Array = [
|
||||
get_node("../UI/HangarMenu/FleetInterceptorLabel"),
|
||||
get_node("../UI/HangarMenu/FleetShieldLabel"),
|
||||
get_node("../UI/HangarMenu/FleetTransporterLabel"),
|
||||
]
|
||||
var build_menu_entries: Array = []
|
||||
|
||||
|
|
@ -97,17 +93,15 @@ var lab_building_id: int = 0
|
|||
|
||||
@onready var craft_menu: Control = get_node("../UI/CraftMenu")
|
||||
@onready var craft_interceptor_button: IconButton = get_node("../UI/CraftMenu/InterceptorButton")
|
||||
@onready var craft_transporter_button: IconButton = get_node("../UI/CraftMenu/TransporterButton")
|
||||
@onready var craft_close_button: IconButton = get_node("../UI/CraftMenu/CloseButton")
|
||||
@onready var craft_status: Label = get_node("../UI/CraftMenu/StatusLabel")
|
||||
@onready var craft_interceptor_label: Label = get_node("../UI/CraftMenu/InterceptorLabel")
|
||||
@onready var craft_transporter_label: Label = get_node("../UI/CraftMenu/TransporterLabel")
|
||||
@onready var craft_shield_label: Label = get_node("../UI/CraftMenu/ShieldLabel")
|
||||
@onready var craft_vessel_buttons: Array = [
|
||||
craft_interceptor_button, craft_shield_button, craft_transporter_button,
|
||||
craft_interceptor_button, craft_shield_button,
|
||||
]
|
||||
@onready var craft_vessel_labels: Array = [
|
||||
craft_interceptor_label, craft_shield_label, craft_transporter_label,
|
||||
craft_interceptor_label, craft_shield_label,
|
||||
]
|
||||
|
||||
# --- the transfer panel (#24) ---------------------------------------------
|
||||
|
|
@ -187,8 +181,8 @@ func _ready() -> void:
|
|||
action_button.pressed.connect(_on_context_action_pressed)
|
||||
building_action_button.pressed.connect(_on_action_pressed)
|
||||
|
||||
for i in range(mini(craft_vessel_buttons.size(), VESSEL_DEFINITIONS.all().size())):
|
||||
var definition: Resource = VESSEL_DEFINITIONS.all()[i]
|
||||
for i in range(mini(craft_vessel_buttons.size(), VESSEL_DEFINITIONS.fleet().size())):
|
||||
var definition: Resource = VESSEL_DEFINITIONS.fleet()[i]
|
||||
craft_vessel_buttons[i].pressed.connect(_on_craft_vessel.bind(definition.definition_id))
|
||||
craft_close_button.pressed.connect(func(): craft_menu.visible = false)
|
||||
|
||||
|
|
@ -734,7 +728,7 @@ func _refresh_craft_status() -> void:
|
|||
# intentionally reserved for the shared resource bar and a short action
|
||||
# message; repeating fleet, queue and transport counts here buried the UI.
|
||||
craft_status.text = ""
|
||||
var definitions: Array = VESSEL_DEFINITIONS.all()
|
||||
var definitions: Array = VESSEL_DEFINITIONS.fleet()
|
||||
for i in range(mini(definitions.size(), craft_vessel_buttons.size())):
|
||||
var definition: Resource = definitions[i]
|
||||
var button: IconButton = craft_vessel_buttons[i]
|
||||
|
|
@ -742,9 +736,6 @@ func _refresh_craft_status() -> void:
|
|||
button.icon = definition.icon
|
||||
button.glow_color = definition.glow_color
|
||||
button.enabled = GameState.vessel_is_unlocked(definition.definition_id)
|
||||
if definition.has_capability("transport"):
|
||||
button.enabled = button.enabled and GameState.has_transport_hub() \
|
||||
and GameState.can_station_transporter()
|
||||
button.queue_redraw()
|
||||
_refresh_queue()
|
||||
if craft_message != "":
|
||||
|
|
@ -768,11 +759,6 @@ func _on_craft_vessel(vessel: String) -> void:
|
|||
if not GameState.queue_order(craft_building_id, vessel):
|
||||
if not GameState.vessel_is_unlocked(vessel):
|
||||
_say("%s must be unlocked at a ship lab first" % definition.display_name)
|
||||
elif definition.has_capability("transport") and not GameState.has_transport_hub():
|
||||
_say("Build a Transport Hub first - a transporter needs somewhere to be stationed")
|
||||
elif definition.has_capability("transport"):
|
||||
_say("All %d berths are taken - build another hub, or research Freight Yards" %
|
||||
GameState.transport_capacity())
|
||||
return
|
||||
_report_order(vessel)
|
||||
|
||||
|
|
@ -787,10 +773,6 @@ func _report_order(product: String) -> void:
|
|||
_say("%s ordered - building now" % GameState.vessel_name(product))
|
||||
|
||||
|
||||
func _on_craft_transporter() -> void:
|
||||
_on_craft_vessel(GameState.VESSEL_TRANSPORTER)
|
||||
|
||||
|
||||
# --- ship lab (#5) --------------------------------------------------------
|
||||
|
||||
func _lab_options() -> Array:
|
||||
|
|
@ -1075,7 +1057,7 @@ func _on_hangar_store_type(index: int) -> void:
|
|||
|
||||
func _hangar_types() -> Array:
|
||||
var types: Array = []
|
||||
for definition in VESSEL_DEFINITIONS.all():
|
||||
for definition in VESSEL_DEFINITIONS.fleet():
|
||||
types.append(definition.definition_id)
|
||||
return types
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue