From 353de811f67b0e3d3f0ac86510bae95818a0e34c Mon Sep 17 00:00:00 2001 From: dingo Date: Wed, 17 Dec 2025 07:53:14 -0500 Subject: [PATCH] Fixing Loot and Dungeon Clear --- scenes/ui/hud.tscn | 6 +++--- scripts/ui/hud.gd | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/scenes/ui/hud.tscn b/scenes/ui/hud.tscn index 51dfa33..2c78d86 100644 --- a/scenes/ui/hud.tscn +++ b/scenes/ui/hud.tscn @@ -13,7 +13,6 @@ bg_color = Color(1, 0.77254903, 0.11764706, 1) [node name="Hud" type="CanvasLayer"] layer = 5 -visible = false script = ExtResource("1_hud") [node name="TopLeft" type="Control" parent="."] @@ -146,8 +145,9 @@ stretch_mode = 5 [node name="EventLog" type="VBoxContainer" parent="TopRight"] layout_mode = 0 -offset_right = 40.0 -offset_bottom = 40.0 +offset_top = 134.0 +offset_right = 125.0 +offset_bottom = 434.0 [node name="BottomCenter" type="Control" parent="."] layout_mode = 3 diff --git a/scripts/ui/hud.gd b/scripts/ui/hud.gd index 181412f..1914adb 100644 --- a/scripts/ui/hud.gd +++ b/scripts/ui/hud.gd @@ -235,10 +235,25 @@ func _get_rarity_color(rarity: String) -> Color: "legendary": return Color(0.95, 0.61, 0.07) _: return Color.WHITE -func add_log_entry(test: String, color: Color): +func add_log_entry(text: String, color: Color): + if not event_log: + print("[HUD] No event_log found for loot display!") + return + var label = RichTextLabel.new() label.bbcode_enabled = true label.fit_content = true label.scroll_active = false + label.text = "[color=#%s]%s[/color]" % [color.to_html(false), text] event_log.add_child(label) + # Auto-remove after 5 seconds + var timer = get_tree().create_timer(5.0) + timer.timeout.connect(func(): + if is_instance_valid(label): + label.queue_free() + ) + + # Keep log from getting too long + while event_log.get_child_count() > 10: + event_log.get_child(0).queue_free()