GridPositionerLogic
AUTO-GENERATED FILE – DO NOT EDIT MANUALLY
Static utility class for GridPositioner logic (visibility and decision helpers).
Source File: addons/grid_building/systems/grid_targeting/grid_positioner/grid_positioner_logic.gd
Extends: RefCounted
Constants
- Constant:
ProjectionMethod = GBEnums.ProjectionMethod - Constant:
RecenterDecision = {
Public Methods
proj_method_to_string
Flags: static
should_be_visible
Flags: static
Computes whether the positioner should be visible based on mode and settings.
Visibility is determined by the following priority order:
- Mode-based visibility: OFF mode respects
remain_active_in_off_mode, INFO mode is always hidden - Recent allowed input: If mouse input was recently allowed, show positioner
- Cached mouse world override: If mouse world position exists and mouse input enabled, show positioner (overrides hide_on_handled)
- Hide on handled: If mouse input enabled + hide_on_handled=true + input blocked, hide positioner
- Default: Show positioner for active modes (BUILD, MOVE, etc.)
Hide on handled behavior:
- Only applies when
targeting_settings.enable_mouse_inputistrue - When mouse input is disabled,
hide_on_handledsetting is ignored - Cached mouse world position takes precedence over hide_on_handled logic
mode The current building mode (GBEnums.Mode)
targeting_settings The targeting settings object
last_mouse_input_status Dictionary with last mouse input gate status
has_mouse_world Whether cached mouse world position exists
[return] True if the positioner should be visible
should_be_visible_for_mode
Flags: static
Computes visibility for a specific mode value.
mode The mode to check
targeting_settings The targeting settings
[return] True if visible in this mode
is_positioner_active
Flags: static
Returns whether the positioner is considered active for the given mode/settings.
is_mouse_follow_allowed
Flags: static
Mouse follow allowed gate
visibility_decision_trace
Flags: static
Builds a diagnostic trace string for visibility decisions.
mode_state The mode state object (can be null)
targeting_settings The targeting settings (can be null)
last_mouse_input_status Last mouse input status dict
has_mouse_world Whether cached mouse world exists
[return] Formatted trace string
visibility_on_mouse_event
Flags: static
Event-driven visibility decision helper.
Returns a MouseEventVisibilityResult with apply=true when the positioner
visibility should be changed because of an InputEvent (mouse motion) and
visible indicating the target visibility. Reason is a short string for
diagnostics.
visibility_on_process_tick
Flags: static
Per-tick visibility decision helper used by GridPositioner2D._process. It centralizes the behavior where, even when continuous follow without events is disabled, we keep the positioner visible if recent mouse input was allowed or a cached mouse world exists. Only applies when hide_on_handled is true.
visibility_reconcile
Flags: static
Per-tick reconciliation: if computed visibility differs from current, request an update. This ensures that when no event has fired yet (e.g., on scene load), the positioner is set to the expected visibility derived from mode/settings.
recenter_on_enable_decision
Flags: static
Decide how to recenter on enable based on policy and available context. Returns a RecenterDecision enum value indicating the preferred action. Policy mapping:
- NONE -> NONE
- LAST_SHOWN -> LAST_SHOWN if cached; else MOUSE_CURSOR if mouse enabled; else VIEW_CENTER
- VIEW_CENTER -> VIEW_CENTER
- MOUSE_CURSOR -> MOUSE_CURSOR if cached or (mouse enabled and viewport available); else VIEW_CENTER
get_tile_delta_from_key_event
Flags: static
Keyboard helper: compute tile delta from a key event and actions
get_rotation_direction_from_key_event
Flags: static
Keyboard helper: detect rotation input from a key event and actions
event The keyboard input event to check
actions GBActions containing rotation action mappings
[return] Rotation direction: 1 for clockwise, -1 for counter-clockwise, 0 for no rotation