Allow non-players to dig bones.
authorMT-Modder <MT-Modder@users.noreply.github.com>
Thu, 25 Feb 2016 23:05:23 +0000 (18:05 -0500)
committerparamat <mat.gregory@virginmedia.com>
Thu, 3 Mar 2016 00:37:01 +0000 (00:37 +0000)
mods/bones/init.lua

index 899ac809b2a4a8020602bd03f10479c6287adce6..c86deccd0077a7c25589f1b242de2a9f209ab638 100644 (file)
@@ -43,7 +43,11 @@ minetest.register_node("bones:bones", {
        
        can_dig = function(pos, player)
                local inv = minetest.get_meta(pos):get_inventory()
-               return is_owner(pos, player:get_player_name()) and inv:is_empty("main")
+               local name = ""
+               if player then
+                       name = player:get_player_name()
+               end
+               return is_owner(pos, name) and inv:is_empty("main")
        end,
        
        allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)