Jump to content

Food values mod


Recommended Posts

Hi,

 

Does anyone know if a mod exists that alters the hunger, health and sanity restoring properties of the various food items ( or better yet has a config menu for each).

 

I want to find a mod that nerfs meatballs & meaty stew and buffs some of the rarer food items made from crockpots. Over on steam I found a mod called "rebalanced crock pot" which looked to be ideal, but it didn't work properly (it nerfed the berries and seeds but left recipies unchanged) and I would like to actually be able to alter the stats myself.

 

Is this something a complete beginner like myself could learn to do, as it would seem I would not be adding anything to the game, just altering some of the numbers ?

 

Thank you klei community in advance.

Link to comment
Share on other sites

@MrDontStARVE Try this.

require = GLOBAL.require-- Get information from cooking.luacooking = require("cooking")-- Get cookpot recipesrecipes = cooking.recipes.cookpot-- Change meatballs statsrecipes.meatballs.health = 10recipes.meatballs.hunger = 10recipes.meatballs.sanity = 10

You can find the names and default stats of all cookpot recipes in "..\scripts\preparedfoods.lua".

 

If you want to make them configurable from the mod config screen, let me know and I'll show you how.

Link to comment
Share on other sites

Oh hey dude, it works! Good job!

 

Alright, Ima start working on the mod, where you can configure all those values.

So carry on, I will drop-by later today to let you know. Hopefully it will work as intended..

 

~ Edit: ~

So, I've made settings for every DS cooked food, but it's still missing the RoG foods.

Gonna tap on that a bit later..

 

About the config portion of the mod - I have no clue, how to manage so many values:

- there's 25 foods (DS)

- there are 4 values per each (health, hunger, sanity and preservance)

- with 6+ options per each value

 

Sigh..

Any ideas?

Link to comment
Share on other sites

Simply said, is there a way to get a "value" out of the config data, rather then a "string"?

Because even when we get data from the config, that says "37.5", it still takes it as a text rather than a number.

 

Edit:

Oh wow, now I see why it was a string.. Can't use the "" around it. Haha..

Ok, moving on!

Link to comment
Share on other sites

@IcyTheWhite

You can also use function to simplify the process. (in modinfo)

local function MakeValueOptions()    return {        {description = "1", data = 1},        {description = "2", data = 2},        {description = "3", data = 3},    }endconfiguration_options =	{		{			name = "Opt1",			label = "Option 1",			options = MakeValueOptions(),			default = 1		},	}

And if you want to reduce the number of items, you could consider merging the health/hunger/sanity all into one, and use a scale to change them.

Ex, The "meatballs" will be set to 0.5, 1, or 2 in modinfo. Then in modmain, you multiply the original meatballs stats with the retrieved values.

local meatball_mult = GetModConfigData("meatballs")recipes.meatballs.health = recipes.meatballs.health * meatball_multrecipes.meatballs.hunger = recipes.meatballs.hunger * meatball_multrecipes.meatballs.sanity = recipes.meatballs.sanity * meatball_mult

So if meatballs is set to 0.5, its stats will be half of the original. If it's set to 2, they will be double.

 

You can make it even easier with another function. (in modmain)

local meatball_mult = GetModConfigData("meatballs")local function use_mult(rec_name, mult)    recipes[rec_name].health = recipes[rec_name].health * mult    recipes[rec_name].hunger = recipes[rec_name].hunger * mult    recipes[rec_name].sanity = recipes[rec_name].sanity * multendif (meatball_mult ~= 1) then    use_mult("meatballs", meatball_mult)end

Edit: Fixed some mistakes in code. ("data" of the first section, and "sanity" in last section)

 

 

Link to comment
Share on other sites

Hey @Blueberrys help me out please!

I don't know what happen. I was making my code and everything worked fine until I started defining perish time of foods...

After setting all up it said that mod crashed on load. Now I can't reenable the mod, but what's worse is that it doesn't even show any info of the mod - No author, version, settings... Nothing!

And I even configured everything up to the previous state, when it DID work, but no.. Still nothing. Still writes it crashed last time and that it's disabled, unknown mod..

 

I'm helpless right now..

No idea what happen and how to fix it.

Link to comment
Share on other sites

And how come even if I copy the whole code to other .lua file, it still knows that it crashed on the last time? Where does it store that info?

 

 

Edit:

Well, it still somehow remembered that the mod crashed even after the reinstall of the game (but this time I could reenable it, and it showed the info this time), so I really want to know, where are the crash informations stored and how does it recognize the crashed mod?

Link to comment
Share on other sites

@IcyTheWhite I think the mod crash information is stored in profile or modindex at:

PC: Go to your documents folder at Documents\ klei\donotstarve\save
Mac: Go to your documents folder at ~/Documents/Klei/DoNotStarve/save
Linux: Go to your Klei folder at ~/.klei/DoNotStarve/save

 

Though I don't think that was the problem, there's likely something wrong in your modinfo file. May I see it?

 

Also, use @[ member='Blueberrys' ] (without the spaces) so it gives me a notification. Just using @ doesn't do it. You can also select a portion of my post and click the "mention" button, which writes that in your post automatically.

 

Link to comment
Share on other sites

So apparently if I use "TUNING.PERISH_SLOW" as data config, the mod crashes...

I though that that line was declaring a specified number, gathered from tuning.lua.

Any idea why?

 

This is what I was trying to use in info file (shortened):

local function PerishOptions()    return {{description = "6 Days", data = TUNING.PERISH_FAST},{description = "10 Days", data = TUNING.PERISH_MED},{description = "15 Days", data = TUNING.PERISH_SLOW},    }endconfiguration_options =    {        {            name = "Bacon and Eggs Perish",            options = PerishOptions(),            default = TUNING.PERISH_MED        },    }

Along with this in main file:

recipes.baconeggs.perishtime = GetModConfigData("Bacon and Eggs Perish")

Well, it works this way with hunger, sanity and health, but there I use flat values, instead of "tuning".

So what do you think @Blueberrys?

 

 

Edit:

Also, my game recently crashed and said - not enough memory.

Is it because I used too many constants?

Does naming config options in info.lua shorter way help reduce memory usage?

Like for example: name = "Bacon and Eggs Perish" to name = "BaE_Perish"

 

Or am I using just just too many mods? (20~ or so atm)

 

Link to comment
Share on other sites

@IcyTheWhite I don't think the TUNING variable can be accessed from modinfo. It shouldn't be used anyways, because the modmain can change it after the modinfo is evaluated. You would also get mixed results if anyone changes them in their mod.

 

You can use 6, 10, and 15 in the modinfo, and apply that as a multiplier in modmain.

 

(modinfo)

local function PerishOptions()    return {        {description = "6 Days", data = 6},        {description = "10 Days", data = 10},        {description = "15 Days", data = 15},    }end-- ...

-

 

(modmain)

local seg_time = 30local total_day_time = seg_time*16local perish_warp = 1 --/200local perish_base = total_day_time*perish_warprecipes.baconeggs.perishtime = perish_base  * (GetModConfigData("Bacon and Eggs Perish") or 10)

-

 

Hmm. I'm don't think this mod would take up much memory, it's mostly just text. Usually memory spikes happen with mods that have many and/or large assets (images, sounds, etc). Get this mod to prevent that crash.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...