Don't crash on nil-player in can_dig and check the right players for attachment in chairs.
This commit is contained in:
parent
73a29be691
commit
beeda8cb9b
@ -40,13 +40,9 @@ function xdecor.sit(pos, node, clicker, pointed_thing)
|
||||
end
|
||||
end
|
||||
|
||||
function xdecor.sit_dig(pos, player)
|
||||
local pname = player:get_player_name()
|
||||
local objs = minetest.get_objects_inside_radius(pos, 0.1)
|
||||
|
||||
for _, p in pairs(objs) do
|
||||
if not player or not player:is_player() or p:get_player_name() or
|
||||
default.player_attached[pname] then
|
||||
function xdecor.sit_dig(pos, digger)
|
||||
for _, player in pairs(minetest.get_objects_inside_radius(pos, 0.1)) do
|
||||
if player:is_player() and default.player_attached[player:get_player_name()] then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
@ -94,10 +94,10 @@ end
|
||||
|
||||
function itemframe.dig(pos, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local pname = player:get_player_name()
|
||||
local pname = player and player:get_player_name()
|
||||
local owner = meta:get_string("owner")
|
||||
|
||||
return player and pname == owner
|
||||
return pname == owner
|
||||
end
|
||||
|
||||
xdecor.register("itemframe", {
|
||||
|
@ -78,10 +78,10 @@ end
|
||||
function mailbox.dig(pos, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local owner = meta:get_string("owner")
|
||||
local player_name = player:get_player_name()
|
||||
local player_name = player and player:get_player_name()
|
||||
local inv = meta:get_inventory()
|
||||
|
||||
return inv:is_empty("mailbox") and player and player_name == owner
|
||||
return inv:is_empty("mailbox") and player_name == owner
|
||||
end
|
||||
|
||||
function mailbox.after_place_node(pos, placer)
|
||||
|
Loading…
Reference in New Issue
Block a user