mirror of
https://github.com/willox/gmod-keypad.git
synced 2025-03-04 03:13:31 -05:00
Don't die when calling SetTable after Initialize
This commit is contained in:
parent
8b8bf09079
commit
a1397528c2
@ -58,6 +58,8 @@ function ENT:GetValue()
|
||||
end
|
||||
|
||||
function ENT:Process(granted)
|
||||
self:GetData()
|
||||
|
||||
local length, repeats, delay, initdelay, owner, key
|
||||
|
||||
if(granted) then
|
||||
@ -119,11 +121,35 @@ function ENT:SetData(data)
|
||||
end
|
||||
|
||||
function ENT:GetData()
|
||||
if not self.KeypadData then
|
||||
self:SetData( {
|
||||
Password = 1337,
|
||||
|
||||
RepeatsGranted = 0,
|
||||
RepeatsDenied = 0,
|
||||
|
||||
LengthGranted = 0,
|
||||
LengthDenied = 0,
|
||||
|
||||
DelayGranted = 0,
|
||||
DelayDenied = 0,
|
||||
|
||||
InitDelayGranted = 0,
|
||||
InitDelayDenied = 0,
|
||||
|
||||
KeyGranted = 0,
|
||||
KeyDenied = 0,
|
||||
|
||||
Secure = false,
|
||||
Owner = NULL
|
||||
} )
|
||||
end
|
||||
|
||||
return self.KeypadData
|
||||
end
|
||||
|
||||
function ENT:Reset()
|
||||
self:SetValue("")
|
||||
self:SetStatus(self.Status_None)
|
||||
self:SetSecure(self.KeypadData.Secure)
|
||||
self:SetSecure(self:GetData().Secure)
|
||||
end
|
@ -42,29 +42,8 @@ function ENT:Initialize()
|
||||
self:SetValue("")
|
||||
self:SetPassword("1337")
|
||||
|
||||
if(not self.KeypadData) then
|
||||
self:SetData({
|
||||
Password = 1337,
|
||||
|
||||
RepeatsGranted = 0,
|
||||
RepeatsDenied = 0,
|
||||
|
||||
LengthGranted = 0,
|
||||
LengthDenied = 0,
|
||||
|
||||
DelayGranted = 0,
|
||||
DelayDenied = 0,
|
||||
|
||||
InitDelayGranted = 0,
|
||||
InitDelayDenied = 0,
|
||||
|
||||
KeyGranted = 0,
|
||||
KeyDenied = 0,
|
||||
|
||||
Secure = false,
|
||||
Owner = NULL
|
||||
})
|
||||
end
|
||||
-- Initialize defaults
|
||||
self:GetData()
|
||||
|
||||
self:Reset()
|
||||
end
|
||||
|
@ -58,6 +58,8 @@ function ENT:GetValue()
|
||||
end
|
||||
|
||||
function ENT:Process(granted)
|
||||
self:GetData()
|
||||
|
||||
local length, repeats, delay, initdelay, owner, outputKey
|
||||
|
||||
if(granted) then
|
||||
@ -122,7 +124,37 @@ function ENT:GetData()
|
||||
return self.KeypadData
|
||||
end
|
||||
|
||||
function ENT:GetData()
|
||||
if not self.KeypadData then
|
||||
self:SetData( {
|
||||
Password = false,
|
||||
|
||||
RepeatsGranted = 0,
|
||||
RepeatsDenied = 0,
|
||||
|
||||
LengthGranted = 0,
|
||||
LengthDenied = 0,
|
||||
|
||||
DelayGranted = 0,
|
||||
DelayDenied = 0,
|
||||
|
||||
InitDelayGranted = 0,
|
||||
InitDelayDenied = 0,
|
||||
|
||||
OutputOn = 0,
|
||||
OutputOff = 0,
|
||||
|
||||
Secure = false,
|
||||
Owner = NULL
|
||||
} )
|
||||
end
|
||||
|
||||
return self.KeypadData
|
||||
end
|
||||
|
||||
function ENT:Reset()
|
||||
self:GetData()
|
||||
|
||||
self:SetValue("")
|
||||
self:SetStatus(self.Status_None)
|
||||
self:SetSecure(self.KeypadData.Secure)
|
||||
|
@ -52,29 +52,8 @@ function ENT:Initialize()
|
||||
self:SetValue("")
|
||||
self:SetPassword("1337")
|
||||
|
||||
if(not self.KeypadData) then
|
||||
self:SetData({
|
||||
Password = false,
|
||||
|
||||
RepeatsGranted = 0,
|
||||
RepeatsDenied = 0,
|
||||
|
||||
LengthGranted = 0,
|
||||
LengthDenied = 0,
|
||||
|
||||
DelayGranted = 0,
|
||||
DelayDenied = 0,
|
||||
|
||||
InitDelayGranted = 0,
|
||||
InitDelayDenied = 0,
|
||||
|
||||
OutputOn = 0,
|
||||
OutputOff = 0,
|
||||
|
||||
Secure = false,
|
||||
Owner = NULL
|
||||
})
|
||||
end
|
||||
-- Initialize defaults
|
||||
self:GetData()
|
||||
|
||||
self:Reset()
|
||||
end
|
||||
|
@ -84,7 +84,7 @@ function TOOL:RightClick(tr)
|
||||
return false
|
||||
end
|
||||
|
||||
if trace_ent.KeypadData.Owner == ply then
|
||||
if trace_ent:GetData().Owner == ply then
|
||||
self:SetupKeypad(trace_ent, password)
|
||||
|
||||
return true
|
||||
|
@ -87,7 +87,7 @@ function TOOL:RightClick(tr)
|
||||
return false
|
||||
end
|
||||
|
||||
if trace_ent.KeypadData.Owner == ply then
|
||||
if trace_ent:GetData().Owner == ply then
|
||||
self:SetupKeypad(trace_ent, password)
|
||||
|
||||
return true
|
||||
|
Loading…
Reference in New Issue
Block a user