Skip to content

Commit 6a80aa5

Browse files
committed
add ENTITY:SetOwner ownership detour
1 parent a4de299 commit 6a80aa5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lua/warden/ownership/sv_ownership.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ timer.Create("WardenSendAllOwnerData", 120, 0, Warden._SendAllOwnerData)
149149

150150
-- // ownership setting // --
151151

152+
local ENTITY = FindMetaTable("Entity")
152153
local PLAYER = FindMetaTable("Player")
153154

154155
local function setInitialOwner(ent)
@@ -203,6 +204,14 @@ end)
203204

204205
-- Detours
205206

207+
if ENTITY.SetOwner then
208+
Warden.BackupEntSetOwner = Warden.BackupEntSetOwner or ENTITY.SetOwner
209+
function ENTITY:SetOwner(ent)
210+
Warden.SetOwner(ent, self)
211+
Warden.BackupEntSetOwner(self, ent)
212+
end
213+
end
214+
206215
if PLAYER.AddCount then
207216
Warden.BackupPlyAddCount = Warden.BackupPlyAddCount or PLAYER.AddCount
208217
function PLAYER:AddCount(enttype, ent)

0 commit comments

Comments
 (0)