// Token: 0x0600792A RID: 31018 RVA: 0x00239AC8 File Offset: 0x00237CC8
        private void PodOpen()
        {
            Map map = base.Map;

            if (this.contents.despawnPodBeforeSpawningThing)
            {
                this.DeSpawn(DestroyMode.Vanish);
            }
            if (dropship != null)
            {
                this.contents.innerContainer.Remove(dropship);
            }
            else
            {
                return;
            }
            GenSpawn.Spawn(dropship, base.Position, map, this.contents.setRotation.Value, this.contents.spawnWipeMode.Value, false);
            for (int i = this.contents.innerContainer.Count - 1; i >= 0; i--)
            {
                Thing thing = this.contents.innerContainer[i];
                if (dropship.TryGetComp <CompTransporter>() != null)
                {
                    CompUSCMDropship transporter = dropship.TryGetComp <CompUSCMDropship>();
                    transporter.Transporter.innerContainer.TryAddOrTransfer(thing);
                }
            }
            this.contents.innerContainer.ClearAndDestroyContents(DestroyMode.Vanish);
            //	SoundDefOf.DropPod_Open.PlayOneShot(new TargetInfo(base.Position, map, false));
            this.Destroy(DestroyMode.Vanish);
        }
        public static bool Prefix(IntVec3 c, Map map, ActiveDropPodInfo info)
        {
            Thing            dropship = null;
            CompUSCMDropship cargo    = null;

            //    CompTransporter comp2 = null;
            for (int index = 0; index < info.innerContainer.Count; index++)
            {
                if (info.innerContainer[index].TryGetComp <CompUSCMDropship>() != null)
                {
                    dropship = info.innerContainer[index];
                    ActiveDropPod activeDropPod = (ActiveDropPod)ThingMaker.MakeThing(USCMDefOf.RRY_USCM_ActiveDropshipUD4L, null);

                    activeDropPod.Contents = info;
                    EnsureInBounds(ref c, info.innerContainer[index].def, map);
                    info.innerContainer.Remove(dropship);
                    cargo = dropship.TryGetComp <CompUSCMDropship>();
                    cargo.Transporter.innerContainer = info.innerContainer;
                    SkyfallerMaker.SpawnSkyfaller(USCMDefOf.RRY_USCM_DropshipUD4LIncoming, dropship, c, map);
                    return(false);
                }
            }

            return(true);
        }
        // Token: 0x060047C7 RID: 18375 RVA: 0x00180F4C File Offset: 0x0017F14C
        public override void GenerateIntoMap(Map map)
        {
            method = PlayerPawnsArriveMethod.DropShip;
            if (Find.GameInitData == null)
            {
                return;
            }
            List <List <Thing> > list = new List <List <Thing> >();

            foreach (Pawn item in Find.GameInitData.startingAndOptionalPawns)
            {
                list.Add(new List <Thing>
                {
                    item
                });
            }
            List <Thing> list2 = new List <Thing>();

            foreach (ScenPart scenPart in Find.Scenario.AllParts)
            {
                list2.AddRange(scenPart.PlayerStartingThings());
            }
            int num = 0;

            foreach (Thing thing in list2)
            {
                if (thing.def.CanHaveFaction)
                {
                    thing.SetFactionDirect(Faction.OfPlayer);
                }
                list[num].Add(thing);
                num++;
                if (num >= list.Count)
                {
                    num = 0;
                }
            }
            if ((int)this.method == (int)PlayerPawnsArriveMethod.DropShip)
            {
                Thing            thing    = ThingMaker.MakeThing(USCMDefOf.RRY_USCM_DropshipUD4L, null);
                CompUSCMDropship dropship = thing.TryGetComp <CompUSCMDropship>();
                foreach (List <Thing> item in list)
                {
                    dropship.Transporter.innerContainer.TryAddRangeOrTransfer(item);
                }
                dropship.autodustoff = true;
                if (DropCellFinder.TryFindDropSpotNear(MapGenerator.PlayerStartSpot, map, out IntVec3 spot, false, false, false, USCMDefOf.RRY_USCM_DropshipUD4L.Size))
                {
                    GenPlace.TryPlaceThing(SkyfallerMaker.MakeSkyfaller(USCMDefOf.RRY_USCM_DropshipUD4LIncoming, thing), spot, map, ThingPlaceMode.Near, null, null, default(Rot4));
                }
                else
                {
                    GenPlace.TryPlaceThing(SkyfallerMaker.MakeSkyfaller(USCMDefOf.RRY_USCM_DropshipUD4LIncoming, thing), MapGenerator.PlayerStartSpot, map, ThingPlaceMode.Near, null, null, default(Rot4));
                }
            }
Example #4
0
 public static IEnumerable <FloatMenuOption> GetATKFloatMenuOptions(CompUSCMDropship representative, IEnumerable <IThingHolder> pods, Settlement settlement, Caravan car)
 {
     foreach (FloatMenuOption f in DropShipArrivalActionUtility.GetFloatMenuOptions <TransportPodsArrivalAction_AttackSettlement>(() => TransportPodsArrivalAction_AttackSettlement.CanAttack(pods, settlement), () => new TransportPodsArrivalAction_AttackSettlement(settlement, PawnsArrivalModeDefOf.EdgeDrop), "AttackAndDropAtEdge".Translate(settlement.Label), representative, settlement.Tile, car))
     {
         yield return(f);
     }
     foreach (FloatMenuOption f2 in DropShipArrivalActionUtility.GetFloatMenuOptions <TransportPodsArrivalAction_AttackSettlement>(() => TransportPodsArrivalAction_AttackSettlement.CanAttack(pods, settlement), () => new TransportPodsArrivalAction_AttackSettlement(settlement, PawnsArrivalModeDefOf.CenterDrop), "AttackAndDropInCenter".Translate(settlement.Label), representative, settlement.Tile, car))
     {
         yield return(f2);
     }
     yield break;
 }
Example #5
0
        public static IEnumerable <FloatMenuOption> GetGIFTFloatMenuOptions(CompUSCMDropship representative, IEnumerable <IThingHolder> pods, Settlement settlement, Caravan car)
        {
            return(Enumerable.Empty <FloatMenuOption>());

            /*
             * if (settlement.Faction == Faction.OfPlayer)
             * {
             *  return Enumerable.Empty<FloatMenuOption>();
             * }
             * return DropShipArrivalActionUtility.GetFloatMenuOptions<TransportPodsArrivalAction_GiveGift>(() => TransportPodsArrivalAction_GiveGift.CanGiveGiftTo(pods, settlement),
             *  () => new TransportPodsArrivalAction_GiveGift(settlement), "GiveGiftViaTransportPods".Translate(settlement.Faction.Name,
             *  FactionGiftUtility.GetGoodwillChange(pods, settlement).ToStringWithSign()), representative, settlement.Tile, car);
             */
        }
Example #6
0
 public static IEnumerable <FloatMenuOption> GetVisitFloatMenuOptions(CompUSCMDropship representative, IEnumerable <IThingHolder> pods, Settlement settlement, Caravan car)
 {
     return(DropShipArrivalActionUtility.GetFloatMenuOptions <TransportPodsArrivalAction_VisitSettlement>(() => TransportPodsArrivalAction_VisitSettlement.CanVisit(pods, settlement),
                                                                                                          () => new TransportPodsArrivalAction_VisitSettlement(settlement), "VisitSettlement".Translate(settlement.Label), representative, settlement.Tile, car));
 }
Example #7
0
        public static IEnumerable <FloatMenuOption> GetFloatMenuOptions <T>(Func <FloatMenuAcceptanceReport> acceptanceReportGetter, Func <T> arrivalActionGetter, string label, CompUSCMDropship representative, int destinationTile, Caravan car) where T : TransportPodsArrivalAction
        {
            FloatMenuAcceptanceReport rep = acceptanceReportGetter();

            if (rep.Accepted || !rep.FailReason.NullOrEmpty() || !rep.FailMessage.NullOrEmpty())
            {
                if (!rep.FailReason.NullOrEmpty())
                {
                    yield return(new FloatMenuOption(label + " (" + rep.FailReason + ")", null, MenuOptionPriority.Default, null, null, 0f, null, null));
                }
                else
                {
                    yield return(new FloatMenuOption(label, delegate
                    {
                        FloatMenuAcceptanceReport floatMenuAcceptanceReport = acceptanceReportGetter();
                        if (floatMenuAcceptanceReport.Accepted)
                        {
                            representative.TryLaunch(destinationTile, arrivalActionGetter(), car);
                        }
                        else if (!floatMenuAcceptanceReport.FailMessage.NullOrEmpty())
                        {
                            Messages.Message(floatMenuAcceptanceReport.FailMessage, new GlobalTargetInfo(destinationTile), MessageTypeDefOf.RejectInput, false);
                        }
                    }, MenuOptionPriority.Default, null, null, 0f, null, null));
                }
            }
            yield break;
        }