Workbench: allow to register custom cuttable nodes (defined by user)

axinite
JP Guerrero 2016-11-30 16:18:12 +01:00
parent 6bd045e3de
commit 388ae38841
2 changed files with 16 additions and 2 deletions

View File

@ -46,8 +46,6 @@ function mailbox:formspec(pos, owner, num)
local stack_count = stack:match("%s(%d+)") or 1
giver = giver.."#FFFF00,"..giver_name..","..i..",#FFFFFF,x "..stack_count..","
-- Hack to force using a 16px resolution for images in formspec's tablecolumn.
-- The engine doesn't scale them automatically yet.
img = img..i.."="..img_col(stack_name).."^\\[resize:16x16,"
end
end

View File

@ -23,6 +23,22 @@ for node, def in pairs(minetest.registered_nodes) do
end
end
-- Optionally, you can register custom cuttable nodes in the workbench
workbench.custom_nodes_register = {
-- "default:leaves",
}
setmetatable(nodes, {
__concat = function(t1, t2)
for k in pairs(t2) do
t1[#t1+1] = t2[k]
end
return t1
end
})
nodes = nodes..workbench.custom_nodes_register
-- Nodeboxes definitions.
workbench.defs = {
-- Name Yield X Y Z W H L