]> git.lizzy.rs Git - xdecor.git/commitdiff
Workbench: allow to register custom cuttable nodes (defined by user)
authorJP Guerrero <jeanpatrick.guerrero@gmail.com>
Wed, 30 Nov 2016 15:18:12 +0000 (16:18 +0100)
committerJP Guerrero <jeanpatrick.guerrero@gmail.com>
Wed, 30 Nov 2016 15:22:31 +0000 (16:22 +0100)
src/mailbox.lua
src/workbench.lua

index cd9a03c4845abce370fb999775974a250b799502..67cb43e9618a2ebb85068ad169227e9b0ab22fb1 100644 (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
index ccf1918cb95f7f135174780c1b80501ae5d1f9de..29f12b9b8af707d85e82af3a5849fd8b2c4be1e5 100644 (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