TargetHighlighter

AUTO-GENERATED FILE – DO NOT EDIT MANUALLY

When a target node is set on the build state, marks it by colors based on the settings of its Manipulatable node (or lack thereof)

Source File: addons/grid_building/components/target_highlighter.gd

Extends: GBSystemsComponent

Properties

  • Property: mode_state : [ModeState](./mode-state/)

  • Property: targeting_state : [GridTargetingState](./grid-targeting-state/) :

  • Property: manipulation_state : [ManipulationState](./manipulation-state/) :

  • Property: highlight_settings : [HighlightSettings](./highlight-settings/)

    Holds color settings for how a highlighted target should be displayed in the game world

  • Property: current_target : CanvasItem : - The currently highlighter target. When set to a new value, the old one’s modulate clears automatically

Public Methods

resolve_gb_dependencies

1
resolve_gb_dependencies(p_container : GBCompositionContainer) -> void

Resolves dependencies from the composition container. Sets up mode state, targeting state, manipulation state, and highlight settings.

p_container: GBCompositionContainer - Container with system dependencies and settings


set_movable_display

1
2
3
4
set_movable_display(
    p_target : CanvasItem,
    p_movable : bool
) -> Color

Sets a canvas item modulate to either the valid or invalid move color. Returns the new modulate color.

p_target: CanvasItem - Target canvas item to set modulate color on

p_movable: bool - Whether the target is movable (valid) or not (invalid)


set_demolish_display

1
2
3
4
set_demolish_display(
    p_target : CanvasItem,
    p_demolishable : bool
) -> Color

Sets a canvas item modulate to either the valid or invalid demolish color. Returns the new modulate color.

p_target: CanvasItem - Target canvas item to set modulate color on

p_demolishable: bool - Whether the target is demolishable (valid) or not (invalid)


set_build_preview_display

1
set_build_preview_display(p_target : CanvasItem) -> void

Setsthe color of a build preview to the preview color


set_info_display

1
set_info_display(p_target : CanvasItem) -> void

set_actionable_colors

1
set_actionable_colors(p_target : CanvasItem) -> Color

Sets the target modulate to colors based on current mode actionability. Changes color based on whether the target can be affected by the current mode’s action.

p_target: CanvasItem - Target canvas item to set actionable colors on


should_highlight

1
2
3
4
should_highlight(
    p_data : ManipulationData,
    p_target : CanvasItem
) -> bool

Checks if the highlighter should highlight the target based on manipulation data. Returns true if the target matches the manipulation data target.

p_data: ManipulationData - Current manipulation data to compare against

p_target: CanvasItem - Target canvas item to check for highlighting


is_locked

1
is_locked() -> bool

Returns true if the highlighter is locked by active manipulation state. A locked highlighter won’t respond to target changes until manipulation finishes.


get_runtime_issues

1
get_runtime_issues() -> Array[String]

Validates that all required dependencies are properly set. Returns true if all dependencies are valid, false otherwise.


Private Methods

_on_data_changed

1
_on_data_changed(p_manipulation : ManipulationData) -> void

Flags: private


_on_started

1
_on_started(p_data : ManipulationData) -> void

Flags: private

Move the modulate to the manipulation target and set the manipulation color


_on_canceled

1
_on_canceled(p_data : ManipulationData) -> void

Flags: private

Return the modulate to the highlighter and set the color to the default


_on_finished

1
_on_finished(p_data : ManipulationData) -> void

Flags: private


_on_target_changed

1
2
3
4
_on_target_changed(
    p_target : Node,
    p_old : Node
) -> void

Flags: private

Response for when the grid targeting state target changes


_on_mode_changed

1
_on_mode_changed(p_mode : GBEnums.Mode) -> void

Flags: private

Refresh colors when mode changes (e.g. MOVE -> DEMOLISH) for the same target


_is_preview_object

1
_is_preview_object(p_target: CanvasItem) -> bool

Flags: private

Check if the target is a preview object (has building_node script attached) Returns true if the target has the building_node script, indicating it’s a preview object