From 988238809706e62cce2dae142825835e6c7c138f Mon Sep 17 00:00:00 2001 From: Axel Meyer Date: Mon, 18 May 2026 18:31:59 +0200 Subject: [PATCH] feat(puppet): add test-only APIs for locomotion + animated-flag - set_foot_sprite_reach_test_only(handle, leg_index, value) - foot_state_test_only(handle, leg_index) - bone_animated_test_only(handle, bone_id) Test-only helpers (not for production use) to enable headless unit tests of the procedural-locomotion-layer and bone_animated keyframe-priority flag. Used by puppet-test Groups 9-11. --- init.lua | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/init.lua b/init.lua index a2ba6dd..7b063ee 100644 --- a/init.lua +++ b/init.lua @@ -574,6 +574,31 @@ function M.write_bone_test_only(handle, bone_id, angle_rad) p.test_overrides[bone_id] = angle_rad end +-- Test-only: override sprite_reach for a foot_state entry without loading textures. +-- Not for production module use. +function M.set_foot_sprite_reach_test_only(handle, leg_index, value) + local p = all_puppets[handle] + if p == nil or p.foot_state[leg_index] == nil then + error("puppet.set_foot_sprite_reach_test_only: invalid handle or leg_index") + end + p.foot_state[leg_index].sprite_reach = value +end + +-- Test-only: read raw foot_state table for a leg by index. +-- Not for production module use. +function M.foot_state_test_only(handle, leg_index) + local p = all_puppets[handle] + return p and p.foot_state[leg_index] or nil +end + +-- Test-only: read per-frame bone_animated flag for a bone. +-- Returns true if a keyframe set at least one channel this frame, nil otherwise. +-- Not for production module use. +function M.bone_animated_test_only(handle, bone_id) + local p = all_puppets[handle] + return p and p.bone_animated[bone_id] or nil +end + -- ==================================================================== -- Cascaded world-transform (substrate puppet.c:692-718 port). -- Local pos is multiplied by parent.world.scl before rotation + translation.