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
+5
View File
@@ -1,5 +1,10 @@
extends Node extends Node
# ---------------------------------------------------------------------------
# Save System
# ---------------------------------------------------------------------------
signal save_loaded
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Player / Run lifecycle # Player / Run lifecycle
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
+1
View File
@@ -22,6 +22,7 @@ func _ready() -> void:
func _load_game() -> void: func _load_game() -> void:
SaveManager.load_save() SaveManager.load_save()
EventBus.save_loaded.emit()
func change_state(new_state: GameState) -> void: func change_state(new_state: GameState) -> void:
_previous_state = current_state _previous_state = current_state
+10
View File
@@ -51,6 +51,7 @@ var shield_projector: bool = false
func _ready() -> void: func _ready() -> void:
EventBus.body_part_equipped.connect(_on_part_equipped) EventBus.body_part_equipped.connect(_on_part_equipped)
EventBus.save_loaded.connect(_on_save_loaded)
recalculate() recalculate()
if RunManager.player_health_carry > 0.0: if RunManager.player_health_carry > 0.0:
current_health = minf(RunManager.player_health_carry, max_health) current_health = minf(RunManager.player_health_carry, max_health)
@@ -58,6 +59,15 @@ func _ready() -> void:
else: else:
current_health = max_health # fresh run — start at full HP 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: func recalculate() -> void:
speed = BASE_SPEED + UpgradeManager.get_stat_modifier("speed") speed = BASE_SPEED + UpgradeManager.get_stat_modifier("speed")
max_health = BASE_MAX_HEALTH + UpgradeManager.get_stat_modifier("max_health") max_health = BASE_MAX_HEALTH + UpgradeManager.get_stat_modifier("max_health")
+7 -5
View File
@@ -9,10 +9,11 @@ const INDICATOR_SIZE := 10.0
const INDICATOR_OFFSET := 20.0 # distance above door const INDICATOR_OFFSET := 20.0 # distance above door
# Indicator light colors - only for special rooms, matching floor colors but brighter # Indicator light colors - only for special rooms, matching floor colors but brighter
# Keys are int values to match what get_room_type_at() returns
const INDICATOR_COLORS := { const INDICATOR_COLORS := {
RoomData.RoomType.ITEM: Color(0.2, 0.45, 0.2), # green 2: Color(0.2, 0.45, 0.2), # ITEM = green
RoomData.RoomType.SHOP: Color(0.9, 0.75, 0.1), # yellow 3: Color(0.9, 0.75, 0.1), # SHOP = yellow
RoomData.RoomType.BOSS: Color(0.7, 0.15, 0.15), # red 4: Color(0.7, 0.15, 0.15), # BOSS = red
} }
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@@ -70,7 +71,8 @@ func _build_barrier() -> void:
func _build_indicator() -> void: func _build_indicator() -> void:
# Only show indicators for special rooms (ITEM, SHOP, BOSS) # Only show indicators for special rooms (ITEM, SHOP, BOSS)
if not INDICATOR_COLORS.has(adjacent_room_type): var type_id := int(adjacent_room_type)
if not INDICATOR_COLORS.has(type_id):
return return
_indicator = Polygon2D.new() _indicator = Polygon2D.new()
@@ -91,7 +93,7 @@ func _build_indicator() -> void:
"right": offset = Vector2(door_size.x / 2.0 + INDICATOR_OFFSET, 0) "right": offset = Vector2(door_size.x / 2.0 + INDICATOR_OFFSET, 0)
_indicator.position = offset _indicator.position = offset
_indicator.color = INDICATOR_COLORS[adjacent_room_type] _indicator.color = INDICATOR_COLORS[type_id]
add_child(_indicator) add_child(_indicator)