naming convention for most stuff but not all
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
Light = {}
|
||||
LoadedObjects.Lights = {}
|
||||
|
||||
function Light:New(x,y,range,flicker,color,lum)
|
||||
function Light:new(x,y,range,flicker,color,lum)
|
||||
local o = {}
|
||||
o.pos = {
|
||||
x = x,
|
||||
@@ -10,8 +10,8 @@ function Light:New(x,y,range,flicker,color,lum)
|
||||
o.range = range
|
||||
o.lum = lum or 1
|
||||
o.color = color or {1,1,1}
|
||||
o.flicker_value = flicker or 2
|
||||
o.flicker = 0
|
||||
o.flicker_amount = flicker or 2
|
||||
o.flicker_value = 0
|
||||
o.dim = 0
|
||||
o.flicker_time = 60/12
|
||||
o.flicker_timer = 0
|
||||
@@ -24,7 +24,7 @@ function Light:New(x,y,range,flicker,color,lum)
|
||||
return o
|
||||
end
|
||||
|
||||
function Light:Kill()
|
||||
function Light:kill()
|
||||
if self.id ~= nil then
|
||||
for _, e in pairs(LoadedObjects.Lights) do
|
||||
if e.id > self.id then
|
||||
@@ -36,12 +36,12 @@ function Light:Kill()
|
||||
self = nil
|
||||
end
|
||||
|
||||
function Light:Flicker()
|
||||
function Light:flicker()
|
||||
self.flicker_timer = self.flicker_timer + 1
|
||||
|
||||
if self.flicker_timer >= self.flicker_time then
|
||||
self.flicker_timer = self.flicker_timer - self.flicker_time
|
||||
self.flicker = math.random(0,1)
|
||||
self.flicker = math.min(math.max(self.flicker, -self.flicker_value), self.flicker_value)
|
||||
self.flicker_value = math.random(0,1)
|
||||
self.flicker_value = math.min(math.max(self.flicker_value, -self.flicker_amount), self.flicker_amount)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user