From f3da6d7ba93f39dcb6a136585a2c799d6effcb95 Mon Sep 17 00:00:00 2001 From: Mehni <Mehni@users.noreply.github.com> Date: Sat, 3 Feb 2018 22:22:25 +0100 Subject: [PATCH] Update to 0.18.1.4 - It's now possible to kill Wandering Caravans. - Fixed a nasty bug with ridiculously long queues. - Bit of a code cleanup. - Reduced stack fragmentation caused by picking up partial stacks when the colonist could've picked up more. --- About/About.xml | 2 +- Assemblies/PickUpAndHaul.dll | Bin 22016 -> 22016 bytes .../PickUpAndHaul/CompHauledToInventory.cs | 2 +- .../PickUpAndHaul/HarmonyPatches.cs | 19 ++++--- .../JobDriver_HaulToInventory.cs | 50 ++++++++++-------- .../JobDriver_UnloadYourHauledInventory.cs | 40 +++++++------- .../PickUpAndHaul/PawnUnloadChecker.cs | 39 ++++---------- .../PickUpAndHaul/Properties/AssemblyInfo.cs | 4 +- .../WorkGiver_HaulToInventory.cs | 46 ++++------------ 9 files changed, 84 insertions(+), 118 deletions(-) diff --git a/About/About.xml b/About/About.xml index 09d52cc..ff1e0f4 100644 --- a/About/About.xml +++ b/About/About.xml @@ -6,7 +6,7 @@ <url>https://ludeon.com/forums/index.php?topic=35832</url> <description>"Greatest hauling mod ever" - Chicken Plucker - v0.18.1.3 + v0.18.1.4 Colonists will gather stuff in their inventory, then haul it all to a stockpile. diff --git a/Assemblies/PickUpAndHaul.dll b/Assemblies/PickUpAndHaul.dll index 7f6ab6c2a4545b1f639079ac1c0696c36dfa448c..254552b740fdb943a2969f536b30a9f0b82bb4f9 100644 GIT binary patch delta 8953 zcma)C3v^V~x&HUwXU@!=%=?)a5D1Wy$piu+N<eu(j65SC#770fQ-L9g3Uo+jQnVJW z3La4rX+hK)#VSUs6xsq+SE<tCwN>fWT&cQxskUl+t=6`9zrD}o<?3DQ#?E*4|JeI~ z?fvgFL$e22_8{Bw9kFTP%{%WHz<#{5W3g||dZKxRzbw%sV&~wnXCILVbk#bdVrwu@ zS`Dm>9k<$9rr;qc%fHL;;pCvDHAH7F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2)Nuj@t{a+9;U2ul@E_^Q}WFh%K6ng(|}?Jv17LWa}cM-|2>L+mT?~Q9u47-F7@w zA8b1jY<r!@DMxi81Cjb4Lg~voI#qVNd9dv*E;|iowjlsN865tZ``zwPTM0K^BA8i% zVcd%mL5+fKr@SOob~35FVjXm_?LBuuj(Xb}aBdk*=6+~hvJ4>gVg^Fy|AB;a63(MF zj)(1<u`(Zv5NimxOClG>U5*cIP=q^X%+@hoG6(H<XY64I?Ts@JjKQT<>soNIKd^4G z^plIY2;zrs#CImqH|9>7yJ1uD(0%VMxFWOnjXAHLe{4g?@>y;c`dy>6cRrs>y12b0 z%0Fzhx6j^a7tedz_RrbmDN&mOqmqvM=gehnM8~=MTk)_P=GL%k{Es55aG}Evh40vo M;Jm-E_Da|P0<{$hrT_o{ diff --git a/Source/PickUpAndHaul/PickUpAndHaul/CompHauledToInventory.cs b/Source/PickUpAndHaul/PickUpAndHaul/CompHauledToInventory.cs index bd91332..f1070af 100644 --- a/Source/PickUpAndHaul/PickUpAndHaul/CompHauledToInventory.cs +++ b/Source/PickUpAndHaul/PickUpAndHaul/CompHauledToInventory.cs @@ -20,7 +20,7 @@ public HashSet<Thing> GetHashSet() public void RegisterHauledItem(Thing thing) { - this.TakenToInventory.Add(thing); + this.TakenToInventory.Add(thing); } public override void PostExposeData() diff --git a/Source/PickUpAndHaul/PickUpAndHaul/HarmonyPatches.cs b/Source/PickUpAndHaul/PickUpAndHaul/HarmonyPatches.cs index 79fa6cb..2659d72 100644 --- a/Source/PickUpAndHaul/PickUpAndHaul/HarmonyPatches.cs +++ b/Source/PickUpAndHaul/PickUpAndHaul/HarmonyPatches.cs @@ -40,7 +40,7 @@ static HarmonyPatches() new HarmonyMethod(typeof(HarmonyPatches), nameof(IdleJoy_Postfix)), null); if (ModCompatibilityCheck.KnownConflict) Log.Message("Pick Up And Haul has found a conflicting mod and will lay dormant."); - if (!ModCompatibilityCheck.KnownConflict) Log.Message("PickUpAndHaul v0.18.1.3 welcomes you to RimWorld with pointless logspam."); + else Log.Message("PickUpAndHaul v0.18.1.4 welcomes you to RimWorld with pointless logspam."); } private static bool Drop_Prefix(ref Pawn pawn, ref Thing thing) @@ -68,18 +68,22 @@ private static void Pawn_InventoryTracker_PostFix(Pawn_InventoryTracker __instan Log.Warning(__instance.pawn + " cannot Pick Up and Haul. Does not inherit from BasePawn. Patch failed or mod incompatibility."); return; } + HashSet<Thing> carriedThing = takenToInventory.GetHashSet(); - if (__instance.pawn.Spawned && __instance.pawn.Faction.IsPlayer) //weird issue with worldpawns and guests + //if (__instance.pawn.Spawned) //weird issue with worldpawns was caused by not having the comp + //{ + // if (__instance.pawn.Faction?.IsPlayer ?? false) //roaming muffalo + // { + if (carriedThing?.Count != 0) { - if (carriedThing?.Count != 0) + if (carriedThing.Contains(item)) { - if (carriedThing.Contains(item)) - { - carriedThing.Remove(item); - } + carriedThing.Remove(item); } } + // } + //} } private static void JobDriver_HaulToCell_PostFix(JobDriver_HaulToCell __instance) @@ -145,7 +149,6 @@ public static IEnumerable<CodeInstruction> FloatMenuMakerMad_AddHumanlikeOrders_ // //{ instructionList[i + 5].labels = instruction.labels;} // instructionList.RemoveRange(i, 5); // patched = true; - } yield return instruction; } diff --git a/Source/PickUpAndHaul/PickUpAndHaul/JobDriver_HaulToInventory.cs b/Source/PickUpAndHaul/PickUpAndHaul/JobDriver_HaulToInventory.cs index 3a5475c..172342c 100644 --- a/Source/PickUpAndHaul/PickUpAndHaul/JobDriver_HaulToInventory.cs +++ b/Source/PickUpAndHaul/PickUpAndHaul/JobDriver_HaulToInventory.cs @@ -7,7 +7,6 @@ using Verse.AI; using System.Diagnostics; using UnityEngine; -using Verse.Sound; namespace PickUpAndHaul { @@ -32,7 +31,7 @@ protected override IEnumerable<Toil> MakeNewToils() { initAction = () => { - this.pawn.pather.StartPath(this.TargetThingA, PathEndMode.ClosestTouch); //thing to change in case of persistent tweener issues. Shouldn't happen though. + this.pawn.pather.StartPath(this.TargetThingA, PathEndMode.ClosestTouch); }, defaultCompleteMode = ToilCompleteMode.PatherArrival }; @@ -46,24 +45,22 @@ protected override IEnumerable<Toil> MakeNewToils() Pawn actor = this.pawn; Thing thing = actor.CurJob.GetTarget(TargetIndex.A).Thing; Toils_Haul.ErrorCheckForCarry(actor, thing); - int num = Mathf.Min(this.job.count, thing.stackCount, MassUtility.CountToPickUpUntilOverEncumbered(actor, thing)); //hauling jobs are stupid and the count is often set to 99999 + + int num = Mathf.Min(thing.stackCount, MassUtility.CountToPickUpUntilOverEncumbered(actor, thing)); if (num <= 0) { Job haul = HaulAIUtility.HaulToStorageJob(actor, thing); - if (haul != null) + + if (haul?.TryMakePreToilReservations(actor) ?? false) { - if (haul.TryMakePreToilReservations(actor)) - { - actor.jobs.jobQueue.EnqueueFirst(haul, new JobTag?(JobTag.Misc)); - return; - } + actor.jobs.jobQueue.EnqueueFirst(haul, new JobTag?(JobTag.Misc)); } actor.jobs.curDriver.JumpToToil(wait); } else { - actor.inventory.GetDirectlyHeldThings().TryAdd(thing.SplitOff(num), false); //Merging and unmerging messes up the picked up ID (which already gets messed up enough) + actor.inventory.GetDirectlyHeldThings().TryAdd(thing.SplitOff(num), false); takenToInventory.RegisterHauledItem(thing); } } @@ -72,7 +69,7 @@ protected override IEnumerable<Toil> MakeNewToils() yield return CheckDuplicateItemsToHaulToInventory(reserveTargetA, TargetIndex.A, false); yield return wait; } - + //regular Toils_Haul.CheckForGetOpportunityDuplicate isn't going to work for our purposes, since we're not carrying anything. //Carrying something yields weird results with unspawning errors when transfering to inventory, so we copy-past-- I mean, implement our own. @@ -85,11 +82,11 @@ public static Toil CheckDuplicateItemsToHaulToInventory(Toil getHaulTargetToil, Job curJob = actor.jobs.curJob; Predicate<Thing> validator = (Thing t) => t.Spawned - && HaulAIUtility.PawnCanAutomaticallyHaulFast(actor, t, false) - && (takeFromValidStorage || !t.IsInValidStorage()) - && !t.IsForbidden(actor) - && actor.CanReserve(t, 1, -1, null, false) - && (extraValidator == null || extraValidator(t)); + && HaulAIUtility.PawnCanAutomaticallyHaulFast(actor, t, false) + && (takeFromValidStorage || !t.IsInValidStorage()) + && !t.IsForbidden(actor) + && actor.CanReserve(t, 1, -1, null, false) + && (extraValidator == null || extraValidator(t)); Thing thing = GenClosest.ClosestThingReachable(actor.Position, actor.Map, ThingRequest.ForGroup(ThingRequestGroup.HaulableAlways), PathEndMode.ClosestTouch, TraverseParms.For(actor, Danger.Deadly, TraverseMode.ByPawn, false), 8f, validator, null, 0, -1, false, RegionType.Set_Passable, false); @@ -97,17 +94,24 @@ public static Toil CheckDuplicateItemsToHaulToInventory(Toil getHaulTargetToil, { curJob.SetTarget(haulableInd, thing); actor.jobs.curDriver.JumpToToil(getHaulTargetToil); + return; } - else if (thing != null) + if (thing != null) { Job haul = HaulAIUtility.HaulToStorageJob(actor, thing); - if (haul != null) //because it can return null, and that ruins my day. + if (haul?.TryMakePreToilReservations(actor) ?? false) { - if (haul.TryMakePreToilReservations(actor)) - { - actor.jobs.jobQueue.EnqueueFirst(haul, new JobTag?(JobTag.Misc)); - return; - } + actor.jobs.jobQueue.EnqueueFirst(haul, new JobTag?(JobTag.Misc)); + return; + } + } + if (thing == null && actor.jobs.jobQueue.Count == 0) + { + Job job = new Job(PickUpAndHaulJobDefOf.UnloadYourHauledInventory); + if (job.TryMakePreToilReservations(actor)) + { + actor.jobs.jobQueue.EnqueueFirst(job, new JobTag?(JobTag.Misc)); + return; } } }; diff --git a/Source/PickUpAndHaul/PickUpAndHaul/JobDriver_UnloadYourHauledInventory.cs b/Source/PickUpAndHaul/PickUpAndHaul/JobDriver_UnloadYourHauledInventory.cs index 5d93f4f..4709ed9 100644 --- a/Source/PickUpAndHaul/PickUpAndHaul/JobDriver_UnloadYourHauledInventory.cs +++ b/Source/PickUpAndHaul/PickUpAndHaul/JobDriver_UnloadYourHauledInventory.cs @@ -12,7 +12,7 @@ public class JobDriver_UnloadYourHauledInventory : JobDriver { private int countToDrop = -1; - private const int UnloadDuration = 10; + private const int UnloadDuration = 3; public override void ExposeData() { @@ -27,7 +27,7 @@ public override bool TryMakePreToilReservations() /// <summary> - /// Find spot, reserve spot, goto spot, + /// Find spot, reserve spot, pull thing out of inventory, go to spot, drop stuff, repeat. /// </summary> /// <returns></returns> [DebuggerHidden] @@ -37,7 +37,7 @@ protected override IEnumerable<Toil> MakeNewToils() HashSet<Thing> carriedThing = takenToInventory.GetHashSet(); Toil wait = Toils_General.Wait(UnloadDuration); - Toil celebrate = Toils_General.Wait(10); + Toil celebrate = Toils_General.Wait(UnloadDuration); yield return wait; @@ -55,7 +55,9 @@ protected override IEnumerable<Toil> MakeNewToils() if (unloadableThing.Count != 0) { - if (!StoreUtility.TryFindStoreCellNearColonyDesperate(unloadableThing.Thing, this.pawn, out IntVec3 c)) + StoragePriority currentPriority = HaulAIUtility.StoragePriorityAtFor(pawn.Position, unloadableThing.Thing); + if (!StoreUtility.TryFindBestBetterStoreCellFor(unloadableThing.Thing, pawn, pawn.Map, currentPriority, pawn.Faction, out IntVec3 c, true)) + //if (!StoreUtility.TryFindStoreCellNearColonyDesperate(unloadableThing.Thing, this.pawn, out IntVec3 c)) { this.pawn.inventory.innerContainer.TryDrop(unloadableThing.Thing, ThingPlaceMode.Near, unloadableThing.Thing.stackCount, out Thing thing, null); this.EndJobWith(JobCondition.Succeeded); @@ -111,41 +113,41 @@ protected override IEnumerable<Toil> MakeNewToils() ThingStackPart FirstUnloadableThing(Pawn pawn) { CompHauledToInventory takenToInventory = pawn.TryGetComp<CompHauledToInventory>(); - HashSet<Thing> carriedThing = takenToInventory.GetHashSet(); - - //List<Thing> mergedList = pawn.inventory.innerContainer.Union(carriedThing).ToList(); + HashSet<Thing> carriedThings = takenToInventory.GetHashSet(); + //List<Thing> mergedList = pawn.inventory.innerContainer.Union(carriedThing).ToList(); + //TODO: Merge stacks upon unload. + //find the overlap. - var potentialThingToUnload = + IEnumerable<Thing> potentialThingsToUnload = from t in pawn.inventory.innerContainer - where carriedThing.Contains(t) + where carriedThings.Contains(t) select t; - foreach (Thing thing in carriedThing) + foreach (Thing thing in carriedThings) { - //partially picked up stacks get a different thingID in inventory - if (!potentialThingToUnload.Contains(thing)) + if (!potentialThingsToUnload.Contains(thing)) { - carriedThing.Remove(thing); ThingDef stragglerDef = thing.def; //we have no method of grabbing the newly generated thingID. This is the solution to that. - var dirtyStragglers = + IEnumerable<Thing> dirtyStragglers = from straggler in pawn.inventory.innerContainer where straggler.def == stragglerDef - select straggler; + select straggler; + + carriedThings.Remove(thing); foreach (Thing dirtyStraggler in dirtyStragglers) { - Predicate<Thing> validator = (Thing t) => t.def == stragglerDef; - carriedThing.RemoveWhere(validator); + //Predicate<Thing> validator = (Thing t) => t.def == stragglerDef; + //carriedThings.RemoveWhere(validator); return new ThingStackPart(dirtyStraggler, dirtyStraggler.stackCount); } - } - return new ThingStackPart(thing, thing.stackCount); //pawn.inventory.innerContainer.Intersect(carriedThing).Max(t => t.stackCount)); + return new ThingStackPart(thing, thing.stackCount); } return default(ThingStackPart); } diff --git a/Source/PickUpAndHaul/PickUpAndHaul/PawnUnloadChecker.cs b/Source/PickUpAndHaul/PickUpAndHaul/PawnUnloadChecker.cs index 8025277..cf632f2 100644 --- a/Source/PickUpAndHaul/PickUpAndHaul/PawnUnloadChecker.cs +++ b/Source/PickUpAndHaul/PickUpAndHaul/PawnUnloadChecker.cs @@ -14,7 +14,6 @@ public class PawnUnloadChecker public static void CheckIfPawnShouldUnloadInventory(Pawn pawn, bool forced = false) { - Job job = new Job(PickUpAndHaulJobDefOf.UnloadYourHauledInventory); CompHauledToInventory takenToInventory = pawn.TryGetComp<CompHauledToInventory>(); if (takenToInventory == null) @@ -23,28 +22,21 @@ public static void CheckIfPawnShouldUnloadInventory(Pawn pawn, bool forced = fal return; } HashSet<Thing> carriedThing = takenToInventory.GetHashSet(); - - if (ModCompatibilityCheck.KnownConflict) - { - return; - } - if (pawn.Faction != Faction.OfPlayer || !pawn.RaceProps.Humanlike) - { - return; - } - - if (carriedThing?.Count == 0 || pawn.inventory.innerContainer.Count == 0) - { - return; - } + if (ModCompatibilityCheck.KnownConflict) return; + if (pawn.Faction != Faction.OfPlayer || !pawn.RaceProps.Humanlike) return; + if (carriedThing?.Count == 0 || pawn.inventory.innerContainer.Count == 0) return; if (carriedThing.Count != 0) { Thing thing = null; try { - carriedThing.Contains(thing); + if (carriedThing.Contains(thing)) + { + carriedThing.Remove(thing); + Log.Warning(pawn + " removed thing null from Pick Up and Haul inventory"); + } } catch (Exception arg) { @@ -53,7 +45,7 @@ public static void CheckIfPawnShouldUnloadInventory(Pawn pawn, bool forced = fal pawn.inventory.UnloadEverything = true; } } - + if (forced) { if (job.TryMakePreToilReservations(pawn)) @@ -63,7 +55,7 @@ public static void CheckIfPawnShouldUnloadInventory(Pawn pawn, bool forced = fal } } - if (MassUtility.EncumbrancePercent(pawn) >= 0.90f || carriedThing.Count >= 2) + if (MassUtility.EncumbrancePercent(pawn) >= 0.90f || carriedThing.Count >= 1) { if (job.TryMakePreToilReservations(pawn)) { @@ -79,10 +71,8 @@ public static void CheckIfPawnShouldUnloadInventory(Pawn pawn, bool forced = fal CompRottable compRottable = rottable.TryGetComp<CompRottable>(); if (compRottable != null) { - //Log.Message(pawn + " compRottable" + rottable); if (compRottable.TicksUntilRotAtCurrentTemp < 30000) { - //Log.Message(pawn + " " + compRottable.TicksUntilRotAtCurrentTemp); pawn.jobs.jobQueue.EnqueueFirst(job, new JobTag?(JobTag.Misc)); return; } @@ -90,15 +80,6 @@ public static void CheckIfPawnShouldUnloadInventory(Pawn pawn, bool forced = fal } } - //if (carriedThing.Count >= 3) //try to unload a bit less aggressively - //{ - // if (job.TryMakePreToilReservations(pawn)) - // { - // pawn.jobs.jobQueue.EnqueueFirst(job, new JobTag?(JobTag.Misc)); - // return; - // } - //} - if (Find.TickManager.TicksGame % 50 == 0 && pawn.inventory.innerContainer.Count < carriedThing.Count) { Log.Warning("[PickUpAndHaul] " + pawn + " inventory was found out of sync with haul index. Pawn will drop their inventory."); diff --git a/Source/PickUpAndHaul/PickUpAndHaul/Properties/AssemblyInfo.cs b/Source/PickUpAndHaul/PickUpAndHaul/Properties/AssemblyInfo.cs index fb75447..1c5d04c 100644 --- a/Source/PickUpAndHaul/PickUpAndHaul/Properties/AssemblyInfo.cs +++ b/Source/PickUpAndHaul/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.18.1.3")] -[assembly: AssemblyFileVersion("1.0.0.545")] +[assembly: AssemblyVersion("0.18.1.4")] +[assembly: AssemblyFileVersion("1.0.0.548")] diff --git a/Source/PickUpAndHaul/PickUpAndHaul/WorkGiver_HaulToInventory.cs b/Source/PickUpAndHaul/PickUpAndHaul/WorkGiver_HaulToInventory.cs index 5053c23..25fb1f3 100644 --- a/Source/PickUpAndHaul/PickUpAndHaul/WorkGiver_HaulToInventory.cs +++ b/Source/PickUpAndHaul/PickUpAndHaul/WorkGiver_HaulToInventory.cs @@ -26,35 +26,19 @@ public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false) CompHauledToInventory takenToInventory = pawn.TryGetComp<CompHauledToInventory>(); - if (t is Corpse) - { - return null; - } - if (!HaulAIUtility.PawnCanAutomaticallyHaulFast(pawn, t, forced)) - { - return null; - } + if (t is Corpse) return null; - if (ModCompatibilityCheck.KnownConflict) - { - return null; - } + if (!HaulAIUtility.PawnCanAutomaticallyHaulFast(pawn, t, forced)) return null; - if (t.IsForbidden(pawn) || StoreUtility.IsInValidBestStorage(t)) - { - return null; - } + if (ModCompatibilityCheck.KnownConflict) return null; + + if (t.IsForbidden(pawn) || StoreUtility.IsInValidBestStorage(t)) return null; - if (ModCompatibilityCheck.Simplesidearms && t.def.defName.Contains("Chunk")) //because who doesn't love hardcoded checks? - { - return HaulAIUtility.HaulToStorageJob(pawn, t); - } + //because who doesn't love hardcoded checks? + if (ModCompatibilityCheck.Simplesidearms && t.def.defName.Contains("Chunk")) return HaulAIUtility.HaulToStorageJob(pawn, t); - //if bulky gear (power armor + minigun) would prevent them carrying lots, don't bother. - if (MassUtility.GearMass(pawn) / MassUtility.Capacity(pawn) >= 0.7f) - { - return null; - } + //bulky gear (power armor + minigun) so don't bother. + if (MassUtility.GearMass(pawn) / MassUtility.Capacity(pawn) >= 0.7f) return null; StoragePriority currentPriority = HaulAIUtility.StoragePriorityAtFor(t.Position, t); if (StoreUtility.TryFindBestBetterStoreCellFor(t, pawn, pawn.Map, currentPriority, pawn.Faction, out IntVec3 storeCell, true)) @@ -70,7 +54,7 @@ public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false) { Thing thing = thingList[i]; if (thing.def == ThingDefOf.Hopper) - return HaulAIUtility.HaulToStorageJob(pawn, t); + return HaulAIUtility.HaulToStorageJob(pawn, t); } } } @@ -90,15 +74,7 @@ public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false) //credit to Dingo int c = MassUtility.CountToPickUpUntilOverEncumbered(pawn, t); - if (c == 0) - { - return HaulAIUtility.HaulToStorageJob(pawn, t); - } - - else if (c >= 2 && t.def.BaseMass >= 1) - { - return HaulAIUtility.HaulToStorageJob(pawn, t); - } + if (c == 0) return HaulAIUtility.HaulToStorageJob(pawn, t); return new Job(PickUpAndHaulJobDefOf.HaulToInventory, t) {