Skip to content

Commit

Permalink
Fix gmod_wire_interactiveprop net errors (#2812)
Browse files Browse the repository at this point in the history
* Check if entity is valid

* Improve other receiver too

* Use ent:IsValid instead

* Add additional check
  • Loading branch information
wrefgtzweve authored Oct 26, 2023
1 parent ca89c04 commit 1a39c49
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions lua/entities/gmod_wire_interactiveprop.lua
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,6 @@ if CLIENT then
end)

return

end

function ENT:InitData()
Expand Down Expand Up @@ -414,13 +413,11 @@ end
----------------------------------------------------
util.AddNetworkString("wire_interactiveprop_action")
net.Receive("wire_interactiveprop_action",function(len,ply)
self = net.ReadEntity()
if not IsValid( self ) or not IsValid( ply ) or ply ~= self.User then return end

self:ReceiveData()

local ent = net.ReadEntity()
if not ent:IsValid() or ent:GetClass() ~= "gmod_wire_interactiveprop" or ply ~= ent.User then return end

self:UpdateOverlay()
ent:ReceiveData()
ent:UpdateOverlay()
end)

----------------------------------------------------
Expand Down Expand Up @@ -452,13 +449,13 @@ end

util.AddNetworkString("wire_interactiveprop_close")
net.Receive("wire_interactiveprop_close",function(len,ply)
local self = net.ReadEntity()
self:Unprompt()
local ent = net.ReadEntity()
if not ent:IsValid() or ent:GetClass() ~= "gmod_wire_interactiveprop" or ply ~= ent.User then return end
ent:Unprompt()
end)

util.AddNetworkString("wire_interactiveprop_kick")
function ENT:Unprompt()

self.User = nil
self:UpdateOverlay()
end
Expand Down

0 comments on commit 1a39c49

Please sign in to comment.