mehni / pickupandhaul Goto Github PK
View Code? Open in Web Editor NEWColonists will gather stuff in their inventory, then haul it all to a stockpile.
License: MIT License
Colonists will gather stuff in their inventory, then haul it all to a stockpile.
License: MIT License
Debug Log.
Exception filling tab RimWorld.ITab_Pawn_Gear: System.NullReferenceException: Object reference not set to an instance of an object
at SimpleSidearms.intercepts.ITab_Pawn_Gear_InterfaceDrop_Prefix.InterfaceDrop (RimWorld.ITab_Pawn_Gear,Verse.Thing) <0x00041>
at (wrapper dynamic-method) RimWorld.ITab_Pawn_Gear.InterfaceDrop_Patch3 (object,Verse.Thing) <0x00022>
at (wrapper dynamic-method) RimWorld.ITab_Pawn_Gear.DrawThingRow_Patch0 (object,single&,single,Verse.Thing,bool) <0x00394>
at (wrapper dynamic-method) RimWorld.ITab_Pawn_Gear.FillTab_Patch0 (object) <0x00aae>
at Verse.InspectTabBase/c__AnonStorey0.<>m__0 () <0x000e3>
Verse.Log:Error(String)
Verse.Log:ErrorOnce(String, Int32)
Verse.c__AnonStorey0:<>m__0()
Verse.ImmediateWindow:DoWindowContents(Rect)
Verse.c__AnonStorey0:<>m__0(Int32)
UnityEngine.GUI:CallWindowDelegate(WindowFunction, Int32, Int32, GUISkin, Int32, Single, Single, GUIStyle)
Since CE got an official 1.4 release could you uncomment the CE stuff?
Bug on the Human Resources side here - adding it here, as I think PUAH excluding HR books/shelves entirely might be the best actual solution - they aren't large contributors to the logistics load of a settlement anyway.
Including a gist of my log.
The big problem there is that sometimes a pawn will not store the books in the shelves (note that HR have special shelves that don't work like any other storage I know) but drop them or store them in a fallback storage - and if I manage to force them to do it somehow (after many retries), sometimes HR mechanics will break. This also happens with PUAH+ and the workaround suggested in the linked bug as well.
When trying to use PU&H with Allow Tool, I noticed corpses weren't getting hauled urgently. I set up a minimal test environment just be to sure(just hugslib, mod manager, allowtool and pu&h), disabled normal hauling, prioritized haul+, killed a pawn, set the body to be hauled urgently, and dug a grave(and made a dumping stockpile as well). With PU&H active, the body just sits there. Deactivate it, and they haul it off to the grave.
Invalid count: -861, setting to 1. Job was HaulToInventory (Job_30088386) A=Thing_Meat_Ibex10399588 B=(120, 0, 122)
This is in conjunction with StackXXL.
The pawn was trying to haul, I believe, several hundred units at the time.
This happens every once in a while:
Screenshot: https://i.imgur.com/RoemHk0.png
Log: https://git.io/fAMkd
It happens while I have a colonist selected and they queue a job, only sometimes though. Not always. It's hard to "make" it happen, but it just happened when I selected a pawn and told him to prioritize hauling some rice. He collected a few other rices around, then as soon as the rice appeared in his hands, the error log got spammed by that.
Hope someone can figure out what this is!
It checks weight for the first thing but doesn't check the rest.
Pawns not unloading to nearby stockpiles is frustrating.
(For Pickup Location P, Stockpiles S1 and S2.)
Case 1: You ask a pawn to move a single item to a nearby stockpile.
Case 2: A pawn decides to move an assortment of items, half which belong in S1 the other in S2.
In the first case it's bad because the player specifically tells the pawn to move a specific item. That item will not only not be immediately moved but will be hidden in an inventory and moved across the map. Bad for stuff like weapons / medicine you may need.
The second case is frustrating because if that pawn had not picked up all the items then the items could have been moved by other pawns. If you have multiple hauling pawns the first pawn collecting items can end up hoarding all the items while it goes back and forth leaving other pawns with nothing to do. If S1 and S2 are far apart then the pawn may not even finish dropping off the items before being interrupted by exhaustion, hypothermia, hunger, etc.
The solutions I see are either reduce the items picked up to take into account target locations. Only picking up items which share a similar destination to already held items. Or, alternatively, to drop off items giving priority to nearby stockpiles.
Currently, pawn does not check "bulk" when hauling. So a pawn with max bulk of 35 can easily haul 200 bulk of goods.
Checked the source code. CE related code is commented out.
Sometimes a pawn can be found picking up and droping a stack of something in a loop.
In my case it was a stack of beer. The person was carying some items, and there were spots to place the items, still, the pawn would pick up an item and drop it. next to himself.
Drafting doesnt seem to help, disabling hauling for the affected pawn causes another pawn to get into the loop.
The pawn was in a corner of a room, I have no idea if that matters though.
I'm using While Youre Up mod too, although according to steam comments people seem to get the issue without mods that could affect the hauling.
To keep things centralized, some suggestions for interfaces here:
class StorageOption {
IEnumerable<ThingDefCount> Storage { get; set; }
int Priority { get; set; }
}
...
IEnumerable<StorageOption> GetStorageOptions(
IEnumerable<Thing> thingsToConsiderForHauling,
IntVec3 storeCell,
Map map)
...
IEnumerable<StorageOption> GetStorageOptions(
IEnumerable<ThingDef> thingsToConsiderForHauling,
IntVec3 storeCell,
Map map)
...
Basically you ask "I'd like to store X & Y & Z - what options for storage are valid for you?".
The return result would be alternative options for storage. Even extended to allow priorities on each option.
Selection of any option from the return would then be up to P&H (with "just the first" or "highest priority" being as valid an option as any other - if storage mods don't like this, they are free to only return what they prefer).
Such a signature should allow storage(s) which follow a pattern of
I have this mod installed and enabled and it works great for transferring materials, but does not work at all for building. For example, I'm trying to build a new Wind Turbine and my builder goes and picks up one building material at a time and hauls it to the building site. One stack of components, one stack of steel, etc. Why does this mod not work with constructing a building?
Hello again. I was thinking it might be nice to have an option exposed to limit the number of hauling jobs a pawn can queue up. I've noticed that occasionally pawns will grab so much stuff(especially bionic pawns), that they can end up unloading their inventory until well past their bedtimes.
I am not sure if it is this mod problem, but it does happen when a pawn tries to pick something up. They'll just pick up and drop a thing several times a second.
Drafting doesn't help, the game starts giving "10 jobs in 10 ticks" error.
This happened before, but everytime I had to down a pawn to stop it.
I've attached logs both for loop and drafted error.
Infinite loop.txt
When drafted.txt
I've been trying to reproduce an issue reported with this mod and Armor Racks (Github here, mod author allows using his code in the "other" section of the mod description). I've been looking over the code of both but I'm still at a loss, and it doesn't help that I'm not familiar with Rimworld modding at all.
The behavior is as described on the mods' comment section: when both Pick Up and Haul and this mod are installed, pawns don't transfer any items to the armor racks. Some people report that setting "free inventory space required to haul" to 100% "fixes" this, but I haven't been able to reproduce this behavior.
I'd guess that the issue is somewhere around here https://github.com/khamenman/armor-racks/blob/master/Source/ArmorRacks/Jobs/JobDriver_TransferToRack.cs#L30-L123, but I can't find anything that would correlate to Pick Up and Haul's code.
Can you provide some pointers/aid?
I did some debugging, the general error you get is this:
JobDriver threw exception in initAction for pawn OmniBot 35 driver=JobDriver_HaulToInventory (toilIndex=2) driver.job=(HaulToInventory (Job_10302090) A=Thing_ComponentSpacer2632801 B=(155, 0, 142)) System.NullReferenceException: Object reference not set to an instance of an object at PickUpAndHaul.JobDriver_HaulToInventory+<>c__DisplayClass1_0.<MakeNewToils>b__2 () [0x000db] in <956c8985da554f8d8240abfc20c81364>:0 at Verse.AI.JobDriver.TryActuallyStartNextToil () [0x001df] in <4489f1367c1c4d76b2ae1272c8ed691d>:0 Verse.Log:Error(String, Boolean) Verse.AI.JobUtility:TryStartErrorRecoverJob(Pawn, String, Exception, JobDriver) Verse.AI.JobDriver:TryActuallyStartNextToil() Verse.AI.JobDriver:ReadyForNextToil()
The issue is the robots don't have a CompHauledToInventory Comp. I don't know how to handle this else I'd submit a pull request with a proper fix.
Hi
Today I had an issue with the pawn who was trying to pick-up-and-haul several items at the same time (which is the purpose of the pick-up-and-haul mod) but the problem was that there only one available spot in the stockpile and the pawn tried to pick up 3+ items. I assume it failed and kept trying over and over until I filled that one spot / removed the items. At which point the error spam went away and the game continued
Here's the log entries:
I have Rimworld 1.1.2552 (64 bit).
Installed Mods:
Core
Pick up and Haul 1.1
With pick up and haul enabled, pawns will not haul when assigned to haul.
Hi Mehni, When you want to use pick and haul you select the action, and all be fine, but if you set the task in the worktab, the pawn go to haul berrys for example, when the pawn take berrys, just take one berry stack but all the others berrys still there. dont carry more. Look it in debug mode
Pick Up and Haul by default tries to fill a pawn's entire inventory when assigned a hauling job. This can mean using the pathing algorithm to go to several stacks to pick them up. This is a minor TPS hit for vanilla pawns when the algorithm has to do the pathing, but given that vanilla pawns have a low carrying capacity the typical number of stacks to path to is low. However, when playing with multiple mods that increase Carrying Capacity in multiple ways, like a combinations of hediffs, apparel, and character-specific stats, Carrying Capacity can go from 35 to several hundred if not even into the thousands.
When a pawn has say 700 Carrying Capacity (20 times vanilla and reasonable for some modded pawns), the pawn given a hauling job will still try to fill their entire inventory. If I mark all Steel Slag chunks for hauling and tell a pawn to prioritize hauling one, this means that instead of pathing to the nearest 7 Steel Slag Chunks to add to the inventory (since Steel Slag Chunks weigh 5 kg), the pawn will try to path to 140 Steel Slag Chunks.
This involves a significant hit to TPS on the ticks when the job is assigned as the pathing algorithm cannot efficiently create a path to all the nodes in the time given for a single tick while maintaining capped TPS. This also means that the job can create very long paths which can force a pawn to be adding things to their inventory for several in-game hours and ignore the pawn's other needs, especially if the hauling job is prioritized as explained above.
Add a Mod Settings menu to the mod with two options: one, a checkbox to limit the number of nodes designated for the pathing algorithm per hauling job - this would by default be unchecked and thus the mod would maintain current behavior. Checking the box would limit the number of nodes as defined by the second option, a numerical slider that goes from 1 to an upper bound (20? 50? Some decently large number that doesn't make the slider hard to use.)
By setting the slider and checking the checkbox, the mod upon generating a hauling job would limit the number of additional stacks to add to the pawn's inventory to the number selected on the slider. If it's 1, only one additional stack would be added to the inventory for future unloading. This would make the pathing have a smaller TPS impact (as it only queues one additional node to move to) and it would shorten the duration of the hauling job for the above mentioned modded pawns to avoid very long-duration hauling jobs.
As it would be user-configurable through mod settings and not an XML and disabled by default, this would allow players on heavily modded playthroughs additional functionality while preserving the Ease of Use factor of the mod. Experienced players would be able to easily change the vlaue for performance without an XML patch, and inexperienced or uncaring players could simply ignore the setting and use current behavior.
Writing a Mod Settings menu would require the use of custom C# code to make the menu work.
Hi Mehni, I love this mod and consider it a staple even amongst vanilla playthroughs. Hope you can help with the following problem.
A recent issue I found (not sure if it's due to a mod/Rimworld update, or something else) is occurring when a pawn is trying to unload their inventory. This problem hasn't ever occurred before, with a plethora of QOL mods, so I'm a little stumped trying to troubleshoot here.
The in-game behavior is that the pawn freezes in place where they're trying to drop stuff, enter "Standing" mode, then give up and move onto the next job, ultimately never dropping their inventory.
I've had to go into the save file and manually remove <hauledToInventory>null</...>
entries once before, but it had no appreciable effect. I suspect it may have had to do with the SimpleSidearms mod, but I disabled that mod when I first started having issues and there's no trace of it in the savefile. Another possible causer would be the unofficial Psychology 1.2 mod, as that's the only other 'new' mod I've enabled recently. The only hit-or-miss solution I have right now is to manually guide the pawn to the zones, dump what belongs there, move on, and finally to give them one more forced action afterwards.
The exception thrown is as follows:
JobDriver threw exception in initAction for pawn Color driver=JobDriver_UnloadYourHauledInventory (toilIndex=1) driver.job=(UnloadYourHauledInventory (Job_968251) A=Thing_Human80445)
System.InvalidOperationException: Failed to compare two elements in the array. ---> System.ArgumentException: At least one object must implement IComparable.
at System.Collections.Comparer.Compare (System.Object a, System.Object b) [0x00069] in <567df3e0919241ba98db88bec4c6696f>:0
at System.Collections.Generic.ObjectComparer`1[T].Compare (T x, T y) [0x00000] in <567df3e0919241ba98db88bec4c6696f>:0
at System.Linq.EnumerableSorter`2[TElement,TKey].CompareAnyKeys (System.Int32 index1, System.Int32 index2) [0x00000] in <351e49e2a5bf4fd6beabb458ce2255f3>:0
at System.Linq.EnumerableSorter`2[TElement,TKey].CompareAnyKeys (System.Int32 index1, System.Int32 index2) [0x00033] in <351e49e2a5bf4fd6beabb458ce2255f3>:0
at System.Collections.Generic.ComparisonComparer`1[T].Compare (T x, T y) [0x00000] in <567df3e0919241ba98db88bec4c6696f>:0
at System.Collections.Generic.ArraySortHelper`1[T].SwapIfGreater (T[] keys, System.Comparison`1[T] comparer, System.Int32 a, System.Int32 b) [0x00004] in <567df3e0919241ba98db88bec4c6696f>:0
at System.Collections.Generic.ArraySortHelper`1[T].IntroSort (T[] keys, System.Int32 lo, System.Int32 hi, System.Int32 depthLimit, System.Comparison`1[T] comparer) [0x00028] in <567df3e0919241ba98db88bec4c6696f>:0
at System.Collections.Generic.ArraySortHelper`1[T].IntrospectiveSort (T[] keys, System.Int32 left, System.Int32 length, System.Comparison`1[T] comparer) [0x00015] in <567df3e0919241ba98db88bec4c6696f>:0
at System.Collections.Generic.ArraySortHelper`1[T].Sort (T[] keys, System.Int32 index, System.Int32 length, System.Collections.Generic.IComparer`1[T] comparer) [0x0000a] in <567df3e0919241ba98db88bec4c6696f>:0
--- End of inner exception stack trace ---
at System.Collections.Generic.ArraySortHelper`1[T].Sort (T[] keys, System.Int32 index, System.Int32 length, System.Collections.Generic.IComparer`1[T] comparer) [0x00036] in <567df3e0919241ba98db88bec4c6696f>:0
at System.Array.Sort[T] (T[] array, System.Int32 index, System.Int32 length, System.Collections.Generic.IComparer`1[T] comparer) [0x00048] in <567df3e0919241ba98db88bec4c6696f>:0
at System.Linq.EnumerableSorter`2[TElement,TKey].QuickSort (System.Int32[] keys, System.Int32 lo, System.Int32 hi) [0x00019] in <351e49e2a5bf4fd6beabb458ce2255f3>:0
at System.Linq.EnumerableSorter`1[TElement].Sort (TElement[] elements, System.Int32 count) [0x00009] in <351e49e2a5bf4fd6beabb458ce2255f3>:0
at System.Linq.OrderedEnumerable`1[TElement].SortedMap (System.Linq.Buffer`1[TElement] buffer) [0x00006] in <351e49e2a5bf4fd6beabb458ce2255f3>:0
at System.Linq.OrderedEnumerable`1+<GetEnumerator>d__3[TElement].MoveNext () [0x0003d] in <351e49e2a5bf4fd6beabb458ce2255f3>:0
at PickUpAndHaul.JobDriver_UnloadYourHauledInventory.FirstUnloadableThing (Verse.Pawn pawn) [0x00129] in <ac6dac2d4c4f49e9ae73ceaea9327034>:0
at PickUpAndHaul.JobDriver_UnloadYourHauledInventory+<>c__DisplayClass4_0.<MakeNewToils>b__0 () [0x00000] in <ac6dac2d4c4f49e9ae73ceaea9327034>:0
at Verse.AI.JobDriver.TryActuallyStartNextToil () [0x001df] in <c36f9493c9844ddaa7fb5c788416098f>:0
Verse.Log:Error(String, Boolean)
Verse.AI.JobUtility:TryStartErrorRecoverJob(Pawn, String, Exception, JobDriver)
Verse.AI.JobDriver:TryActuallyStartNextToil()
Verse.AI.JobDriver:ReadyForNextToil()
Verse.AI.JobDriver:DriverTick()
Verse.AI.Pawn_JobTracker:JobTrackerTick()
Verse.Pawn:Tick()
Verse.TickList:Tick()
Verse.TickManager:DoSingleTick()
Verse.TickManager:TickManagerUpdate()
Verse.Game:UpdatePlay()
Verse.Root_Play:Update()
I'm rather unfamiliar with Rimworld modding, but I do know enough programming that if you need me to run some tests, I'd be happy to try.
I'll also keep adding comments to this as I try different things to narrow down the possibilities.
When MAI go out world's map then come back settlement, it seems like MAI push jobs in queue while MAI is in world's map.
Miscellaneous.MAI
https://github.com/HaploX1/RimWorld-Miscellaneous_Mods/tree/master/Mods/Miscellaneous_MAI
And another bug is NullReferenceException
Exception filling tab RimWorld.ITab_Pawn_Gear: System.NullReferenceException: Object reference not set to an instance of an object
at PickUpAndHaul.DrawThingRow_Patch.GetColorForHauled (Verse.Pawn,Verse.Thing) <0x0003f>
at (wrapper dynamic-method) RimWorld.ITab_Pawn_Gear.DrawThingRow_Patch0 (object,single&,single,Verse.Thing,bool) <0x00413>
at RimWorld.ITab_Pawn_Gear.FillTab () <0x00a65>
at Verse.InspectTabBase/c__AnonStorey0.<>m__0 () <0x00118>
Verse.Log:Error(String, Boolean)
Verse.Log:ErrorOnce(String, Int32, Boolean)
Verse.c__AnonStorey0:<>m__0()
Verse.ImmediateWindow:DoWindowContents(Rect)
Verse.c__AnonStorey0:<>m__0(Int32)
UnityEngine.GUI:CallWindowDelegate(WindowFunction, Int32, Int32, GUISkin, Int32, Single, Single, GUIStyle)
Mouse position stack is not empty. There were more calls to BeginScrollView than EndScrollView. Fixing.
Verse.Log:Error(String, Boolean)
Verse.Widgets:EnsureMousePositionStackEmpty()
Verse.Root:Update_Patch1(Object)
Verse.Root_Play:Update()
Been having some issues with stuttering / slowdown and logspam that seem to be linked to having PickUpAndHaul loaded with Extended Storage loaded and multiple stacks of stacks on the same cell. This is a normal occurance - its how Extended Storage works. The logspam indicates that it's multiple hauls generated per tick that throws the game into a tizzy (formatted for easier reading:
[...]
Hal started 10 jobs in one tick.
newJob=HaulToCell (Job_2116986) A=Thing_Meat_Cassowary221137 B=(176, 0, 107)
jobGiver=RimWorld.JobGiver_Work
jobList=
(HaulToCell (Job_2116966) A=Thing_Meat_Cassowary221137 B=(176, 0, 107))
(HaulToCell (Job_2116968) A=Thing_Meat_Cassowary221137 B=(176, 0, 107))
(HaulToCell (Job_2116970) A=Thing_Meat_Cassowary221137 B=(176, 0, 107))
(HaulToCell (Job_2116972) A=Thing_Meat_Cassowary221137 B=(176, 0, 107))
(HaulToCell (Job_2116974) A=Thing_Meat_Cassowary221137 B=(176, 0, 107))
(HaulToCell (Job_2116976) A=Thing_Meat_Cassowary221137 B=(176, 0, 107))
(HaulToCell (Job_2116978) A=Thing_Meat_Cassowary221137 B=(176, 0, 107))
(HaulToCell (Job_2116980) A=Thing_Meat_Cassowary221137 B=(176, 0, 107))
(HaulToCell (Job_2116982) A=Thing_Meat_Cassowary221137 B=(176, 0, 107))
(HaulToCell (Job_2116984) A=Thing_Meat_Cassowary221137 B=(176, 0, 107))
(HaulToCell (Job_2116986) A=Thing_Meat_Cassowary221137 B=(176, 0, 107))
lastJobGiver=RimWorld.JobGiver_Work
[...]
The excerpt is from HugsLib. The log is from another user @Sixdd6, but shows the same errors (but different item ids & destination cells) that I encountered.
When testing just Extended Storage + my own mod (+HugsLibs, +JecsTools) I did not run into this at all and I know my mod doesn't touch / make any code changes.
The slowdowns and the logspam went away once I disabled PickUpAndHaul and reloaded.
Maybe HaulToCell (patched by PickUpAndHaul) does not like that multiple target stacks can be on one cell? I would like to help, but my C#-fu is very-weak sauce.
Once the prisoner simply disappeared while carrying. Or they do not spread portable things, transferring them to inventory constantly. Please, when you have time, test your mod with another great mod - Prison Labor. Thank you in advance ั:
Marble chunk = 25kg
Free space in Pawn inv. ~= 10kg
Pawn try take this chunk and cant. And it's infinity jobs loop: gathering, standing, gathering, standing, gathering, standing...
In to default stockpile he can haul in hands this chunk(with this mod) under these circumstances
PS: Without mod he can hauling this chunk in to ES
Video demo: https://streamable.com/d9tm4
All other items can be picked up in any amount, but Addicts cannot be picked up
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.