Merge pull request #1189 from CapsAdmin/phys-event-fix

Made physgun event use a table. Fixes: #1187
This commit is contained in:
thegrb93 2022-04-07 04:41:03 -04:00 committed by GitHub
commit 35ff332bea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 3 deletions

View File

@ -12,8 +12,15 @@ pac.AddHook("DrawPhysgunBeam", "physgun_event", function(ply, wep, enabled, targ
ply.pac_drawphysgun_event = nil
end
if ply.pac_drawphysgun_event_part and ply.pac_drawphysgun_event_part:IsValid() then
ply.pac_drawphysgun_event_part:OnThink()
local pac_drawphysgun_event_part = ply.pac_drawphysgun_event_part
if pac_drawphysgun_event_part then
for event in pairs(pac_drawphysgun_event_part) do
if event:IsValid() then
event:OnThink()
else
pac_drawphysgun_event_part[event] = nil
end
end
end

View File

@ -308,7 +308,12 @@ PART.OldEvents = {
using_physgun = {
callback = function(self, ent)
ent = self:GetPlayerOwner()
ent.pac_drawphysgun_event_part = self
local pac_drawphysgun_event_part = ent.pac_drawphysgun_event_part
if not pac_drawphysgun_event_part then
pac_drawphysgun_event_part = {}
ent.pac_drawphysgun_event_part = pac_drawphysgun_event_part
end
pac_drawphysgun_event_part[self] = true
return ent.pac_drawphysgun_event ~= nil
end,
},