forked from wiremod/wire
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
37 lines (30 loc) · 1020 Bytes
/
init.lua
File metadata and controls
37 lines (30 loc) · 1020 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
function SWEP:Equip(newOwner)
if IsValid(newOwner.LasReceiver) then
self.Receiver = newOwner.LasReceiver
newOwner.LasReceiver = nil
newOwner:PrintMessage(HUD_PRINTTALK, "Relinked Successfully!")
end
end
function SWEP:Think()
if self.Pointing and IsValid(self.Receiver) then
local owner = self:GetOwner()
if not IsValid(owner) then return end
local trace
if IsValid(owner) then
trace = owner:GetEyeTrace()
else
local att = self:GetAttachment(self:LookupAttachment("muzzle"))
trace = util.TraceLine({ start = att.Pos, endpos = att.Pos + att.Ang:Forward() * 16384, filter = self })
end
local point = trace.HitPos
Wire_TriggerOutput(self.Receiver, "X", point.x)
Wire_TriggerOutput(self.Receiver, "Y", point.y)
Wire_TriggerOutput(self.Receiver, "Z", point.z)
Wire_TriggerOutput(self.Receiver, "Pos", point)
Wire_TriggerOutput(self.Receiver, "RangerData", trace)
self.Receiver.VPos = point
end
end