wiremod / advdupe2

Advanced Duplicator 2
http://wiremod.com
Apache License 2.0
90 stars 60 forks source link

Dupe ghost disappearing in multiplayer #413

Closed wrefgtzweve closed 1 year ago

wrefgtzweve commented 1 year ago

OwnerChanged always gets called when any player in the game dies or drops a weapon Also seems to happen when any player holsters a swep https://github.com/Facepunch/garrysmod/blob/b6c4159bbe8b95591c8189a27d7fa68d607aeebf/garrysmod/gamemodes/sandbox/entities/weapons/gmod_tool/stool.lua#L127

which calls ReleaseGhostEntity which then clears all ghosts.

This happens quite often on larger populated servers and makes advdupe2 pretty hard if not impossible to properly use.

https://user-images.githubusercontent.com/69946827/215128812-6bc86bab-833c-4934-b646-b25f858f189f.mp4

HavannaFR commented 1 year ago

I can confirm the problem

thegrb93 commented 1 year ago

@wrefgtzweve @HavannaFR you likely have an addon causing the issue. Can you add debug.Trace() at this place https://github.com/wiremod/advdupe2/blob/master/lua/weapons/gmod_tool/stools/advdupe2.lua#L762 and tell us what the console prints when the issue happens.

wrefgtzweve commented 1 year ago

I've done that, i got more proof on the wire discord https://discord.com/channels/231131817640460288/237764217736921089/1069073763385225297

Added it through a detour thus the runstring (i was holding a crowbar at the time)

AdvDupe2_RemoveGhosts = AdvDupe2_RemoveGhosts or AdvDupe2.RemoveGhosts

function AdvDupe2.RemoveGhosts()
    AdvDupe2_RemoveGhosts()
    debug.Trace()
end

image

thegrb93 commented 1 year ago

Can you see if adding if self:GetOwner()~=LocalPlayer() then return end in that spot fixes the issue?

thegrb93 commented 1 year ago

Kind of looks like your gmod_tool code might be out of date as well. Your trace shows 325 as the ReleaseGhost call, but it's on line 327. https://github.com/Facepunch/garrysmod/blob/master/garrysmod/gamemodes/sandbox/entities/weapons/gmod_tool/shared.lua#L327

wrefgtzweve commented 1 year ago

seems like it's the holster function that's different image

wrefgtzweve commented 1 year ago

I think that's because the latest commit isn't in gmod yet

wrefgtzweve commented 1 year ago

Can you see if adding if self:GetOwner()~=LocalPlayer() then return end in that spot fixes the issue?

seems to runs for other players too, as the issue states gets called when any player in the game dies or drops a weapon will try though

thegrb93 commented 1 year ago

Can you open a garrysmod-issue about it? 'Clientside SWEP:OwnerChanged getting called on local player's swep when other players switch weapons', and reference this issue?

wrefgtzweve commented 1 year ago

Can you see if adding if self:GetOwner()~=LocalPlayer() then return end in that spot fixes the issue?

seems to only print when i die with the tool out, not when the dupe is getting cleared, doesn't make much sense

thegrb93 commented 1 year ago

Oh, so something else is maybe clearing the ghosts?

wrefgtzweve commented 1 year ago

it's hard to test live, i'll see if i can get another player in a clean dev enviroment to test

robotboy655 commented 1 year ago

If there's a new problem since friday, it's more likely to be caused by this: https://github.com/Facepunch/garrysmod/commit/165a5e19996b2f94b4d9a65da639b3aaf560e77e

Although I do not see a reason it would affect a player by other players doing anything.

wrefgtzweve commented 1 year ago

My guess is that it's because https://github.com/Facepunch/garrysmod/blob/f49947b238183e0929f47dcb882553478662f9d9/garrysmod/gamemodes/sandbox/entities/weapons/gmod_tool/shared.lua#L323 this gets called for everyone, not just the player thats holding the toolgun i think

robotboy655 commented 1 year ago

Hmm, I see. It does indeed get called on all clients clientside sometimes, and the recent changes to GetToolObject() make the bug happen.

I will get that sorted on the toolguns end.

wrefgtzweve commented 1 year ago

This is now fixed within gmod, thanks robotboy!