Work Table nodeboxes : move combination table outisde of rightclick function to prevent table creation overhead
This commit is contained in:
parent
7c647948c0
commit
22e06a66ad
@ -42,6 +42,22 @@ worktable.repairable_tools = [[
|
|||||||
pick, axe, shovel, sword, hoe, armor, shield
|
pick, axe, shovel, sword, hoe, armor, shield
|
||||||
]]
|
]]
|
||||||
|
|
||||||
|
-- Nodeboxes's combination table.
|
||||||
|
worktable.nodebox_blender = {
|
||||||
|
{"nanoslab", nil, 2 },
|
||||||
|
{"micropanel", nil, 3 },
|
||||||
|
{"cube", nil, 6 },
|
||||||
|
{"cube", "panel", 9 },
|
||||||
|
{"cube", "outerstair", 11 },
|
||||||
|
{"cube", "halfstair", 7 },
|
||||||
|
{"cube", "innerstair", nil},
|
||||||
|
{"panel", nil, 7 },
|
||||||
|
{"panel", "cube", 9 },
|
||||||
|
{"panel", "outerstair", 12 },
|
||||||
|
{"halfstair", nil, 11 },
|
||||||
|
{"halfstair", "outerstair", nil}
|
||||||
|
}
|
||||||
|
|
||||||
function worktable:get_recipe(item)
|
function worktable:get_recipe(item)
|
||||||
if item:find("^group:") then
|
if item:find("^group:") then
|
||||||
if item:find("wool$") or item:find("dye$") then
|
if item:find("wool$") or item:find("dye$") then
|
||||||
@ -407,25 +423,10 @@ for node in pairs(minetest.registered_nodes) do
|
|||||||
minetest.record_protection_violation(pos, player_name) return
|
minetest.record_protection_violation(pos, player_name) return
|
||||||
end
|
end
|
||||||
|
|
||||||
local T = {
|
|
||||||
{"nanoslab", nil, 2 },
|
|
||||||
{"micropanel", nil, 3 },
|
|
||||||
{"cube", nil, 6 },
|
|
||||||
{"cube", "panel", 9 },
|
|
||||||
{"cube", "outerstair", 11 },
|
|
||||||
{"cube", "halfstair", 7 },
|
|
||||||
{"cube", "innerstair", nil},
|
|
||||||
{"panel", nil, 7 },
|
|
||||||
{"panel", "cube", 9 },
|
|
||||||
{"panel", "outerstair", 12 },
|
|
||||||
{"halfstair", nil, 11 },
|
|
||||||
{"halfstair", "outerstair", nil}
|
|
||||||
}
|
|
||||||
|
|
||||||
local newnode, combined = def.name, false
|
local newnode, combined = def.name, false
|
||||||
if clicker:get_player_control().sneak then
|
if clicker:get_player_control().sneak then
|
||||||
local wield_item = clicker:get_wielded_item():get_name()
|
local wield_item = clicker:get_wielded_item():get_name()
|
||||||
for _, x in pairs(T) do
|
for _, x in pairs(worktable.nodebox_blender) do
|
||||||
if wield_item == newnode.."_"..x[1] then
|
if wield_item == newnode.."_"..x[1] then
|
||||||
if not x[2] then x[2] = x[1] end
|
if not x[2] then x[2] = x[1] end
|
||||||
local pointed_nodebox = minetest.get_node(pos).name:match("(%w+)$")
|
local pointed_nodebox = minetest.get_node(pos).name:match("(%w+)$")
|
||||||
|
Loading…
Reference in New Issue
Block a user