Store resources in generic inventories

This commit is contained in:
Loïc Wisniewski 2026-08-14 20:32:58 +02:00
commit 1721edd123
24 changed files with 385 additions and 172 deletions

View file

@ -27,7 +27,7 @@ func _ready() -> void:
_destination_heading.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
add_child(_destination_heading)
for resource_type in GameState.RESOURCE_TYPES:
for resource_type in GameState.resource_types():
var colour: Color = GameState.resource_color(resource_type)
var glyph := ResourceGlyph.new()
glyph.resource_type = resource_type
@ -140,7 +140,7 @@ func set_destination(id: int, heading: String) -> void:
func refresh() -> void:
for resource_type in GameState.RESOURCE_TYPES:
for resource_type in GameState.resource_types():
var row: Dictionary = _rows.get(resource_type, {})
if row.is_empty():
continue
@ -169,7 +169,7 @@ func _layout() -> void:
var row_height: float = (size.y - HEADER_HEIGHT) / maxf(1.0, float(_rows.size()))
var row_index: int = 0
for resource_type in GameState.RESOURCE_TYPES:
for resource_type in GameState.resource_types():
var row: Dictionary = _rows[resource_type]
var y: float = HEADER_HEIGHT + float(row_index) * row_height
var glyph_size: float = minf(66.0, row_height * 0.23)