RimWorld

RimWorld

617 arvostelua
Storage Refill Hysteresis
16
12
2
7
2
2
3
3
   
Palkinto
Lisää suosikkeihin
Lisätty suosikkeihin
Poista suosikeista
Mod, 1.5, 1.6
Tiedostokoko
Julkaistu
Päivitetty
551.468 KB
22.6.2024 klo 21.00
15.7. klo 13.26
10 muutosilmoitusta ( näytä )

Tilaa ladataksesi
Storage Refill Hysteresis

1 kokoelmassa, tekijä pureMJ
Common Sense +
5 luomusta
Kuvaus
Storage now has Smart Refill (hysteresis) function.
Refill if below configurable level. Stop if above another configurable level.

It avoids "single meal hauling" and maintains the balanced storage, making hauling adaptive.

Supports Stockpile Zones, Shelf, Fridges and all other storage buildings, as well as linked Storage groups.
Supports nutrient paste dispenser hoppers!

Has both automatic controlling and a manual toggle button (flickable control).



Background
In Rimworld we have storage units, such as a stockpile zone, shelf, fridges (from mods) and etc. Colonists will haul stuff into them automatically.

One common strategy most veteran players use: have some high priority shelf or fridge (or smaller stock pile zones), placed near dining table/crafting table/kitchen, so colonist can quickly grab what they need, rather than walking a long way into the messy general storage area for a single piece of material/meal.

This is a very good strategy, until another colonist walks across the map, into the messy general storage area, then walks a long way to the shelf next to the dining table, just to delivery a single meal.

Yes, this is beyond stupidity and I can't bear to see it happen all the time in my game play.

This Mod Adds
Hysteresis, a mysterious word that comes to rescue!

TL;DR: Install this mod and turn on the "Smart Refill" function on the storage of your choice, problem solved.

Details
We set a target range of storage usages.
Colonist consumes the material/items on the shelf gradually, and it will eventuall become relatively empty (the usage is below the target min usage), at which point the hauler can come to haul a whole stack (and in case you use Pickup and Haul, tens of stacks) and deliver all at once.
The refill will make the shelf almost full (the usage reaches the target max usage), then refill is paused (turned off).
Then again, next time when the shelf is below the target min usage, the refill is unpaused (turned on again).
... prepeat...

This process is called hysteresis. It is the same mechanism as the "do until" bill option with "pause until" checked.
We call the [min, max) target range the [b]hysteresis[/b] range.

Common Usage Cases
Different settings of the Smart Refill function will allow the storage to work on different logical "Mode".
Below are some examples.

6-9 Smart Refill Mode
A typical hysteresis range of [60%, 95%). (This is the default of the "default range" mod setting)
In this mode your storage will be filled up to 95%-ish, then refill after it's used up to below 60%.
This is the sweet point for small storages such as fridge (or linked fridges) near dining table. No more single meal delivery.

One Fill Mode
Hysteresis range of [0%, x%).
This storage will be filled to x% once and then stop, until you manually click the toggle button to tell it to refill again.

No Hysteresis Mode
Hysteresis range of [x%, x%).
This storage will refill if it's below x% but immediately stop when it's above.
This mode will be similar to how SatisfiedStorage works except this mod counts all cells of a storage and supports linked storages.

Monitor Mode
Hysteresis range of [100%, 100%).
Even if you do not want the Smart Refill function, it is still beneficial to turn it on.
At this mode the storage functions as if this mod does not exist, except your large storages will no long tank your performance when it's full.
And you get to have a nice monitor UI of how much your storage is filled up.

More smart ways to use this mod are waiting for you to explore.

Performance
This mod has no observable negative impact on performance. It is tested in late game scenarios with tens of thousands of storage cells.

In fact, thanks to the usage of cache this mod improves performance, by telling the game that "this big, almost full storage is paused for refill", so that vanilla game does not need to check every cell each time a haul job is made.

Compatibility
Compatible with Deep Storage, Pickup and Haul, While You Are Nearby, Rim Fridge etc.
Also compatible with Adaptive Storage Framework, RimKeeper - Storage & Filters Helper etc.


