From 5f7cd6271e4674b0e7a68b66ac1e66c7b8cecea6 Mon Sep 17 00:00:00 2001 From: sys4-fr Date: Thu, 18 Jan 2018 01:25:15 +0100 Subject: [PATCH] Fix diet support with some food items --- .gitmodules | 6 +++--- mods/farming | 2 +- mods/morefarming | 2 +- mods/nalc/depends.txt | 1 + mods/nalc/diet.lua | 31 +++++++++++++++++++++++++++++++ mods/nalc/init.lua | 2 +- 6 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 mods/nalc/diet.lua diff --git a/.gitmodules b/.gitmodules index 0020a6f3..90a61684 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/mods/farming b/mods/farming index ce0c3e8e..271c1718 160000 --- a/mods/farming +++ b/mods/farming @@ -1 +1 @@ -Subproject commit ce0c3e8eb87452a92c46754ef49380b6f0131fb0 +Subproject commit 271c17180e2ec98a8c1981bb5f18070f990ce846 diff --git a/mods/morefarming b/mods/morefarming index 7f248777..2c40dd71 160000 --- a/mods/morefarming +++ b/mods/morefarming @@ -1 +1 @@ -Subproject commit 7f2487779d705f997d278821628a1793ac9e3037 +Subproject commit 2c40dd7115121c03c2ba24142a00f0a6f349aed2 diff --git a/mods/nalc/depends.txt b/mods/nalc/depends.txt index 7c3381cf..6f770124 100644 --- a/mods/nalc/depends.txt +++ b/mods/nalc/depends.txt @@ -23,3 +23,4 @@ cherry_tree? nether? mobs_animal? minercantile? +diet? diff --git a/mods/nalc/diet.lua b/mods/nalc/diet.lua new file mode 100644 index 00000000..047c13a2 --- /dev/null +++ b/mods/nalc/diet.lua @@ -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 diff --git a/mods/nalc/init.lua b/mods/nalc/init.lua index 07a80f2c..678b8ee3 100644 --- a/mods/nalc/init.lua +++ b/mods/nalc/init.lua @@ -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