Work Table : modify nodes array to string

This commit is contained in:
kilbith 2016-01-15 16:30:31 +01:00
parent d6f3f955ee
commit f1ff9b6e0c
2 changed files with 24 additions and 24 deletions

View File

@ -139,7 +139,7 @@ enchanting.speed = 0.2
enchanting.jump = 0.2 enchanting.jump = 0.2
local tools = { local tools = {
--[[ Registration format : --[[ Registration format:
[Mod name] = { [Mod name] = {
{materials}, {materials},
{tool name, tool group, {enchantments}} {tool name, tool group, {enchantments}}

View File

@ -1,29 +1,29 @@
local worktable = {} local worktable = {}
screwdriver = screwdriver or {} screwdriver = screwdriver or {}
local nodes = { -- Nodes allowed to be cut. Mod name = {node name}. local nodes = { -- Nodes allowed to be cut. Registration format: [mod name] = [[ node names ]].
["default"] = { ["default"] = [[
"wood", "tree", "cobble", "desert_stone", wood tree cobble desert_stone
"junglewood", "jungletree", "mossycobble", "stonebrick", junglewood jungletree mossycobble stonebrick
"pine_wood", "pine_tree", "desert_cobble", "sandstonebrick", pine_wood pine_tree desert_cobble sandstonebrick
"acacia_wood", "acacia_tree", "stone", "desert_stonebrick", acacia_wood acacia_tree stone desert_stonebrick
"aspen_wood", "aspen_tree", "sandstone", "obsidianbrick", aspen_wood aspen_tree sandstone obsidianbrick
"coalblock", "mese", "obsidian", coalblock mese obsidian
"copperblock", "brick", "obsidian_glass", copperblock brick obsidian_glass
"steelblock", "cactus", steelblock cactus
"goldblock", "ice", goldblock ice
"bronzeblock", "meselamp", bronzeblock meselamp
"diamondblock", "glass", diamondblock glass
}, ]],
["xdecor"] = { ["xdecor"] = [[
"coalstone_tile", "hard_clay", coalstone_tile hard_clay
"desertstone_tile", "packed_ice", desertstone_tile packed_ice
"stone_rune", "moonbrick", stone_rune moonbrick
"stone_tile", "woodframed_glass", stone_tile woodframed_glass
"cactusbrick", "wood_tile", cactusbrick wood_tile
}, ]],
} }
local def = { -- Nodebox name, yield, definition. local def = { -- Nodebox name, yield, definition.
@ -274,7 +274,7 @@ end
function worktable.allowed(mod, node) function worktable.allowed(mod, node)
if not mod then return end if not mod then return end
for _, it in pairs(mod) do for it in mod:gmatch("[%w_]+") do
if it == node then return true end if it == node then return true end
end end
return false return false
@ -384,7 +384,7 @@ xdecor.register("worktable", {
for _, d in pairs(def) do for _, d in pairs(def) do
for mod, n in pairs(nodes) do for mod, n in pairs(nodes) do
for _, name in pairs(n) do for name in n:gmatch("[%w_]+") do
local ndef = minetest.registered_nodes[mod..":"..name] local ndef = minetest.registered_nodes[mod..":"..name]
if ndef then if ndef then
local groups, tiles, light = {}, {} local groups, tiles, light = {}, {}