-
Notifications
You must be signed in to change notification settings - Fork 15
Tooltip API
Oen44 edited this page Jun 5, 2026
·
6 revisions
Displays a tooltip for an item when hovered over.
Shows item name, description, stats, etc. Supports an “advanced” mode toggle via a configured shortcut, and can optionally show a side-by-side comparison panel for the currently equipped item in the same slot type.
hbox_container: HBoxContainer # Root container holding the current/equipped tooltip panels.container_current: Control # Container where the current (hovered) item tooltip lines are added.margin_container_current: MarginContainer # Margin container used for sizing the current item panel.equipped_panel: Control # Panel shown/hidden when an equipped comparison item exists.container_equipped: Control # Container where the equipped item tooltip lines are added.margin_container_equipped: MarginContainer # Margin container used for sizing the equipped item panel.max_width: int # Maximum tooltip width (used by sizing logic elsewhere, e.g. reset_size()).default_label: PackedScene # Default label scene used by add_line when no custom label_path is provided.advanced_shortcut: Shortcut # Shortcut used to toggle advanced tooltip mode.show_advanced: bool # Whether advanced tooltip mode is enabled (toggled by advanced_shortcut).sections: Array[TooltipSection] # Ordered list of tooltip sections used to build the tooltip contents.## Hides the tooltip and equipped comparison panel, clearing the current item reference.
close() -> void## Shows and populates the tooltip for the given InventoryItem and (if applicable) the currently equipped comparison item.
inspect(inventory_item: InventoryItem) -> void## Positions the tooltip near the hovered item while clamping within the viewport, and orders the equipped panel based on side.
display(rect: Rect2) -> void## Adds a single label line to whichever panel is currently being built (current vs equipped).
add_line(text: String, label_path: String = "") -> void## Adds a small vertical spacer to whichever panel is currently being built (current vs equipped).
add_spacer() -> void## Returns true if this section should be shown for the given item.
applies_to(_item: Item) -> bool## Appends this section's content to the tooltip for the given item.
append(_item: Item, _tooltip: ItemTooltip) -> void