diff --git a/scenes/ui/inspect_tooltip.gd b/scenes/ui/inspect_tooltip.gd index a369953..3a09e99 100644 --- a/scenes/ui/inspect_tooltip.gd +++ b/scenes/ui/inspect_tooltip.gd @@ -144,24 +144,39 @@ func _describe_tile(tile: Vector2i) -> String: elif r.get("tile") == tile: return _describe_rock(r) + # Trees anchor to the trunk tile (bottom) but visually rise up to 4 tiles + # above (canopy). Treat any hover within that vertical band as the tree. for t in World.trees: - if is_instance_valid(t) and t.get("tile") == tile: + if not is_instance_valid(t): + continue + var tt: Vector2i = t.get("tile") + if tile.x == tt.x and tile.y >= tt.y - 4 and tile.y <= tt.y: return _describe_tree(t) # Furniture / build sites at this tile (Wall, Floor, Door, Bed, Crate, # Workbench, Torch, GraveSlot all live in World.build_queue via _ready). + # Two-pass: above-ground furniture wins over floor, so hovering on a bed + # placed on a wood floor reports the bed, not the floor underneath. + var floor_hit = null for s in World.build_queue: if not is_instance_valid(s): continue - if s.get("tile") == tile: - var d := _describe_build_site(s) - if d != "": - return d - - # Items lying on the ground. + if s.get("tile") != tile: + continue + var path: String = s.get_script().resource_path if s.get_script() else "" + if "floor.gd" in path: + floor_hit = s + continue # remember it, but keep scanning for furniture on top + var d := _describe_build_site(s) + if d != "": + return d + # Items take priority over the bare floor too — a wood stack should show + # as "wood ×N", not as the floor it sits on. for it in World.items: if is_instance_valid(it) and it.get("tile") == tile: return _describe_item(it) + if floor_hit != null: + return _describe_build_site(floor_hit) # Grave markers (permanent, not in build_queue once converted). for gm in World.grave_markers: