[ADDED] Vector output to the Laser Pointer Receiver [ADDED] Laser Pointers Should Now Auto Relink [TIDY] Removed some debugging or commented out code.
25 lines
729 B
Lua
25 lines
729 B
Lua
include('shared.lua')
|
|
SWEP.PrintName = "Laser Pointer"
|
|
SWEP.Slot = 0
|
|
SWEP.SlotPos = 4
|
|
SWEP.DrawAmmo = false
|
|
SWEP.DrawCrosshair = true
|
|
|
|
local LASER = Material('cable/redlaser')
|
|
|
|
function SWEP:Initialize()
|
|
local ply = LocalPlayer()
|
|
self.VM = ply:GetViewModel()
|
|
local attachmentIndex = self.VM:LookupAttachment("muzzle")
|
|
if attachmentIndex == 0 then attachmentIndex = self.VM:LookupAttachment("1") end
|
|
self.Attach = attachmentIndex
|
|
end
|
|
|
|
function SWEP:ViewModelDrawn()
|
|
if(self.Weapon:GetNWBool("Active")) then
|
|
//Draw the laser beam.
|
|
render.SetMaterial( LASER )
|
|
render.DrawBeam(self.VM:GetAttachment(self.Attach).Pos, self.Owner:GetEyeTrace().HitPos, 2, 0, 12.5, Color(255, 0, 0, 255))
|
|
end
|
|
end
|