add an after_unexpand hook to allow beds to properly expand and unexpand, and update beds to use expansion in the process

This commit is contained in:
Tim
2015-01-23 00:48:53 +01:00
committed by Vanessa Ezekowitz
parent e9bfc337d4
commit 306a6798b3
2 changed files with 15 additions and 34 deletions

View File

@ -77,8 +77,10 @@ function homedecor.register(name, def)
end
end
local expand = def.expand
local expand = def.expand
def.expand = nil
local after_unexpand = def.after_unexpand
def.after_unexpand = nil
if expand then
def.on_place = def.on_place or function(itemstack, placer, pointed_thing)
@ -115,6 +117,10 @@ function homedecor.register(name, def)
minetest.remove_node(forward_pos)
end
end
if after_unexpand then
after_unexpand(pos)
end
end
end