forked from mtcontrib/farming
nil check
This commit is contained in:
parent
1018a558d2
commit
10abb996c1
@ -32,7 +32,7 @@ local function place_beans(itemstack, placer, pointed_thing, plantname)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- is player planting crop?
|
-- is player planting crop?
|
||||||
local name = placer:get_player_name() or ""
|
local name = placer and placer:get_player_name() or ""
|
||||||
|
|
||||||
-- check for protection
|
-- check for protection
|
||||||
if minetest.is_protected(pt.under, name) then
|
if minetest.is_protected(pt.under, name) then
|
||||||
|
@ -32,7 +32,7 @@ local function place_cocoa(itemstack, placer, pointed_thing, plantname)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- is player planting crop?
|
-- is player planting crop?
|
||||||
local name = placer:get_player_name() or ""
|
local name = placer and placer:get_player_name() or ""
|
||||||
|
|
||||||
-- check for protection
|
-- check for protection
|
||||||
if minetest.is_protected(pt.above, name) then
|
if minetest.is_protected(pt.above, name) then
|
||||||
|
@ -27,7 +27,7 @@ local function place_grapes(itemstack, placer, pointed_thing, plantname)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- is player planting seed?
|
-- is player planting seed?
|
||||||
local name = placer:get_player_name() or ""
|
local name = placer and placer:get_player_name() or ""
|
||||||
|
|
||||||
-- check for protection
|
-- check for protection
|
||||||
if minetest.is_protected(pt.under, name) then
|
if minetest.is_protected(pt.under, name) then
|
||||||
|
2
init.lua
2
init.lua
@ -445,7 +445,7 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- is player planting seed?
|
-- is player planting seed?
|
||||||
local name = placer:get_player_name() or ""
|
local name = placer and placer:get_player_name() or ""
|
||||||
|
|
||||||
-- if not protected then add node and remove 1 item from the itemstack
|
-- if not protected then add node and remove 1 item from the itemstack
|
||||||
if not minetest.is_protected(pt.above, name) then
|
if not minetest.is_protected(pt.above, name) then
|
||||||
|
Loading…
Reference in New Issue
Block a user