Esempio n. 1
0
        private static void CallDeepstrikeOf()
        {
            List <DebugMenuOption> list = new List <DebugMenuOption>();

            foreach (PawnKindDef localKindDef2 in from f in DefDatabase <PawnKindDef> .AllDefs
                     //  where f.RoyalTitlesAwardableInSeniorityOrderForReading.Count > 0
                     orderby f.defName
                     select f)
            {
                PawnKindDef localKindDef = localKindDef2;

                /*
                 * if (!localKindDef.HasModExtension<DeepStrikeExtension>())
                 * {
                 *  continue;
                 * }
                 */
                list.Add(new DebugMenuOption(localKindDef.defName, DebugMenuOptionMode.Tool, delegate()
                {
                    List <FloatMenuOption> list2 = new List <FloatMenuOption>();
                    IntVec3 cell = UI.MouseCell();
                    for (int i = 0; i < 6; i++)
                    {
                        DeepStrikeType strikeType = (DeepStrikeType)i;
                        list2.Add(new FloatMenuOption(DeepStrikeUtility.DeepstrikeArrivalmode(strikeType) + " - ", delegate()
                        {
                            Faction faction = FactionUtility.DefaultFactionFrom(localKindDef.defaultFactionType);
                            Pawn newPawn    = PawnGenerator.GeneratePawn(localKindDef, faction);
                            DeepStrikeUtility.DropThingsNear(cell, Find.CurrentMap, Gen.YieldSingle <Thing>(newPawn), 110, false, false, true, strikeType);
                            if (faction != null && faction != Faction.OfPlayer)
                            {
                                Lord lord = null;
                                if (Find.CurrentMap.mapPawns.SpawnedPawnsInFaction(faction).Any((Pawn p) => p != newPawn))
                                {
                                    lord = ((Pawn)GenClosest.ClosestThing_Global(cell, Find.CurrentMap.mapPawns.SpawnedPawnsInFaction(faction), 99999f, (Thing p) => p != newPawn && ((Pawn)p).GetLord() != null, null)).GetLord();
                                }
                                if (lord == null)
                                {
                                    LordJob_DefendPoint lordJob = new LordJob_DefendPoint(cell, null, false, true);
                                    lord = LordMaker.MakeNewLord(faction, lordJob, Find.CurrentMap, null);
                                }
                                lord.AddPawn(newPawn);
                            }
                        }, MenuOptionPriority.Default, null, null, 0f, null, null));
                    }
                    Find.WindowStack.Add(new FloatMenu(list2));
                }));
            }
            Find.WindowStack.Add(new Dialog_DebugOptionListLister(list));
        }
Esempio n. 2
0
        public static string DeepstrikeArrivalmode(DeepStrikeType pawnsArrivalMode)
        {
            string str = string.Empty;

            if (pawnsArrivalMode == DeepStrikeType.Drop)
            {
                str = "AMA_DeepStrikeType_Drop".Translate();
            }
            if (pawnsArrivalMode == DeepStrikeType.Fly)
            {
                str = "AMA_DeepStrikeType_Flight".Translate();
            }
            if (pawnsArrivalMode == DeepStrikeType.Tunnel)
            {
                str = "AMA_DeepStrikeType_Tunnel".Translate();
            }
            if (pawnsArrivalMode == DeepStrikeType.Teleport)
            {
                str = "AMA_DeepStrikeType_Teleport".Translate();
            }
            return(str);
        }
Esempio n. 3
0
        public static string DeepstrikeArrivalmode(DeepStrikeType pawnsArrivalMode)
        {
            switch (pawnsArrivalMode)
            {
            case DeepStrikeType.DropPara:
                return("AdeptusMechanicus.DeepStrikeType_DropPara".Translate() + " - NOT YET IMPLEMENTED");

            case DeepStrikeType.Fly:
                return("AdeptusMechanicus.DeepStrikeType_Flight".Translate());

            case DeepStrikeType.Teleport:
                return("AdeptusMechanicus.DeepStrikeType_Teleport".Translate());

            case DeepStrikeType.Tunnel:
                return("AdeptusMechanicus.DeepStrikeType_Tunnel".Translate());

            case DeepStrikeType.DropShip:
                return("AdeptusMechanicus.DeepStrikeType_DropShip".Translate() + " - NOT YET IMPLEMENTED");

            default:
                return("AdeptusMechanicus.DeepStrikeType_DropPod".Translate());
            }
        }
