public override bool ShouldSkip(Pawn pawn) { Trace.DebugWriteHaulingPawn(pawn); if (ToolsForHaulUtility.Cart().Count == 0) { return(true); } return(false); }
protected override bool TryFindGoodExitDest(Pawn pawn, out IntVec3 spot) { using (List <Thing> .Enumerator enumerator = ToolsForHaulUtility.Cart().GetEnumerator()) { while (enumerator.MoveNext()) { Vehicle_Cart vehicle_Cart = (Vehicle_Cart)enumerator.Current; if (vehicle_Cart.mountableComp.IsMounted && !vehicle_Cart.mountableComp.Driver.RaceProps.Animal && vehicle_Cart.mountableComp.Driver.ThingID == pawn.ThingID) { vehicle_Cart.despawnAtEdge = true; } } } return(ExitUtility.TryFindRandomExitSpot(pawn, ref spot, 1)); }
public static void DebugWriteHaulingPawn(Pawn pawn) { Trace.AppendLine(pawn.LabelCap + " Report: Cart " + ToolsForHaulUtility.Cart().Count + " Job: " + ((pawn.CurJob != null) ? pawn.CurJob.def.defName : "No Job") + " Backpack: " + ((ToolsForHaulUtility.TryGetBackpack(pawn) != null) ? "True" : "False") + " lastGivenWorkType: " + pawn.mindState.lastGivenWorkType); foreach (Pawn other in Find.ListerPawns.FreeColonistsSpawned) { //Vanilla haul or Haul with backpack if (other.CurJob != null && (other.CurJob.def == JobDefOf.HaulToCell || other.CurJob.def == DefDatabase <JobDef> .GetNamed("HaulWithBackpack"))) { Trace.AppendLine(other.LabelCap + " Job: " + other.CurJob.def.defName + " Backpack: " + ((ToolsForHaulUtility.TryGetBackpack(other) != null) ? "True" : "False") + " lastGivenWorkType: " + other.mindState.lastGivenWorkType); } } foreach (Vehicle_Cart cart in ToolsForHaulUtility.Cart()) { string driver = ((cart.mountableComp.IsMounted) ? cart.mountableComp.Driver.LabelCap : "No Driver"); string state = ""; if (cart.IsForbidden(pawn.Faction)) { state = string.Concat(state, "Forbidden "); } if (pawn.CanReserveAndReach(cart, PathEndMode.Touch, Danger.Some)) { state = string.Concat(state, "CanReserveAndReach "); } if (ToolsForHaulUtility.AvailableCart(cart, pawn)) { state = string.Concat(state, "AvailableCart "); } if (ToolsForHaulUtility.AvailableAnimalCart(cart)) { state = string.Concat(state, "AvailableAnimalCart "); } Pawn reserver = Find.Reservations.FirstReserverOf(cart, Faction.OfColony); if (reserver != null) { state = string.Concat(state, reserver.LabelCap, " Job: ", reserver.CurJob.def.defName); } Trace.AppendLine(cart.LabelCap + "- " + driver + ": " + state); } Trace.LogMessage(); }
public override IEnumerable <Thing> PotentialWorkThingsGlobal(Pawn pawn) { return(ToolsForHaulUtility.Cart() as IEnumerable <Thing>); }