diff --git a/lua/entities/gmod_track_udochka/init.lua b/lua/entities/gmod_track_udochka/init.lua index 3186b87..c6f9e1c 100644 --- a/lua/entities/gmod_track_udochka/init.lua +++ b/lua/entities/gmod_track_udochka/init.lua @@ -22,13 +22,15 @@ local function removeWeldBetweenEnts(ent1,ent2) end end function ENT:Use(ply) - if self.Coupled then + if IsValid(self.Coupled) then sound.Play("buttons/lever8.wav",self:GetPos()) removeWeldBetweenEnts(self,self.Coupled) removeWeldBetweenEnts(self.Coupled,self) + self.Coupled.Connectors[self.ConnectorID] = nil self.Timer = CurTime()+2 end + self.ConnectorID = nil self.Coupled = nil if ( self:IsPlayerHolding() ) then return end if ply.PickupObject then ply:PickupObject( self ) end diff --git a/lua/entities/gmod_train_bogey/init.lua b/lua/entities/gmod_train_bogey/init.lua index ac6ab1a..de2cc44 100644 --- a/lua/entities/gmod_train_bogey/init.lua +++ b/lua/entities/gmod_train_bogey/init.lua @@ -392,17 +392,13 @@ function ENT:CheckContact(pos,dir,id,cpos) traceEnt:SetPos(self:LocalToWorld(cpos)) traceEnt:SetAngles(self:GetAngles()) traceEnt.Coupled = self + traceEnt.ConnectorID = id sound.Play("udochka_connect.wav",traceEnt:GetPos()) self.Connectors[id] = traceEnt DropEntityIfHeld(traceEnt) end end return false - elseif self.Connectors[id] == traceEnt then - if traceEnt.Coupled == nil then - self.Connectors[id] = nil - end - return false elseif traceEnt:GetClass() == "player" and self.Voltage > 40 then local pPos = traceEnt:GetPos() self.VoltageDropByTouch = (self.VoltageDropByTouch or 0) + 1