TargetHighlighter
Check if the target is...
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
Version: v5.0.0
Inherits: GBSystemsComponent
Source: target_highlighter.gd
Parsing: AST-based for maximum accuracy with symbol typing
Variables
mode_state: ModeState
Type: ModeState
targeting_state: GridTargetingState
Type: GridTargetingState
manipulation_state: ManipulationState
Type: ManipulationState
highlight_settings: HighlightSettings
world
Type: HighlightSettings
current_target: CanvasItem
The currently highlighter target. When set to a new value, the old one’s modulate clears automatically
Type: CanvasItem
Methods
resolve_gb_dependencies
Signature: resolve_gb_dependencies(p_container : GBCompositionContainer: Variant) -> void
p_container: GBCompositionContainer - Container with system dependencies and settings
Returns: void
Parameters:
p_container : GBCompositionContainer: Variant
set_movable_display
Signature: set_movable_display(p_target : CanvasItem: Variant, p_movable : bool: Variant) -> Color
p_movable: bool - Whether the target is movable (valid) or not (invalid)
Returns: Color
Parameters:
p_target : CanvasItem: Variantp_movable : bool: Variant
set_demolish_display
Signature: set_demolish_display(p_target : CanvasItem: Variant, p_demolishable : bool: Variant) -> Color
p_demolishable: bool - Whether the target is demolishable (valid) or not (invalid)
Returns: Color
Parameters:
p_target : CanvasItem: Variantp_demolishable : bool: Variant
set_build_preview_display
Signature: set_build_preview_display(p_target : CanvasItem: Variant) -> void
Setsthe color of a build preview to the preview color
Returns: void
Parameters:
p_target : CanvasItem: Variant
set_info_display
Signature: set_info_display(p_target : CanvasItem: Variant) -> void
Returns: void
Parameters:
p_target : CanvasItem: Variant
set_actionable_colors
Signature: set_actionable_colors(p_target : CanvasItem: Variant) -> Color
p_target: CanvasItem - Target canvas item to set actionable colors on
Returns: Color
Parameters:
p_target : CanvasItem: Variant
should_highlight
Signature: should_highlight(p_data : ManipulationData: Variant, p_target : CanvasItem: Variant) -> bool
p_target: CanvasItem - Target canvas item to check for highlighting
Returns: bool
Parameters:
p_data : ManipulationData: Variantp_target : CanvasItem: Variant
is_locked
Signature: is_locked() -> bool
A locked highlighter won’t respond to target changes until manipulation finishes.
Returns: bool
get_runtime_issues
Signature: get_runtime_issues() -> Array
Returns true if all dependencies are valid, false otherwise.
Returns: Array
_on_data_changed
Signature: _on_data_changed(p_manipulation : ManipulationData: Variant) -> void
Returns: void
Parameters:
p_manipulation : ManipulationData: Variant
_on_started
Signature: _on_started(p_data : ManipulationData: Variant) -> void
Move the modulate to the manipulation target and set the manipulation color
Returns: void
Parameters:
p_data : ManipulationData: Variant
_on_canceled
Signature: _on_canceled(p_data : ManipulationData: Variant) -> void
Return the modulate to the highlighter and set the color to the default
Returns: void
Parameters:
p_data : ManipulationData: Variant
_on_finished
Signature: _on_finished(p_data : ManipulationData: Variant) -> void
Returns: void
Parameters:
p_data : ManipulationData: Variant
_on_target_changed
Signature: _on_target_changed(p_target : Node: Variant, p_old : Node: Variant) -> void
Response for when the grid targeting state target changes
Returns: void
Parameters:
p_target : Node: Variantp_old : Node: Variant
_on_mode_changed
Signature: _on_mode_changed(p_mode : GBEnums.Mode: Variant) -> void
Refresh colors when mode changes (e.g. MOVE -> DEMOLISH) for the same target
Returns: void
Parameters:
p_mode : GBEnums.Mode: Variant
_is_preview_object
Signature: _is_preview_object(p_target: CanvasItem) -> bool
Returns true if the target has the building_node script, indicating it’s a preview object
Returns: bool
Parameters:
p_target: CanvasItem