From acc209a7c44693369e9ef7574a9f0e75b862c582 Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Fri, 10 Apr 2026 23:05:46 +0300 Subject: [PATCH] Add error checking during creation also to the regular GenericDuplicatorFunction Some bad dupes can cause an error even in it, creating an entity that is broken and will never be removed --- lua/advdupe2/sv_clipboard.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lua/advdupe2/sv_clipboard.lua b/lua/advdupe2/sv_clipboard.lua index e81dcfe..3400033 100644 --- a/lua/advdupe2/sv_clipboard.lua +++ b/lua/advdupe2/sv_clipboard.lua @@ -1003,7 +1003,13 @@ local function CreateEntityFromTable(EntTable, Player) end if IsAllowed(Player, EntTable.Class, EntityClass) then + hook.Add( "OnEntityCreated", "AdvDupe2_GetLastEntitiesCreated", function( ent ) + table.insert( CreatedEntities, ent ) + end ) + status, valid = pcall(GenericDuplicatorFunction, EntTable, Player) + + hook.Remove( "OnEntityCreated", "AdvDupe2_GetLastEntitiesCreated" ) else print("Advanced Duplicator 2: ENTITY CLASS IS BLACKLISTED, CLASS NAME: " .. EntTable.Class) return nil