From ee993f9d61cb2ade8a10afd39254b6bdb09cf5ae Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Fri, 22 Mar 2019 17:17:25 +0000 Subject: [PATCH] 1 in 3 chance of raw potato being poisonous --- crops/potato.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crops/potato.lua b/crops/potato.lua index 1547fc0..256ce97 100644 --- a/crops/potato.lua +++ b/crops/potato.lua @@ -14,7 +14,16 @@ minetest.register_craftitem("farming:potato", { on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:potato_1") end, - on_use = minetest.item_eat(1), +-- on_use = minetest.item_eat(1), + on_use = function(itemstack, user, pointed_thing) + if user then + if math.random(1, 3) == 1 then + return minetest.do_item_eat(-1, nil, itemstack, user, pointed_thing) + else + return minetest.do_item_eat(1, nil, itemstack, user, pointed_thing) + end + end + end, }) -- baked potato