Esempio n. 1
0
        virtual public bool Reserve(Pawn pawn, Thing thing)
        {
            if (!active)
            {
                return(false);
            }
            int count = Math.Min(pawn.carryTracker.AvailableStackSpace(thing.def),
                                 Math.Min(pawn.CurJob.count, thing.stackCount));
            var newReservation = new StorageReservation(this, pawn, thing, count);

            reservations.Add(newReservation);
            parent.Map.GetStorageCoordinator().AddReservation(newReservation);
            Utility.Debug($"{pawn} has reserved for {(count)} of {thing.def} ({thing})");
            return(true);
        }
 internal void RemoveReservation(StorageReservation reservation)
 {
     reservations.Remove(reservation);
 }
 internal void AddReservation(StorageReservation reservation)
 {
     reservations.Add(reservation);
 }
Esempio n. 4
0
 public VirtualThing(StorageReservation reservation)
 {
     def        = reservation.def;
     stuff      = reservation.stuff;
     stackCount = reservation.stackCount;
 }
Esempio n. 5
0
 virtual public void Notify_ReservationRemoved(StorageReservation reservation)
 {
     Utility.Debug($"Removing reservation {reservation}");
     reservations.Remove(reservation);
 }