TargetingShapeCast2D

AUTO-GENERATED FILE – DO NOT EDIT MANUALLY

Encapsulates ShapeCast2D-based targeting logic as a reusable component

Source File: addons/grid_building/systems/grid_targeting/grid_positioner/targeting_shape_cast_2d.gd

Extends: ShapeCast2D

Exported Properties

  • Property: debug_log_collisions: bool = false - Local debug flag: can be toggled per-instance in editor or by code

Private Properties

  • Property: _logger: [GBLogger](./gb-logger/) = null (private) - GB dependencies (typed)
  • Property: _targeting_state: [GridTargetingState](./grid-targeting-state/) = null (private)

Public Methods

resolve_gb_dependencies

1
resolve_gb_dependencies(p_container: GBCompositionContainer) -> void

Resolve Grid Building dependencies (logger, targeting state)


update_target

1
update_target() -> void

Update the GridTargetingState.target based on current collisions Skips automatic updates when manipulation is active (target set manually)


Private Methods

_physics_process

1
_physics_process(_delta: float) -> void

Flags: private

Physics process: continuously update targeting state based on ShapeCast2D collisions


_log_collisions

1
_log_collisions() -> void

Flags: private

Log current collisions for diagnostics


_format_collision_layers

1
_format_collision_layers(mask: int) -> String

Flags: private

Format collision mask as layer names or numbers


_promote_to_targetable_root

1
_promote_to_targetable_root(raw: Object) -> Node2D

Flags: private

Promote a raw collider (which may be a child physics body) to its root Area2D if that root represents the intended gameplay target. This handles scenes like the Smithy where the visual/physics StaticBody2D is a child of an Area2D which carries the targetable layer. raw The collider returned by ShapeCast2D. [return] A Node2D to use as targeting root (prefer Area2D on targetable layer) or the original if no promotion needed.