AddCSLuaFile( "cl_init.lua" ) AddCSLuaFile( "shared.lua" ) include('shared.lua') ENT.WireDebugName = "RFID Reader" local MODEL = Model("models/jaanus/wiretool/wiretool_input.mdl") function ENT:Initialize() self:SetModel( MODEL ) self:PhysicsInit( SOLID_VPHYSICS ) self:SetMoveType( MOVETYPE_VPHYSICS ) self:SetSolid( SOLID_VPHYSICS ) self.Outputs = Wire_CreateOutputs(self, { "State", "A", "B", "C", "D" }) self.MaxRange=100 self.A=0 self.B=0 self.C=0 self.D=0 self.State=0 self.NoColorChg=false Wire_TriggerOutput(self,"State",0) Wire_TriggerOutput(self,"A",0) Wire_TriggerOutput(self,"B",0) Wire_TriggerOutput(self,"C",0) Wire_TriggerOutput(self,"D",0) self:ShowOutput(0,0,0,0,0) end function ENT:OnRemove() Wire_Remove(self) end function ENT:Setup(Range,col) self.MaxRange=Range self.NoColorChg=col end function ENT:Think() self.BaseClass.Think(self) local ent = nil local mypos = self:GetPos() local mindist = -1 for _,contact in pairs(ents.FindInSphere(self:GetPos(), self.MaxRange or 10)) do if contact.__RFID_HASRFID then ent=contact; local dist = (contact:GetPos() - mypos):Length() if (mindist<0 or dist