
Mods / No offline food spoil
Author: Wiltoga
Side: Server
Created: Oct 10th 2023 at 7:43 AM
Last modified: Dec 28th 2024 at 7:13 PM
Downloads: 5278
Follow Unfollow 169
Latest release (for outdated Vintage Story v1.20.0):
OfflineFoodNoSpoil_1.4.0-1.20.zip
1-click install
Imagine, you are going for an aventure outside your home. You hunt a few deers and other animals. But there are UFO outside your house (IRL), and need a quick military negociation with them. But when you log back into the multiplayer server in Vintage Story, all your food has perished, thanks to those aliens because you spent too much time offline with food in your inventory.
When a player is disconnected from a server, all its food stored in its hotbar and backpacks (not the chests nor anything accessible from other players) no longer spoils. It also prevents items to progress any other timed transition, such as drying if it is a spoilable item.
Only works server-side, no need to install on client.
Configuration
The mod can be configured by tweaking a few parameters in the VintagestoryData/ModConfig
folder (OfflineFoodNoSpoil.json
).
The configuration is Hot-Reloaded, meaning that a change to the configuration file won't require a server restart. It will work out of the box.
Field | Description |
EnableMod |
Set to Default: |
UseLogs |
Enable or disable logging in the terminal. Used for debugging. Default: |
FoodSpoilMultiplier |
A value between
Default: |
MaxAllowedSkippedHours |
(Optional) A final max amount of hours allowed of skipping. If the skipped time is bigger than this value, it will be clamped.
Default: |
Time computation
The skipped time is computed this way, with a offline duration of 48 hours :
- First get the elapsed time while offline. Here 48 hours.
- Apply the multiplier. Here let's say we have a multipler of
0.25
. That means 25% of the elapsed time will be applied on the food.
48 hours * (1 - 0.25) = 36 skipped hours - Then if
MaxAllowedSkippedHours
is defined, we use it to clamp the value. Here the value is 30 hours.
Since 36 is bigger than 30, we get 30 skipped hours. Otherwise, we would get 36 hours.
Each perishable item in the inventory will skip 30 hours before applying the remaining time : 48 - 30 = 18 actual hours applied on the perishable food.
Version | For Game version | Downloads | Release date | Changelog | Download | 1-click mod install* |
---|---|---|---|---|---|---|
v1.4.0 | 2440 | Dec 28th 2024 at 7:13 PM | Show | OfflineFoodNoSpoil_1.4.0-1.20.zip | 1-click install | |
v1.3.2 | 59 | Dec 28th 2024 at 6:43 PM | Show | OfflineFoodNoSpoil_1.3.2-1.20.zip | 1-click install | |
v1.3.1 | 286 | Dec 18th 2024 at 6:37 PM | Show | OfflineFoodNoSpoil_1.3.1-1.19.zip | 1-click install | |
v1.3.0 | 162 | Dec 15th 2024 at 8:42 PM | Show | OfflineFoodNoSpoil_1.3.0-1.19.zip | 1-click install | |
v1.2.0 | 1003 | Jan 11th 2024 at 8:40 PM | Show | OfflineFoodNoSpoil_1.2.0.zip | 1-click install | |
v1.1.1 | 642 | Oct 12th 2023 at 4:39 PM | Show | OfflineFoodNoSpoil_1.1.1.zip | 1-click install | |
v1.1.0 | 190 | Oct 12th 2023 at 8:14 AM | Show | OfflineFoodNoSpoil_1.1.0.zip | 1-click install | |
v1.0.1 | 258 | Oct 10th 2023 at 7:39 PM | Show | OfflineFoodNoSpoil_1.0.1.zip | 1-click install | |
v1.0.0 | 238 | Oct 10th 2023 at 7:46 AM | Show | OfflineFoodNoSpoil_1.0.0.zip | 1-click install |
Hi everyone, I tried the mod in 1.4.0 version on a 1.20.10 game server (hosted locally and on remote). I again had no issue, so I can't fix a bug I can't reproduce sadly. I you ever encounter an issue, give me as much details as possible, including the logs (if any), the current player inventory would be very useful (preferrably as a screenshot, as modded inventories are not yet supported). The player count would be great too, just to know if it is related to server performances. If you are using a mod adding custom player inventories (like new bags, or more slots), they may not work. Technically, every kind of inventory has a 'class' (like "hotbar", "backpack", but also "creative", ...) Right now, only "hotbar" and "backpack" are allowed, maybe the problem comes from here
Server Error] Exception: Object reference not set to an instance of an object.
at Wiltoga.OfflineFoodNoSpoil.ItemPerishValue..ctor(ItemStack stack)
at Wiltoga.OfflineFoodNoSpoil.ItemPerishValue..ctor(ItemStack stack)
at Wiltoga.OfflineFoodNoSpoil.PerishService.PreventInventorySpoil(IInventory inventory, Settings settings)
issue works only half of the time.
would you be able to add the functionality to apply this effect always for a single player?
+1 to this not always working on servers. On my (1.20.4) server, it only seems to work some of the time. Half the food people log out with is spoiled when they log back in. On the other hand, about half the time it works fine. No idea why. :(
I do use Expanded Foods on my server and the mod is working fine. One way I think it may break, is if the server fully computes the food decay before my mod can patch it. If it is the case, then I fear it is unlikely to be fixed as this is a core mechanic of the game
Could this mod, by chance, not work with Expanded Foods?
The file "OfflineFoodNoSpoil.json" in the ModConfig folder contains this exact text:
{
"EnableMod": true,
"UseLogs": false,
"FoodSpoilMultiplier": 0.0
}
Tested on my 1.20.3 server, everything works fine. Can you provide me with the full config file ? Perhaps contact me on the official discord of the game so I can look deeper into it
Same case on my 1.20.3 server, mod seems to not be functioning for any players.
I have this mod on my server and my food spoiled while I was offline. The mod is enabled and has all default values set.
Game version 1.20.3
Maybe, if padlocks, when used on chests (and hopefully storage vessels could set lockable to ture,) would only have their contexts rot when the player who locked it is on! Would that be easier?
* without a ritualistic log-off routine of filling your inventory with food
Wiltoga: Yes, but drops the rate of decay to 0. Multiply any food decay rate by a number, and my boss's surprise overtime will find a way to outlast it, so having something that, with enough effort, can create a small reserve for when one logs back on in winter after a week is the goal?
Luke_16 Something like this mod ?
@Wiltoga. My friends want to preserve rotting as mechanics but don't want to be punished for having a life throughout the whole game. Would it be easier to create a new craftable block to store food without rot? Say, needing temporal gears, copper-nickel, gold... late game items to craft and maybe* powered as a late-game solution? Like mashing a recolored chest with the sound of a storage vessel and having the power requirements pasted from a helve hammer or something? You know, before I ask someone politely or hopefully not fail while trying myself:)
A mod that prevents spoil in chests just because someone claimed it is a lot of work for little to no benefit at all.
If you really have a multi-player issue with rot in chest, the only true solution is to adjust the server config or disable chest spoilage at all. User claimed area will just raise more issues or bugs.
And again, if you find a bug and want me to fix it, I'm all good, but do provide me with more data than just "doesn't work in 1.20". Tell me your mod list, how you managed to find the bug, how to reproduce, with which item, EVERY step can be useful.
I've been looking. Is there any mod that would make it so that every time I log off, all my animals and food don't disappear and rot? Maybe tie rotting to a claimed area or create a tag for anyone who touched the food so that it would only rot when they are on?
does not work in 1.20.
The only food mod we are using is A culinary artillery
I have not tried in 1.20-rc.9 and will not fix if any bug is found in this version of the game since the stable 1.20 is out.
I tried my mod in 1.20 and everything is working as intended so far, including pies.
If you find an issue, please also provide additional informations such as the logs, your mods list (especially if a mod changes how food works) or any context that could help me reproduce the bug.
Even better, send an issue in the issue tracker (if you have a github account), or ping me in the Vintage Story official discord
The latest version isn't working with pies
doesn't work in 1.20.0-rc.9
MishkaSnep Done in 1.4.0+ versions.
Is it possible to have it configurable? to stop abuse of someone just grabbing all the food they have everytime they log off? Like it only just slows it down a bunch or it keeps decaying for a day then stops?
After a year without updates, I fixed bug with the Butchering mod.
I second the player data corruption with Butchering mod. We've had to wipe player data quite a few times. WhiskeySunshine
The mod works fine in 1.19.7 stable but is incompatible with butchering in that, if you have animal corpses in a backpack slot, it will cause an "object reference not set to an instance of an object" null reference exception that requires wiping player data to reconnect to the world or server.
Seems to work for 1.19.1 (At least does not crash to desktop)
Had a crash with this mod enabled. Crash log here.
Context: I was knapping a flint knife head - using Nats Survival Expanded mod. The last piece of flint I had broke, and then I CTD'd.
I could not load the world again after this. It immediately CTD'd with that same crash log each time. The crash log does not indicate any specific mod to be the cause, however, after painstakingly trying to load the world a few mods at a time, I narrowed it down to the OfflineNoFoodSpoil mod. Once that was removed, I could finally load the world again, and I've been playing as normal.
I'm not well versed in C# whatsoever, so I doubt that I'm interpreting the crash log correctly, but it almost seems like there was some issue in the base game code itself. I hope you'll be able to make something of it. I'd really like to add this mod back to our server. ✌🙏