Use creative.is_enabled_for for creative mode if possible (#1558)
This commit is contained in:
parent
b847888cb7
commit
077316b4cd
13 changed files with 34 additions and 19 deletions
|
@ -57,7 +57,8 @@ farming.hoe_on_use = function(itemstack, user, pointed_thing, uses)
|
|||
gain = 0.5,
|
||||
})
|
||||
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if not (creative and creative.is_enabled_for
|
||||
and creative.is_enabled_for(user:get_player_name())) then
|
||||
-- wear tool
|
||||
local wdef = itemstack:get_definition()
|
||||
itemstack:add_wear(65535/(uses-1))
|
||||
|
@ -187,7 +188,8 @@ farming.place_seed = function(itemstack, placer, pointed_thing, plantname)
|
|||
-- add the node and remove 1 item from the itemstack
|
||||
minetest.add_node(pt.above, {name = plantname, param2 = 1})
|
||||
tick(pt.above)
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if not (creative and creative.is_enabled_for
|
||||
and creative.is_enabled_for(placer:get_player_name())) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue