diff --git a/Assemblies/PickUpAndHaul.dll b/Assemblies/PickUpAndHaul.dll index d385855..30c7f99 100644 Binary files a/Assemblies/PickUpAndHaul.dll and b/Assemblies/PickUpAndHaul.dll differ diff --git a/Source/PickUpAndHaul/ExtendedStorage_Support.cs b/Source/PickUpAndHaul/ExtendedStorage_Support.cs index 24900cb..3d98cce 100644 --- a/Source/PickUpAndHaul/ExtendedStorage_Support.cs +++ b/Source/PickUpAndHaul/ExtendedStorage_Support.cs @@ -35,7 +35,7 @@ public static bool CapacityAtEx(ThingDef def, IntVec3 storeCell, Map map, out in if (thing.Position == storeCell) continue; ExtendedStorage.Building_ExtendedStorage storage = thing as ExtendedStorage.Building_ExtendedStorage; - + if(storage.StoredThingTotal == 0) capacity = (int)(def.stackLimit * storage.GetStatValue(ExtendedStorage.DefReferences.Stat_ES_StorageFactor)); else diff --git a/Source/PickUpAndHaul/HarmonyPatches.cs b/Source/PickUpAndHaul/HarmonyPatches.cs index 23220cc..60e88af 100644 --- a/Source/PickUpAndHaul/HarmonyPatches.cs +++ b/Source/PickUpAndHaul/HarmonyPatches.cs @@ -66,7 +66,7 @@ static HarmonyPatches() //} //catch (TypeLoadException) { } - Verse.Log.Message("PickUpAndHaul v0.1.0.4 welcomes you to RimWorld with pointless logspam."); + Verse.Log.Message("PickUpAndHaul v0.1.0.5 welcomes you to RimWorld with pointless logspam."); harmony.PatchAll(); } diff --git a/Source/PickUpAndHaul/Properties/AssemblyInfo.cs b/Source/PickUpAndHaul/Properties/AssemblyInfo.cs index b927a4f..f949e42 100644 --- a/Source/PickUpAndHaul/Properties/AssemblyInfo.cs +++ b/Source/PickUpAndHaul/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.1.0.4")] -[assembly: AssemblyFileVersion("0.1.0.692")] +[assembly: AssemblyVersion("0.1.0.5")] +[assembly: AssemblyFileVersion("0.1.0.714")] diff --git a/Source/PickUpAndHaul/WorkGiver_HaulToInventory.cs b/Source/PickUpAndHaul/WorkGiver_HaulToInventory.cs index 042cd0f..48ea368 100644 --- a/Source/PickUpAndHaul/WorkGiver_HaulToInventory.cs +++ b/Source/PickUpAndHaul/WorkGiver_HaulToInventory.cs @@ -45,9 +45,17 @@ public override bool HasJobOnThing(Pawn pawn, Thing thing, bool forced) public override Job JobOnThing(Pawn pawn, Thing thing, bool forced = false) { //bulky gear (power armor + minigun) so don't bother. - if (MassUtility.GearMass(pawn) / MassUtility.Capacity(pawn) >= 0.8f) return null; - - if (!GoodThingToHaul(thing, pawn) || !HaulAIUtility.PawnCanAutomaticallyHaulFast(pawn, thing, forced)) return null; + if (MassUtility.GearMass(pawn) / MassUtility.Capacity(pawn) >= 0.8f) + return null; + + DesignationDef HaulUrgentlyDesignation = DefDatabase.GetNamed("HaulUrgentlyDesignation", false); + + //This WorkGiver gets hijacked by AllowTool and expects us to urgently haul corpses. + if (ModCompatibilityCheck.AllowToolIsActive && thing is Corpse && pawn.Map.designationManager.DesignationOn(thing)?.def == HaulUrgentlyDesignation && HaulAIUtility.PawnCanAutomaticallyHaulFast(pawn, thing, forced)) + return HaulAIUtility.HaulToStorageJob(pawn, thing); + + if (!GoodThingToHaul(thing, pawn) || !HaulAIUtility.PawnCanAutomaticallyHaulFast(pawn, thing, forced)) + return null; StoragePriority currentPriority = StoreUtility.CurrentStoragePriorityOf(thing); if (StoreUtility.TryFindBestBetterStoreCellFor(thing, pawn, pawn.Map, currentPriority, pawn.Faction, out IntVec3 storeCell, true)) @@ -90,7 +98,6 @@ public override Job JobOnThing(Pawn pawn, Thing thing, bool forced = false) Log.Message($"{pawn} job found to haul: {thing} to {storeCell}:{capacityStoreCell}, looking for more now"); //Find extra things than can be hauled to inventory, queue to reserve them - DesignationDef HaulUrgentlyDesignation = DefDatabase.GetNamed("HaulUrgentlyDesignation", false); bool isUrgent = false; if (ModCompatibilityCheck.AllowToolIsActive && pawn.Map.designationManager.DesignationOn(thing)?.def == HaulUrgentlyDesignation)