Use the nodebox as selection box if it's not set manually
authorDiego Martínez <kaeza@users.sf.net>
Fri, 5 Apr 2013 05:51:31 +0000 (02:51 -0300)
committerPilzAdam <pilzadam@minetest.net>
Fri, 5 Apr 2013 13:14:37 +0000 (15:14 +0200)
builtin/misc_register.lua
doc/lua_api.txt

index f9c06a02a3ac7796bf047f6cd8d4fc709062089f..d1e28fdab4b57d30aa6196e882954f40129ef5a0 100644 (file)
@@ -103,6 +103,10 @@ function minetest.register_item(name, itemdef)
 
        -- Apply defaults and add to registered_* table
        if itemdef.type == "node" then
+               -- 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
+               end
                setmetatable(itemdef, {__index = minetest.nodedef_default})
                minetest.registered_nodes[itemdef.name] = itemdef
        elseif itemdef.type == "craft" then
index a61ffce648d7a9f7c4701e96e28178e2174a2427..de73ecd3f517eb11b8d1d33a1cdbcf0f9abcd239 100644 (file)
@@ -1589,6 +1589,7 @@ Node definition (register_node)
     damage_per_second = 0, -- If player is inside node, this damage is caused
     node_box = {type="regular"}, -- See "Node boxes"
     selection_box = {type="regular"}, -- See "Node boxes"
+    ^ If drawtype "nodebox" is used and selection_box is nil, then node_box is used
     legacy_facedir_simple = false, -- Support maps made in and before January 2012
     legacy_wallmounted = false, -- Support maps made in and before January 2012
     sounds = {