Light fix... again

This commit is contained in:
2026-03-10 11:30:56 -04:00
parent a137d565a8
commit efd6ca2fa5
4 changed files with 23 additions and 5 deletions
+10
View File
@@ -51,6 +51,7 @@ var shield_projector: bool = false
func _ready() -> void:
EventBus.body_part_equipped.connect(_on_part_equipped)
EventBus.save_loaded.connect(_on_save_loaded)
recalculate()
if RunManager.player_health_carry > 0.0:
current_health = minf(RunManager.player_health_carry, max_health)
@@ -58,6 +59,15 @@ func _ready() -> void:
else:
current_health = max_health # fresh run — start at full HP
func _on_save_loaded() -> void:
var old_max := max_health
recalculate()
# Grant bonus HP from body parts on fresh start
if RunManager.player_health_carry < 0.0 and max_health > old_max:
current_health += (max_health - old_max)
current_health = minf(current_health, max_health)
EventBus.player_health_changed.emit(current_health, max_health)
func recalculate() -> void:
speed = BASE_SPEED + UpgradeManager.get_stat_modifier("speed")
max_health = BASE_MAX_HEALTH + UpgradeManager.get_stat_modifier("max_health")