wiremod-svn-archive/wire/lua/weapons/laserPointer/cl_init.lua

35 lines
1.1 KiB
Lua
Raw Normal View History

include('shared.lua')
SWEP.PrintName = "Laser Pointer"
SWEP.Slot = 0
SWEP.SlotPos = 4
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = true
2007-06-12 12:49:29 +00:00
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()
2007-06-12 12:49:29 +00:00
if(self.Weapon:GetNWBool("Active")) then
--[[
local pos = self.Owner:GetShootPos()
local tracedata = {}
tracedata.start = pos
tracedata.endpos = pos + self.Owner:GetAimVector() * 100000
tracedata.filter = self.Owner
local trace = util.TraceLine(tracedata)
]]--
//Draw the laser beam.
2007-06-12 12:49:29 +00:00
render.SetMaterial( LASER )
//render.DrawBeam(trace.StartPos, trace.HitPos, 6, 0, 10, Color(255,0,0,255))
render.DrawBeam(self.VM:GetAttachment(self.Attach).Pos, self.Owner:GetEyeTrace().HitPos, 2, 0, 12.5, Color(255, 0, 0, 255))
2007-06-06 15:19:16 +00:00
//Msg("Laser\n")
end
end