Fix alchemy tower

This commit is contained in:
2026-04-23 12:46:01 +02:00
parent a10f2f02d7
commit 0064e61389
35 changed files with 792 additions and 19 deletions

View File

@@ -150,7 +150,7 @@ func _ready() -> void:
# CURRENCY API
# ==============================================================================
## Returns the normalized ID from a Currency resource.
func get_currency_id(currency: Resource) -> StringName:
func get_currency_id(currency: Currency) -> StringName:
return _normalize_currency_id(currency.id if currency else &"")
## Parses and normalizes a currency ID from raw input (handles special cases like "gem" -> "gems").
@@ -193,7 +193,7 @@ func get_currency_icon(currency_id: StringName) -> Texture2D:
return null
## Adds currency from a Currency resource. Emits [signal currency_changed] on success.
func add_currency(currency: Resource, amount: BigNumber) -> void:
func add_currency(currency: Currency, amount: BigNumber) -> void:
var currency_id: StringName = get_currency_id(currency)
if currency_id == &"":
push_warning("Attempted to add currency with an invalid Currency resource.")
@@ -201,7 +201,7 @@ func add_currency(currency: Resource, amount: BigNumber) -> void:
add_currency_by_id(currency_id, amount)
## Spends currency from a Currency resource. Returns false if insufficient funds.
func spend_currency(currency: Resource, cost: BigNumber) -> bool:
func spend_currency(currency: Currency, cost: BigNumber) -> bool:
var currency_id: StringName = get_currency_id(currency)
if currency_id == &"":
push_warning("Attempted to spend currency with an invalid Currency resource.")
@@ -237,7 +237,7 @@ func spend_currency_by_id(currency_id: StringName, cost: BigNumber) -> bool:
return false
## Returns the current balance for a Currency resource.
func get_currency_amount(currency: Resource) -> BigNumber:
func get_currency_amount(currency: Currency) -> BigNumber:
return get_currency_amount_by_id(get_currency_id(currency))
## Returns the current balance for a currency ID.
@@ -245,7 +245,7 @@ func get_currency_amount_by_id(currency_id: StringName) -> BigNumber:
return _get_current_currency_ref(currency_id)
## Returns the total acquired this run for a Currency resource.
func get_total_currency_acquired(currency: Resource) -> BigNumber:
func get_total_currency_acquired(currency: Currency) -> BigNumber:
return get_total_currency_acquired_by_id(get_currency_id(currency))
## Returns the total acquired this run for a currency ID (resets on prestige).
@@ -253,7 +253,7 @@ func get_total_currency_acquired_by_id(currency_id: StringName) -> BigNumber:
return _get_total_currency_ref(currency_id)
## Returns the all-time total for a Currency resource.
func get_all_time_currency_acquired(currency: Resource) -> BigNumber:
func get_all_time_currency_acquired(currency: Currency) -> BigNumber:
return get_all_time_currency_acquired_by_id(get_currency_id(currency))
## Returns the all-time total for a currency ID (never resets).