garrysmod-issues
garrysmod-issues copied to clipboard
GetAttachment data is corrupted by unreliable netmessages being sent
Details
It seems as though sending unreliable netmessages to clients will cause GetAttachment data to get corrupted and sometimes show errorenous positions. This is reproducible in Sandbox.
This issue has been occuring since the 27th of May on the 64 bit branch, but DOES NOT occur on at the 21st of may.
Steps to reproduce
Code for reproduction
if SERVER then
util.AddNetworkString("test")
timer.Create("t", 0.05, 0, function()
net.Start("test", true)
net.Broadcast()
end)
else
net.Receive("test", function(ln)
local vm = Entity(1):GetViewModel()
if not IsValid(vm) then return end
local att = vm:GetAttachment(1)
if att then
debugoverlay.Sphere(att.Pos, 12, 3, Color(0, 0, 255), true)
end
--Entity(1):EmitSound("NPC_Hunter.FlechetteShoot")
end)
end
- set developer 1 for debugoverlay
- Place in lua/autorun
- Switch to SMG1 and fire
- Attachments will erroneously appear at center of map
I have tried rolling my GMod build back to March 15 2024 and February 20 2024 versions, and it appears to function identically there, so I don't think this is by any means a regression or changed behavior as you claim, so I don't know where you got your dates from.
Furthermore, from what I can see, the unreliable flag (or shooting in general) seems to have nothing to do with it.
Testing in Singleplayer, dev beta.
Testing in Singleplayer,
devbeta.
Should be a local MP server, also on 64 bit
I had a friend run through and attempt to reproduce it on different dates.
x86-64 from May 14, local multiplayer:
it's not a new issue.
I have investigated it further a bit, and it appears to be related to bone positions for the viewmodel entity at point in time. It is evident by printing out vm:GetBoneMatrix(att.Bone):GetTranslation(). Don't have a fix yet, but it seems to be just related to a missing local to world transformation somewhere, or something along those lines.