public bool Reserve(Actor self, BunkerCargo cargo)
 {
     Unreserve(self);
     if (!cargo.ReserveSpace(self))
     {
         return(false);
     }
     ReservedCargo = cargo;
     return(true);
 }
        public void ResolveOrder(Actor self, Order order)
        {
            if (order.OrderString != "EnterBunker" && order.OrderString != "EnterBunkers")
            {
                return;
            }

            // Enter orders are only valid for own/allied actors,
            // which are guaranteed to never be frozen.
            if (order.Target.Type != TargetType.Actor)
            {
                return;
            }

            var targetActor = order.Target.Actor;

            if (!CanEnter(targetActor))
            {
                return;
            }

            if (!IsCorrectCargoType(targetActor))
            {
                return;
            }

            if (!order.Queued)
            {
                self.CancelActivity();
            }

            BunkerCargo cargo = targetActor.TraitOrDefault <BunkerCargo>();

            var transports = order.OrderString == "EnterBunkers";

            self.SetTargetLine(order.Target, Color.Green);
            self.QueueActivity(new EnterBunker(self, targetActor, targetActor.CenterPosition, cargo.Info.WillDisappear, transports ? Info.MaxAlternateTransportAttempts : 0, !transports));
        }
 bool CanEnter(BunkerCargo cargo)
 {
     return(cargo != null && cargo.HasSpace(Info.Weight));
 }