[stained_wood] Make "wood_colors" & "wood_colors_count" global & move to

init.lua script.
This commit is contained in:
AntumDeluge 2016-08-07 18:39:45 -07:00
parent 194bf45c22
commit 9acbeb85c1
2 changed files with 20 additions and 19 deletions

View File

@ -46,6 +46,26 @@ titleize = function(string)
end
-- Define function to retrieve total number of stained wood colors
getWoodColorsCount = function(colors)
local color_count = 0
for _ in pairs(colors) do
color_count = color_count + 1
end
return color_count
end
-- Set stained wood colors
wood_colors = {"blue", "brown", "gray", "green", "purple", "red",
"white", "yellow"}
wood_colors_count = getWoodColorsCount(wood_colors)
logMessage("nodes.lua: " .. wood_colors_count .. " wood colors loaded")
-- Load sub-scripts
dofile(modpath .. "/nodes.lua")
dofile(modpath .. "/crafting.lua")

View File

@ -23,18 +23,6 @@
-- Define function to retrieve total number of stained wood colors
getWoodColorsCount = function(colors)
local color_count = 0
for _ in pairs(colors) do
color_count = color_count + 1
end
return color_count
end
-- Define function for adding a stained wood
addStainedWood = function(color)
local node_name = "stained_wood:" .. color
@ -51,13 +39,6 @@ addStainedWood = function(color)
end
local wood_colors = {"blue", "brown", "gray", "green", "purple", "red",
"white", "yellow"}
local wood_colors_count = getWoodColorsCount(wood_colors)
logMessage("nodes.lua: " .. wood_colors_count .. " wood colors loaded")
-- Register all stained wood
for i = 1, wood_colors_count do
addStainedWood(wood_colors[i])