mirror of
https://github.com/minetest/minetest_game.git
synced 2025-06-28 20:56:02 +02:00
Add nil checks for placer
This commit is contained in:
@ -266,7 +266,8 @@ function doors.register(name, def)
|
||||
local node = minetest.get_node(pointed_thing.under)
|
||||
local pdef = minetest.registered_nodes[node.name]
|
||||
if pdef and pdef.on_rightclick and
|
||||
not placer:get_player_control().sneak then
|
||||
not (placer and placer:is_player() and
|
||||
placer:get_player_control().sneak) then
|
||||
return pdef.on_rightclick(pointed_thing.under,
|
||||
node, placer, itemstack, pointed_thing)
|
||||
end
|
||||
@ -290,12 +291,12 @@ function doors.register(name, def)
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local pn = placer:get_player_name()
|
||||
local pn = placer and placer:get_player_name() or ""
|
||||
if minetest.is_protected(pos, pn) or minetest.is_protected(above, pn) then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local dir = minetest.dir_to_facedir(placer:get_look_dir())
|
||||
local dir = placer and minetest.dir_to_facedir(placer:get_look_dir()) or 0
|
||||
|
||||
local ref = {
|
||||
{x = -1, y = 0, z = 0},
|
||||
|
Reference in New Issue
Block a user