Skip to content

Commit 6c9a4b5

Browse files
authored
Add error checking during creation also to the regular GenericDuplicatorFunction (#536)
Some bad dupes can cause an error even in it, creating an entity that is broken and will never be removed
1 parent 6279b7f commit 6c9a4b5

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

lua/advdupe2/sv_clipboard.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,13 @@ local function CreateEntityFromTable(EntTable, Player)
10031003
end
10041004

10051005
if IsAllowed(Player, EntTable.Class, EntityClass) then
1006+
hook.Add( "OnEntityCreated", "AdvDupe2_GetLastEntitiesCreated", function( ent )
1007+
table.insert( CreatedEntities, ent )
1008+
end )
1009+
10061010
status, valid = pcall(GenericDuplicatorFunction, EntTable, Player)
1011+
1012+
hook.Remove( "OnEntityCreated", "AdvDupe2_GetLastEntitiesCreated" )
10071013
else
10081014
print("Advanced Duplicator 2: ENTITY CLASS IS BLACKLISTED, CLASS NAME: " .. EntTable.Class)
10091015
return nil

0 commit comments

Comments
 (0)