forked from minetest/minetest_game
Use Minetest 5.3 'minetest.is_creative_enabled' API (#2795)
This commit is contained in:
@ -45,12 +45,14 @@ farming.hoe_on_use = function(itemstack, user, pointed_thing, uses)
|
||||
return
|
||||
end
|
||||
|
||||
if minetest.is_protected(pt.under, user:get_player_name()) then
|
||||
minetest.record_protection_violation(pt.under, user:get_player_name())
|
||||
local player_name = user and user:get_player_name() or ""
|
||||
|
||||
if minetest.is_protected(pt.under, player_name) then
|
||||
minetest.record_protection_violation(pt.under, player_name)
|
||||
return
|
||||
end
|
||||
if minetest.is_protected(pt.above, user:get_player_name()) then
|
||||
minetest.record_protection_violation(pt.above, user:get_player_name())
|
||||
if minetest.is_protected(pt.above, player_name) then
|
||||
minetest.record_protection_violation(pt.above, player_name)
|
||||
return
|
||||
end
|
||||
|
||||
@ -61,8 +63,7 @@ farming.hoe_on_use = function(itemstack, user, pointed_thing, uses)
|
||||
gain = 0.5,
|
||||
}, true)
|
||||
|
||||
if not (creative and creative.is_enabled_for
|
||||
and creative.is_enabled_for(user:get_player_name())) then
|
||||
if not minetest.is_creative_enabled(player_name) then
|
||||
-- wear tool
|
||||
local wdef = itemstack:get_definition()
|
||||
itemstack:add_wear(65535/(uses-1))
|
||||
@ -181,8 +182,7 @@ farming.place_seed = function(itemstack, placer, pointed_thing, plantname)
|
||||
minetest.pos_to_string(pt.above))
|
||||
minetest.add_node(pt.above, {name = plantname, param2 = 1})
|
||||
tick(pt.above)
|
||||
if not (creative and creative.is_enabled_for
|
||||
and creative.is_enabled_for(player_name)) then
|
||||
if not minetest.is_creative_enabled(player_name) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
|
Reference in New Issue
Block a user