コード例 #1
0
        public override void MapComponentTick()
        {
            base.MapComponentTick();
            if (innerContainer.Count > 0)
            {
                if (strikeDelay == -1)
                {
                    strikeDelay = ResultSpawnDelay.RandomInRange;
                    ticksSinceRaid++;
                }
                if (ticksSinceRaid != -1)
                {
                    ticksSinceRaid++;
                }

                //    Log.Message(string.Format("{0}, strikeDelay: {1}, ticksLastRaid: {2}, ticksSinceRaid: {3}", innerContainer.ContentsString, strikeDelay, raidLastTick, ticksSinceRaid));
                if (ticksSinceRaid > strikeDelay)
                {
                    foreach (Pawn p in innerContainer)
                    {
                        if (p.DeepStrike().pawnsArrivalMode == DeepStrikeType.Drop)
                        {
                            Droppers.Add(p);
                        }
                        if (p.DeepStrike().pawnsArrivalMode == DeepStrikeType.Fly)
                        {
                            Flyers.Add(p);
                        }
                        if (p.DeepStrike().pawnsArrivalMode == DeepStrikeType.Teleport)
                        {
                            Teleporters.Add(p);
                        }
                        if (p.DeepStrike().pawnsArrivalMode == DeepStrikeType.Tunnel)
                        {
                            Tunnellers.Add(p);
                        }
                    }

                    if (!innerContainer.NullOrEmpty())
                    {
                        DoStrike();
                    }
                    strikeLastTick = Find.TickManager.TicksGame;
                }
            }
            else
            {
                raidLastTick   = -1;
                ticksSinceRaid = -1;
                strikeDelay    = -1;
            }
        }
コード例 #2
0
        public void DoStrike(DeepStrike strike)
        {
            string str = string.Empty;

            foreach (var item in strike.Members)
            {
                switch (item.DeepStrike().pawnsArrivalMode)
                {
                case DeepStrikeType.DropPod:
                    Droppers.Add(item);
                    break;

                case DeepStrikeType.DropPara:
                    break;

                case DeepStrikeType.DropShip:
                    break;

                case DeepStrikeType.Fly:
                    Flyers.Add(item);
                    break;

                case DeepStrikeType.Teleport:
                    Teleporters.Add(item);
                    break;

                case DeepStrikeType.Tunnel:
                    Tunnellers.Add(item);
                    break;

                default:
                    break;
                }
            }
            List <Pawn> pawns = new List <Pawn>();

            if (!Droppers.NullOrEmpty())
            {
                str += str == string.Empty ? DeepStrikeUtility.DeepstrikeArrivalmode(DeepStrikeType.DropPod) : ", " + DeepStrikeUtility.DeepstrikeArrivalmode(DeepStrikeType.DropPod);
                pawns.AddRange(Droppers);
                ArriveDropPod(Droppers);
                Droppers.Clear();
            }
            if (!Flyers.NullOrEmpty())
            {
                str += str == string.Empty ? DeepStrikeUtility.DeepstrikeArrivalmode(DeepStrikeType.Fly) : ", " + DeepStrikeUtility.DeepstrikeArrivalmode(DeepStrikeType.Fly);
                pawns.AddRange(Flyers);
                ArriveFly(Flyers);
                Flyers.Clear();
            }
            if (!Teleporters.NullOrEmpty())
            {
                str += str == string.Empty ? DeepStrikeUtility.DeepstrikeArrivalmode(DeepStrikeType.Teleport) : ", " + DeepStrikeUtility.DeepstrikeArrivalmode(DeepStrikeType.Teleport);
                pawns.AddRange(Teleporters);
                ArriveTeleport(Teleporters);
                Teleporters.Clear();
            }
            if (!Tunnellers.NullOrEmpty())
            {
                str += str == string.Empty ? DeepStrikeUtility.DeepstrikeArrivalmode(DeepStrikeType.Tunnel) : ", " + DeepStrikeUtility.DeepstrikeArrivalmode(DeepStrikeType.Tunnel);
                pawns.AddRange(Tunnellers);
                ArriveTunnel(Tunnellers);
                Tunnellers.Clear();
            }
            Find.LetterStack.ReceiveLetter("AdeptusMechanicus.DeepStrike_Incomming".Translate(pawns.Find(x => x.Faction != null).Faction.def.pawnSingular), "AdeptusMechanicus.DeepStrike_Incomming_Letter".Translate(pawns.Find(x => x.Faction != null).Faction.def.pawnsPlural, str), LetterDefOf.ThreatBig, pawns, pawns.Find(x => x.Faction != null).Faction, null);
            strike.struck = true;
        }