Skip to content

ManipulationSystem

System for manipulating (move, rotate, flip, demolish, build preview integration) grid building objects.

Responsibilities:

  • Creates and manages a temporary manipulation copy (“move copy”) when entering MOVE workflows.
  • Delegates spatial translation to the external targeting/positioner system. (No per-frame movement logic here.)
  • Sets up and tears down placement validation rules for move and build actions.
  • Manages physics layer disabling/enabling during active manipulation.
  • Emits structured status transitions via ManipulationData.status (STARTED, FAILED, FINISHED, CANCELED).

Non‑Responsibilities (by design):

  • Calculating or enforcing cursor/keyboard driven position updates (handled by GridTargetingSystem & its positioner node).
  • Determining selection/target acquisition (handled by targeting state & systems).
  • Rendering or UI feedback (delegated to name displayer / external UI nodes).

Design Notes:

  • The move copy is parented under the active positioner when available so that any positioner movement (mouse, keyboard, gamepad) naturally repositions the copy without duplicate logic or tight coupling.
  • If no positioner exists (edge/test fallback), the copy is parented under the manipulation parent as a legacy behavior.
  • Rotation / flip actions operate directly on the target Node2D passed in, typically the move copy’s root while an action is active.
get_runtime_issues( ) -> Array[String]

Validates that all required dependencies are properly set. Returns list of validation issues (empty if valid).

resolve_gb_dependencies( p_container: GBCompositionContainer ) -> void
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( p_move: ManipulationData ) -> ValidationResults

Force target to be the moved object

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( ) -> bool

Checks if the manipulation system is ready for operations.

cancel( )

Cancels the active manipulation action.

demolish( p_manipulatable: Manipulatable ) -> bool

Attempts to demolish the targeted manipulatable object.

rotate( p_target: Node, degrees: float )

Rotates the target node by the specified degrees.

flip_horizontal( p_target: Node )

Flips the target node horizontally.

flip_vertical( p_target: Node )

Flips the target node vertically.

get_targeted( ) -> Node

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

set_targeted( p_obj_root: Node ) -> void

Sets the manipulation root to be the obj root

_process( _delta: float ) -> void

addons/grid_building/systems/manipulation/manipulation_system.gd


This page was auto-generated from GDScript source. Edit the source file to improve documentation.

Generated on 2025-09-07