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.
This commit is contained in:
Axel Meyer
2026-05-18 18:31:59 +02:00
parent 9519897ba2
commit 9882388097

View File

@@ -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.