From ed36ae43055fff30bb57302572f0621a1bc26106 Mon Sep 17 00:00:00 2001 From: Grocel Date: Sun, 14 Dec 2025 01:13:16 +0100 Subject: [PATCH] Use the upcoming GM:OnDuplicated hook. Removes the need for the "OnEntityCreated" hack. Requires these pull request to be merged: - https://github.com/Facepunch/garrysmod/pull/2408 - https://github.com/wiremod/advdupe2/pull/528 --- .../base_library/duplicator.lua | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/lua/sligwolf_addons/base_library/duplicator.lua b/lua/sligwolf_addons/base_library/duplicator.lua index 3406a12..a507f2f 100644 --- a/lua/sligwolf_addons/base_library/duplicator.lua +++ b/lua/sligwolf_addons/base_library/duplicator.lua @@ -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