Assume a selection box for fences
author0gb.us <0gb.us@0gb.us>
Wed, 16 Oct 2013 05:17:06 +0000 (22:17 -0700)
committerShadowNinja <shadowninja@minetest.net>
Sat, 30 Nov 2013 18:22:50 +0000 (13:22 -0500)
Similar to assuming a selection box for the nodebox drawtype, minetest.register_item() now assumes a selection box for the fencelike drawtype.

builtin/misc_register.lua

index bb2c62ab8ca0ecd33d27c16ae6c2f6df24f4a8b1..aa062d731797eff4c8a05794bb62a78d6a4fe2b8 100644 (file)
@@ -106,6 +106,11 @@ function minetest.register_item(name, itemdef)
                -- Use the nodebox as selection box if it's not set manually
                if itemdef.drawtype == "nodebox" and not itemdef.selection_box then
                        itemdef.selection_box = itemdef.node_box
+               elseif itemdef.drawtype == "fencelike" and not itemdef.selection_box then
+                       itemdef.selection_box = {
+                               type = "fixed",
+                               fixed = {-1/8, -1/2, -1/8, 1/8, 1/2, 1/8},
+                       }
                end
                setmetatable(itemdef, {__index = minetest.nodedef_default})
                minetest.registered_nodes[itemdef.name] = itemdef