Class ManipulationService
- Namespace
- GridPlacement.GDScript
- Assembly
- MoonBark.GridPlacement.GDScript.dll
Scene-free manipulation service. Extracted from ManipulationSystem (6.0.0-S Phase 1) to make move/rotate/flip/demolish logic directly unit-testable without a scene tree.\n\nHandles the full manipulation lifecycle: move copy creation, rule validation, completion/placement, cancellation, rotation/flip/scale transforms, physics-layer management, and demolish.\n\nSignal emission and indicator signals (move_indicators_ready) stay on the hosting Node — the service emits them through injected callbacks.\n\nUsage: var service := ManipulationService.new() service.configure(states, manipulation_settings, actions, indicator_context, logger) var data := service.try_move(some_node)
class ManipulationService extends RefCounted
ManipulationService
Properties
failed_reason
var failed_reason: String
source
var source: Manipulatable = PlacementSearchUtils.find_first(p_root, Manipulatable)
move_data
var move_data = ManipulationData.new(
started
var started: bool = _start_move(move_data)
bad_move_results
var bad_move_results = ValidationResults.new(false, "[p_move] is not valid. Cannot move object.", {})
target_root
var target_root = p_move.target.root
move_rules
var move_rules: Array[PlacementRule] = []
ignore_base
var ignore_base: bool = false
validation_results
var validation_results: ValidationResults
setup_report
var setup_report: PlacementReport = _indicator_context.get_manager().try_setup(
issues
var issues = setup_report.indicators_report.issues
vr
var vr = ValidationResults.new(
old_transform
var old_transform: Transform2D = p_move.source.root.global_transform
manipulation_parent
var manipulation_parent: ManipulationParent = _states.manipulation.parent
final_position
var final_position: Vector2 = target_root.global_position
accumulated_rotation
var accumulated_rotation: float = manipulation_parent.rotation
accumulated_scale
var accumulated_scale: Vector2 = manipulation_parent.scale
root_node
var root_node: Node = p_move.source.root
body
var body = root_node as RigidBody2D
node2d
var node2d = root_node as Node2D
applied_position
var applied_position: Vector2 = (root_node as Node2D).global_position if root_node is Node2D else final_position
target
var target: Manipulatable = p_manipulatable if p_manipulatable != null else _states.manipulation.active_manipulatable
demolish_data
var demolish_data = DemolishData.new(
root
var root: Node = p_data.target.root
display_name
var display_name: String = _get_demolish_display_name(target)
data
var data: ManipulationData = _states.manipulation.data
manipulation_parent
var manipulation_parent: ManipulationParent = _states.manipulation.parent
manipulation_parent
var manipulation_parent: ManipulationParent = _states.manipulation.parent
manipulation_parent
var manipulation_parent: ManipulationParent = _states.manipulation.parent
root
var root: Node = p_data.target.root
kept_script_types
var kept_script_types: Array[String] = ["Manipulatable"]
source_rotation
var source_rotation: float = p_data.source.root.rotation
source_scale
var source_scale: Vector2 = p_data.source.root.scale
move_rules
var move_rules: Array[PlacementRule] = []
ignore_base_rules
var ignore_base_rules = p_data.source.settings != null and p_data.source.settings.ignore_base_rules == true
report
var report = _indicator_context.get_manager().try_setup(move_rules, _states.targeting, ignore_base_rules)
indicators
var indicators: Array[RuleCheckIndicator] = _indicator_context.get_manager().get_indicators()
physics_objects
var physics_objects = PlacementSearchUtils.get_collision_object_2ds(p_container)
node
var node: Node = p_manipulatable.root if p_manipulatable.root != null else p_manipulatable
Methods
configure
func configure( p_states: PlacementStates,
set_source_tree_exiting_callback
func set_source_tree_exiting_callback(p_callback: Callable) -> void:
Parameters
p_callback
Returns
try_move
func try_move(p_root: Node) -> ManipulationData:
Parameters
p_root
Returns
try_placement
func try_placement(p_move: ManipulationData) -> ValidationResults:
Parameters
p_move
Returns
try_demolish
func try_demolish(p_manipulatable: Manipulatable) -> ManipulationData:
Parameters
p_manipulatable
Returns
cancel
func cancel() -> void:
Returns
rotate
func rotate(p_target: Node, degrees: float) -> bool:
Parameters
p_targetdegrees
Returns
flip_horizontal
func flip_horizontal(p_target: Node) -> bool:
Parameters
p_target
Returns
flip_vertical
func flip_vertical(p_target: Node) -> bool:
Parameters
p_target
Returns
get_targeted
func get_targeted() -> Node:
Returns
set_targeted
func set_targeted(p_obj_root: Node) -> void:
Parameters
p_obj_root
Returns
is_ready
func is_ready() -> bool:
Returns
Events
move_indicators_ready
signal move_indicators_ready(indicators: Array[RuleCheckIndicator])