ManipulationStateMachine
AUTO-GENERATED FILE — DO NOT EDIT MANUALLY
Source: systems/manipulation/manipulation_state_machine.gd
Version: 5.1
class_name: ManipulationStateMachine
extends: (none)
Summary
Pure state machine for manipulation logic.
Extracted from ManipulationSystem to provide:
- Testable logic without dependencies
- Clear command structure for side effects
- Separation of concerns (pure logic vs system execution)
- Deterministic state transitions
Uses Command pattern: Input -> Pure Function -> Command Objects
ARCHITECTURE: This class provides pure functions that analyze current state and return command objects describing what side effects should occur. The system then executes these commands. This separation allows:
- 100% test coverage of state logic without environment/dependencies
- Clear decision points: which side effects are needed?
- Easy to audit state transitions: what changes are happening?
USAGE PATTERN: [codeblock]
Get commands from pure logic
var commands := ManipulationStateMachine.cancel_manipulation(data)
System executes based on command flags
if commands.emit_signal: commands.signal_data.status = GBEnums.Status.CANCELED
if commands.clear_data: _states.manipulation.data = null [/codeblock]
TESTING: Pure functions make state machine extremely testable - no mocking needed: [codeblock] func test_cancel_with_active_data() -> void: var data := _create_test_data() var commands := ManipulationStateMachine.cancel_manipulation(data) assert_bool(commands.emit_signal).is_true() assert_object(commands.signal_data).is_equal(data) [/codeblock]
SEE ALSO: ManipulationCancellationCommands, ManipulationFinishCommands, ManipulationDemolishCommands
Signals
(none)
Exports
(none)
Methods
(none)