Пример #1
0
        public override bool TryResolveRaidSpawnCenter(IncidentParms parms)
        {
            Map map = (Map)parms.target;

            if (!parms.raidArrivalModeForQuickMilitaryAid)
            {
                parms.podOpenDelay = 520;
            }
            parms.spawnRotation = Rot4.Random;
            if (!parms.spawnCenter.IsValid)
            {
                bool flag  = parms.faction == Faction.OfMechanoids;
                bool flag2 = parms.faction != null && parms.faction.HostileTo(Faction.OfPlayer);
                if (Rand.Chance(0.4f) && !flag && map.listerBuildings.ColonistsHaveBuildingWithPowerOn(ThingDefOf.OrbitalTradeBeacon))
                {
                    parms.spawnCenter = DropCellFinder.TradeDropSpot(map);
                }
                else if (!DropCellFinder.TryFindRaidDropCenterClose(out parms.spawnCenter, map, !flag && flag2, !flag, true, -1))
                {
                    parms.raidArrivalMode = PawnsArrivalModeDefOf.EdgeDrop;
                    return(parms.raidArrivalMode.Worker.TryResolveRaidSpawnCenter(parms));
                }
            }
            return(true);
        }
Пример #2
0
 protected override bool CanFireNowSub(IncidentParms parms)
 {
     return(base.CanFireNowSub(parms: parms) && Find.World.GetComponent <WorldComponent_MFI_FactionWar>().WarIsOngoing &&
            FindAlliedWarringFaction(faction: out Faction _) &&
            CommsConsoleUtility.PlayerHasPoweredCommsConsole(map: (Map)parms.target) &&
            DropCellFinder.TryFindRaidDropCenterClose(spot: out IntVec3 _, map: (Map)parms.target));
 }
 public void RevealInfiltrators(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))
         {
             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_NewTemp(map, true);
             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("AdeptusMechanicus.Infiltrators_Revealed".Translate(pawns.Find(x => x.Faction != null).Faction.def.pawnSingular), "AdeptusMechanicus.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("AdeptusMechanicus.Infiltrators_Revealed".Translate(pawns.Find(x=> x.Faction!=null).Faction.Name), pawns, MessageTypeDefOf.ThreatBig);
 }
Пример #4
0
        // Token: 0x060045CC RID: 17868 RVA: 0x001780D4 File Offset: 0x001762D4
        public override void TravelingTransportPodsArrived(List <ActiveDropPodInfo> dropPods, Map map)
        {
            IntVec3 near;

            if (!DropCellFinder.TryFindRaidDropCenterClose(out near, map, true, true, true, -1))
            {
                near = DropCellFinder.FindRaidDropCenterDistant_NewTemp(map, false);
            }
            TunnelsArrivalActionUtility.PlaceTravelingTunnelers(dropPods, near, map);
        }
 public void ArriveTeleport(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]), 0, true, false, true, DeepStrikeType.Teleport);
         }
     }
     Teleporters.Clear();
 }
Пример #6
0
        public static PawnsArrivalModeDef ResolveRaidArriveMode(IncidentParms parms)
        {
            Map map = (Map)parms.target;

            if (Rand.Chance(0.35f))
            {
                DropCellFinder.TryFindRaidDropCenterClose(out parms.spawnCenter, map);
                return(PawnsArrivalModeDefOf.CenterDrop);
            }

            CellFinder.TryFindRandomEdgeCellWith(x => x.Walkable(map) && !x.Fogged(map) && x.Standable(map), map, 0f, out parms.spawnCenter);
            return(PawnsArrivalModeDefOf.EdgeWalkIn);
        }
        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);
        }
        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);
        }
Пример #9
0
        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);
        }
Пример #10
0
        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);
        }