generated from your-land/yl_template
Implements feature eat including data structure
This commit is contained in:
parent
76fae9a185
commit
ce3d645405
6
data.lua
6
data.lua
@ -5,13 +5,15 @@ yl_canned_food_mtg.recipes = {
|
||||
base_mod = "group",
|
||||
base_item = "food_apple",
|
||||
base_amount = 3,
|
||||
additives = {}
|
||||
additives = {},
|
||||
nutrition = 7
|
||||
}, {
|
||||
out = "yl_canned_food:banana_jam",
|
||||
base_mod = "group",
|
||||
base_item = "food_banana",
|
||||
base_amount = 5,
|
||||
additives = {"group:sugar"}
|
||||
additives = {"group:sugar"},
|
||||
nutrition = 7
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1 +1,32 @@
|
||||
-- eat
|
||||
-- item eat integration
|
||||
|
||||
if (yl_canned_food_mtg.settings.enable_eat ~= true) then
|
||||
return false
|
||||
end
|
||||
|
||||
-- dependencies
|
||||
if (minetest.get_modpath("vessels") == nil) then
|
||||
yl_canned_food_mtg.log("feature item_eat enabled, but mod vessels not found")
|
||||
return false
|
||||
end
|
||||
|
||||
local amount = 0
|
||||
|
||||
for _, recipe in ipairs(yl_canned_food_mtg.recipes) do
|
||||
|
||||
-- normal
|
||||
local redefinition = {
|
||||
on_use = minetest.item_eat(recipe.nutrition, "vessels:glass_bottle")
|
||||
}
|
||||
minetest.override_item(recipe.out, redefinition)
|
||||
|
||||
-- pickled
|
||||
local redefinition_plus = {
|
||||
on_use = minetest.item_eat(recipe.nutrition*2, "vessels:glass_bottle")
|
||||
}
|
||||
minetest.override_item(recipe.out .. "_plus", redefinition_plus)
|
||||
|
||||
amount = amount + 1
|
||||
end
|
||||
|
||||
yl_canned_food_mtg.log("item eat integration: " .. dump(amount))
|
||||
|
Loading…
Reference in New Issue
Block a user