Stardew Valley
0 of 0

File information

Last updated

Original upload

Created by

aedenthorn

Uploaded by

aedenthorn

Virus scan

Safe to use

Tags for this mod

About this mod

Causes perishable goods to deteriorate over time, reducing quality and eventually spoiling. Fridges slow rate of decay. Highly customizable.

Permissions and credits
Changelogs
Donations
Description

This mod implements a simple spoilage system in Stardew Valley, making preserved items and fridges more meaningful, and curbing some of the more extreme hording tendencies. Also, it just makes sense not to be able to keep raw fish in your backpack for months.


Deterioration

Each perishable category has separate "days to spoil" settings. The default values are:

  • Fruits: 5
  • Vegetables: 5
  • Greens: 4
  • Flowers: 3
  • Egg: 3
  • Milk: 2
  • Cooked: 2
  • Meat: 1
  • Fish: 1

Greens is used for forage items.

Items in fridges will deteriorate at a separate rate (default 0.1x).

Items in the player's inventory also have a separate deterioration rate (default 1.5x).

Deterioration is calculated in the morning after saving, so if you make a mistake and something spoils unexpectedly, you can just change the settings and reload the save.


Quality

By default, items that have "quality" stars will lose one quality point each time they would otherwise spoil, resetting their "age" back to 0. Iridium products have 4 quality points, so it will take two spoil cycles for them to reach gold star quality (2).

You can turn off quality reduction and / or spoilage in the config.


Exceptions

Some items may not neatly fall into their spoilage category, so you can set exceptions in the config. E.g.:

"CustomSpoilage": {
"Sap": {
"age": 0,
"category": 9999,
"spoiled": null
}
}

means Sap will never spoil even though it is in the Greens category for some reason. Setting the age higher than 0 gives any item a custom number of days to spoil of course. You can also use the ParentSheetIndex value instead of the name.

If you change "category" to something other than 9999 that item will follow the setting for that category instead of the number at "age".

Category numbers are:

GreensCategory = -81
VegetableCategory = -75
FishCategory = -4
EggCategory = -5
MilkCategory = -6
CookingCategory = -7
FruitsCategory = -79
flowersCategory = -80
meatCategory = -14

If you change "spoiled" to either the name or index of a valid object, this item will be seen as that sort of item instead of trash. (Omit the "age" field if you just want to change "spoiled").

There is also a dictionary at aedenthorn.Spoilage/dictionary available for mods to add their own exceptions using Content Patcher. E.g.:

{
"Format": "1.23.0",
"Changes": [
{
"Action": "EditData",
"Target": "aedenthorn.Spoilage/dictionary",
"Entries": {
"Sap": {
"age": 0,
"category": 9999,
"spoiled": null
}
}
}
]
}


Display

By default, the age and days left are shown in item descriptions, and spoiled items will be marked as such. Spoiled items also have their ParentSheetIndex changed to 168 (the index for Trash) and their quality set to -4, so the game and other mods don't mistake them for unspoiled goods. Spoiled items' trash sprite will be colored green in menus.


API

This mod only finds items in placed chests and directly in the player inventory. Items in modded non-chest-type containers will probably not be found. Mods can trigger aging and get info about items using the following SMAPI mod API interface:

    public interface ISpoilageAPI
    {
        public void SpoilItems(IList<Item> items, float mult = 1);
        public void SpoilFridgeItems(IList<Item> items);
        public void SpoilPlayerItems(IList<Item> items);
        public string SpoiledItem(Item item);
        public float ItemAge(Item item);
    }

SpoiledItem returns the original name of the spoiled item if it is indeed spoiled, otherwise returns null.
ItemAge returns the item age in days if it has aged as a spoilable item, otherwise returns -1.


Config

You can customize this mod by editing the config file or using Generic Mod Config Menu.


Technical

Requires SMAPI.

Implements a Generic Mod Config Menu interface to change config settings in-game.

Compatible with Mod Updater for automatic updates.

Code is at https://github.com/aedenthorn/StardewValleyMods.

If you want to complain or ask for help or help me test my mods, you can visit my Discord server.

A list of all my mods for Stardew Valley is available at https://www.nexusmods.com/stardewvalley/articles/895.