tModLoader Starvation - No 'Well Fed' buff = harm

hamstar

Terrarian


Requires Mod Helpers


See title. Also, you begin with 3 bowls of soup, and your Well Fed buff depletes 2x as quickly. Configurable.

NEW! (as of v1.3): Food spoilage is now an option in the config settings. Set "FoodSpoilageEnabled": true to enable. IMPORTANT: Due to a limitation with tModLoader, ALL food items will be set to maximum stack size of 1, once this setting is enabled. All existing food stacks will be permanently unstackable (but retain their quantity). Tupperware items exist to let you store spoilable foods in stacks, though. You have been warned.

NEW! (as of v1.4): Added Unlife Crystals. Reduces max hp by 20. Returns a Life Crystal on use.

NEW! (as of v2.0): Added setting to enable ingredient spoilage, tupperware items to store stacks of spoilable food or ingredients (drops from skeletons by default), and food expiration inside containers. Also tweaked some vanilla food values and the Pumpkin Pie recipe now requires Hay, Blinkroot Seeds, and Mashed Pumpkin (crafted from regular pumpkin). Also, items that fully spoil permanently turn to rot, now.



Source available. API available. Config settings here.



Starvation.png



 
Last edited:
v2.2.1
  • Updated for TML11.5
  • Added FloatInputElement for float config settings
  • Added ranges to some config settings
v2.2.0
  • Updated to TML11.4 and MH5b
  • Changed uses of NPC and Item configs to NPCDefinition and ItemDefinition
v2.1.2
  • Set starter players to have the usual on-respawn Well Fed buff buffer
  • Added Bug Net item recipe (also a setting)
  • Refactored recipe loading internal structure
v2.1.1.6
  • Changed FoodSpoilageRateScale to FoodSpoilageDurationScale (readjusted value accordingly)
  • Changed TupperwareSpoilageRateScale to TupperwareSpoilageDurationScale (readjusted and increased value)
  • Removed FoodIngredientSpoilageRateScale
  • Added StarvationItem.ComputeTimeLeftPercent(...) and implemented for use
  • Changed StarvationItem and TupperwareItem to both set their spoilages via. SetTimeLeftByPercent(...)
  • Added further debug output info
  • Assorted internal refactoring
  • Renamed code file for tupperware spoilage computations
  • Corrected tooltip and freshness bar of foods and ingredients
  • Set ComputeMaxElapsedTicks(...) to give priority to the FoodSpoilageDurationScale settings
  • Fixed duping rot items while holding an item in the mouse
v2.1.1.5
  • Attempted another fix for computing tupperware freshness
  • Added debug mode output for tupperware
  • Changed AddedWellFedDrainRatePerTickMultiplierPerMaxHealthOver100 to AddedWellFedDrainRateMultiplierForMaxHealthOver100
  • Changed AddedStarvationHarmPerTickMultiplierPerMaxHealthOver100 to AddedStarvationHarmMultiplierForMaxHealthOver100
  • Changed FoodIngredientSpoilageRatePerSecond to FoodIngredientSpoilageRateScale (and changed its value to 1)
  • Assorted internal refactoring (particularly with Compute stuff)
v2.1.1.4
  • Restructured tupperware freshness computing
  • Modified (hopefully to fix) item freshness computing when removed from tupperware
v2.1.1.3
  • Fixed issue of tupperware not returning correct freshness when items are extracted
v2.1.1.2
  • Forced cap of spoilage time to no more than a given item's max, and no less than 0
v2.1.1.1
  • Fixed tupperware occasionally being consumed on right click
  • Modified tupperware item add behavior to not displace the tupperware in inventory
v2.1.1
  • Added failsafe fix for tupperware right-click consume
  • Changed FoodSpoilageRatePerSecond setting to FoodSpoilageRateScale
  • Changed FoodSpoilageMinDuration to 10 seconds
  • Fixed max stack size for mashed pumpkin
  • Cleaned up tupperware sprite
  • Tweaked tupperware contained item draw position
  • Fixed incorrect spoilage indicator on tupperware
  • Changed FoodSpoilageMinDuration to FoodSpoilageMinTickDuration (and the Max ones)
  • Changed TupperwareSpoilageRate to TupperwareSpoilageRateScale
v2.1.0.1
  • Fixed missing custom pumpkin pie recipe (!)
v2.1.0
  • Improved tupperware and rot sprites
  • Added FoodSpoilageMinDuration (defaults to 15 minutes) and FoodSpoilageMaxDuration (default 3 hours) settings
  • Added TupperwareSellsFromMerchantByNpcId setting (defaults to skeleton merchant)
  • Increased Grub Soup to 120 minute Well Fed
  • Added FishbowlToGoldfishRecipe setting
v2.0.0.1
  • Set clay bowls to not have food ingredient spoilage
  • Fixed recipe of Unlife Crystal to correctly reference seaweed as fishing junk (not the pet item)
