Hover-inspect tooltip — what's under the cursor

Adds an InspectTooltip CanvasLayer that follows the mouse, samples the
tile under the cursor each frame, and renders a small dark panel with a
short description of whatever's there.

Per-entity describers cover the playable surface:
* Pawn: name + HP + mood + current job
* Tree / rock / big rock: progress %, "marked" tag if designated
* Wall: material + ghost/% if unbuilt
* Floor / door / torch: ghost vs complete state
* Bed: occupant or "available", medical tag
* Crate: full contents broken down by item type and count
* Workbench: label + active bills count
* Item on ground: type + stack size
* Corpse: deceased name + fresh/rotting/rotted state
* Wolf: HP + state
* Grave marker: deceased name
* Stockpile / graveyard zone: name + priority + accepted types

Layer 50 so the tooltip sits above the world but below modals (which
sit at 100+). process_mode = ALWAYS so hovering still works during
storyteller modals. Position auto-flips to the other side of the cursor
when it would overflow the viewport.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
megaproxy 2026-05-15 19:01:24 +01:00
parent d819c13a9d
commit ce61928a54
3 changed files with 365 additions and 0 deletions

View file

@ -132,6 +132,14 @@ func _ready() -> void:
alerts_log.name = "AlertsLog"
add_child(alerts_log)
# Inspect tooltip — hover any tile to see what's there (pawn / wall / bed
# / crate contents / tree progress / item stack / stockpile filter).
# Layer 50: above world, below modals (which sit at 100+).
var inspect := CanvasLayer.new()
inspect.set_script(preload("res://scenes/ui/inspect_tooltip.gd"))
inspect.name = "InspectTooltip"
add_child(inspect)
# Inject refs into TopBar and add Work + Log buttons to ButtonRow.
if top_bar != null:
top_bar.work_priority_matrix = work_matrix