public static void set_Forbidden(CompForbiddable __instance, bool value) { if (__instance.parent.Map != null) { HaulingCache.ReregisterHaulableItem(__instance.parent); } }
public static bool ReleaseAllClaimedBy(ReservationManager __instance, Pawn claimant) { Dictionary <Pawn, List <Reservation> > reservationClaimantDict = getReservationClaimantDict(__instance); lock (__instance) { Dictionary <LocalTargetInfo, List <Reservation> > reservationTargetDict = getReservationTargetDict(__instance); List <Reservation> reservationClaimantList = getReservationClaimantList(reservationClaimantDict, claimant); foreach (Reservation reservation in reservationClaimantList) { List <Reservation> reservationTargetList = getReservationTargetList(reservationTargetDict, reservation.Target); List <Reservation> newReservationTargetList = new List <Reservation>(); for (int index = 0; index < reservationTargetList.Count; index++) { Reservation reservation2 = reservationTargetList[index]; if (reservation2.Claimant != claimant) { newReservationTargetList.Add(reservation2); } } reservationTargetDict[reservation.Target] = newReservationTargetList; //HaulingCache if (reservation.Target.Thing != null && reservation.Target.Thing.def.EverHaulable && reservation.Target.Thing.Map != null) { HaulingCache.ReregisterHaulableItem(reservation.Target.Thing); } } reservationClaimantDict[claimant] = new List <Reservation>(); } return(false); }
public static void PostReleaseAllForTarget(ReservationManager __instance, LocalTargetInfo target, Pawn claimant, Job job) { if (target.Thing != null && target.Thing.def.EverHaulable && target.Thing.Map != null) { HaulingCache.ReregisterHaulableItem(target.Thing); } }
public static bool Release(ReservationManager __instance, LocalTargetInfo target, Pawn claimant, Job job) { if (target.ThingDestroyed) { Log.Warning("Releasing destroyed thing " + target + " for " + claimant); } Reservation reservation1 = null; List <Reservation> reservationTargetListUnsafe = getReservationTargetList(__instance, target); foreach (Reservation reservation2 in reservationTargetListUnsafe) { if (reservation2.Claimant == claimant && reservation2.Job == job) { reservation1 = reservation2; break; } } if (reservation1 == null && !target.ThingDestroyed) { Log.Warning("Tried to release " + target + " that wasn't reserved by " + claimant + "."); } else { lock (__instance) { Dictionary <Pawn, List <Reservation> > reservationClaimantDict = getReservationClaimantDict(__instance); List <Reservation> reservationClaimantList = getReservationClaimantList(reservationClaimantDict, claimant); List <Reservation> newReservationClaimantList = new List <Reservation>(); foreach (Reservation reservation in reservationClaimantList) { if (reservation != reservation1) { newReservationClaimantList.Add(reservation); } reservationClaimantDict[claimant] = newReservationClaimantList; } Dictionary <LocalTargetInfo, List <Reservation> > reservationTargetDict = getReservationTargetDict(__instance); List <Reservation> reservationTargetList = getReservationTargetList(reservationTargetDict, target); List <Reservation> newReservationTargetList = new List <Reservation>(); foreach (Reservation reservation2 in reservationTargetList) { if (reservation2 != reservation1) { newReservationTargetList.Add(reservation2); } } reservationTargetDict[target] = newReservationTargetList; } } //Postfix if (target.Thing != null && target.Thing.def.EverHaulable && target.Thing.Map != null) { HaulingCache.ReregisterHaulableItem(target.Thing); } return(false); }
public static void DesignateThing(Designator_Haul __instance, Thing t) { HaulingCache.ReregisterHaulableItem(t); }