Mods / No Offline Container Food Spoil
Author: Draconikard
Side: Both
Created: Jan 10th at 9:02 AM
Last modified: Jan 10th at 10:57 PM
Downloads: 522
Follow Unfollow 33
Recommended download (for Vintage Story 1.21.0 - 1.21.6):
noofflinecontainerfoodspoil_1.0.2.zip
1-click install
WARNING: Release 1.0.1 had a bug that affected the lastUser checks. Please update asap. You may need to re-place chests that were placed while using the old version.
DISCLAIMER:
This mod does not prevent spoilage in a player's inventory. There is an existing mod for this made by Wiltoga, and I really don't know how to make a good-enough solution that wouldn't just copy their work. Both mods should be compatible with each other.
Also I really don't know what I am doing, so if I messed something obvious up in the code I apologize. I will do my best to keep this working/bug free as possible.
Overview
This mod targets an issue with food in Vintage Story multiplayer. In the base game, if a player leaves food in a container and then leaves the server, it will gradually spoil over time. Players that spend large amounts of time on servers can negatively affect other player's experience as by the time they log back on, everything they have will be turned into rot.
More in-depth testing is in progress to make sure that it performs as expected. I will put a list of what was tested in this at a later point.
How it works
Containers blocks have custom behavior attached to them that tracks who placed the block, as well as who last opened it. If the owner of the block is offline, the "transition" rate for that container will be changed to 0.
If a player interacts with this container, the food in it will spoil like normal until that player leaves. If requested enough, I may try to find a way to make this feature toggleable through a config.
Also, there was some funky stuff I had to do with calculations for spoilage when an unloaded chunk is loaded by an owner, which I will really need to do some testing on, but my initial tests have worked so far.
There is also a log that will appear in the console when a non-owner of a container breaks a container, for auditing purposes.
Credit where it is due!
This was not my idea! I knew this was a problem and was looking for a solution, and credit for this idea goes fully to Tabulius! The post I found their idea on is here.
| Mod Version | Mod Identifier | For Game version | Downloads | Released | Changelog | Download | 1-click mod install* |
|---|---|---|---|---|---|---|---|
| 1.0.2 | noofflinecontainerfoodspoil | 464 | Jan 10th at 10:57 PM | noofflinecontainerfoodspoil_1.0.2.zip | 1-click install | ||
|
Fixes issues with lastUser staying after they disconnect. | |||||||
| 1.0.1 | noofflinecontainerfoodspoil | 57 | Jan 10th at 9:19 AM | Release Retracted | |||
Retraction Reason:Major bug with lastUser not being removed after disconnect. Changelog:Added modicon. | |||||||
| 1.0.0 | noofflinecontainerfoodspoil | 1 | Jan 10th at 9:08 AM | Release Retracted | |||
Retraction Reason:No modinfo icon Changelog:Initial realease. | |||||||
nothing that affects containers no, i took this mod off and tested in a diff world also, seems to be that it changes the cointaners so that when enabled it changes them so there "new" but empty
Centerion That is very odd, I don't believe that any of the items in the containers are touched with the mod, just the container's properties. It should also not affect any containers that were placed before the mod was added. I will look into this to see if I can reproduce this issue.
Do you have any other mods installed that might interact with containers?
seems that any containers placed before mod was installed have there contents deleated, picking them up and placing them back down again does correct the odd missing texture tho
Mikihisa123 Thank you! As a heads up, keep in mind that this would only affect chests that are placed after the mod was installed, due to the way the custom behaviors work, so any containers would need to be re-placed.
Also, great question about drying/ripening. In theory, yes it would affect those. The game clumps all of these processes into something called a "transition rate". Rather than target specific items and stop their spoilage (as this can cause some server lag), I have targeted the container's "transition rate multiplier" to be 0 when the owner is not online.
I will look into a way to see if I can make those processes an option to happen through a tongle in a config perhaps, but that behavior isn't the case in any current releases.
Heya! Great idea for a mod! As a main cook in my friend's multiplayer server it would be terrific to have it on - people on server are still playing and my half-products from EF and CA mods are constantly rotting and outside of logging in regularly to just cook some stew I had no idea how to fix that. Will hopefully be checking this mod soon!
I have one question tho - does it also interact with Drying / Ripening like cheese / sausages / barrels? Basically I would like my food that needs those proccesses to happen to still be happening, but spoilage be halted once final product is in place. Is it possible or does this mod completely blocks any spoilage / ripening.
Once again, great idea and looking forward to it!
WARNING There was a major bug affecting chests that would continue to spoil based on the last user, please ensure you update.
artemax44
Good question, this should affect all containers, not just ones in a cellar.
Draconikard
Does this mod affect all types of containers? Or only the vessels in the cellar?