diff --git a/init.lua b/init.lua index 22a2a78..603c2b7 100644 --- a/init.lua +++ b/init.lua @@ -468,6 +468,22 @@ function M.bone_world_transform(handle, bone_id) return ws.x, ws.y, ws.rot end +-- ==================================================================== +-- World-scale query (public API; reads from cached bone_state.world). +-- Returns scl_x, scl_y of the bone's cached world-state. +-- ==================================================================== +function M.bone_world_scale(handle, bone_id) + local p = all_puppets[handle] + if p == nil then + error("puppet.bone_world_scale: handle " .. tostring(handle) .. " not spawned") + end + local ws = p.bone_state[bone_id] and p.bone_state[bone_id].world + if ws == nil then + error("puppet.bone_world_scale: bone '" .. tostring(bone_id) .. "' has no cached world-state") + end + return ws.scl_x, ws.scl_y +end + -- ==================================================================== -- Test-only: direct bone-angle write bypassing track-conflict guard. -- Stored in test_overrides and applied during update after rest-reset