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 {} return {}
func reset_for_prestige(reset_total_currency: bool = false) -> void: func reset_for_prestige(reset_total_currency: bool = false, emit_currency_signals: bool = true) -> void:
for currency_id in _collect_currency_ids_for_save(): 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)) _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: if reset_total_currency:
_set_total_currency(currency_id, BigNumber.from_float(0.0)) _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_levels.clear()
generator_buff_unlocked.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) # PERSISTENCE (Save/Load)
# ========================================== # ==========================================

View File

@@ -385,13 +385,13 @@ func _grants_click_while_hovering() -> bool:
return grants_click_while_hovering return grants_click_while_hovering
func _get_prestige_multiplier() -> float: 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: if manager == null:
return 1.0 return 1.0
if not manager.has_method("get_total_multiplier"): if not manager.get_total_multiplier():
return 1.0 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: if raw_multiplier is float:
return maxf(raw_multiplier, 0.0) return maxf(raw_multiplier, 0.0)
if raw_multiplier is int: if raw_multiplier is int:

View File

@@ -129,8 +129,9 @@ func perform_prestige() -> bool:
prestige_resets_count += 1 prestige_resets_count += 1
last_reset_time = Time.get_unix_time_from_system() 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() _reinitialize_generators_after_prestige_reset()
GameState.emit_currency_changed_for_all()
_initialize_run_tracking_from_current_state() _initialize_run_tracking_from_current_state()
_save_state_to_game_state() _save_state_to_game_state()
GameState.save_game() GameState.save_game()

View File

@@ -5,14 +5,12 @@
[ext_resource type="Resource" uid="uid://ceugcxmassmpk" path="res://idles/buffs/orb_auto_flux.tres" id="2_x505b"] [ext_resource type="Resource" uid="uid://ceugcxmassmpk" path="res://idles/buffs/orb_auto_flux.tres" id="2_x505b"]
[ext_resource type="Resource" uid="uid://6i3fcygusuqf" path="res://idles/buffs/orb_click_focus.tres" id="3_fsxdm"] [ext_resource type="Resource" uid="uid://6i3fcygusuqf" path="res://idles/buffs/orb_click_focus.tres" id="3_fsxdm"]
[ext_resource type="Resource" uid="uid://brqaojindcxa5" path="res://idles/currencies/magic.tres" id="4_jpwus"] [ext_resource type="Resource" uid="uid://brqaojindcxa5" path="res://idles/currencies/magic.tres" id="4_jpwus"]
[ext_resource type="Resource" uid="uid://qyxct5gbrxwa" path="res://idles/goals/magic_total_30.tres" id="6_5v0af"]
[resource] [resource]
script = ExtResource("1_c6y77") script = ExtResource("1_c6y77")
id = &"Magic" id = &"Magic"
name = "Magic Orb" name = "Magic Orb"
purchase_currency = ExtResource("4_jpwus") purchase_currency = ExtResource("4_jpwus")
unlock_goal = ExtResource("6_5v0af")
initial_cost = 200.0 initial_cost = 200.0
initial_productivity = 20.0 initial_productivity = 20.0
buffs = Array[ExtResource("1_t6lg0")]([ExtResource("2_x505b"), ExtResource("3_fsxdm")]) buffs = Array[ExtResource("1_t6lg0")]([ExtResource("2_x505b"), ExtResource("3_fsxdm")])