TargetingShapeCast2D
AUTO-GENERATED FILE — DO NOT EDIT MANUALLY
Source: systems/grid_targeting/grid_positioner/targeting_shape_cast_2d.gd
Version: 5.0
class_name: TargetingShapeCast2D
extends: ShapeCast2D
Summary
Encapsulates ShapeCast2D-based targeting logic as a reusable component
Signals
(none)
Exports
debug_log_collisions- Local debug flag: can be toggled per-instance in editor or by code
Methods
resolve_gb_dependencies()- Resolve Grid Building dependencies (logger, targeting state)
_physics_process()- Physics process: continuously update targeting state based on ShapeCast2D collisions
update_target()- Update the GridTargetingState.target based on current collisions Skips automatic updates when manipulation is active (target set manually)
_log_collisions()- Log current collisions for diagnostics
_format_collision_layers()- Format collision mask as layer names or numbers
_promote_to_targetable_root()- 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. [param 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.