Assume a selection box for fences

Similar to assuming a selection box for the nodebox drawtype, minetest.register_item() now assumes a selection box for the fencelike drawtype.
This commit is contained in:
0gb.us 2013-10-15 22:17:06 -07:00 committed by Nils Dagsson Moskopp
parent 9ddac46bd9
commit 41be943528
Signed by: erle
GPG Key ID: A3BC671C35191080
1 changed files with 5 additions and 0 deletions

View File

@ -106,6 +106,11 @@ function minetest.register_item(name, itemdef)
-- Use the nodebox as selection box if it's not set manually -- Use the nodebox as selection box if it's not set manually
if itemdef.drawtype == "nodebox" and not itemdef.selection_box then if itemdef.drawtype == "nodebox" and not itemdef.selection_box then
itemdef.selection_box = itemdef.node_box 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 end
setmetatable(itemdef, {__index = minetest.nodedef_default}) setmetatable(itemdef, {__index = minetest.nodedef_default})
minetest.registered_nodes[itemdef.name] = itemdef minetest.registered_nodes[itemdef.name] = itemdef