Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions lua/sligwolf_addons/base_library/duplicator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -240,34 +240,20 @@ function LIB.Load()
LIBMeta = SligWolf_Addons.Meta

if SERVER then
local function onDuplicated(ent, ...)
local function OnDuplicated(ent, ...)
if not IsValid(ent) then return end

local entTable = ent:SligWolf_GetTable()
local oldOnDuplicated = entTable._oldOnDuplicated

entTable.isDuped = true

if isfunction(oldOnDuplicated) then
oldOnDuplicated(ent, ...)
end

local swOnDuplicated = entTable.OnDuplicated
if isfunction(swOnDuplicated) then
swOnDuplicated(ent, ...)
end
end

local function OnEntityCreated(ent)
if not IsValid(ent) then return end

local entTable = ent:SligWolf_GetTable()
entTable._oldOnDuplicated = entTable._oldOnDuplicated or ent.OnDuplicated

ent.OnDuplicated = onDuplicated
end

LIBHook.Add("OnEntityCreated", "Library_Duplicator_OnEntityCreated", OnEntityCreated, 1000)
LIBHook.Add("OnDuplicated", "Library_Duplicator_OnDuplicated", OnDuplicated, 1000)
end
end

Expand Down