1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2024-12-23 08:20:21 +01:00

local-ize a few variables

This commit is contained in:
Vanessa Ezekowitz 2013-12-15 14:07:36 -05:00
parent ef6002bee1
commit 744b016f93
3 changed files with 10 additions and 9 deletions

View File

@ -4,8 +4,8 @@ local S = homedecor.gettext
-- doors -- doors
function isSolid(pos,adj) local function isSolid(pos,adj)
adj = {x=adj[1],y=adj[2],z=adj[3]} local adj = {x=adj[1],y=adj[2],z=adj[3]}
local node = minetest.get_node(vector.add(pos,adj)) local node = minetest.get_node(vector.add(pos,adj))
if node then if node then
local idef = minetest.registered_nodes[minetest.get_node(vector.add(pos,adj)).name] local idef = minetest.registered_nodes[minetest.get_node(vector.add(pos,adj)).name]
@ -16,7 +16,7 @@ function isSolid(pos,adj)
return false return false
end end
function countSolids(pos,node,level) local function countSolids(pos,node,level)
local solids = 0 local solids = 0
for x = -1, 1 do for x = -1, 1 do
for z = -1, 1 do for z = -1, 1 do
@ -43,7 +43,7 @@ function countSolids(pos,node,level)
return solids return solids
end end
function calculateClosed(pos) local function calculateClosed(pos)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
-- the door is considered closed if it is closing off something. -- the door is considered closed if it is closing off something.
@ -119,7 +119,7 @@ function calculateClosed(pos)
end end
-- isClosed flag, is 0 or 1 0 = open, 1 = closed -- isClosed flag, is 0 or 1 0 = open, 1 = closed
function getClosed(pos) local function getClosed(pos)
local isClosed = minetest.get_meta(pos):get_string('closed') local isClosed = minetest.get_meta(pos):get_string('closed')
if isClosed=='' then if isClosed=='' then
if calculateClosed(pos) then if calculateClosed(pos) then
@ -134,7 +134,7 @@ function getClosed(pos)
end end
end end
function addDoorNode(pos,def,isClosed) local function addDoorNode(pos,def,isClosed)
if isClosed then if isClosed then
isClosed = 1 isClosed = 1
else else
@ -534,6 +534,7 @@ function homedecor.flip_gate(pos, node, player, gate, oc)
-- since right facing gates use "open" nodes for closed, we need an -- since right facing gates use "open" nodes for closed, we need an
-- isClosed flag to tell if it's "really" closed. -- isClosed flag to tell if it's "really" closed.
local gateresult = nil
if oc == "closed" then if oc == "closed" then
gateresult = "homedecor:gate_"..gate.."_open" gateresult = "homedecor:gate_"..gate.."_open"
else else

View File

@ -71,8 +71,8 @@ local chaircolors = {
} }
for i in ipairs(chaircolors) do for i in ipairs(chaircolors) do
color = chaircolors[i][1] local color = chaircolors[i][1]
name = chaircolors[i][2] local name = chaircolors[i][2]
minetest.register_node("homedecor:armchair_"..color, { minetest.register_node("homedecor:armchair_"..color, {
description = "Armchair ("..name..")", description = "Armchair ("..name..")",
tiles = { tiles = {

View File

@ -2,7 +2,7 @@
local S = homedecor.gettext local S = homedecor.gettext
materials = { local materials = {
{"glass","Glass"}, {"glass","Glass"},
{"wood","Wood"} {"wood","Wood"}
} }