Open TiberiumFusion opened 3 years ago
I am somewhat confident in my guess that the server replaces every SWEP's worldmodel with some invalid stand-in. I tried to create to create a workaround with Entity:GetBoneMatrix
, but it was returning nil when it shouldn't have. This only makes sense if the bone index I am trying to access does not actually exist... except it does. And the only way the bone could not exist is if the server was completely ignoring my SWEP's worldmodel and substituting its own garbage one instead.
It's using the view model on server and in some frames on client, and we are at the point again that there is probably code that relies on this behavior and fixing this would cause shit to break..
In fact the engine itself relies on this shit for animations for some reason. The only way I can see out of this mess is to add manual hacks to the Lua functions like GetModel()
already does.
I would be fine with a new GetWorldModelAttachment
on SWEPs only that fixes the behavior while leaving the original GetAttachment
unmodified. It is ugly, but that is nothing new for gmod.
Details
When
GetAttachment
is called serverside on a SWEP, the server ignores the SWEP's actual worldmodel and substitutes in some mysterious unknown worldmodel for the attachment calculations. Naturally, this makes the attachments calculations completely wrong, and soGetAttachment
is completely useless for things like firing hitscan/entity bullets, particle effects like muzzle flashes, etc. You know, stuff that's kind of sort of maybe important to SWEPs.On the client,
GetAttachment
works correctly.Demo
Use this addon to visualize the problem: broken_getattachment_demo.zip
Here are some screenshots of what the addon demonstrates:
Steps to reproduce
-noworkshop
.WorldModel
in the swep code, kill yourself, and spawn a new swep. Observe how the server is always wrong in the exact same way, regardless of the world model.Environment
Vanilla 2021.06.09 x64-86 2021.06.09