Beispiel #1
0
 protected override void LeaveMap()
 {
     if (!createWorldObject)
     {
         base.LeaveMap();
         return;
     }
     if (flightPath.Any(node => node.tile < 0))
     {
         Log.Error("AerialVehicle left the map but has a flight path Tile that is invalid. Removing node from path.");
         flightPath.RemoveAll(node => node.tile < 0);
         if (flightPath.NullOrEmpty())
         {
             //REDO - Handle better here
             return;
         }
     }
     Messages.Message($"{vehicle.LabelShort} LEFT", MessageTypeDefOf.PositiveEvent);
     if (createWorldObject)
     {
         AerialVehicleInFlight flyingVehicle = (AerialVehicleInFlight)WorldObjectMaker.MakeWorldObject(WorldObjectDefOfVehicles.AerialVehicle);
         flyingVehicle.vehicle = vehicle;
         flyingVehicle.Tile    = Map.Tile;
         flyingVehicle.SetFaction(vehicle.Faction);
         flyingVehicle.OrderFlyToTiles(new List <FlightNode>(flightPath), Find.WorldGrid.GetTileCenter(Map.Tile), arrivalAction);
         if (orderRecon)
         {
             flyingVehicle.flightPath.ReconCircleAt(flightPath.LastOrDefault().tile);
         }
         flyingVehicle.Initialize();
         Find.WorldObjects.Add(flyingVehicle);
     }
     Destroy(DestroyMode.Vanish);
 }
Beispiel #2
0
        protected virtual void ExitMap()
        {
            AerialVehicleInFlight flyingVehicle = (AerialVehicleInFlight)WorldObjectMaker.MakeWorldObject(WorldObjectDefOfVehicles.AerialVehicle);

            flyingVehicle.vehicle = vehicle;
            flyingVehicle.Tile    = Map.Tile;
            flyingVehicle.SetFaction(vehicle.Faction);
            flyingVehicle.OrderFlyToTiles(aerialVehicle.flightPath.Path, Find.WorldGrid.GetTileCenter(Map.Tile), aerialVehicle.arrivalAction);
            //Recon edge case?
            flyingVehicle.Initialize();
            Find.WorldObjects.Add(flyingVehicle);
            Destroy();
        }
Beispiel #3
0
        private static void SpawnCrashingShuttle()
        {
            List <DebugMenuOption> list = new List <DebugMenuOption>();

            foreach (VehicleDef vehicleDef in DefDatabase <VehicleDef> .AllDefs.OrderBy(d => d.defName))
            {
                list.Add(new DebugMenuOption(vehicleDef.defName, DebugMenuOptionMode.Tool, delegate()
                {
                    Faction faction     = Faction.OfPlayer;
                    VehiclePawn vehicle = VehicleSpawner.GenerateVehicle(vehicleDef, faction);
                    vehicle.CompVehicleLauncher?.InitializeLaunchProtocols(false);
                    AerialVehicleInFlight flyingVehicle = (AerialVehicleInFlight)WorldObjectMaker.MakeWorldObject(WorldObjectDefOfVehicles.AerialVehicle);
                    flyingVehicle.vehicle = vehicle;
                    flyingVehicle.vehicle.CompVehicleLauncher.inFlight = true;
                    flyingVehicle.Tile = Find.CurrentMap.Tile;
                    flyingVehicle.SetFaction(vehicle.Faction);
                    flyingVehicle.Initialize();
                    (VehicleIncidentDefOf.BlackHawkDown.Worker as IncidentWorker_ShuttleDowned).TryExecuteEvent(flyingVehicle, null, Verse.UI.MouseCell());
                }));
            }
            Find.WindowStack.Add(new Dialog_DebugOptionListLister(list));
        }