public void DoStrike() { string str = string.Empty; List <Pawn> pawns = new List <Pawn>(); if (!Droppers.NullOrEmpty()) { str += str == string.Empty ? DeepStrikeUtility.DeepstrikeArrivalmode(DeepStrikeType.Drop) : ", " + DeepStrikeUtility.DeepstrikeArrivalmode(DeepStrikeType.Drop); pawns.AddRange(Droppers); ArriveDropPod(Droppers); } if (!Flyers.NullOrEmpty()) { str += str == string.Empty ? DeepStrikeUtility.DeepstrikeArrivalmode(DeepStrikeType.Fly) : ", " + DeepStrikeUtility.DeepstrikeArrivalmode(DeepStrikeType.Fly); pawns.AddRange(Flyers); ArriveFly(Flyers); } if (!Teleporters.NullOrEmpty()) { str += str == string.Empty ? DeepStrikeUtility.DeepstrikeArrivalmode(DeepStrikeType.Teleport) : ", " + DeepStrikeUtility.DeepstrikeArrivalmode(DeepStrikeType.Teleport); pawns.AddRange(Teleporters); ArriveTeleport(Teleporters); } if (!Tunnellers.NullOrEmpty()) { str += str == string.Empty ? DeepStrikeUtility.DeepstrikeArrivalmode(DeepStrikeType.Tunnel) : ", " + DeepStrikeUtility.DeepstrikeArrivalmode(DeepStrikeType.Tunnel); pawns.AddRange(Tunnellers); ArriveTunnel(Tunnellers); } Find.LetterStack.ReceiveLetter("AMA_DeepStrike_Incomming".Translate(pawns.Find(x => x.Faction != null).Faction.def.pawnSingular), "AMA_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); }
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; } }
public void ArriveDropPod(List <Pawn> pawns) { for (int i = 0; i < pawns.Count; i++) { // IntVec3 dropCenter = map.listerBuildings.allBuildingsColonist.FindAll(x => x.TryGetCompFast<CompPowerPlant>() != null).RandomElement().Position; IntVec3 dropCenter; if (DropCellFinder.TryFindRaidDropCenterClose(out dropCenter, map)) { DeepStrikeUtility.DropThingsNear(dropCenter, map, Gen.YieldSingle <Thing>(pawns[i]), 50, false, false, true, DeepStrikeType.DropPod); } } Droppers.Clear(); }
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; }