From: JP Guerrero Date: Wed, 30 Nov 2016 15:18:12 +0000 (+0100) Subject: Workbench: allow to register custom cuttable nodes (defined by user) X-Git-Tag: 1.0~25 X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=388ae38841871ee8c949278ac0f436586ec62889;p=xdecor.git Workbench: allow to register custom cuttable nodes (defined by user) --- diff --git a/src/mailbox.lua b/src/mailbox.lua index cd9a03c..67cb43e 100644 --- a/src/mailbox.lua +++ b/src/mailbox.lua @@ -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 diff --git a/src/workbench.lua b/src/workbench.lua index ccf1918..29f12b9 100644 --- a/src/workbench.lua +++ b/src/workbench.lua @@ -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