v2.0.0
  • Added Rot item (sprite credit v1tell)
  • Adjusted food tooltip when fully spoiled
  • Added Unlife Crystal tip when starving while at 400 max hp
  • Added Tupperware item (allows storing and preserving stacks of spoilable items)
  • Internally renamed to UnlifeCrystalItem
  • Added settings for custom Well Fed durations for vanilla food items (with presets)
  • Modified custom Well Fed config fields into a dictionary
  • Added MashedPumpkinItem (crafted from Pumpkin)
  • Modified Pumpkin Pie recipe (+10 hay, +1 blinkroot seed, 10 Mashed Pumpkin)
  • Set item ingredients to have spoilage
  • Implemented tupperware food unstacking (right-click)
  • Added settings FoodIngredientsAlsoSpoil, FoodIngredientSpoilageDurationTicks, TupperwareDropsFromNpcIdsAndChances, TupperwareSpoilageRate
  • Restructured spoilage item draw code
  • Added settings FoodIngredientSpoilageRatePerSecond, TupperwareMaxStackSize
  • Stopped drawing item freshness info for non-inventory items
  • Changed item durations to timestamps; allows item spoilage even inside containers
  • Added RotItem (rotted items transform into this)
  • Changed some config setting names to clarify their use
  • Set blinkroot seeds, hay, and mushrooms not to spoil
  • Added failsafe against food rot outside of game
  • Added inbox message about using Unlife Crystals
v1.4.0
  • Lowered (correctly) FoodSpoilageRate to 1
  • Lowered WellFedDrainRate to 2
  • Changed AddedWellFedDrainRatePerMaxHealthOver100 to AddedWellFedDrainRateMultiplierPerMaxHealthOver100, lowered amount considerably (only triples drain rate at max hp 400)
  • Changed AddedStarvationHarmPerMaxHealthOver100 to AddedStarvationHarmMultiplierPerMaxHealthOver100, lowered amount considerably (only triples drain rate at max hp 400)
  • Added Unlife Crystal item
  • Set Unlife Crystal to return a Life Crystal on use (with setting)
v1.3.1.1
  • Reduced default food spoilage rate once more
  • Added clamp for 60 fps item update tick amount (failsafe?)
v1.3.1
  • Changed FoodSpoilageRate setting from 3 to 2
  • Added tooltip to Well Fed buff to indicate its depletion rate
  • Added item spoilage tooldtip to indicate their rate of spoilage
v1.3.0
  • Added basic spoilage to foods (time based)
  • Added settings for enabling spoilage and scaling it
  • Spoilage items are forced to be maxStack = 1
  • Implemented spoilage bar on inventory items and coloration of the tooltip
  • Updated mod description
v1.2.0.1
  • Updated to newer MH conventions
  • Changed StarvationHarmRate setting to StarvationHarmDelay
  • Added AddedWellFedDrainRatePerMaxHealthOver100 and AddedStarvationHarmPerMaxHealthOver100 settings
  • Removed traces of snake case
v1.1.2.1
  • Added PlayerStarterSoup config option
  • Minor internal refactoring
v1.1.2
  • Updated for Mod Helpers v4
v1.1.1
  • Downgraded properly to MH v3.1
v1.1.0
  • Updated description + readme
  • Renamed config setting WellFedDrainRate
 

Attachments

  • Starvation v1.1.2.1.zip
    18.4 KB · Views: 147
  • Starvation v1.2.0.1.zip
    20.2 KB · Views: 152
  • Starvation v1.3.0.zip
    23.9 KB · Views: 162
  • Starvation v1.3.1.zip
    24.4 KB · Views: 152
  • Starvation v1.3.1.1.zip
    24.7 KB · Views: 149
  • Starvation v1.4.0.zip
    26.5 KB · Views: 158
  • Starvation v2.0.0.zip
    35.8 KB · Views: 139
  • Starvation v2.0.0.1.zip
    35.8 KB · Views: 142
  • Starvation v2.1.0.zip
    36.3 KB · Views: 135
  • Starvation v2.1.0.1.zip
    36.3 KB · Views: 153
  • Starvation v2.1.1.zip
    36.2 KB · Views: 151
  • Starvation v2.1.1.1.zip
    36.4 KB · Views: 142
  • Starvation v2.1.1.2.zip
    36.4 KB · Views: 141
  • Starvation v2.1.1.3.zip
    36.4 KB · Views: 146
  • Starvation v2.1.1.4.zip
    36.5 KB · Views: 147
  • Starvation v2.1.1.5.zip
    36.9 KB · Views: 140
  • Starvation v2.1.1.6.zip
    37.8 KB · Views: 152
  • Starvation v2.1.2.zip
    38.1 KB · Views: 148
  • Starvation v2.2.0.zip
    80.3 KB · Views: 152
  • Starvation v2.2.1.zip
    80.3 KB · Views: 227
