Fix anonymous digging of non-empty machine
authorZefram <zefram@fysh.org>
Thu, 6 Nov 2014 10:29:53 +0000 (10:29 +0000)
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>
Thu, 6 Nov 2014 13:33:14 +0000 (08:33 -0500)
The quarry was causing crashes when it reached a machine that was
undiggable due to containing items.

technic/machines/register/common.lua

index 0e59d0eb286a9afe41c45eeb4a8cf35318df65f5..c9f8b5d9b1135e071dc791e5fb2aaef4cfb2c6fd 100644 (file)
@@ -122,8 +122,10 @@ function technic.machine_can_dig(pos, player)
        local inv = meta:get_inventory()
        if not inv:is_empty("src") or not inv:is_empty("dst") or
           not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") then
-               minetest.chat_send_player(player:get_player_name(),
-                       S("Machine cannot be removed because it is not empty"))
+               if player then
+                       minetest.chat_send_player(player:get_player_name(),
+                               S("Machine cannot be removed because it is not empty"))
+               end
                return false
        else
                return true