public static void DropShipGroups(IntVec3 dropCenter, Map map, List <ShipBase> shipsToDrop, TravelingShipArrivalAction arrivalAction, bool launchdAsSingleShip = false) { foreach (ShipBase current in shipsToDrop) { IntVec3 dropLoc; // if (TryFindShipDropLocationNear(dropCenter, 200, map, out dropLoc, current.def.size)) // if (DropCellFinder.TryFindRaidDropCenterClose(out dropLoc, map)) try { dropLoc = dropCenter; if (dropLoc.IsValid && launchdAsSingleShip) { Log.Message("Dropping single Ship"); } else { if (!DropShipUtility.TryFindShipDropSpotNear(current, dropCenter, map, out dropLoc, true, true)) { DropShipUtility.TryFindShipDropSpotNear(current, DropCellFinder.FindRaidDropCenterDistant(map), map, out dropLoc, true, true); } } current.drawTickOffset = current.compShip.sProps.TicksToImpact + Rand.Range(10, 60); current.ActivatedLaunchSequence = false; current.shipState = ShipState.Incoming; ShipBase_Traveling incomingShip = new ShipBase_Traveling(current, false, arrivalAction); // Log.Message("Dropping " + incomingShip.containingShip.ShipNick); GenSpawn.Spawn(incomingShip, dropLoc, map); } catch (Exception ex) { Log.Error("Couldn't drop ships in map: " + ex.ToString()); } } }
private void SpawnShipsInMap(Map map, string extraMessagePart = null) { this.RemoveAllPawnsFromWorldPawns(); IntVec3 intVec; if (this.destinationCell.IsValid && this.destinationCell.InBounds(map)) { intVec = this.destinationCell; } else if (this.arriveMode == PawnsArrivalModeDefOf.CenterDrop) { intVec = DropCellFinder.FindRaidDropCenterDistant(map); } else { if (this.arriveMode != PawnsArrivalModeDefOf.EdgeDrop) { Log.Warning("Unsupported arrive mode " + this.arriveMode); } Log.Message("Invalid Cell"); intVec = DropCellFinder.FindRaidDropCenterDistant(map); } string text = "MessageShipsArrived".Translate(); if (extraMessagePart != null) { text = text + " " + extraMessagePart; } DropShipUtility.DropShipGroups(intVec, map, this.ships, this.arrivalAction, this.isSingularShip); Messages.Message(text, new TargetInfo(intVec, map, false), MessageTypeDefOf.NeutralEvent); this.RemoveAllShip(); Find.WorldObjects.Remove(this); }
public void RevealInfiltrators(List <Pawn> pawns) { for (int i = 0; i < pawns.Count; i++) { // IntVec3 dropCenter = map.listerBuildings.allBuildingsColonist.FindAll(x => x.TryGetComp<CompPowerPlant>() != null).RandomElement().Position; IntVec3 dropCenter; if (DropCellFinder.TryFindRaidDropCenterClose(out dropCenter, map)) { if (RCellFinder.TryFindRandomSpotJustOutsideColony(dropCenter, map, out dropCenter)) { InfiltrateUtility.DropThingsNear(dropCenter, map, Gen.YieldSingle <Thing>(pawns[i]), 50, true, false, true); } else { InfiltrateUtility.DropThingsNear(dropCenter, map, Gen.YieldSingle <Thing>(pawns[i]), 50, true, false, true); } } else { dropCenter = DropCellFinder.FindRaidDropCenterDistant(map); if (RCellFinder.TryFindRandomSpotJustOutsideColony(dropCenter, map, out dropCenter)) { InfiltrateUtility.DropThingsNear(dropCenter, map, Gen.YieldSingle <Thing>(pawns[i]), 50, true, false, true); } else { InfiltrateUtility.DropThingsNear(dropCenter, map, Gen.YieldSingle <Thing>(pawns[i]), 50, true, false, true); } } } Find.LetterStack.ReceiveLetter("AMA_Infiltrators_Revealed".Translate(pawns.Find(x => x.Faction != null).Faction.def.pawnSingular), "AMA_Infiltrators_Revealed_Letter".Translate(pawns.Find(x => x.Faction != null).Faction.def.pawnsPlural), LetterDefOf.ThreatBig, pawns, pawns.Find(x => x.Faction != null).Faction, null); // Messages.Message("AMA_Infiltrators_Revealed".Translate(pawns.Find(x=> x.Faction!=null).Faction.Name), pawns, MessageTypeDefOf.ThreatBig); }
public override void PostMapGenerate() { if (!MercenaryBattle_Active) { return; } MapParent parent = (MapParent)this.parent; foreach (Pawn p in parent.Map.mapPawns.SpawnedPawnsInFaction(this.parent.Faction)) { p.Destroy(); } int side = Rand.Chance(0.5f) ? 0 : 1; for (int i = 0; i < 2; i++) { Faction f = i == 1 ? war.AttackerFaction() : f = war.DefenderFaction(); side = side == 0 ? 1 : 0; if (!RCellFinder.TryFindRandomPawnEntryCell(out IntVec3 vec3, parent.Map, 0, false, x => x.Standable(parent.Map) && (x.x == (side == 0 ? 0 : parent.Map.Size.x - 1)))) { vec3 = DropCellFinder.FindRaidDropCenterDistant(parent.Map); } Utilities.GenerateFighter(Mathf.Clamp((Utilities.FactionsWar().GetByFaction(f).resources / 10) + EndGame_Settings.MassiveBattles + StorytellerUtility.DefaultThreatPointsNow(parent.Map), 1000, 10000), LordMaker.MakeNewLord(f, new LordJob_AssaultColony(f, true, false, true), parent.Map), Utilities.GeneratePawnKindDef(65, f), parent.Map, f, vec3); } }
private static IntVec3 DistantCell(Map map) { IntVec3 cell; cell = DropCellFinder.FindRaidDropCenterDistant(map); return(cell); }
public override void TravelingTransportPodsArrived(List <ActiveDropPodInfo> dropPods, Map map) { if (!DropCellFinder.TryFindRaidDropCenterClose(out IntVec3 near, map, true, true, true, -1)) { near = DropCellFinder.FindRaidDropCenterDistant(map, false); } TransportPodsArrivalActionUtility.DropTravelingTransportPods(dropPods, near, map); }
// Token: 0x060045D5 RID: 17877 RVA: 0x0017826C File Offset: 0x0017646C public override bool TryResolveRaidSpawnCenter(IncidentParms parms) { Map map = (Map)parms.target; if (!parms.spawnCenter.IsValid) { parms.spawnCenter = DropCellFinder.FindRaidDropCenterDistant(map, false); } parms.spawnRotation = Rot4.Random; return(true); }
// Token: 0x06003B20 RID: 15136 RVA: 0x001373B8 File Offset: 0x001355B8 private static IntVec3 FindDropPodLocation(Map map, Predicate <IntVec3> validator) { for (int i = 0; i < 200; i++) { IntVec3 intVec = RCellFinder.FindSiegePositionFrom(DropCellFinder.FindRaidDropCenterDistant(map, true), map, true); if (validator(intVec)) { return(intVec); } } return(IntVec3.Invalid); }
public static void Enter(List <ShipBase> ships, Map map, bool centerDrop = true) { IntVec3 loc; if (centerDrop) { loc = TravelingShipsUtility.CenterCell(map); } else { loc = DropCellFinder.FindRaidDropCenterDistant(map); } DropShipUtility.DropShipGroups(loc, map, ships, ShipArrivalAction.EnterMapFriendly); }
private void SpawnDropPodsInMap(Map map, string extraMessagePart = null) { Utility.DebugReport("SpawnDropPodsInMap Called"); RemoveAllPawnsFromWorldPawns(); IntVec3 intVec; if (destinationCell.IsValid && destinationCell.InBounds(map)) { intVec = destinationCell; } else if (arriveMode == PawnsArrivalModeDefOf.CenterDrop) { if (!DropCellFinder.TryFindRaidDropCenterClose(out intVec, map)) { intVec = DropCellFinder.FindRaidDropCenterDistant(map); } } else { if (arriveMode != PawnsArrivalModeDefOf.EdgeDrop && arriveMode != PawnsArrivalModeDefOf.EdgeDrop) { Log.Warning("Unsupported arrive mode " + arriveMode); } intVec = DropCellFinder.FindRaidDropCenterDistant(map); } for (var i = 0; i < pods.Count; i++) { Utility.DebugReport("PawnFlyerIncoming Generation Started"); DropCellFinder.TryFindDropSpotNear(intVec, map, out var c, false, true); var pawnFlyerIncoming = (PawnFlyersIncoming)ThingMaker.MakeThing(PawnFlyerDef.incomingDef); pawnFlyerIncoming.pawnFlyer = pawnFlyer; pawnFlyerIncoming.Contents = pods[i]; GenSpawn.Spawn(pawnFlyerIncoming, c, map); } RemoveAllPods(); Find.WorldObjects.Remove(this); string text = "MessageTransportPodsArrived".Translate(); if (extraMessagePart != null) { text = text + " " + extraMessagePart; } Messages.Message(text, new TargetInfo(intVec, map), MessageTypeDefOf.PositiveEvent); }
public static void Enter(List <ShipBase> ships, Map map, bool centerDrop = true) { foreach (ShipBase ship in ships) { DropShipUtility.ReimbarkWorldPawnsForLandedShip(ship); } IntVec3 loc; if (centerDrop) { loc = TravelingShipsUtility.CenterCell(map); } else { loc = DropCellFinder.FindRaidDropCenterDistant(map); } DropShipUtility.DropShipGroups(loc, map, ships, TravelingShipArrivalAction.EnterMapFriendly); }
private void SpawnDropPodsInMap(Map map, string extraMessagePart = null) { this.RemoveAllPawnsFromWorldPawns(); IntVec3 intVec; if (this.destinationCell.IsValid && this.destinationCell.InBounds(map)) { intVec = this.destinationCell; } else if (this.arriveMode == PawnsArriveMode.CenterDrop) { if (!DropCellFinder.TryFindRaidDropCenterClose(out intVec, map)) { intVec = DropCellFinder.FindRaidDropCenterDistant(map); } } else { if (this.arriveMode != PawnsArriveMode.EdgeDrop && this.arriveMode != PawnsArriveMode.Undecided) { Log.Warning("Unsupported arrive mode " + this.arriveMode); } intVec = DropCellFinder.FindRaidDropCenterDistant(map); } for (int i = 0; i < this.pods.Count; i++) { IntVec3 c; DropCellFinder.TryFindDropSpotNear(intVec, map, out c, false, true); this.pods[i].parent = null; DropPodUtility.MakeDropPodAt(c, map, this.pods[i], false); } this.RemoveAllPods(); Find.WorldObjects.Remove(this); string text = "MessageTransportPodsArrived".Translate(); if (extraMessagePart != null) { text = text + " " + extraMessagePart; } Messages.Message(text, new TargetInfo(intVec, map, false), MessageTypeDefOf.TaskCompletion); }
public static void InitiateGovernorArrestEvent(Map map) { if (CorruptionStoryTrackerUtilities.currentStoryTracker.PlanetaryGovernor == null) { return; } Faction faction = CorruptionStoryTrackerUtilities.currentStoryTracker.ImperialGuard; List <Pawn> arbites = new List <Pawn>(); for (int i = 0; i < 5; i++) { Pawn member = PawnGenerator.GeneratePawn(PawnKindDef.Named("IoM_Arbites"), faction); arbites.Add(member); } OHUShips.ShipBase dropShip = (OHUShips.ShipBase)ThingMaker.MakeThing(ThingDef.Named("AquilaLander")); dropShip.shipState = OHUShips.ShipState.Incoming; dropShip.drawTickOffset = dropShip.compShip.sProps.TicksToImpact; Thing initialFuel = ThingMaker.MakeThing(DefOfs.C_ThingDefOfs.Chemfuel); initialFuel.stackCount = 2000; dropShip.refuelableComp.Refuel(initialFuel); dropShip.SetFaction(arbites[0].Faction); foreach (Pawn current in arbites) { dropShip.GetInnerContainer().TryAdd(current); } List <ShipBase> tmp = new List <ShipBase>(); tmp.Add(dropShip); IntVec3 dropCenter; if (!DropCellFinder.TryFindRaidDropCenterClose(out dropCenter, map)) { dropCenter = DropCellFinder.FindRaidDropCenterDistant(map); } DropShipUtility.DropShipGroups(dropCenter, map, tmp, TravelingShipArrivalAction.EnterMapFriendly); LordMaker.MakeNewLord(dropShip.Faction, new IoM.LordJob_ArrestGovernor(dropShip, dropCenter), map, arbites); }
private void SpawnShipsInMap(Map map, string extraMessagePart = null) { this.RemoveAllPawnsFromWorldPawns(); IntVec3 intVec; Log.Message("Dest: " + this.destinationCell.ToString()); if (this.destinationCell.IsValid && this.destinationCell.InBounds(map)) { intVec = this.destinationCell; } else if (this.arriveMode == PawnsArriveMode.CenterDrop) { if (!DropCellFinder.TryFindRaidDropCenterClose(out intVec, map)) { intVec = DropCellFinder.FindRaidDropCenterDistant(map); } } else { if (this.arriveMode != PawnsArriveMode.EdgeDrop && this.arriveMode != PawnsArriveMode.Undecided) { Log.Warning("Unsupported arrive mode " + this.arriveMode); } Log.Message("Invalid Cell"); intVec = DropCellFinder.FindRaidDropCenterDistant(map); } string text = "MessageShipsArrived".Translate(); if (extraMessagePart != null) { text = text + " " + extraMessagePart; } Log.Message("Dest2: " + intVec.ToString()); DropShipUtility.DropShipGroups(intVec, map, this.ships, this.arrivalAction, this.isSingularShip); Messages.Message(text, new TargetInfo(intVec, map, false), MessageSound.Benefit); this.RemoveAllPods(); Find.WorldObjects.Remove(this); }
// Token: 0x060045EE RID: 17902 RVA: 0x00178914 File Offset: 0x00176B14 private static IntVec3 FindNewMapEdgeGroupCenter(Map map, List <Pair <List <Pawn>, IntVec3> > groups, bool arriveInPods) { IntVec3 result = IntVec3.Invalid; float num = 0f; for (int i = 0; i < 4; i++) { IntVec3 intVec; if (arriveInPods) { intVec = DropCellFinder.FindRaidDropCenterDistant(map, false); } else if (!RCellFinder.TryFindRandomPawnEntryCell(out intVec, map, CellFinder.EdgeRoadChance_Hostile, false, null)) { intVec = DropCellFinder.FindRaidDropCenterDistant(map, false); } if (!groups.Any <Pair <List <Pawn>, IntVec3> >()) { result = intVec; break; } float num2 = float.MaxValue; for (int j = 0; j < groups.Count; j++) { float num3 = (float)intVec.DistanceToSquared(groups[j].Second); if (num3 < num2) { num2 = num3; } } if (!result.IsValid || num2 > num) { num = num2; result = intVec; } } return(result); }
public override bool TryExecute(IncidentParms parms) { Map map = (Map)parms.target; this.ResolveRaidPoints(parms); if (!this.TryResolveRaidFaction(parms)) { return(false); } IntVec3 dropCenter; dropCenter = DropCellFinder.FindRaidDropCenterDistant(map); this.ResolveRaidStrategy(parms); this.ResolveRaidArriveMode(parms); this.ResolveRaidSpawnCenter(parms); IncidentParmsUtility.AdjustPointsForGroupArrivalParams(parms); PawnGroupMakerParms defaultPawnGroupMakerParms = IncidentParmsUtility.GetDefaultPawnGroupMakerParms(parms); List <Pawn> list = PawnGroupMakerUtility.GeneratePawns(PawnGroupKindDefOf.Normal, defaultPawnGroupMakerParms, true).ToList <Pawn>(); if (list.Count == 0) { Log.Error("Got no pawns spawning raid from parms " + parms); return(false); } TargetInfo target = new TargetInfo(dropCenter, map); List <ShipBase> ships = DropShipUtility.CreateDropShips(list, parms.faction); DropShipUtility.DropShipGroups(dropCenter, map, ships, TravelingShipArrivalAction.EnterMapAssault); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("Points = " + parms.points.ToString("F0")); foreach (Pawn current2 in list) { string str = (current2.equipment == null || current2.equipment.Primary == null) ? "unarmed" : current2.equipment.Primary.LabelCap; stringBuilder.AppendLine(current2.KindLabel + " - " + str); } string letterLabel = this.GetLetterLabel(parms); string letterText = this.GetLetterText(parms, list); PawnRelationUtility.Notify_PawnsSeenByPlayer(list, ref letterLabel, ref letterText, this.GetRelatedPawnsInfoLetterText(parms), true); Find.LetterStack.ReceiveLetter(letterLabel, letterText, this.GetLetterDef(), target, stringBuilder.ToString()); if (this.GetLetterDef() == LetterDefOf.BadUrgent) { TaleRecorder.RecordTale(TaleDefOf.RaidArrived, new object[0]); } this.ResolveRaidParmOptions(parms); Lord lord = LordMaker.MakeNewLord(parms.faction, new LordJob_AerialAssault(ships, parms.faction, this.Kidnappers(parms.faction), true, this.UseSappers, this.SmartGrid, this.Stealers(parms.faction)), map, list); //Lord lord = LordMaker.MakeNewLord(parms.faction, new LordJob_AssaultColony(parms.faction, true, true, true, true, true), map, list); AvoidGridMaker.RegenerateAvoidGridsFor(parms.faction, map); LessonAutoActivator.TeachOpportunity(ConceptDefOf.EquippingWeapons, OpportunityType.Critical); if (!PlayerKnowledgeDatabase.IsComplete(ConceptDefOf.ShieldBelts)) { for (int i = 0; i < list.Count; i++) { Pawn pawn = list[i]; if (pawn.apparel.WornApparel.Any((Apparel ap) => ap is ShieldBelt)) { LessonAutoActivator.TeachOpportunity(ConceptDefOf.ShieldBelts, OpportunityType.Critical); break; } } } if (DebugViewSettings.drawStealDebug && parms.faction.HostileTo(Faction.OfPlayer)) { Log.Message(string.Concat(new object[] { "Market value threshold to start stealing: ", StealAIUtility.StartStealingMarketValueThreshold(lord), " (colony wealth = ", map.wealthWatcher.WealthTotal, ")" })); } return(true); }
// Token: 0x060045D4 RID: 17876 RVA: 0x0017824C File Offset: 0x0017644C public override void TravelingTransportPodsArrived(List <ActiveDropPodInfo> dropPods, Map map) { IntVec3 near = DropCellFinder.FindRaidDropCenterDistant(map, false); TunnelsArrivalActionUtility.PlaceTravelingTunnelers(dropPods, near, map); }