Grid Placement

TargetInformer

AUTO-GENERATED FILE — DO NOT EDIT MANUALLY

Source: ui/target_informer/target_informer.gd

Version: 5.0

class_name: TargetInformer extends: GBControl

Summary

Display UI for showing information about objects being targeted, manipulated, or built [br][br] 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:[br] [br] [b]Priority System:[/b][br]

  1. [b]Manipulation[/b] (Highest Priority): Shows info for actively manipulated objects[br]
  2. [b]Building[/b]: Shows info for building preview objects[br]
  3. [b]Targeting[/b] (Lowest Priority): Shows info for hovered/targeted objects[br] [br] [b]Signal Flow:[/b][br]
  • [code]GridTargetingState.target_changed[/code] → Updates display on hover[br]
  • [code]ManipulationState.active_target_node_changed[/code] → Overrides targeting info[br]
  • [code]BuildingState.preview_changed[/code] → Shows building preview info[br] [br] [b]Usage:[/b][br] [codeblock] var informer = TargetInformer.new() add_child(informer) informer.resolve_gb_dependencies(composition_container)

Now responds automatically to targeting/manipulation/building changes

[/codeblock] [br] Override [code]_to_string()[/code] on displayed object nodes to show custom names

Signals

(none)

Exports

  • target
  • info_parent

Methods

  • _ready()
    • Initialize the target informer display when ready.
  • _process()
    • Update the target information display every frame.
  • resolve_gb_dependencies()
    • Resolve dependencies from the composition container.[br][br] [code]p_container[/code]: [i]GBCompositionContainer[/i] - 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.[br][br] [code]p_text[/code]: [i]String[/i] - Text to display in the label
  • track_manipulatable_target()
  • _format_position()
    • Formats a node’s global position for display. Uses the position format and decimal precision from settings.[br][br] [code]p_target[/code]: [i]Node[/i] - Node to format position for (must be Node2D or Node3D)
  • _on_manipulation_target_changed()
  • _on_manipulation_started()
  • _on_manipulation_finished()
  • _on_manipulation_canceled()
  • _on_target_tree_exiting()
  • _on_building_preview_changed()
  • _on_mode_changed()
  • _on_targeting_target_changed()
    • Handle targeting state changes - shows info for any targeted object (hover).[br] [br] [b]Priority Logic:[/b] 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.[br] [br] [code]p_new[/code]: [i]Node2D[/i] - Newly targeted node (can be null)[br] [code]_p_old[/code]: [i]Node2D[/i] - Previously targeted node (unused)