Fix "uninitialized global variable" warnings

This commit is contained in:
FaceDeer 2017-04-09 15:31:33 -06:00 committed by LNJ
parent 69cad92b3e
commit 8009743d8d
No known key found for this signature in database
GPG Key ID: 69268DBD835B6B0B
3 changed files with 12 additions and 12 deletions

@ -46,7 +46,7 @@ function drawers.drawer_on_construct(pos)
-- meta
local meta = core.get_meta(pos)
i = 1
local i = 1
while i <= drawerType do
local vid = i
-- 1x1 drawers don't have numbers in the meta fields
@ -84,7 +84,7 @@ function drawers.drawer_on_dig(pos, node, player)
local meta = core.get_meta(pos)
k = 1
local k = 1
while k <= drawerType do
-- don't add a number in meta fields for 1x1 drawers
local vid = tostring(k)
@ -98,7 +98,7 @@ function drawers.drawer_on_dig(pos, node, player)
local j = math.floor(count / stack_max) + 1
local i = 1
while i <= j do
rndpos = drawers.randomize_pos(pos)
local rndpos = drawers.randomize_pos(pos)
if not (i == j) then
core.add_item(rndpos, name .. " " .. stack_max)
else
@ -141,11 +141,11 @@ function drawers.register_drawer(name, def)
def.on_destruct = drawers.drawer_on_destruct
def.on_dig = drawers.drawer_on_dig
if screwdriver then
if minetest.get_modpath("screwdriver") and screwdriver then
def.on_rotate = def.on_rotate or screwdriver.disallow
end
if pipeworks then
if minetest.get_modpath("pipeworks") and pipeworks then
def.groups.tubedevice = 1
def.groups.tubedevice_receiver = 1
def.tube = def.tube or {}
@ -159,7 +159,7 @@ function drawers.register_drawer(name, def)
if drawers.enable_1x1 then
-- normal drawer 1x1 = 1
def1 = table.copy(def)
local def1 = table.copy(def)
def1.description = def.description .. " Drawer"
def1.tiles = def.tiles or def.tiles1
def1.tiles1 = nil
@ -172,7 +172,7 @@ function drawers.register_drawer(name, def)
if drawers.enable_1x2 then
-- 1x2 = 2
def2 = table.copy(def)
local def2 = table.copy(def)
def2.description = def.description .. " Drawers (1x2)"
def2.tiles = def.tiles2
def2.tiles1 = nil
@ -184,7 +184,7 @@ function drawers.register_drawer(name, def)
if drawers.enable_2x2 then
-- 2x2 = 4
def4 = table.copy(def)
local def4 = table.copy(def)
def4.description = def.description .. " Drawers (2x2)"
def4.tiles = def.tiles4
def4.tiles1 = nil

@ -83,7 +83,7 @@ function drawers.spawn_visuals(pos)
local fdir = vector.new(-bdir.x, 0, -bdir.z)
local pos2 = vector.add(pos, vector.multiply(fdir, 0.438))
obj = core.add_entity(pos2, "drawers:visual")
local obj = core.add_entity(pos2, "drawers:visual")
if bdir.x < 0 then obj:setyaw(0.5 * math.pi) end
if bdir.z < 0 then obj:setyaw(math.pi) end
@ -103,7 +103,7 @@ function drawers.spawn_visuals(pos)
fdir2 = vector.new(-bdir.x, -0.5, -bdir.z)
end
objs = {}
local objs = {}
drawers.last_visual_id = 1
drawers.last_texture = drawers.get_inv_image(core.get_meta(pos):get_string("name1"))
@ -149,7 +149,7 @@ function drawers.spawn_visuals(pos)
fdir4 = vector.new(-bdir.x, -0.5, -bdir.z + 0.5)
end
objs = {}
local objs = {}
drawers.last_visual_id = 1
drawers.last_texture = drawers.get_inv_image(core.get_meta(pos):get_string("name1"))

@ -51,7 +51,7 @@ core.register_entity("drawers:visual", {
on_activate = function(self, staticdata, dtime_s)
-- Restore data
data = core.deserialize(staticdata)
local data = core.deserialize(staticdata)
if data then
self.drawer_pos = {
x = data.drawer_posx,