Chests: Fix locked chest protection against explosions (#1886)
authordanielmeek32 <danielmeek32@users.noreply.github.com>
Wed, 20 Sep 2017 18:08:17 +0000 (19:08 +0100)
committersfan5 <sfan5@live.de>
Sun, 19 Nov 2017 22:03:38 +0000 (23:03 +0100)
Fixes #1885

mods/default/nodes.lua

index d31a34b10e58fffa743d0d7059d458733e92f0c8..36d58340d2e66711bfd53d5da9e11bec62821de9 100644 (file)
@@ -1973,6 +1973,13 @@ function default.register_chest(name, d)
                        open_chests[clicker:get_player_name()] = { pos = pos,
                                        sound = def.sound_close, swap = name }
                end
+               def.on_blast = function(pos)
+                       local drops = {}
+                       default.get_inventory_drops(pos, "main", drops)
+                       drops[#drops+1] = "default:" .. name
+                       minetest.remove_node(pos)
+                       return drops
+               end
        end
 
        def.on_metadata_inventory_move = function(pos, from_list, from_index,
@@ -1990,13 +1997,6 @@ function default.register_chest(name, d)
                        " takes " .. stack:get_name() ..
                        " from chest at " .. minetest.pos_to_string(pos))
        end
-       def.on_blast = function(pos)
-               local drops = {}
-               default.get_inventory_drops(pos, "main", drops)
-               drops[#drops+1] = "default:chest"
-               minetest.remove_node(pos)
-               return drops
-       end
 
        local def_opened = table.copy(def)
        local def_closed = table.copy(def)
@@ -2018,6 +2018,7 @@ function default.register_chest(name, d)
        def_opened.can_dig = function()
                return false
        end
+       def_opened.on_blast = function() end
 
        def_closed.mesh = nil
        def_closed.drawtype = nil