[Mod] Diet [0.1] [diet]

User avatar
rubenwardy
Moderator
Posts: 6978
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

[Mod] Diet [0.1] [diet]

by rubenwardy » Post

Diet Mod

This mod adds a motive to make lots of different types of food.
Eating a food that you have eaten lots reduces its effect.

For example, if the last 5 things you ate were chocolate cakes, then eating another chocolate cakes would only give half its health points.
You receive messages like "Your stomach hates chocolate cake" and "Your stomach could do with a change".

Supports Better HUD.
Spoiler
- Apples (default)
- Animalmaterials (mobf modpack)
- Bread (default)
- Bushes
- bushes_classic
- Dwarves (beer and such)
- Docfarming
- Fishing
- Farming plus
- Food (2.2 or later) and expansions
- fruit
- Glooptest
- Mooretrees
- Mtfoods
- mushroom
- mush45
- Simple mobs

Download

Dependencies: none. Optionally depends on the above list of supported mods.
License: CC0

Download
... browse the code
Spoiler
If Better HUD supports your mod, then Diet does too. Other wise:

Code: Select all

local function item_eat(amt)
    if minetest.get_modpath("diet") then
        return diet.item_eat(amt)
    elseif minetest.get_modpath("hud") then
        return hud.item_eat(amt)
    else
        return minetest.item_eat(amt)
    end
end
And then in your food item definition (minetest.register_node or craftitem):

Code: Select all

on_use = item_eat(5)
replace 5 with value of your choice.

Don't forget to add:

Code: Select all

hud?
diet?
to your depends.txt

To do

  • Add nutrients such as proteins - You need to get all nutrients to gain health.
  • balanced diets: making one food healing lots of HP while reducing speed a bit, other increasing speed a bit at the cost of jump height, etc. (kaeza)
Last edited by rubenwardy on Sat Jul 23, 2016 18:45, edited 7 times in total.
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

by kaeza » Post

You could make it a necessity to have a balanced diet, by e.g. making one food healing lots of HP while reducing speed a bit, other increasing speed a bit at the cost of jump height, etc.

Anyway, this is nice :)
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

User avatar
rubenwardy
Moderator
Posts: 6978
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

by rubenwardy » Post

kaeza wrote:You could make it a necessity to have a balanced diet, by e.g. making one food healing lots of HP while reducing speed a bit, other increasing speed a bit at the cost of jump height, etc.

Anyway, this is nice :)
I like those ideas.
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
rubenwardy
Moderator
Posts: 6978
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

by rubenwardy » Post

Update

  • Added support for Better Hud
  • Added support for all the foods Better Hud supports
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
philipbenr
Member
Posts: 1897
Joined: Fri Jun 14, 2013 01:56
GitHub: philipbenr
IRC: philipbenr
In-game: robinspi
Location: United States

by philipbenr » Post

This looks really good. The idea is pretty creative too. :) Nice work.

User avatar
rubenwardy
Moderator
Posts: 6978
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

by rubenwardy » Post

Thank you :D
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
webdesigner97
Member
Posts: 1328
Joined: Mon Jul 30, 2012 19:16
GitHub: webD97
IRC: webdesigner97
In-game: webdesigner97
Location: Cologne, Germany
Contact:

by webdesigner97 » Post

What a great idea! This makes eating much more realistic and forces players to eat more than just one kind of food!

glenstein
New member
Posts: 3
Joined: Thu Mar 27, 2014 01:58

by glenstein » Post

would you consider adding support for sweet foods?

User avatar
rubenwardy
Moderator
Posts: 6978
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

by rubenwardy » Post

It is supported.

Food mod (2.2 or later) and expansions.

Sweet foods is an expansion. I will add it to the list though, to make it clear.
Last edited by rubenwardy on Tue Apr 15, 2014 21:04, edited 1 time in total.
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

Martno
Member
Posts: 80
Joined: Thu May 28, 2015 07:09
Location: Hungary

Re: [Mod] Diet [0.1] [diet]

by Martno » Post

