1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2024-12-23 00:20:17 +01:00

Prevent crashs in can_dig on nil-player.

This commit is contained in:
Tim 2016-07-31 01:42:11 +02:00
parent df84e62798
commit 436fdfac55
2 changed files with 6 additions and 5 deletions

View File

@ -61,9 +61,10 @@ minetest.register_node("inbox:empty", {
end, end,
can_dig = function(pos,player) can_dig = function(pos,player)
local meta = minetest.get_meta(pos); local meta = minetest.get_meta(pos);
local name = player and player:get_player_name()
local owner = meta:get_string("owner") local owner = meta:get_string("owner")
local inv = meta:get_inventory() local inv = meta:get_inventory()
return player:get_player_name() == owner and inv:is_empty("main") return player == owner and inv:is_empty("main")
end, end,
on_metadata_inventory_put = function(pos, listname, index, stack, player) on_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)

View File

@ -141,9 +141,9 @@ minetest.register_node("itemframes:frame",{
end end
end, end,
can_dig = function(pos,player) can_dig = function(pos,player)
local name = player and player:get_player_name()
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
return player:get_player_name() == meta:get_string("owner") return name == meta:get_string("owner")
end, end,
on_destruct = function(pos) on_destruct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
@ -198,9 +198,9 @@ minetest.register_node("itemframes:pedestal",{
end end
end, end,
can_dig = function(pos,player) can_dig = function(pos,player)
local name = player and player:get_player_name()
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
return player:get_player_name() == meta:get_string("owner") return name == meta:get_string("owner")
end, end,
on_destruct = function(pos) on_destruct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)