Esempio n. 1
0
        public static void Settle(AerialVehicleInFlight aerialVehicle)
        {
            Faction faction = aerialVehicle.Faction;

            if (faction != Faction.OfPlayer)
            {
                Log.Error("Cannot settle with non-player faction.");
                return;
            }
            Settlement newHome = SettleUtility.AddNewHome(aerialVehicle.Tile, faction);

            LongEventHandler.QueueLongEvent(delegate()
            {
                GetOrGenerateMapUtility.GetOrGenerateMap(aerialVehicle.Tile, Find.World.info.initialMapSize, null);
            }, "GeneratingMap", true, new Action <Exception>(GameAndMapInitExceptionHandlers.ErrorWhileGeneratingMap), true);
            LongEventHandler.QueueLongEvent(delegate()
            {
                IntVec3 landingCell = GetLandingCell(newHome.Map, aerialVehicle);
                //AerialVehicleArrivalAction_LandSpecificCell arrivalAction = new AerialVehicleArrivalAction_LandSpecificCell(aerialVehicle.vehicle, newHome, aerialVehicle.Tile,
                //	aerialVehicle.vehicle.CompVehicleLauncher.launchProtocols.FirstOrDefault(), landingCell, Rot4.North);
                //arrivalAction.Arrived(aerialVehicle.Tile);
                VehiclePawn vehicle = (VehiclePawn)GenSpawn.Spawn(aerialVehicle.vehicle, landingCell, newHome.Map);
                CameraJumper.TryJump(vehicle);
                aerialVehicle.Destroy();
            }, "SpawningColonists", true, new Action <Exception>(GameAndMapInitExceptionHandlers.ErrorWhileGeneratingMap), true);
        }
 public override void Arrived(int tile)
 {
     LongEventHandler.QueueLongEvent(delegate()
     {
         Map map            = GetOrGenerateMapUtility.GetOrGenerateMap(tile, null);      //MAP INDEX BUG
         TaggedString label = "LetterLabelCaravanEnteredEnemyBase".Translate();
         TaggedString text  = "LetterTransportPodsLandedInEnemyBase".Translate(parent.Label).CapitalizeFirst();
         if (parent is Settlement settlement)
         {
             SettlementUtility.AffectRelationsOnAttacked(settlement, ref text);
         }
         if (!parent.HasMap)
         {
             Find.TickManager.Notify_GeneratedPotentiallyHostileMap();
             PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter(map.mapPawns.AllPawns, ref label, ref text, "LetterRelatedPawnsInMapWherePlayerLanded".Translate(Faction.OfPlayer.def.pawnsPlural), true, true);
         }
         AerialVehicleInFlight aerialVehicle = vehicle.GetAerialVehicle();
         CameraJumper.TryJump(map.Center, map);
         StrafeTargeter.Instance.BeginTargeting(vehicle, vehicle.CompVehicleLauncher.launchProtocol, delegate(IntVec3 start, IntVec3 end)
         {
             VehicleSkyfaller_FlyOver skyfaller = VehicleSkyfallerMaker.MakeSkyfallerFlyOver(vehicle.CompVehicleLauncher.Props.skyfallerStrafing, vehicle, start, end);
             skyfaller.aerialVehicle            = aerialVehicle;
             Thing thing = GenSpawn.Spawn(skyfaller, start, parent.Map, Rot8.North);                     //REDO - Other rotations?
         }, null, null, null, true);
         aerialVehicle.Destroy();
     }, "GeneratingMap", false, null, true);
 }
Esempio n. 3
0
 public override void Arrived(int tile)
 {
     LongEventHandler.QueueLongEvent(delegate()
     {
         Map map            = GetOrGenerateMapUtility.GetOrGenerateMap(tile, null);
         TaggedString label = "LetterLabelCaravanEnteredEnemyBase".Translate();
         TaggedString text  = "LetterTransportPodsLandedInEnemyBase".Translate(settlement.Label).CapitalizeFirst();
         SettlementUtility.AffectRelationsOnAttacked(settlement, ref text);
         if (!settlement.HasMap)
         {
             Find.TickManager.Notify_GeneratedPotentiallyHostileMap();
             PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter(map.mapPawns.AllPawns, ref label, ref text, "LetterRelatedPawnsInMapWherePlayerLanded".Translate(Faction.OfPlayer.def.pawnsPlural), true, true);
         }
         Find.LetterStack.ReceiveLetter(label, text, LetterDefOf.NeutralEvent, vehicle, settlement.Faction, null, null, null);
         AerialVehicleInFlight aerialVehicle = vehicle.GetAerialVehicle();
         arrivalModeDef.Worker.VehicleArrived(aerialVehicle, launchProtocol, settlement.Map);
         aerialVehicle.Destroy();
     }, "GeneratingMap", false, null, true);
 }