Fix diet support with some food items

This commit is contained in:
sys4-fr 2018-01-18 01:25:15 +01:00
parent 59682e253a
commit 5f7cd6271e
6 changed files with 38 additions and 6 deletions

6
.gitmodules vendored
View File

@ -111,9 +111,6 @@
[submodule "mods/player_physics"]
path = mods/player_physics
url = https://github.com/MinetestForFun/player_physics.git
[submodule "mods/farming"]
path = mods/farming
url = https://github.com/sys4-fr/farming.git
[submodule "mods/moreores"]
path = mods/moreores
url = https://github.com/minetest-mods/moreores.git
@ -150,3 +147,6 @@
path = minetest_game
url = https://github.com/minetest/minetest_game.git
branch = backport-0.4
[submodule "mods/farming"]
path = mods/farming
url = https://github.com/tenplus1/farming.git

@ -1 +1 @@
Subproject commit ce0c3e8eb87452a92c46754ef49380b6f0131fb0
Subproject commit 271c17180e2ec98a8c1981bb5f18070f990ce846

@ -1 +1 @@
Subproject commit 7f2487779d705f997d278821628a1793ac9e3037
Subproject commit 2c40dd7115121c03c2ba24142a00f0a6f349aed2

View File

@ -23,3 +23,4 @@ cherry_tree?
nether?
mobs_animal?
minercantile?
diet?

31
mods/nalc/diet.lua Normal file
View File

@ -0,0 +1,31 @@
if minetest.get_modpath("diet") then
local function overwrite(name, hunger_change, replace_with_item, poisen, heal)
local tab = minetest.registered_items[name]
if not tab then
return
end
tab.on_use = diet.item_eat(hunger_change, replace_with_item, poisen, heal)
end
if minetest.get_modpath("farming") and farming.mod == "redo" then
-- Strawberries fix
overwrite("ethereal:strawberry", 1)
overwrite("farming_plus:strawberry_item", 1)
-- Banana
overwrite("ethereal:banana", 2)
overwrite("ethereal:orange", 4)
-- Support with farming_redo >= 1.29
if tonumber(farming.version) >= 1.29 then
overwrite("farming:chili_pepper", 2)
overwrite("farming:chili_bowl", 8)
overwrite("farming:porridge", 6)
end
end
if minetest.get_modpath("mtfoods") then
overwrite("mtfoods:boston_cream", 5)
end
end

View File

@ -22,7 +22,7 @@ local mods =
"nyancat", "moreores", "moreblocks",
"bonemeal", "maptools", "doors",
"flowers", "carts", "nether",
"mobs_animal", "minercantile"
"mobs_animal", "minercantile", "diet"
}
for _,mod in ipairs(mods) do