Add currency database, cleanup legacy system

This commit is contained in:
2026-03-14 17:20:22 +01:00
parent 6da962a53d
commit 7b58c36414
20 changed files with 353 additions and 222 deletions

View File

@@ -1,7 +1,7 @@
class_name CurrencyTile
extends HBoxContainer
@export var currency: Resource = GameState.GOLD_CURRENCY
@export var currency: Resource
@onready var _icon: TextureRect = $CurrencyIcon
@onready var _label: Label = $Label
@@ -12,7 +12,10 @@ var _currency_id: StringName = &""
func _ready() -> void:
if currency == null:
currency = GameState.GOLD_CURRENCY
currency = CurrencyDatabase.get_currency_resource(GameState.GOLD_CURRENCY_ID)
if currency == null:
push_warning("CurrencyTile '%s' has no currency configured." % String(name))
return
_currency_id = GameState.get_currency_id(currency)
_label.text = "%s:" % GameState.get_currency_name(_currency_id)