forked from willox/gmod-keypad
Remove owner from wire keypad
This commit is contained in:
parent
b21780fef6
commit
0ffb2ed22c
@ -60,25 +60,23 @@ end
|
||||
function ENT:Process(granted)
|
||||
self:GetData()
|
||||
|
||||
local length, repeats, delay, initdelay, owner, outputKey
|
||||
local length, repeats, delay, initdelay, outputKey
|
||||
|
||||
if(granted) then
|
||||
self:SetStatus(self.Status_Granted)
|
||||
|
||||
length = self.KeypadData.LengthGranted
|
||||
repeats = math.min(self.KeypadData.RepeatsGranted, 50)
|
||||
delay = self.KeypadData.DelayGranted
|
||||
length = self.KeypadData.LengthGranted
|
||||
repeats = math.min(self.KeypadData.RepeatsGranted, 50)
|
||||
delay = self.KeypadData.DelayGranted
|
||||
initdelay = self.KeypadData.InitDelayGranted
|
||||
owner = self.KeypadData.Owner
|
||||
outputKey = "Access Granted"
|
||||
else
|
||||
self:SetStatus(self.Status_Denied)
|
||||
|
||||
length = self.KeypadData.LengthDenied
|
||||
repeats = math.min(self.KeypadData.RepeatsDenied, 50)
|
||||
delay = self.KeypadData.DelayDenied
|
||||
length = self.KeypadData.LengthDenied
|
||||
repeats = math.min(self.KeypadData.RepeatsDenied, 50)
|
||||
delay = self.KeypadData.DelayDenied
|
||||
initdelay = self.KeypadData.InitDelayDenied
|
||||
owner = self.KeypadData.Owner
|
||||
outputKey = "Access Denied"
|
||||
end
|
||||
|
||||
@ -92,13 +90,13 @@ function ENT:Process(granted)
|
||||
if(IsValid(self)) then
|
||||
for i = 0, repeats do
|
||||
timer.Simple(length * i + delay * i, function()
|
||||
if(IsValid(self) and IsValid(owner)) then
|
||||
if(IsValid(self)) then
|
||||
Wire_TriggerOutput(self, outputKey, self.KeypadData.OutputOn)
|
||||
end
|
||||
end)
|
||||
|
||||
timer.Simple(length * (i + 1) + delay * i, function()
|
||||
if(IsValid(self) and IsValid(owner)) then
|
||||
if(IsValid(self)) then
|
||||
Wire_TriggerOutput(self, outputKey, self.KeypadData.OutputOff)
|
||||
end
|
||||
end)
|
||||
@ -145,8 +143,7 @@ function ENT:GetData()
|
||||
OutputOn = 0,
|
||||
OutputOff = 0,
|
||||
|
||||
Secure = false,
|
||||
Owner = NULL
|
||||
Secure = false
|
||||
} )
|
||||
end
|
||||
|
||||
|
@ -62,9 +62,7 @@ function TOOL:SetupKeypad(ent, pass)
|
||||
OutputOn = self:GetClientNumber("output_on"),
|
||||
OutputOff = self:GetClientNumber("output_off"),
|
||||
|
||||
Secure = util.tobool(self:GetClientNumber("secure")),
|
||||
|
||||
Owner = self:GetOwner()
|
||||
Secure = util.tobool(self:GetClientNumber("secure"))
|
||||
}
|
||||
|
||||
ent:SetData(data)
|
||||
@ -87,11 +85,8 @@ function TOOL:RightClick(tr)
|
||||
return false
|
||||
end
|
||||
|
||||
if trace_ent:GetData().Owner == ply then
|
||||
self:SetupKeypad(trace_ent, password)
|
||||
|
||||
return true
|
||||
end
|
||||
self:SetupKeypad(trace_ent, password)
|
||||
return true
|
||||
end
|
||||
|
||||
function TOOL:LeftClick(tr)
|
||||
|
Loading…
Reference in New Issue
Block a user