From 5d9abe9cfe145f7c23ce1770e75d8c1d02fd0862 Mon Sep 17 00:00:00 2001 From: trans_soup <> Date: Mon, 17 Jul 2023 13:11:14 +0200 Subject: [PATCH] mcl_tomato: refactor: use new food registration utility. --- mcl_tomato/item.lua | 40 +++++++++++----------------------------- 1 file changed, 11 insertions(+), 29 deletions(-) diff --git a/mcl_tomato/item.lua b/mcl_tomato/item.lua index 4e2541f..b2f2f4a 100644 --- a/mcl_tomato/item.lua +++ b/mcl_tomato/item.lua @@ -8,40 +8,22 @@ mcl_vegan.register_plant_items(modname, "tomato", { food_strength = 2.0, }) -minetest.register_craftitem(modname .. ":pasta", { +local reg_food = mcl_vegan.register_food + +reg_food(modname, "pasta", { description = "Noddles :3", - inventory_image = modname .. "_pasta.png", - groups = { - craftitem = 1, - food = 1, - eatable = 3, - }, - _mcl_saturation = 3.0, - on_place = minetest.item_eat(3), - on_secondary_use = minetest.item_eat(3), + food_strength = 3.0, + saturation = 2.0, }) -minetest.register_craftitem(modname .. ":sauce", { +reg_food(modname, "sauce", { description = "Tomato Sauce", - inventory_image = modname .. "_sauce.png", - groups = { - craftitem = 1, - food = 1, - eatable = 2, - }, - _mcl_saturation = 2.0, - on_place = minetest.item_eat(2), - on_secondary_use = minetest.item_eat(2), + food_strength = 2.0, + saturation = 2.0, }) -minetest.register_craftitem(modname .. ":pasta_with_sauce", { +reg_food(modname, "pasta_with_sauce", { description = "Noddles with Tomato Sauce", - inventory_image = modname .. "_pasta_with_sauce.png", - groups = { - food = 2, - eatable = 8, - }, - _mcl_saturation = 8.0, - on_place = minetest.item_eat(8), - on_secondary_use = minetest.item_eat(8), + food_strength = 8.0, + saturation = 8.0, })