Hi.
This is great idea, because without this, no motivation to eat or cook various kind of foods. I needed this mod so much. So this is awesome.
One question: is this mod supports any hunger mod? I tried with hbhunger and it seems that it doesn't work (my hunger didn't change at all). Didn't try Better HUD and hunger though.

User avatar
rubenwardy
Moderator
Posts: 6978
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: [Mod] Diet [0.1] [diet]

by rubenwardy » Post

It's a little outdated - I need to up date it. It supports better HUD (unless the API has changed)
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

Martno
Member
Posts: 80
Joined: Thu May 28, 2015 07:09
Location: Hungary

Re: [Mod] Diet [0.1] [diet]

by Martno » Post

Doesn't work with Better HUD either. I got this error:

Code: Select all

10:00:11: ACTION[ServerThread]: singleplayer uses default:apple, pointing at [nothing]
10:00:11: ERROR[main]: ServerError: ...e1m519\Desktop\Minetest 0.4.12\bin\..\mods\diet\init.lua:81: attempt to index field 'hunger' (a nil value)
10:00:11: ERROR[main]: stack traceback:
10:00:11: ERROR[main]: 	...e1m519\Desktop\Minetest 0.4.12\bin\..\mods\diet\init.lua:81: in function <...e1m519\Desktop\Minetest 0.4.12\bin\..\mods\diet\init.lua:27>
If you could update this mod, it would be fantastic. Seems that diet is not very popular, I don't know why, I think it's great.

User avatar
rubenwardy
Moderator
Posts: 6978
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: [Mod] Diet [0.1] [diet]

by rubenwardy » Post

Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

Martno
Member
Posts: 80
Joined: Thu May 28, 2015 07:09
Location: Hungary

Re: [Mod] Diet [0.1] [diet]

by Martno » Post

rubenwardy wrote:it should work now...

