What is up with clientside physics objects?!

[lua]local ragdoll = ents.FindByClass(“prop_ragdoll”)
ragdoll = ragdoll[#ragdoll]
local prop = ents.FindByClass(“prop_physics”)
prop = prop[#prop]

local function DebugPhysObj(ent)
print("Model: " … ent:GetModel() … "
local phys = ent:GetPhysicsObject()
print(“GetPhysicsObject()”, phys, IsValid(phys) and phys:GetPos() or “”, "

print("GetPhysicsObjectCount()", ent:GetPhysicsObjectCount())

for i=0, 7 do
local numphys = ent:GetPhysicsObjectNum(i)
print(“GetPhysicsObjectNum(” … i … “)”, numphys, IsValid(numphys) and numphys:GetPos() or “”, numphys == phys and “Same as GetPhysicsObject()!” or “”)


===== RAGDOLL =====
===== PROP =====

What the FUCK is happening clientside?!

The Good
Serverside works just fine. GetPhysicsObject returns a physics object, and it’s the same as GetPhysicsObjectNum(0). GetPhysicsObjectCount returns the correct number of valid GetPhysicsObjectNum’s, and calling GetPhysicsObjectNum with an invalid index returns nil. Just like you’d expect! That’s great!

The Bad
Clientside, a prop has no physics object. That’s, like, fine I guess, assuming it’s by design.

The Ugly
And now we get to the important bit - ragdolls on the client’s side. What the fuck is going on here?
GetPhysicsObjectCount returns 0, but GetPhysicsObjectNum(0 to 5) returns valid(ish?) physics objects. So …Count() was lying? And what the fuck am I getting on Num(6) and (7)?! What is that even.

I don’t know what to make of this, but SOMETHING needs fixed!

Edit: confirmed still broken in dev branch

Edit: oh, and

Entity:GetModelPhysBoneCount returns 0 too.

Someone using pairs instead of ipairs internally, maybe?

Which anomaly would this explain?

You’re right, it doesn’t. I just tested my theory and I was wrong.

It’s improbable anyway really, - since, other theories aside, either it is using # to count, or it is not happening at the Lua level anyway.

On client, ragdolls are not supposed to have any physics objects either, but Garry added some code that adds them. Why it is there I do not know.

Oh. Well it’s the only way that I know of to find the position of the different body parts clientside, so it’s a good thing he did.