Beispiel #1
0
 public override IEnumerable <FloatMenuOption> GetTransportPodsFloatMenuOptions(IEnumerable <IThingHolder> pods, CompLaunchable representative)
 {
     foreach (FloatMenuOption o in base.GetTransportPodsFloatMenuOptions(pods, representative))
     {
         yield return(o);
     }
     foreach (FloatMenuOption f in TransportPodsArrivalAction_GiveToCaravan.GetFloatMenuOptions(representative, pods, this))
     {
         yield return(f);
     }
 }
 private void Arrived()
 {
     if (this.arrived)
     {
         return;
     }
     this.arrived = true;
     if (this.arrivalAction == null || !this.arrivalAction.StillValid(this.pods.Cast <IThingHolder>(), this.destinationTile))
     {
         this.arrivalAction = null;
         List <Map> maps = Find.Maps;
         for (int i = 0; i < maps.Count; i++)
         {
             if (maps[i].Tile == this.destinationTile)
             {
                 this.arrivalAction = new TransportPodsArrivalAction_LandInSpecificCell(maps[i].Parent, DropCellFinder.RandomDropSpot(maps[i]));
                 break;
             }
         }
         if (this.arrivalAction == null)
         {
             if (TransportPodsArrivalAction_FormCaravan.CanFormCaravanAt(this.pods.Cast <IThingHolder>(), this.destinationTile))
             {
                 this.arrivalAction = new TransportPodsArrivalAction_FormCaravan();
             }
             else
             {
                 List <Caravan> caravans = Find.WorldObjects.Caravans;
                 for (int j = 0; j < caravans.Count; j++)
                 {
                     if (caravans[j].Tile == this.destinationTile && TransportPodsArrivalAction_GiveToCaravan.CanGiveTo(this.pods.Cast <IThingHolder>(), caravans[j]))
                     {
                         this.arrivalAction = new TransportPodsArrivalAction_GiveToCaravan(caravans[j]);
                         break;
                     }
                 }
             }
         }
     }
     if (this.arrivalAction != null && this.arrivalAction.ShouldUseLongEvent(this.pods, this.destinationTile))
     {
         LongEventHandler.QueueLongEvent(delegate()
         {
             this.DoArrivalAction();
         }, "GeneratingMapForNewEncounter", false, null);
     }
     else
     {
         this.DoArrivalAction();
     }
 }
        public override FloatMenuAcceptanceReport StillValid(IEnumerable <IThingHolder> pods, int destinationTile)
        {
            FloatMenuAcceptanceReport floatMenuAcceptanceReport = base.StillValid(pods, destinationTile);

            if (!floatMenuAcceptanceReport)
            {
                return(floatMenuAcceptanceReport);
            }
            if (this.caravan != null && !Find.WorldGrid.IsNeighborOrSame(this.caravan.Tile, destinationTile))
            {
                return(false);
            }
            return(TransportPodsArrivalAction_GiveToCaravan.CanGiveTo(pods, this.caravan));
        }
 public static IEnumerable <FloatMenuOption> GetFloatMenuOptions(CompLaunchable representative, IEnumerable <IThingHolder> pods, Caravan caravan)
 {
     return(TransportPodsArrivalActionUtility.GetFloatMenuOptions <TransportPodsArrivalAction_GiveToCaravan>(() => TransportPodsArrivalAction_GiveToCaravan.CanGiveTo(pods, caravan), () => new TransportPodsArrivalAction_GiveToCaravan(caravan), "GiveToCaravan".Translate(new object[]
     {
         caravan.Label
     }), representative, caravan.Tile));
 }
 internal FloatMenuAcceptanceReport <> m__0()
 {
     return(TransportPodsArrivalAction_GiveToCaravan.CanGiveTo(this.pods, this.caravan));
 }