From 4b8ff81549031f3b57f8f8860802e4094b2a0b10 Mon Sep 17 00:00:00 2001 From: Strand8319 Date: Sat, 28 Mar 2026 22:21:19 +0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20fix=20damage=20detector=20linkin?= =?UTF-8?q?g=20to=20itself=20after=20dupe=20paste?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/entities/gmod_wire_damage_detector.lua | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lua/entities/gmod_wire_damage_detector.lua b/lua/entities/gmod_wire_damage_detector.lua index aa243886c3..9c36495704 100644 --- a/lua/entities/gmod_wire_damage_detector.lua +++ b/lua/entities/gmod_wire_damage_detector.lua @@ -329,11 +329,19 @@ function ENT:ApplyDupeInfo(ply, ent, info, GetEntByID) BaseClass.ApplyDupeInfo(self, ply, ent, info, GetEntByID) if info.linked_entities then - if type( info.linked_entities ) == "number" then -- old dupe compatibility - self:LinkEnt( GetEntByID( info.linked_entities ) ) + self:ClearEntities() + + if type(info.linked_entities) == "number" then -- old dupe compatibility + local linked = GetEntByID(info.linked_entities) + if IsValid(linked) then + self:LinkEnt(linked, true) + end else - for i=1,#info.linked_entities do - self:LinkEnt( GetEntByID( info.linked_entities[i] ) ) + for i = 1, #info.linked_entities do + local linked = GetEntByID(info.linked_entities[i]) + if IsValid(linked) then + self:LinkEnt(linked, true) + end end end end