ManipulationSystem
AUTO-GENERATED FILE – DO NOT EDIT MANUALLY
System for manipulating (move, rotate, flip, demolish, build preview integration) grid building objects.
Source File: addons/grid_building/systems/manipulation/manipulation_system.gd
Extends: GBSystem
Signals
Signal:
move_indicators_ready(indicators: Array[RuleCheckIndicator])Emitted when move indicators have been fully set up after physics frame Passes the array of created indicators for debugging and validation
Private Properties
- Property:
_logger: [GBLogger](./gb-logger/)(private) - Property:
_physics_disabled_objects: Array[CollisionObject2D] = [](private) - Objects with physics layers disabled during move operations. - Property:
_systems_context: [GBSystemsContext](./gb-systems-context/)(private) - Systems context for plugin integration. - Property:
_indicator_context: [IndicatorContext](./indicator-context/)(private) - Placement context for validation and rules. - Property:
_states: [GBStates](./gb-states/)(private) - Shared states for plugin systems. - Property:
_manipulation_settings: [ManipulationSettings](./manipulation-settings/)(private) - Settings for manipulation system behavior (includes messages). - Property:
_actions: [GBActions](./gb-actions/)(private) - Input actions configuration.
Public Methods
create_with_injection
Flags: static
Creates a ManipulationSystem with dependency injection from container.
get_runtime_issues
resolve_gb_dependencies
try_move
Attempts to move a targeted object. Failed or successful move data available through state signals.
p_root: Node - Container node to search for Manipulatable component
try_placement
Attempts to place a manipulated object at the desired location. Validates placement rules and commits the move if successful.
p_move: ManipulationData - Movement data containing source and target information
is_ready
Checks if the manipulation system is ready for operations.
cancel
Cancels the active manipulation action.
try_demolish
Attempts to demolish the given manipulatable object and returns manipulation data for result inspection. Only succeeds if the object is configured as demolishable.
p_manipulatable: Manipulatable - Component to demolish
demolish
Demolishes a manipulatable object and returns true when the object is successfully removed.
p_manipulatable: Manipulatable - Component to demolish; defaults to active manipulatable when null
rotate
Rotates the target node by the specified degrees. Delegates to ManipulationParent’s transform coordination.
flip_horizontal
Flips the target node horizontally. Delegates to ManipulationParent’s transform coordination.
flip_vertical
Flips the target node vertically. Delegates to ManipulationParent’s transform coordination.
get_targeted
Get the root node of the current targeted object for this manipulation system
set_targeted
Sets the manipulation root to be the obj root
Private Methods
_are_dependencies_ready
Flags: private
Validates that all required dependencies are properly set. Returns list of validation issues (empty if valid). Checks if all critical dependencies are ready for operation. Returns true if the system can safely process operations.
_ensure_manipulation_settings
Flags: private
Ensures _manipulation_settings is initialized with a default instance if null. This prevents string formatting crashes when dependencies haven’t been resolved yet. The default will be replaced with the real settings when resolve_gb_dependencies() is called.
_validate_move_preconditions
Flags: private
Validates all preconditions for move operation. Returns empty string if all validations pass, otherwise returns failure reason.
_check_dependencies_resolved
Flags: private
Attempts to move a targeted object. Checks if dependencies have been properly resolved. Returns false and logs error if not resolved.
_get_unsupported_node_type_message
Flags: private
Gets the unsupported node type error message.
p_node_class The class name of the unsupported node
_start_move
Flags: private
Creates a manipulation (move) copy and prepares rule validation.
Flow:
- Clone source manipulatable root via
create_copy. - Parent under manipulation parent node.
- Reset transform if configured.
- Align initial global position to the parent root. Parent root is responsible for moving object.
- Initialize placement validation rules using IndicatorManager.
- Disable configured physics layers on the original source.
Returns true if setup succeeded; false if rule setup failed.
_unhandled_input
Flags: private
Handles input events for manipulation system controls. Responds to demolish, info, moving, and off mode actions.
event: InputEvent - Input event to process for manipulation controls
_input
Flags: private
Route standard input to unhandled to support tests or scenes that call _input directly.
_perform_manipulation_actions
Flags: private
_finish
Flags: private
Finishes a manipulation action and cleans up resources.
_on_mode_changed
Flags: private
_process
Flags: private
While moving, keep the target copy aligned with the positioner so tests detect movement shifts.
_on_target_changed
Flags: private
NOTE: _process removed. Movement visuals are driven by reparenting the move copy under the positioner.
_on_preview_changed
Flags: private
_send_manipulation_failed
Flags: private
Sends manipulation failed signal for failed operations.
_disable_selected_physics
Flags: private
Disables physics layers for objects during manipulation.
_enable_selected_physics
Flags: private
Re-enables physics layers that were disabled during manipulation.
_on_source_tree_exiting
Flags: private
Handles source object leaving the scene tree during manipulation. Automatically cancels manipulation to prevent operating on deleted objects.
_disconnect_source_monitoring
Flags: private
Disconnects source object monitoring signal if connected.
_get_demolish_display_name
Flags: private
Gets a display name appropriate for demolish messaging, preferring the manipulatable root when available.
_clear_manipulation_data
Flags: private
Clears manipulation data reference when the provided data matches the active state.
_debug_node
Flags: private
_describe_layers
Flags: private