TargetInformer
AUTO-GENERATED FILE – DO NOT EDIT MANUALLY
Display UI for showing information about objects being targeted, manipulated, or built
TargetInformer provides a dynamic UI component that displays object information based on the current game state. It responds to three different contexts with clear priority:
Priority System:
Manipulation (Highest Priority): Shows info for actively manipulated objects
Building: Shows info for building preview objects
Targeting (Lowest Priority): Shows info for hovered/targeted objects
Signal Flow:
GridTargetingState.target_changed→ Updates display on hoverManipulationState.active_target_node_changed→ Overrides targeting infoBuildingState.preview_changed→ Shows building preview info
Usage:
Override _to_string() on displayed object nodes to show custom names
Source File: addons/grid_building/ui/target_informer/target_informer.gd
Extends: GBControl
Exported Properties
- Property:
target: Node: - Property:
info_parent: Control
Private Properties
Property:
_building_state: [BuildingState](./building-state/):(private)Building state reference - connects to preview_changed signal.
When building preview changes, displays preview object information.
Property:
_manipulation_state: [ManipulationState](./manipulation-state/):(private)Manipulation state reference - connects to active_target_node_changed, started, and canceled signals.
Takes priority over targeting info when active manipulation exists.
Property:
_targeting_state: [GridTargetingState](./grid-targeting-state/):(private)Targeting state reference - connects to target_changed signal.
Displays info for any targeted object (hover). Lowest priority: overridden by manipulation/building.
Property:
_mode_state: [ModeState](./mode-state/):(private) - When set, will hide when the mode is off and show otherwise. Optional.Property:
_settings: [TargetInfoSettings](./target-info-settings/)(private)Property:
_name_label: Label(private)Property:
_position_label: Label(private)
Public Methods
resolve_gb_dependencies
Resolve dependencies from the composition container.
p_container: GBCompositionContainer - Container with states and configuration
clear
Clears all child controls from the info parent container.
refresh
Updates the target information display with current target data.
setup
add_info_label
Adds an information label to the info parent container. Creates a new label with the specified text and adds it to the UI.
p_text: String - Text to display in the label
track_manipulatable_target
Private Methods
_ready
Flags: private
Initialize the target informer display when ready.
_process
Flags: private
Update the target information display every frame.
_format_position
Flags: private
Formats a node’s global position for display. Uses the position format and decimal precision from settings.
p_target: Node - Node to format position for (must be Node2D or Node3D)
_on_manipulation_target_changed
Flags: private
_on_manipulation_started
Flags: private
_on_manipulation_finished
Flags: private
_on_manipulation_canceled
Flags: private
_on_target_tree_exiting
Flags: private
_on_building_preview_changed
Flags: private
_on_mode_changed
Flags: private
_on_targeting_target_changed
Flags: private
Handle targeting state changes - shows info for any targeted object (hover).
Priority Logic: If manipulation is active (active_target_node != null) or building preview is active (preview != null), this handler returns early without updating the display. This ensures manipulation and building preview info takes precedence over targeting info.
p_new: Node2D - Newly targeted node (can be null)
_p_old: Node2D - Previously targeted node (unused)