Add manual extractor resource transfers

This commit is contained in:
Loïc Wisniewski 2026-08-14 22:21:01 +02:00
commit db0e6a0ec2
7 changed files with 180 additions and 14 deletions

View file

@ -15,6 +15,7 @@ const ALL_AMOUNT: int = 1 << 30
const AMOUNT_OPTIONS: Array[int] = [1, 5, 25, ALL_AMOUNT]
var building_id: int = 0
var extractor_index: int = -1
var _destination_heading: Label
var _rows: Dictionary = {}
@ -134,6 +135,15 @@ func _refresh_amount_controls(row: Dictionary) -> void:
func set_destination(id: int, heading: String) -> void:
building_id = id
extractor_index = -1
if _destination_heading != null:
_destination_heading.text = heading.to_upper()
refresh()
func set_extractor_destination(index: int, heading: String) -> void:
building_id = 0
extractor_index = index
if _destination_heading != null:
_destination_heading.text = heading.to_upper()
refresh()
@ -145,7 +155,8 @@ func refresh() -> void:
if row.is_empty():
continue
var fleet_amount: int = GameState.fleet_resource(resource_type)
var local_amount: int = GameState.building_resource(building_id, resource_type)
var local_amount: int = GameState.extractor_resource(extractor_index, resource_type) \
if extractor_index >= 0 else GameState.building_resource(building_id, resource_type)
row.fleet_amount.text = str(fleet_amount)
row.local_amount.text = str(local_amount)
row.unload.enabled = fleet_amount > 0