`entity:aimBone()` does not return a valid bone
Denneisk opened this issue · 0 comments
Description
When using entity:aimBone()
, the bone will be null despite looking at a proper ragdoll. Using entity:bone(number)
on an entity does not cause this.
To Reproduce
Steps to reproduce the behavior:
- Put this code on a chip
@strict event keyPressed(_:entity, _:string, Down:number, KeyBind:string) { if(Down & KeyBind == "use") { print(owner():aimBone()) } }
- Press E on a ragdoll
- Observe the print statement will say
(null)
Expected behavior
The print statement should show something like Entity [100][prop_ragdoll]:bone(1)
.
Notes:
In testing this, entity:aimBone()
does return a valid bone, but in isValidBone
, the bone gets invalidated wrongly. When performing bone2entity[b]
, this returns nil
even when an equivalent reference to the bone is in the table. Annoyingly, this only happens when using aimBone
. This shouldn't happen since getBone
uses a cached value which is guaranteed to be in bone2index
, bone2entity
, and entity2bone
.