Drop food eating limits in Creative Mode

This commit is contained in:
Wuzzy 2019-02-05 21:51:40 +01:00
parent d9b6bae320
commit 9ed83bd196
5 changed files with 19 additions and 11 deletions

View file

@ -51,7 +51,7 @@ minetest.register_node("mcl_cake:cake", {
on_rightclick = function(pos, node, clicker, itemstack)
local newcake = minetest.do_item_eat(2, ItemStack("mcl_cake:cake_6"), ItemStack("mcl_cake:cake"), clicker, {type="nothing"})
-- Check if we were allowed to eat
if newcake:get_name() ~= "mcl_cake:cake" then
if newcake:get_name() ~= "mcl_cake:cake" or minetest.settings:get_bool("creative_mode") == true then
minetest.add_node(pos,{type="node",name="mcl_cake:cake_6",param2=0})
end
end,
@ -71,7 +71,7 @@ local register_slice = function(level, nodebox, desc)
on_rightclick = function(pos, node, clicker, itemstack)
local newcake = minetest.do_item_eat(2, ItemStack(after_eat), ItemStack(this), clicker, {type="nothing"})
-- Check if we were allowed to eat
if newcake:get_name() ~= this then
if newcake:get_name() ~= this or minetest.settings:get_bool("creative_mode") == true then
minetest.add_node(pos,{type="node",name=after_eat,param2=0})
end
end
@ -80,7 +80,7 @@ local register_slice = function(level, nodebox, desc)
on_rightclick = function(pos, node, clicker, itemstack)
local newcake = minetest.do_item_eat(2, ItemStack("mcl:cake:cake 0"), ItemStack("mcl_cake:cake_1"), clicker, {type="nothing"})
-- Check if we were allowed to eat
if newcake:get_name() ~= this then
if newcake:get_name() ~= this or minetest.settings:get_bool("creative_mode") == true then
minetest.remove_node(pos)
core.check_for_falling(pos)
end

View file

@ -339,7 +339,7 @@ local eat_chorus_fruit = function(itemstack, player, pointed_thing)
local count = itemstack:get_count()
local new_itemstack = minetest.do_item_eat(0, nil, itemstack, player, pointed_thing)
local new_count = new_itemstack:get_count()
if count ~= new_count or new_itemstack:get_name() ~= "mcl_end:chorus_fruit" then
if count ~= new_count or new_itemstack:get_name() ~= "mcl_end:chorus_fruit" or (minetest.settings:get_bool("creative_mode") == true) then
random_teleport(player)
end
return new_itemstack

View file

@ -135,7 +135,7 @@ minetest.register_craftitem("mcl_mobitems:cooked_rabbit", {
local drink_milk = function(itemstack, player, pointed_thing)
local bucket = minetest.do_item_eat(0, "mcl_buckets:bucket_empty", itemstack, player, pointed_thing)
-- Check if we were allowed to drink this (eat delay check)
if bucket:get_name() ~= "mcl_mobitems:milk_bucket" and mcl_hunger.active then
if (bucket:get_name() ~= "mcl_mobitems:milk_bucket" and mcl_hunger.active) or minetest.settings:get_bool("creative_mode") == true then
mcl_hunger.stop_poison(player)
end
return bucket