F.A.Q
Does this mod affect performance?
No. It actually improves performance, see explanation in the Performance section.

Is this mod safe to add/remove mid save?
Yes.

Why does my colonist refill my storage beyond the set upper limit?
That's normal. There is a overshoot effect which is intentional.

Detailed Explanation:
The upper limit serves two goals:
  1. When the usage is below it, if it was refilling, the refill won't stop.
  2. When usage reaches it, the refill will turn off automatically.

Note that the first goals is strict. It will never turn off refill automatically if the usage is below the upper limit.
However, the second goal is not strict. The moment when the usage hit the upper limit, it takes up to about a second (can be configured in the mod settings) for the storage to stop the refill. This is for game performance.
Also, for colonist work efficiency, this mod does not hard stop any colonist who is already on the way to delivery things to the storage. So they will finish whatever they are already hauling into the storage before the refill stop. (If you think about it, there is no point to hard stop at the upper limit, because that only wastes storage space and waste some of the ongoing work efforts)


Updates
v0.2.0 Now supports 1.6.
v0.1.6 Fixed a minor bug that shelves in blueprint could not be linked.
v0.1.5 Fixed a minor bug that mod settings would only appear in dev mode.
v0.1.4 Emergent bug fix: game cannot load.
v0.1.3 Fixed a minor bug that hoppers were ignoring smart refill settings.
v0.1.2 Improved UI logic so it's now compatible with more mods.
v0.1.1 Fixed a minor bug that when this mod is added mid save, old storages couldn't gain hysteresis function.
v0.1.0 First version.

Credits & Links
Many thanks to the members of the #mod-development channel on the Rimworld Discord server!

If you enjoy this mod, please check out my other Rimworld mods on Steam Workshop!
Suositut keskustelut Näytä kaikki (1)
0
26.6.2024 klo 8.45
Bug Report
pureMJ
246 kommenttia
Barblegarb 21.8. klo 10.04 
It's infuriating that they implemented hysteresis on production bills, so they are obviously aware of the necessity, but have done nothing to add it to storage functionality.
Glothia 19.8. klo 9.41 
@baka1125 太感谢了,我找了好久没找到原因,没想到是 Vehicle Map Framework
Hattsworth 17.8. klo 19.11 
Question: does this affect all hauling or only hauling from other storage units. My use case is that I want to have a primary storage location, and an overflow one, where they will only take to overflow once the main is full (easily done with priority of course). Ideally then, this mod just prevents them from hauling from overflow every time something is taken out of main storage.
大番薯之怒 9.8. klo 4.13 
我居然现在才发现这个神级MOD~
躲进温柔的梦 9.8. klo 1.18 
点击物品架没有相关设置是不是和哪个冲突了
碳烤鱿鱼丝 7.8. klo 3.36 
太棒了,强迫症狂喜
Soup_UK 6.8. klo 12.00 
@DawnsGlow - StackGap, a mod I've been using for years to set/configure stack limits - has the same issue regarding settings resetting for storage on GravShips at launch. I've not found a stack limiting mod that works reliably with GravShips yet.
DawnsGlow 4.8. klo 23.56 
@PureMJ : The storage settings turns itself off after gravship launch.

Will you accept a patch, which I might create, to fix the odyssey gravship ? It would be helpful if you release the source but I can create the patch using ilspy.

A similar error also happens with Farming Hysteresis. You can check the comment of tapuesch and the response of author.
PsychedellicToxin 4.8. klo 11.56 
@pureMJ all I wanted was a single storage shelf frequently resupplied with a minor amount of meals at all time so that my minions don't have to carry and feed a malnutritioned prisoner in bed. Fill it to the brim, and the food will spoil. They're prisoners not guests, I'm not giving them 30 meals to use one or two a day.
pureMJ  [tekijä] 2.8. klo 16.18 
@Psychedellictoxin
You can raise the thresholds, or simply build one more storage.
This mod only turns it off when it's "kind of full". You probably have too many prisoners hence your meal storage depleted from "kind of full" to empty too fast. If that is the case, having more storage is the solution.