public static bool CanReserve(ref bool __result, Pawn p, LocalTargetInfo target, int maxPawns = 1, int stackCount = -1, ReservationLayerDef layer = null, bool ignoreOtherReservations = false) { if (!p.Spawned) { __result = false; return(false); } __result = false; __result = ReservationManager_Patch.CanReserve(p.Map.reservationManager, ref __result, p, target, maxPawns, stackCount, layer, ignoreOtherReservations); return(false); }
public static void RegisterHaulableItem(Thing haulableThing) { Map map = haulableThing.Map; if (map == null) { return; } if (haulableThing.IsForbidden(Faction.OfPlayer)) { return; } //---SHOULD HELP WITH NOT HAULING ROCK CHUNKS--- if (!haulableThing.def.EverHaulable) { return; } if (!haulableThing.def.alwaysHaulable && (map.designationManager.DesignationOn(haulableThing, DesignationDefOf.Haul) == null)) { return; } //---SHOULD HELP WITH NOT HAULING ROCK CHUNKS--- int num = haulableThing.stackCount; int maxPawns = 1; if (map.physicalInteractionReservationManager.IsReserved(haulableThing)) { //Log.Warning("IsReserved"); return; } List <Reservation> reservations = ReservationManager_Patch.getReservationTargetList(map.reservationManager, haulableThing); if (reservations != null && reservations.Count > 0) { return; } int num3 = 0; int num4 = 0; List <Reservation> reservationTargetList = ReservationManager_Patch.getReservationTargetList(map.reservationManager, haulableThing); foreach (Reservation reservation in reservationTargetList) { if (reservation.Layer == null) { if (reservation.Claimant != null && (reservation.StackCount == -1 || reservation.StackCount >= num)) { break; } if (reservation.Claimant != null) { if (reservation.MaxPawns != maxPawns) { //Log.Warning("maxPawns"); return; } num3++; num4 = (reservation.StackCount != -1) ? (num4 + reservation.StackCount) : (num4 + num); if (num3 >= maxPawns || num + num4 > num) { //Log.Warning(reservation.Claimant.ToString() + " StackCount"); return; } } } } int storagePriority = (int)StoreUtility.CurrentStoragePriorityOf(haulableThing); if (TryFindBestBetterStoreCellFor(haulableThing, null, map, StoreUtility.CurrentStoragePriorityOf(haulableThing), null, out _, false) && //fast check HaulToStorageJobTest(haulableThing)) //slower check { AddThingToAwaitingHaulingHashSets(haulableThing); } else { HashSet <Thing> things = getWaitingForZoneBetterThan(map)[storagePriority]; lock (things) { things.Add(haulableThing); } } }