1,051 ratings
Stack Merger
File Size
0.222 MB
Feb 4, 2017 @ 2:57pm
Jun 3 @ 1:25pm
16 Change Notes ( view )

Subscribe to download
Stack Merger

Make your haulers understand that a tidy stockpile is an efficient stockpile.

Adds a low-priority hauling job that makes your haulers merge stacks in your stockpiles. Works per stockpile, so if items are in different stockpiles they will not be merged.

As each storage building (e.g. vanilla racks, extended storage, deep storage, etc) count as a single stockpile (or technically, have their own SlotGroup - which for this mod is equivalent), stacks in different storage units will not be merged.

When I was playtesting this, Stockpile Efficiency was brought to my attention. These mods do pretty much exactly the same thing (in fact we both use the same vanilla methods for the actual hauling). The main difference is in how we keep track of what can be merged. Stockpile Efficiency searches for stacks that can potentially be merged whenever a pawn is looking for something to merge. Stack Merger keeps a permanent cache of stacks that can be merged. I haven’t run any benchmarks, but I expect my mod to have a mostly constant, relatively low cpu load. Stockpile Efficiency will have no load as long as pawns don’t have time to do the hauling jobs, but when they search for things to merge the cpu load will most likely be considerably larger.

- duduluu: Chinese translations
- Zhentar: A17 update
- Lauri7x3: German translation
- Proxyer: Japanese translation
- Orange_mushroom: Korean translation

Think you found a bug?
Please read this guide before creating a bug report, and then create a bug report here[github.com]

Older versions
All current and past versions of this mod can be downloaded from GitHub[github.com].

All original code in this mod is licensed under the MIT license[opensource.org]. Do what you want, but give me credit. All original content (e.g. text, imagery, sounds) in this mod is licensed under the CC-BY-SA 4.0 license[creativecommons.org].

Parts of the code in this mod, and some content may be licensed by their original authors. If this is the case, the original author & license will either be given in the source code, or be in a LICENSE file next to the content. Please do not decompile my mods, but use the original source code available on GitHub[github.com], so license information in the source code is preserved.

Are you enjoying my mods?
Show your appreciation by buying me a coffee (or contribute towards a nice single malt).


This is version v0.18.1.5

Popular Discussions View All (2)
Jun 15 @ 7:59pm
Bug with picking up/dropping onto same stack (infinite loop until interrupted)
Oct 5, 2017 @ 7:54pm
< >
[RGN]Ursus Aug 9 @ 9:15am 
This is probably moot, but I think a better way for this mod to behave is to only merge if it can eliminate one or more stacks.
bonesbro Jul 24 @ 8:33pm 
I know it's not your problem soon, but there's a bug in the way that this mod interacts with the storage crates from Project RimFactory. If a crate contains multiple stacks that aren't full, the pawn will try and fail to stack them and just stay stuck there until they find something better to do:

Humps started 10 jobs in 10 ticks. List: (WaitMaintainPosture (Job_4068255)) , (HaulToCell (Job_4068259) A=Thing_Steel1001183 B=(91, 0, 154)) (WaitMaintainPosture (Job_4068260)) , (HaulToCell (Job_4068264) A=Thing_Steel1001183 B=(91, 0, 154)) (WaitMaintainPosture (Job_4068265)) , (HaulToCell (Job_4068268) A=Thing_Steel1001183 B=(91, 0, 154)) (WaitMaintainPosture (Job_4068269)) , (HaulToCell (Job_4068272) A=Thing_Steel1001183 B=(91, 0, 154)) (WaitMaintainPosture (Job_4068273)) , and (HaulToCell (Job_4068276) A=Thing_Steel1001183 B=(91, 0, 154)) (WaitMaintainPosture (Job_4068277)) lastJobGiver=null, curJob.def=WaitMaintainPosture, curDriver=Verse.AI.JobDriver_WaitMaintainPosture
Fluffy  [author] Jul 10 @ 3:56pm 
In any case, RimWorld 1.0 has a built-in stack merger (pretty much identical to this mod), so pretty soon it won't be my problem anymore :P
Fluffy  [author] Jul 10 @ 3:55pm 
@fdsfse; Yeah, the game overwrites the log, but only sometimes. I'm not quite sure how, when and why, but it's a good thing it does, or they would become insanely large. Most 'hard' errors (i.e. exceptions) generate a stack trace, which can be very helpful in tracing the source of an error. I asked because I suspect the fault is in another mod, or at least in an interaction with another mod. Given that at least two people have now mentioned issues with a bot mod, that would be a prime suspect.

I can't do much either way without a stack trace or two though. The code I'm using for the hauling job is simply a call to the vanilla haul functions, so they're unlikely to cause any major issues on their own - or if they did, the problem would be a lot bigger, affecting _all_ hauling.
fdsfse #PFC Jul 10 @ 10:40am 
Hmm odd, it's not generating those errors anymore but I'm still getting the freezes. Also it looks like the log files are wiped per game retart. Is there a way to get older version of the log? Also I don't recall there being a stack trace before, just the error.

I'll try to get some log messages out again. I don't think it's this mod now though. I've turned stack merger off and on and the problem occurs in both cases. The issue is most likely with the bots mod.
Fluffy  [author] Jul 9 @ 11:30pm 
@fdsfse; Could you upload the complete log somewhere? Having access to the full stack trace + any other earlier errors would be very helpful.
@Jackknife; You can enable the 1.0 beta (as opposed to B18...) in the steam client.
@小航子; this is not a stack size mod.
fdsfse #PFC Jul 9 @ 8:50pm 
Hi Fluffy, I got the same issue that AC.Seth a while ago. I'm not sure if it is this mod or the bots mod or another mod but combined, when the bots are about to finish a haul job (doesn't have to be to merge stacks but merge stacks is the most noticeable) and the game will freeze for a second or 2. This doesn't occur with animals or colonists (well I don't raelly have colonists on haul duty cause of animals and bots), just these bots.

This is the error I get from my logs:

Nested calls to ProcessEquidistantCells() are not allowed.

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

I confirmed it was the bots hauling that caused this error, a line gets generated per haul completion with an accompanying freeze. Stopping the bots stopped the freezes and stops the generation of that error.
XH Jul 8 @ 10:31am 
meat also 75? why? no setting?
Jackknife Jul 6 @ 2:11am 
A built-in stack merger, you say? Damn, how do I use it? These scattered items are driving me insane!
Fluffy  [author] Jun 21 @ 4:02am 
@Patrick; Nope. 1.0 has a built-in stack merger! :D