Last edited:
Love it. Having a good time running it with Overhaul and Stamina.
Do you have any plans to expand on it? Like a Starbound style hunger system, with added foods/farming?
 
Love it. Having a good time running it with Overhaul and Stamina.
Do you have any plans to expand on it? Like a Starbound style hunger system, with added foods/farming?
That's something I could do as a separate mod, but not right now. Too much on my plate, without reimbursement.
 
Nice mod!

I've got an idea! What about adding smoked food, so it didn't spoil for much longer time (using the chimney as crafting table)
 
Nice mod!

I've got an idea! What about adding smoked food, so it didn't spoil for much longer time (using the chimney as crafting table)
Interesting, but there's already tupperware for food stacking and preservation.

Do you want this in addition?
 
Last edited:
how i fix the tupperware freshness problem? tried to do manualy, but i'm kinda new with mods. my config file have only alterations in the duration of the buf after respawn and spoilage for food(true) and ingredients(false). (srry for the engrish)
 
how i fix the tupperware freshness problem? tried to do manualy, but i'm kinda new with mods. my config file have only alterations in the duration of the buf after respawn and spoilage for food(true) and ingredients(false). (srry for the engrish)
Post your config file. Can you describe the problem a bit more?
 
Post your config file. Can you describe the problem a bit more?

i don't know some itens names, i'm playing the game in portuguese language. but, for example: i have a food with 20 minutes duration in my inventory, and spoilage start to increase each second, and it works well for me, but when i put the food into tupperware, looks like its increasing the spoilage value. i dont know the number exactly, it's somthing like 10sec spoilage become 2 min(instant) when i bring the item back to inventory. (ps:again, sry for the eng. thanks)
 

Attachments

  • Starvation Config.json
    1.9 KB · Views: 145
i don't know some itens names, i'm playing the game in portuguese language. but, for example: i have a food with 20 minutes duration in my inventory, and spoilage start to increase each second, and it works well for me, but when i put the food into tupperware, looks like its increasing the spoilage value. i dont know the number exactly, it's somthing like 10sec spoilage become 2 min(instant) when i bring the item back to inventory. (ps:again, sry for the eng. thanks)
Try setting TupperwareSpoilageRateScale to 1.0 and see if anything weird is still happening. Note that 1.0 makes it the same as normal spoilage, so Tupperware only works to store foods in stacks; no preservation.

I'll see if I can't figure what could be causing this, meanwhile.
 
Try setting TupperwareSpoilageRateScale to 1.0 and see if anything weird is still happening. Note that 1.0 makes it the same as normal spoilage, so Tupperware only works to store foods in stacks; no preservation.

I'll see if I can't figure what could be causing this, meanwhile.
well, I tested it and the effect seems to have been increased. I put on tupperware with 20 secs and remove with 11min approximately. by the way, **** is 0.5 by default I think.
well, I tested it and the effect seems to have been increased. I put on tupperware with 20 secs and remove with 11min approximately.

btw, FoodSpoilageRateScale is 0.5 by default I think. would that be a problem?
 
It shouldn't be.
well, I tested it and the effect seems to have been increased. I put on tupperware with 20 secs and remove with 11min approximately. by the way, **** is 0.5 by default I think.
well, I tested it and the effect seems to have been increased. I put on tupperware with 20 secs and remove with 11min approximately.

btw, FoodSpoilageRateScale is 0.5 by default I think. would that be a problem?
Was your tupperware container empty? It averages the freshness of stored items, so if the freshness is low on items inside the container, it will reduce the freshness of anything you add.
 
It shouldn't be.

Was your tupperware container empty? It averages the freshness of stored items, so if the freshness is low on items inside the container, it will reduce the freshness of anything you add.

is empty. I used the cheat sheet to do the tests, with just one item or more it still loses its freshness immediately, and it seems that gradually. just taking out and putting the same item about three times makes him rot.
 
is empty. I used the cheat sheet to do the tests, with just one item or more it still loses its freshness immediately, and it seems that gradually. just taking out and putting the same item about three times makes him rot.
Have you been using Tupperware to store different types of items (empty one type, start using for another)?
 
Have you been using Tupperware to store different types of items (empty one type, start using for another)?

When I do the tests I usually use the same food, I try to stock one and then take two or more. at first I thought it might be some kind of mechanics, but I varied only in quantity, not in items. Is that what you meant?
 
When I do the tests I usually use the same food, I try to stock one and then take two or more. at first I thought it might be some kind of mechanics, but I varied only in quantity, not in items. Is that what you meant?
Yeah, that's what I meant. I just found a bug involving switching item types in the tupperware, but according to your information, that wouldn't be the issue.
 
Yeah, that's what I meant. I just found a bug involving switching item types in the tupperware, but according to your information, that wouldn't be the issue.

Yes, it happened the first time soon with the first item, and I just had that one. then it should not be. If there something o can help...
 
Back
Top Bottom