Eat on rightclick
This commit is contained in:
parent
bbf7efc338
commit
96521433f5
11 changed files with 81 additions and 39 deletions
|
@ -92,7 +92,8 @@ minetest.register_craftitem("mcl_farming:beetroot_item", {
|
|||
description = "Beetroot",
|
||||
inventory_image = "mcl_farming_beetroot.png",
|
||||
wield_image = "mcl_farming_beetroot.png",
|
||||
on_use = minetest.item_eat(1),
|
||||
on_place = minetest.item_eat(1),
|
||||
on_secondary_use = minetest.item_eat(1),
|
||||
groups = { food = 2, eatable = 1 },
|
||||
})
|
||||
|
||||
|
@ -101,7 +102,8 @@ minetest.register_craftitem("mcl_farming:beetroot_soup", {
|
|||
stack_max = 1,
|
||||
inventory_image = "mcl_farming_beetroot_soup.png",
|
||||
wield_image = "mcl_farming_beetroot_soup.png",
|
||||
on_use = minetest.item_eat(6, "mcl_core:bowl"),
|
||||
on_place = minetest.item_eat(6, "mcl_core:bowl"),
|
||||
on_secondary_use = minetest.item_eat(6, "mcl_core:bowl"),
|
||||
groups = { food = 3, eatable = 6 },
|
||||
})
|
||||
|
||||
|
|
|
@ -67,17 +67,23 @@ minetest.register_node("mcl_farming:carrot", {
|
|||
minetest.register_craftitem("mcl_farming:carrot_item", {
|
||||
description = "Carrot",
|
||||
inventory_image = "farming_carrot.png",
|
||||
on_use = minetest.item_eat(3),
|
||||
groups = { food = 2, eatable = 3 },
|
||||
on_secondary_use = minetest.item_eat(3),
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return mcl_farming:place_seed(itemstack, placer, pointed_thing, "mcl_farming:carrot_1")
|
||||
end
|
||||
local new = mcl_farming:place_seed(itemstack, placer, pointed_thing, "mcl_farming:carrot_1")
|
||||
if new ~= nil then
|
||||
return new
|
||||
else
|
||||
return minetest.do_item_eat(3, nil, itemstack, placer, pointed_thing)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mcl_farming:carrot_item_gold", {
|
||||
description = "Golden Carrot",
|
||||
inventory_image = "farming_carrot_gold.png",
|
||||
on_use = minetest.item_eat(3),
|
||||
on_place = minetest.item_eat(3),
|
||||
on_secondary_use = minetest.item_eat(3),
|
||||
groups = { brewitem = 1, food = 2, eatable = 3 },
|
||||
})
|
||||
|
||||
|
|
|
@ -216,7 +216,8 @@ minetest.register_craftitem("mcl_farming:melon_item", {
|
|||
description = "Melon",
|
||||
stack_max = 64,
|
||||
inventory_image = "farming_melon.png",
|
||||
on_use = minetest.item_eat(2),
|
||||
on_place = minetest.item_eat(2),
|
||||
on_secondary_use = minetest.item_eat(2),
|
||||
groups = { food = 2, eatable = 2 },
|
||||
})
|
||||
|
||||
|
|
|
@ -36,7 +36,8 @@ minetest.register_node("mcl_farming:mushroom_red", {
|
|||
minetest.register_craftitem("mcl_farming:mushroom_stew", {
|
||||
description = "Mushroom Stew",
|
||||
inventory_image = "farming_mushroom_stew.png",
|
||||
on_use = minetest.item_eat(6, "mcl_core:bowl"),
|
||||
on_place = minetest.item_eat(6, "mcl_core:bowl"),
|
||||
on_secondary_use = minetest.item_eat(6, "mcl_core:bowl"),
|
||||
groups = { food = 3, eatable = 6 },
|
||||
stack_max = 1,
|
||||
})
|
||||
|
|
|
@ -50,11 +50,16 @@ minetest.register_node("mcl_farming:potato", {
|
|||
minetest.register_craftitem("mcl_farming:potato_item", {
|
||||
description = "Potato",
|
||||
inventory_image = "farming_potato.png",
|
||||
on_use = minetest.item_eat(1),
|
||||
groups = { food = 2, eatable = 1 },
|
||||
stack_max = 64,
|
||||
on_secondary_use = minetest.item_eat(1),
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return mcl_farming:place_seed(itemstack, placer, pointed_thing, "mcl_farming:potato_1")
|
||||
local new = mcl_farming:place_seed(itemstack, placer, pointed_thing, "mcl_farming:potato_1")
|
||||
if new ~= nil then
|
||||
return new
|
||||
else
|
||||
return minetest.do_item_eat(1, nil, itemstack, placer, pointed_thing)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -62,7 +67,8 @@ minetest.register_craftitem("mcl_farming:potato_item_baked", {
|
|||
description = "Baked Potato",
|
||||
stack_max = 64,
|
||||
inventory_image = "farming_potato_baked.png",
|
||||
on_use = minetest.item_eat(6),
|
||||
on_place = minetest.item_eat(6),
|
||||
on_secondary_use = minetest.item_eat(6),
|
||||
groups = { food = 2, eatable = 6 },
|
||||
})
|
||||
|
||||
|
@ -70,7 +76,8 @@ minetest.register_craftitem("mcl_farming:potato_item_poison", {
|
|||
description = "Poisonous Potato",
|
||||
stack_max = 64,
|
||||
inventory_image = "farming_potato_poison.png",
|
||||
on_use = minetest.item_eat(2),
|
||||
on_place = minetest.item_eat(2),
|
||||
on_secondary_use = minetest.item_eat(2),
|
||||
groups = { food = 2, eatable = 2 },
|
||||
})
|
||||
|
||||
|
|
|
@ -287,7 +287,8 @@ minetest.register_craftitem("mcl_farming:pumpkin_pie", {
|
|||
stack_max = 64,
|
||||
inventory_image = "mcl_farming_pumpkin_pie.png",
|
||||
wield_image = "mcl_farming_pumpkin_pie.png",
|
||||
on_use = minetest.item_eat(8),
|
||||
on_place = minetest.item_eat(8),
|
||||
on_secondary_use = minetest.item_eat(8),
|
||||
groups = { food = 2, eatable = 8 },
|
||||
})
|
||||
|
||||
|
|
|
@ -149,7 +149,8 @@ minetest.register_craftitem("mcl_farming:cookie", {
|
|||
description = "Cookie",
|
||||
inventory_image = "farming_cookie.png",
|
||||
groups = {food=2, eatable=2},
|
||||
on_use = minetest.item_eat(2)
|
||||
on_place = minetest.item_eat(2),
|
||||
on_secondary_use = minetest.item_eat(2),
|
||||
})
|
||||
|
||||
|
||||
|
@ -157,6 +158,7 @@ minetest.register_craftitem("mcl_farming:bread", {
|
|||
description = "Bread",
|
||||
inventory_image = "farming_bread.png",
|
||||
groups = {food=2, eatable=5},
|
||||
on_use = minetest.item_eat(5)
|
||||
on_place = minetest.item_eat(5),
|
||||
on_secondary_use = minetest.item_eat(5),
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue