From 4b8ff81549031f3b57f8f8860802e4094b2a0b10 Mon Sep 17 00:00:00 2001 From: Strand8319 Date: Sat, 28 Mar 2026 22:21:19 +0500 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=94=A7=20fix=20damage=20detector=20li?= =?UTF-8?q?nking=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 From 78cb4f5f7bab2021d37eb737887c7199bdf3f513 Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Thu, 9 Apr 2026 19:21:50 +0300 Subject: [PATCH 2/3] Less diff --- lua/entities/gmod_wire_damage_detector.lua | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/lua/entities/gmod_wire_damage_detector.lua b/lua/entities/gmod_wire_damage_detector.lua index 9c36495704..b2fc3ca204 100644 --- a/lua/entities/gmod_wire_damage_detector.lua +++ b/lua/entities/gmod_wire_damage_detector.lua @@ -61,8 +61,6 @@ function ENT:Initialize() self.linked_entities = {} -- numerical array self.linked_entities_lookup = {} -- lookup table indexed by entities - self:LinkEnt( self ) - self.count = 0 self.key_ents = {} @@ -331,17 +329,11 @@ function ENT:ApplyDupeInfo(ply, ent, info, GetEntByID) if info.linked_entities then 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 + if type( info.linked_entities ) == "number" then -- old dupe compatibility + self:LinkEnt( GetEntByID( info.linked_entities ) ) else - for i = 1, #info.linked_entities do - local linked = GetEntByID(info.linked_entities[i]) - if IsValid(linked) then - self:LinkEnt(linked, true) - end + for i=1,#info.linked_entities do + self:LinkEnt( GetEntByID( info.linked_entities[i] ) ) end end end From 489155f2146b3300b9d792bb7e3cdbad3d6c8c04 Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Thu, 9 Apr 2026 19:22:18 +0300 Subject: [PATCH 3/3] Woops --- lua/entities/gmod_wire_damage_detector.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/entities/gmod_wire_damage_detector.lua b/lua/entities/gmod_wire_damage_detector.lua index b2fc3ca204..e5baba3665 100644 --- a/lua/entities/gmod_wire_damage_detector.lua +++ b/lua/entities/gmod_wire_damage_detector.lua @@ -61,6 +61,8 @@ function ENT:Initialize() self.linked_entities = {} -- numerical array self.linked_entities_lookup = {} -- lookup table indexed by entities + self:LinkEnt( self ) + self.count = 0 self.key_ents = {}