Implement Phase 8: Rig Relocation and Component Modularization
- Moved the rig scene from `res://master_rig.tscn` to `res://scenes/stickman_rig.tscn`, preserving its UID. - Split the `StickmanRig` controller into three components: `StickmanLocomotion`, `StickmanRagdoll`, and `StickmanActionRunner`. - Updated the architecture to ensure `StickmanRig` acts as the public facade for the new components. - Created a new test suite `test_phase8_rig_modularization.gd` to verify the integrity of the relocated rig and its components. - Added checks for scene loading, component resolution, action queue delegation, and state authority.
This commit is contained in:
@@ -2803,17 +2803,17 @@ func _action_hint_text() -> String:
|
||||
func _action_origin() -> Vector2:
|
||||
if _pending_walk_target:
|
||||
if _context_rig != null and is_instance_valid(_context_rig):
|
||||
return _context_rig.global_position - STICKMAN_RIG.FOOT_OFFSET
|
||||
return _context_rig.global_position - StickmanLocomotion.FOOT_OFFSET
|
||||
return Vector2.ZERO
|
||||
if _capture_kind != CaptureKind.NONE:
|
||||
if _walk_edit_rig != null and is_instance_valid(_walk_edit_rig):
|
||||
return _walk_edit_rig.global_position - STICKMAN_RIG.FOOT_OFFSET
|
||||
return _walk_edit_rig.global_position - StickmanLocomotion.FOOT_OFFSET
|
||||
if _panel_rig != null and is_instance_valid(_panel_rig):
|
||||
return _panel_rig.global_position - STICKMAN_RIG.FOOT_OFFSET
|
||||
return _panel_rig.global_position - StickmanLocomotion.FOOT_OFFSET
|
||||
return Vector2.ZERO
|
||||
if _rule_step != RuleStep.IDLE:
|
||||
if _rule_context_rig != null and is_instance_valid(_rule_context_rig):
|
||||
return _rule_context_rig.global_position - STICKMAN_RIG.FOOT_OFFSET
|
||||
return _rule_context_rig.global_position - StickmanLocomotion.FOOT_OFFSET
|
||||
var trigger: Dictionary = _rule_builder.get("trigger", {})
|
||||
var src := instance_from_id(int(trigger.get("source", -1)))
|
||||
if src is Node2D and is_instance_valid(src):
|
||||
@@ -3467,7 +3467,7 @@ func _update_area_entry() -> void:
|
||||
## Stickman point = feet (root - FOOT_OFFSET); prop point = global position.
|
||||
func _movable_point(node: Node2D) -> Vector2:
|
||||
if node is STICKMAN_RIG:
|
||||
return node.global_position - StickmanRig.FOOT_OFFSET
|
||||
return node.global_position - StickmanLocomotion.FOOT_OFFSET
|
||||
return node.global_position
|
||||
|
||||
|
||||
@@ -3636,7 +3636,7 @@ func _begin_walk_edit(rig: StickmanRig, index: int, from_panel: bool) -> void:
|
||||
_walk_edit_index = index
|
||||
_walk_edit_from_panel = from_panel
|
||||
var queue := rig.get_queue()
|
||||
var pos: Vector2 = queue[index].get("target", rig.global_position - STICKMAN_RIG.FOOT_OFFSET)
|
||||
var pos: Vector2 = queue[index].get("target", rig.global_position - StickmanLocomotion.FOOT_OFFSET)
|
||||
_director_visuals.set_edit_waypoint(pos)
|
||||
_begin_capture(CaptureKind.POSITION, "🚩 Click the new waypoint position (Esc or RMB to cancel)", _on_walk_edit_captured, _cb_walk_edit_cancel)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user