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:

  1. Manipulation (Highest Priority): Shows info for actively manipulated objects

  2. Building: Shows info for building preview objects

  3. Targeting (Lowest Priority): Shows info for hovered/targeted objects

Signal Flow:

  • GridTargetingState.target_changed → Updates display on hover

  • ManipulationState.active_target_node_changed → Overrides targeting info

  • BuildingState.preview_changed → Shows building preview info

Usage:

1
2
3
4
var informer = TargetInformer.new()
add_child(informer)
informer.resolve_gb_dependencies(composition_container)
Now responds automatically to targeting/manipulation/building changes

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

1
resolve_gb_dependencies(p_container: GBCompositionContainer) -> void

Resolve dependencies from the composition container.

p_container: GBCompositionContainer - Container with states and configuration


clear

1
clear() -> void

Clears all child controls from the info parent container.


refresh

1
refresh() -> void

Updates the target information display with current target data.


setup

1
setup() -> void

add_info_label

1
add_info_label(p_text: String) -> 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

1
track_manipulatable_target() -> void

Private Methods

_ready

1
_ready() -> void

Flags: private

Initialize the target informer display when ready.


_process

1
_process(delta: float) -> void

Flags: private

Update the target information display every frame.


_format_position

1
_format_position(p_target: Node) -> String

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

1
_on_manipulation_target_changed(p_target: Manipulatable) -> void

Flags: private


_on_manipulation_started

1
_on_manipulation_started(p_data: ManipulationData) -> void

Flags: private


_on_manipulation_finished

1
_on_manipulation_finished(_p_data: ManipulationData) -> void

Flags: private


_on_manipulation_canceled

1
_on_manipulation_canceled(_p_data: ManipulationData) -> void

Flags: private


_on_target_tree_exiting

1
_on_target_tree_exiting() -> void

Flags: private


_on_building_preview_changed

1
_on_building_preview_changed(p_preview: Node) -> void

Flags: private


_on_mode_changed

1
_on_mode_changed(p_mode: GBEnums.Mode)

Flags: private


_on_targeting_target_changed

1
2
3
4
_on_targeting_target_changed(
    p_new: Node2D,
    _p_old: Node2D
) -> void

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)