Skip to content

Commit

Permalink
Allow building doors on buildable_to nodes.
Browse files Browse the repository at this point in the history
This code never allowed placing a door on e.g. a grass
plant. The code to handle this isn't that complex. With
this code, doors can be placed on flowers and on normal
node surfaces without issues.
  • Loading branch information
sofar authored and paramat committed Feb 19, 2016
1 parent 1ab0fc1 commit bbf17c9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions mods/doors/init.lua
Expand Up @@ -183,8 +183,15 @@ function doors.register(name, def)
inventory_image = def.inventory_image,
on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.above
local node = minetest.get_node(pos)
local pos = nil
local node = minetest.get_node(pointed_thing.under)
if minetest.registered_nodes[node.name].buildable_to then
pos = pointed_thing.under
else
pos = pointed_thing.above
node = minetest.get_node(pos)
end
if not minetest.registered_nodes[node.name].buildable_to then
return itemstack
Expand Down

0 comments on commit bbf17c9

Please sign in to comment.