Esempio n. 4
0
        public static void DropThingGroupsNear(IntVec3 dropCenter, Map map, List <List <Thing> > thingsGroups, int openDelay = 110, bool instaDrop = false, bool leaveSlag = false, bool canRoofPunch = true, DeepStrikeType strikeType = DeepStrikeType.DropPod, bool scatters = true)
        {
            foreach (List <Thing> list in thingsGroups)
            {
                List <Thing>        list2     = list.Where(x => x.def.thingClass == typeof(Pawn) && (x.Faction != null && x.Faction.def.HasModExtension <FactionDefExtension>())).ToList();
                FactionDefExtension extension = list2.NullOrEmpty() ? null : list2.RandomElement().Faction.def.GetModExtensionFast <FactionDefExtension>();
                if (!DropCellFinder.TryFindDropSpotNear(dropCenter, map, out IntVec3 intVec, true, canRoofPunch) || !scatters)
                {
                    if (scatters)
                    {
                        Log.Warning(string.Concat(new object[]
                        {
                            "DropThingsNear failed to find a place to drop ",
                            list.FirstOrDefault <Thing>(),
                            " near ",
                            dropCenter,
                            ". Dropping on random square instead."
                        }));
                    }
                    intVec = CellFinderLoose.RandomCellWith((IntVec3 c) => c.Walkable(map) && (c.Roofed(map) && c.GetRoof(map) != RoofDefOf.RoofRockThick), map, 1000);
                }
                for (int i = 0; i < list.Count; i++)
                {
                    list[i].SetForbidden(true, false);
                }
                if (instaDrop)
                {
                    foreach (Thing thing in list)
                    {
                        GenPlace.TryPlaceThing(thing, intVec, map, ThingPlaceMode.Near, null, null);
                    }
                }
                else
                {
                    ActiveDropPodInfo activeDropPodInfo = new ActiveDropPodInfo();
                    foreach (Thing item in list)
                    {
                        activeDropPodInfo.innerContainer.TryAddOrTransfer(item, true);
                    }
                    activeDropPodInfo.openDelay = openDelay;
                    activeDropPodInfo.leaveSlag = leaveSlag;

                    switch (strikeType)
                    {
                    /*
                     * case DeepStrikeType.DropPara:
                     *  DeepStrikeUtility.MakeDropParaAt(intVec, map, activeDropPodInfo, extension);
                     *  break;
                     * case DeepStrikeType.DropShip:
                     *  DeepStrikeUtility.MakeDropShipLandAt(intVec, map, activeDropPodInfo, extension);
                     *  break;
                     */
                    case DeepStrikeType.Fly:
                        DeepStrikeUtility.MakeFlyerLandAt(intVec, map, activeDropPodInfo, extension);
                        break;

                    case DeepStrikeType.Teleport:
                        DeepStrikeUtility.MakeTeleportAt(intVec, map, activeDropPodInfo, extension);
                        break;

                    case DeepStrikeType.Tunnel:
                        DeepStrikeUtility.MakeTunnelAt(intVec, map, activeDropPodInfo, extension);
                        break;

                    default:
                        DeepStrikeUtility.MakeDropPodAt(intVec, map, activeDropPodInfo, extension);
                        break;
                    }
                }
            }
        }
Esempio n. 5
0
 public static void DropThingsNear(IntVec3 dropCenter, Map map, IEnumerable <Thing> things, int openDelay = 110, bool canInstaDropDuringInit = false, bool leaveSlag = false, bool canRoofPunch = true, DeepStrikeType strikeType = DeepStrikeType.DropPod, bool scatters = true)
 {
     DeepStrikeUtility.tempList.Clear();
     foreach (Thing item in things)
     {
         List <Thing> list = new List <Thing>
         {
             item
         };
         DeepStrikeUtility.tempList.Add(list);
     }
     DeepStrikeUtility.DropThingGroupsNear(dropCenter, map, DeepStrikeUtility.tempList, openDelay, canInstaDropDuringInit, leaveSlag, canRoofPunch, strikeType, scatters);
     DeepStrikeUtility.tempList.Clear();
 }