include('shared.lua') // Best material local Laser = Material("tripmine_laser") // Draw function ENT:Draw() if (LocalPlayer():GetEyeTrace().Entity == self.Entity && EyePos():Distance(self.Entity:GetPos()) < 512) then self:DrawEntityOutline(1.0) if (self:GetOverlayText() != "") then AddWorldTip(self.Entity:EntIndex(), self:GetOverlayText(), 0.5, self.Entity:GetPos(), self.Entity) end end local Entity = self.Entity:GetNetworkedEntity("Target") local Target = self.Entity:GetNetworkedInt("Target") if (Target == 1) then if (Entity) then local Valid = Entity:IsValid() if (Valid) then local Position = self.Entity:GetPos() local Radius = self:GetEntityRadius() local Ang = Entity:GetPos() local Pl = Entity:IsPlayer() if (Pl) then Ang = Ang + Vector(0, 0, 32) end Ang = (Ang - Position):Normalize() local Trace = {} Trace.start = Position Trace.endpos = Position + (Ang * Radius) Trace.filter = self.Entity local TR = util.TraceLine(Trace) render.SetMaterial(Laser) if (TR.Entity and TR.Entity == Entity) then render.DrawBeam(Position, TR.HitPos, 16, 0.2, 0.8, Color(0, 255, 0, 200)) else render.DrawBeam(Position, TR.HitPos, 16, 0.2, 0.8, Color(255, 0, 0, 200)) end end end end self.Entity:DrawModel() end