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

1
2
3
4
create_with_injection(
    p_parent: Node,
    container: GBCompositionContainer
) -> ManipulationSystem

Flags: static

Creates a ManipulationSystem with dependency injection from container.


get_runtime_issues

1
get_runtime_issues() -> Array[String]

resolve_gb_dependencies

1
resolve_gb_dependencies(p_container: GBCompositionContainer) -> void

try_move

1
try_move(p_root: Node) -> ManipulationData

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

1
try_placement(p_move: ManipulationData) -> ValidationResults

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

1
is_ready() -> bool

Checks if the manipulation system is ready for operations.


cancel

1
cancel()

Cancels the active manipulation action.


try_demolish

1
try_demolish(p_manipulatable: Manipulatable) -> ManipulationData

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

1
demolish(p_manipulatable: Manipulatable) -> bool

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

1
2
3
4
rotate(
    p_target: Node,
    degrees: float
)

Rotates the target node by the specified degrees. Delegates to ManipulationParent’s transform coordination.


flip_horizontal

1
flip_horizontal(p_target: Node)

Flips the target node horizontally. Delegates to ManipulationParent’s transform coordination.


flip_vertical

1
flip_vertical(p_target: Node)

Flips the target node vertically. Delegates to ManipulationParent’s transform coordination.


get_targeted

1
get_targeted() -> Node

Get the root node of the current targeted object for this manipulation system


set_targeted

1
set_targeted(p_obj_root: Node) -> void

Sets the manipulation root to be the obj root


Private Methods

_are_dependencies_ready

1
_are_dependencies_ready() -> bool

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

1
_ensure_manipulation_settings() -> void

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

1
2
3
4
_validate_move_preconditions(
    p_root: Node,
    p_move_data: ManipulationData
) -> String

Flags: private

Validates all preconditions for move operation. Returns empty string if all validations pass, otherwise returns failure reason.


_check_dependencies_resolved

1
_check_dependencies_resolved() -> bool

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

1
_get_unsupported_node_type_message(p_node_class: String) -> String

Flags: private

Gets the unsupported node type error message. p_node_class The class name of the unsupported node


_start_move

1
_start_move(p_data: ManipulationData) -> bool

Flags: private

Creates a manipulation (move) copy and prepares rule validation.

Flow:

  1. Clone source manipulatable root via create_copy.
  2. Parent under manipulation parent node.
  3. Reset transform if configured.
  4. Align initial global position to the parent root. Parent root is responsible for moving object.
  5. Initialize placement validation rules using IndicatorManager.
  6. Disable configured physics layers on the original source.

Returns true if setup succeeded; false if rule setup failed.


_unhandled_input

1
_unhandled_input(event: InputEvent) -> void

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

1
_input(event: InputEvent) -> void

Flags: private

Route standard input to unhandled to support tests or scenes that call _input directly.


_perform_manipulation_actions

1
_perform_manipulation_actions(event: InputEvent)

Flags: private


_finish

1
_finish(p_data: ManipulationData) -> void

Flags: private

Finishes a manipulation action and cleans up resources.


_on_mode_changed

1
_on_mode_changed(p_mode: GBEnums.Mode)

Flags: private


_process

1
_process(_delta: float) -> void

Flags: private

While moving, keep the target copy aligned with the positioner so tests detect movement shifts.


_on_target_changed

1
2
3
4
_on_target_changed(
    p_new: Node,
    p_old: Node
)

Flags: private

NOTE: _process removed. Movement visuals are driven by reparenting the move copy under the positioner.


_on_preview_changed

1
_on_preview_changed(p_preview: Node)

Flags: private


_send_manipulation_failed

1
2
3
4
_send_manipulation_failed(
    p_manipulated: Manipulatable,
    p_action: GBEnums.Action
)

Flags: private

Sends manipulation failed signal for failed operations.


_disable_selected_physics

1
_disable_selected_physics(p_container: Node2D)

Flags: private

Disables physics layers for objects during manipulation.


_enable_selected_physics

1
_enable_selected_physics()

Flags: private

Re-enables physics layers that were disabled during manipulation.


_on_source_tree_exiting

1
_on_source_tree_exiting() -> void

Flags: private

Handles source object leaving the scene tree during manipulation. Automatically cancels manipulation to prevent operating on deleted objects.


_disconnect_source_monitoring

1
_disconnect_source_monitoring(p_data: ManipulationData) -> void

Flags: private

Disconnects source object monitoring signal if connected.


_get_demolish_display_name

1
_get_demolish_display_name(p_manipulatable: Manipulatable) -> String

Flags: private

Gets a display name appropriate for demolish messaging, preferring the manipulatable root when available.


_clear_manipulation_data

1
_clear_manipulation_data(p_data: ManipulationData) -> void

Flags: private

Clears manipulation data reference when the provided data matches the active state.


_debug_node

1
_debug_node(n)

Flags: private


_describe_layers

1
_describe_layers(obj)

Flags: private