forked from your-land/canned_food
Recipes now require variable amount of ingredients
This commit is contained in:
parent
035f0866cb
commit
3b398d9741
@ -8,9 +8,12 @@ All products are defined by shapless recipes, and yield items which can be place
|
|||||||
real world. Although the cans with non-symmetrical items on labels look good only from
|
real world. Although the cans with non-symmetrical items on labels look good only from
|
||||||
half of the angles.
|
half of the angles.
|
||||||
|
|
||||||
The recipes follow the scheme of "glass bottle" + "produce" [ + "sugar" ]
|
The recipes follow the scheme of "glass bottle" + "produce" × "amount" [ + "sugar" ]
|
||||||
|
|
||||||
The default 4 items do not require sugar, even though 3 of those are jams and probably
|
The amount of ingredients differs, roughly based on the original nutritional value of
|
||||||
|
the items, so that you'd need more less nutricious items to fill a mason jar.
|
||||||
|
|
||||||
|
The default 4 recipes do not require sugar, even though 3 of those are jams and probably
|
||||||
would taste horribly IRL without sugar:
|
would taste horribly IRL without sugar:
|
||||||
* Apple jam
|
* Apple jam
|
||||||
* Canned brown mushrooms
|
* Canned brown mushrooms
|
||||||
@ -22,6 +25,7 @@ canning also turns two othwerise inedible objects (in game - such jams do exist
|
|||||||
|
|
||||||
Ethereal and farming (redo) mods introduce items that can be canned, too.
|
Ethereal and farming (redo) mods introduce items that can be canned, too.
|
||||||
Some of them (jams) require sugar as the third ingredient. So some of them require both mods.
|
Some of them (jams) require sugar as the third ingredient. So some of them require both mods.
|
||||||
|
There also is a jar of honey, which requires honey from mobs/mobs_animal mod.
|
||||||
|
|
||||||
The mason jars with canned food can be put into vessel storage shelves. Or put on display
|
The mason jars with canned food can be put into vessel storage shelves. Or put on display
|
||||||
just like the glass vessels can, and destroyed by hand (retreiving the item).
|
just like the glass vessels can, and destroyed by hand (retreiving the item).
|
||||||
|
32
init.lua
32
init.lua
@ -185,7 +185,7 @@ local canned_food_definitions = {
|
|||||||
found_in = "mobs_animal",
|
found_in = "mobs_animal",
|
||||||
obj_name = "mobs:honey",
|
obj_name = "mobs:honey",
|
||||||
orig_nutritional_value = 4,
|
orig_nutritional_value = 4,
|
||||||
amount = 3,
|
amount = 4,
|
||||||
sugar = false
|
sugar = false
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -217,12 +217,9 @@ for product, def in pairs(canned_food_definitions) do
|
|||||||
dig_immediate = 3,
|
dig_immediate = 3,
|
||||||
attached_node = 1 },
|
attached_node = 1 },
|
||||||
-- canned food prolongs shelf life IRL, but in minetest food never
|
-- canned food prolongs shelf life IRL, but in minetest food never
|
||||||
-- goes bad. Instead, we will reward the effort with 2x higher
|
-- goes bad. Here, we increase the nutritional value instead.
|
||||||
-- nutritional value, even if that's not realistic.
|
|
||||||
-- when (and if) the 'amount' could be taken into account, the
|
|
||||||
-- rate could also be adjusted
|
|
||||||
on_use = minetest.item_eat(
|
on_use = minetest.item_eat(
|
||||||
math.floor (def.orig_nutritional_value * 2)
|
math.floor (def.orig_nutritional_value * def.amount * 0.33)
|
||||||
+ (def.sugar and 1 or 0), "vessels:glass_bottle"),
|
+ (def.sugar and 1 or 0), "vessels:glass_bottle"),
|
||||||
-- the empty bottle stays, of course
|
-- the empty bottle stays, of course
|
||||||
sounds = default.node_sound_glass_defaults(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
@ -232,21 +229,18 @@ for product, def in pairs(canned_food_definitions) do
|
|||||||
-- except for apple: there should be at least 1 jam guaranteed
|
-- except for apple: there should be at least 1 jam guaranteed
|
||||||
-- to be available in vanilla game (and mushrooms are the guaranteed
|
-- to be available in vanilla game (and mushrooms are the guaranteed
|
||||||
-- regular - not sweet - canned food)
|
-- regular - not sweet - canned food)
|
||||||
|
local ingredients = {"vessels:glass_bottle"}
|
||||||
if def.sugar then
|
if def.sugar then
|
||||||
minetest.register_craft({
|
table.insert(ingredients, "farming:sugar")
|
||||||
type = "shapeless",
|
|
||||||
output = "canned_food:" .. product,
|
|
||||||
recipe = {"vessels:glass_bottle", "farming:sugar",
|
|
||||||
def.obj_name},
|
|
||||||
})
|
|
||||||
else
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "canned_food:" .. product,
|
|
||||||
recipe = {"vessels:glass_bottle",
|
|
||||||
def.obj_name},
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
for i=1,def.amount do
|
||||||
|
table.insert(ingredients, def.obj_name)
|
||||||
|
end
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "canned_food:" .. product,
|
||||||
|
recipe = ingredients
|
||||||
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user