forked from mtcontrib/homedecor_modpack
Prevent crashs in can_dig on nil-player.
This commit is contained in:
parent
df84e62798
commit
436fdfac55
@ -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)
|
||||||
|
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user