Clean up door tops if fire destroys bottom.
authorAuke Kok <sofar@foo-projects.org>
Sat, 12 Mar 2016 06:11:39 +0000 (22:11 -0800)
committerparamat <mat.gregory@virginmedia.com>
Sun, 13 Mar 2016 04:49:21 +0000 (04:49 +0000)
Fixes #909. Door tops are never flammable.

This doesn't guard yet against a voxelmanip removing the top node,
but that is less of an issue since if a voxelmanip removes the top,
then the bottom part remains functional and visibly intact. If the
voxelmanip removes the bottom part, but not the top, then this patch
makes it clean up the top just fine.

mods/doors/init.lua

index e5962bd3a3f5452f6060c958c4849d83e40abccb..9300e6ffc3488e83249c246086a299010b8d6c00 100644 (file)
@@ -339,6 +339,10 @@ function doors.register(name, def)
                end
        end
 
+       def.on_destruct = function(pos)
+               minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z})
+       end
+
        minetest.register_node(":" .. name .. "_a", {
                description = def.description,
                visual = "mesh",
@@ -361,6 +365,7 @@ function doors.register(name, def)
                can_dig = def.can_dig,
                on_rotate = def.on_rotate,
                on_blast = def.on_blast,
+               on_destruct = def.on_destruct,
                selection_box = {
                        type = "fixed",
                        fixed = { -1/2,-1/2,-1/2,1/2,3/2,-6/16}
@@ -393,6 +398,7 @@ function doors.register(name, def)
                can_dig = def.can_dig,
                on_rotate = def.on_rotate,
                on_blast = def.on_blast,
+               on_destruct = def.on_destruct,
                selection_box = {
                        type = "fixed",
                        fixed = { -1/2,-1/2,-1/2,1/2,3/2,-6/16}