Fix generator behaviour after prestige

This commit is contained in:
2026-03-22 12:19:26 +01:00
parent c914b0c590
commit 726f2bb5a3
4 changed files with 18 additions and 9 deletions

View File

@@ -321,10 +321,10 @@ func get_external_save_data(section_key: StringName) -> Dictionary:
return {}
func reset_for_prestige(reset_total_currency: bool = false) -> void:
for currency_id in _collect_currency_ids_for_save():
func reset_for_prestige(reset_total_currency: bool = false, emit_currency_signals: bool = true) -> void:
var currency_ids: Array[StringName] = _collect_currency_ids_for_save()
for currency_id in currency_ids:
_set_current_currency(currency_id, BigNumber.from_float(0.0))
currency_changed.emit(currency_id, _get_current_currency_ref(currency_id))
if reset_total_currency:
_set_total_currency(currency_id, BigNumber.from_float(0.0))
@@ -332,6 +332,16 @@ func reset_for_prestige(reset_total_currency: bool = false) -> void:
generator_buff_levels.clear()
generator_buff_unlocked.clear()
if not emit_currency_signals:
return
for currency_id in currency_ids:
currency_changed.emit(currency_id, _get_current_currency_ref(currency_id))
func emit_currency_changed_for_all() -> void:
for currency_id in _collect_currency_ids_for_save():
currency_changed.emit(currency_id, _get_current_currency_ref(currency_id))
# ==========================================
# PERSISTENCE (Save/Load)
# ==========================================

View File

@@ -385,13 +385,13 @@ func _grants_click_while_hovering() -> bool:
return grants_click_while_hovering
func _get_prestige_multiplier() -> float:
var manager: Node = get_node_or_null("/root/PrestigeManager")
var manager: PrestigeManager = get_node_or_null("/root/PrestigeManager")
if manager == null:
return 1.0
if not manager.has_method("get_total_multiplier"):
if not manager.get_total_multiplier():
return 1.0
var raw_multiplier: Variant = manager.call("get_total_multiplier")
var raw_multiplier: Variant = manager.get_total_multiplier()
if raw_multiplier is float:
return maxf(raw_multiplier, 0.0)
if raw_multiplier is int:

View File

@@ -129,8 +129,9 @@ func perform_prestige() -> bool:
prestige_resets_count += 1
last_reset_time = Time.get_unix_time_from_system()
GameState.reset_for_prestige(true)
GameState.reset_for_prestige(true, false)
_reinitialize_generators_after_prestige_reset()
GameState.emit_currency_changed_for_all()
_initialize_run_tracking_from_current_state()
_save_state_to_game_state()
GameState.save_game()