summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorh-v-smacker <hans-von-smacker+github@gmail.com>2017-11-22 03:10:56 +0300
committerh-v-smacker <hans-von-smacker+github@gmail.com>2017-11-22 03:10:56 +0300
commit3b398d97416614d03e7897116e1aee8dbf99c384 (patch)
tree214b11761d30d1e8d14cb71ecb4d1435ad774da3 /init.lua
parent035f0866cb6eb38ef3ffbc584b0e22a4df2fb16e (diff)
Recipes now require variable amount of ingredients
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua32
1 files changed, 13 insertions, 19 deletions
diff --git a/init.lua b/init.lua
index 079373f..dae9cf0 100644
--- a/init.lua
+++ b/init.lua
@@ -185,7 +185,7 @@ local canned_food_definitions = {
found_in = "mobs_animal",
obj_name = "mobs:honey",
orig_nutritional_value = 4,
- amount = 3,
+ amount = 4,
sugar = false
},
@@ -217,12 +217,9 @@ for product, def in pairs(canned_food_definitions) do
dig_immediate = 3,
attached_node = 1 },
-- canned food prolongs shelf life IRL, but in minetest food never
- -- goes bad. Instead, we will reward the effort with 2x higher
- -- nutritional value, even if that's not realistic.
- -- when (and if) the 'amount' could be taken into account, the
- -- rate could also be adjusted
+ -- goes bad. Here, we increase the nutritional value instead.
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"),
-- the empty bottle stays, of course
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
-- to be available in vanilla game (and mushrooms are the guaranteed
-- regular - not sweet - canned food)
+ local ingredients = {"vessels:glass_bottle"}
if def.sugar then
- minetest.register_craft({
- 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},
- })
+ table.insert(ingredients, "farming:sugar")
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