https://github.com/rubenwardy/diet/comm ... 56a3f1a76d
Thanks, but unfortunately I still have the same error. I tried when other mods were enabled, and tried with new world with just diet and better hud and hunger enabled. Same error :(

Actually with hudbars and hbhunger (instead of better hud) diet works, I got the "your stomach could do with a change" message (after I ate more than 5 food from same type), but hunger bar doesn't change.

tinkerlevu
Member
Posts: 15
Joined: Tue Sep 08, 2015 21:59

Re: [Mod] Diet [0.1] [diet]

by tinkerlevu » Post

hey rubenwardy... can you add support for hudbars?

User avatar
sys4
Member
Posts: 51
Joined: Thu Nov 26, 2015 13:57
GitHub: sys4-fr
IRC: sys4
In-game: sys4
Contact:

Re: [Mod] Diet [0.1] [diet]

by sys4 » Post

I have made a fork located here : https://github.com/sys4-fr/diet

The compatibility issue whith hud+hunger is fixed.
Added hbhunger (hudbars) support.

User avatar
TheReaperKing
Member
Posts: 531
Joined: Sun Nov 22, 2015 21:36
Contact:

Re: [Mod] Diet [0.1] [diet]

by TheReaperKing » Post

So I think this mod is fantastic and I'm using it with the exertion mod and crops mod. Would it be possible to make it compatible with the Mobs redo mod? Meat doesn't seem to work and also it doesn't take many apples for them to not be tolerated anymore. Wouldn't they just have reduced effect vs no effect?

I'm using this with my students and I think it is such a great way to teach them about diet and nutrition. Thank you so much for creating it!
Become A Real Life Superhero - http://SuperheroHill.com
Project Lead of the Doom 3 Mod Last Man Standing - http://Doom3Coop.com
Project Lead of Platinum Arts Sandbox Free 3D Game Maker - http://SandboxGameMaker.com
Youtube Channel - https://www.youtube.com/user/PlatinumArtsKids

User avatar
rubenwardy
Moderator
Posts: 6978
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: [Mod] Diet [0.1] [diet]

by rubenwardy » Post

TheReaperKing wrote:So I think this mod is fantastic and I'm using it with the exertion mod and crops mod. Would it be possible to make it compatible with the Mobs redo mod? Meat doesn't seem to work and also it doesn't take many apples for them to not be tolerated anymore. Wouldn't they just have reduced effect vs no effect?
I have a look into these when I can get around to it. I haven't maintained this mod in a while
TheReaperKing wrote:I'm using this with my students and I think it is such a great way to teach them about diet and nutrition. Thank you so much for creating it!
Please note that this is not meant to be accurate at all - if it was, then it would similar micros and macros, etc
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
Stix
Member
Posts: 1385
Joined: Fri Aug 04, 2017 14:19
IRC: nil
In-game: Stix [+alts]
Location: USA

Re: [Mod] Diet [0.1] [diet]

by Stix » Post

will the value of certain food items go back up after you haven't eaten them in a while?
Hey, what can i say? I'm the bad guy.

Byakuren
Member
Posts: 818
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: [Mod] Diet [0.1] [diet]

by Byakuren » Post

Stix wrote:will the value of certain food items go back up after you haven't eaten them in a while?
Yes, but not enough to make up for the decrease in the other food items you ate. It's a metaphor for our search for novelty in the face of boredom and meaninglessness.
Every time a mod API is left undocumented, a koala dies.

User avatar
ManElevation
Member
Posts: 896
Joined: Tue Aug 02, 2016 22:04
GitHub: ManElevation
IRC: ManElevation
In-game: ManElevation
Location: Madrid,Spain

Re: [Mod] Diet [0.1] [diet]

by ManElevation » Post

+1
yum! :P
My Public Mods! Discord: Rottweiler Games#3368

User avatar
Lord_Vlad
Member
Posts: 112
Joined: Thu Jul 20, 2017 07:58

Re: [Mod] Diet [0.1] [diet]

by Lord_Vlad » Post

How many food does it keep in memory ?
How many food are needed to get negative effect ?
Also can you change it ?
We need a simple configuration in mod configuration to change that.

This mod is awesome btw

User avatar
Lord_Vlad
Member
Posts: 112
Joined: Thu Jul 20, 2017 07:58

Re: [Mod] Diet [0.1] [diet]

by Lord_Vlad » Post

Sorry for double post but this is radically different from last intervention :
I have made a few addition to the mod's code, so it supports more of the mods I am using, I post it here and if you can add it to the original code...
I don't know how to make forks and pull requests yet, I really should learn...

Anyways, here is the code to accomodate most of the recent updates to farming redo :

Code: Select all

if minetest.get_modpath("farming") and farming.mod == "redo" then
	overwrite("farming:bread", 6)
	overwrite("farming:potato", 1)
	overwrite("farming:baked_potato", 6)
	overwrite("farming:cucumber", 4)
	overwrite("farming:tomato", 4)
	overwrite("farming:carrot", 3)
	overwrite("farming:carrot_gold", 6, "", nil, 8)
	overwrite("farming:corn", 3)
	overwrite("farming:corn_cob", 5)
	overwrite("farming:melon_slice", 2)
	overwrite("farming:pumpkin_slice", 1)
	overwrite("farming:pumpkin_bread", 9)
	overwrite("farming:coffee_cup", 2, "farming:drinking_cup")
	overwrite("farming:coffee_cup_hot", 3, "farming:drinking_cup", nil, 2)
	overwrite("farming:cookie", 2)
	overwrite("farming:chocolate_dark", 3)
	overwrite("farming:donut", 4)
	overwrite("farming:donut_chocolate", 6)
	overwrite("farming:donut_apple", 6)
	overwrite("farming:raspberries", 1)
	overwrite("farming:blueberries", 1)
	overwrite("farming:muffin_blueberry", 4)
	if minetest.get_modpath("vessels") then
		overwrite("farming:smoothie_raspberry", 2, "vessels:drinking_glass")
		overwrite("farming:pineapple_juice", 4, "vessels:drinking_glass")
	end
	overwrite("farming:rhubarb", 1)
	overwrite("farming:rhubarb_pie", 6)
	overwrite("farming:garlic", 1)
	overwrite("farming:chili_bowl", 8, "farming:bowl")
	overwrite("farming:grapes", 2)
	overwrite("farming:peas", 1)
	overwrite("farming:pea_soup", 4, "farming:bowl")
	overwrite("farming:pepper", 2)
	overwrite("farming:chili_pepper", 2)
	overwrite("farming:pineapple_ring", 1)
	overwrite("farming:onion", 1)
	overwrite("farming:bread_slice", 1)
	overwrite("farming:toast", 1)
	overwrite("farming:toast_sandwich", 4)
	overwrite("farming:porridge", 6)
end
And here is for various other mods :

Code: Select all

if minetest.get_modpath("mobs_zombie") ~= nil then
	overwrite("mobs_zombie:rotten_flesh", 1)
end

if minetest.get_modpath("pumpkinspice") ~= nil then
	overwrite("pumpkinspice:pumpkinspice_latte", 5, "farming:drinking_cup")
	overwrite("pumpkinspice:donut_pumpkinspice", 6)
	overwrite("pumpkinspice:pumpkinspice_cookie", 2)
	overwrite("pumpkinspice:pumpkinspice_bread", 6)
end

if minetest.get_modpath("redtrees") ~= nil then
	overwrite("redtrees:treechillitreat", 5)
end

if minetest.get_modpath("more_bread") ~= nil then
	overwrite("more_bread:pastrie_with_strawberry", 5)
	overwrite("more_bread:pastrie_with_chocolate", 4)
	overwrite("more_bread:croissant_with_cherry", 6)
	overwrite("more_bread:croissant_with_strawberry", 6)
	overwrite("more_bread:croissant_with_peach", 5)
	overwrite("more_bread:burger", 10)
	overwrite("more_bread:sausage_in_dough", 7)
	overwrite("more_bread:bun", 6)
	overwrite("more_bread:hot_cross_bun", 10)
	overwrite("more_bread:bun_block", 15)
	overwrite("more_bread:hot_cross_bun_block", 20)
	overwrite("more_bread:pastrie", 4)
	overwrite("more_bread:pastrie_dough", 1)
	overwrite("more_bread:bagel", 10)
	overwrite("more_bread:bagel_shaped_dough_lump", 3)
	overwrite("more_bread:baguette_shaped_dough_lump", 2)
	overwrite("more_bread:baguette", 8)
end

if minetest.get_modpath("foody") ~= nil then
	overwrite("foody:creamcheese", 1)
	overwrite("foody:strawberry_muffin", 5)
	overwrite("foody:chocolate_banana_muffin", 8)
	overwrite("foody:orange_raspberry_muffin", 7)
	overwrite("foody:chocolate_muffin", 7)
	overwrite("foody:coffeecake_muffin", 5)
	overwrite("foody:carrotcake", 12)
	overwrite("foody:fries", 4)
	overwrite("foody:diamond_donut", 30)
	overwrite("foody:meat6", 9)
	overwrite("foody:meat5", 9)
	overwrite("foody:meat4", 9)
	overwrite("foody:meat3", 9)
	overwrite("foody:meat2", 9)
	overwrite("foody:meat1", 9)
end


if minetest.get_modpath("food") ~= nil then
	overwrite("food:pasta_bake", 3)
	overwrite("food:soup_chicken", 4)
	overwrite("food:soup_tomato", 4)
	overwrite("food:apple_juice", 2)
	overwrite("food:orange_juice", 2)
	overwrite("food:cactus_juice", 2)
end

User avatar
j0j0n4th4n
Member
Posts: 251
Joined: Tue Jan 26, 2021 06:45

Re: [Mod] Diet [0.1] [diet]

by j0j0n4th4n » Post

Is this mod still being supported?
cdb_894a100ddd76

Germain
Member
Posts: 42
Joined: Thu Aug 13, 2015 10:16

Re: [Mod] Diet [0.1] [diet]

by Germain » Post

I use Minetest-server 5.3, and didn't see problems with this mod.
Usualy I don't use this, because I should add many other edible food from other mods, but activated today without problem.

Post Reply

Who is online

Users browsing this forum: No registered users and 35 guests