상속: Structure
예제 #1
0
        private void LaunchShip(CraftTemplate ship, ListValue crew, StringValue launchSiteName)
        {
            // From EditorLogic, see launchVessel(), proceedWithVesselLaunch(), and goForLaunch()
            var manifest = BuildCrewManifest(ship.InnerTemplate, crew);

            LaunchShipInternal(ship, launchSiteName.ToString(), manifest);
        }
예제 #2
0
        public void LaunchShip(CraftTemplate ship, StringValue launchSiteName)
        {
            var manifest = VesselCrewManifest.FromConfigNode(ship.InnerTemplate.config);

            manifest = HighLogic.CurrentGame.CrewRoster.DefaultCrewForVessel(ship.InnerTemplate.config, manifest);
            LaunchShipInternal(ship, launchSiteName.ToString(), manifest);
        }
예제 #3
0
        private void LaunchShip(CraftTemplate ship)
        {
            var manifest = VesselCrewManifest.FromConfigNode(ship.InnerTemplate.config);

            manifest = HighLogic.CurrentGame.CrewRoster.DefaultCrewForVessel(ship.InnerTemplate.config, manifest);
            LaunchShipInternal(ship, ship.LaunchFacility, manifest);
        }
예제 #4
0
        private void LaunchShip(CraftTemplate ship, string launchSiteName)
        {
            // From EditorLogic, see launchVessel(), proceedWithVesselLaunch(), and goForLaunch()
            var manifest = VesselCrewManifest.FromConfigNode(ship.InnerTemplate.config);

            manifest = HighLogic.CurrentGame.CrewRoster.DefaultCrewForVessel(ship.InnerTemplate.config, manifest);
            PreFlightCheck preFlightCheck = new PreFlightCheck(
                () =>
            {
                SafeHouse.Logger.Log("Launch new vessel!");
                FlightDriver.StartWithNewLaunch(ship.FilePath, EditorLogic.FlagURL, launchSiteName, manifest);
            },
                () =>
            {
                SafeHouse.Logger.LogError("Could not launch vessel, did not pass preflight...");
            });

            if (launchSiteName.Equals("runway", System.StringComparison.OrdinalIgnoreCase))
            {
                preFlightCheck.AddTest(new CraftWithinPartCountLimit(ship.InnerTemplate, SpaceCenterFacility.SpaceplaneHangar, GameVariables.Instance.GetPartCountLimit(ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.SpaceplaneHangar), false)));
                preFlightCheck.AddTest(new CraftWithinSizeLimits(ship.InnerTemplate, SpaceCenterFacility.Runway, GameVariables.Instance.GetCraftSizeLimit(ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.Runway), false)));
                preFlightCheck.AddTest(new CraftWithinMassLimits(ship.InnerTemplate, SpaceCenterFacility.Runway, (double)GameVariables.Instance.GetCraftMassLimit(ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.Runway), false)));
            }
            else if (launchSiteName.Equals("launchpad", System.StringComparison.OrdinalIgnoreCase))
            {
                preFlightCheck.AddTest(new CraftWithinPartCountLimit(ship.InnerTemplate, SpaceCenterFacility.VehicleAssemblyBuilding, GameVariables.Instance.GetPartCountLimit(ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.VehicleAssemblyBuilding), true)));
                preFlightCheck.AddTest(new CraftWithinSizeLimits(ship.InnerTemplate, SpaceCenterFacility.LaunchPad, GameVariables.Instance.GetCraftSizeLimit(ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.LaunchPad), true)));
                preFlightCheck.AddTest(new CraftWithinMassLimits(ship.InnerTemplate, SpaceCenterFacility.LaunchPad, (double)GameVariables.Instance.GetCraftMassLimit(ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.LaunchPad), true)));
            }
            else
            {
                throw new KOSException("Failed to lauch vessel, unrecognized lauch site: " + launchSiteName + ". Expected \"Runway\" or \"LaunchPad\".");
            }
            preFlightCheck.AddTest(new ExperimentalPartsAvailable(manifest));
            preFlightCheck.AddTest(new CanAffordLaunchTest(ship.InnerTemplate, Funding.Instance));
            preFlightCheck.AddTest(new FacilityOperational(launchSiteName, launchSiteName));
            preFlightCheck.AddTest(new NoControlSources(manifest));
            preFlightCheck.AddTest(new LaunchSiteClear(launchSiteName, launchSiteName, HighLogic.CurrentGame));
            preFlightCheck.RunTests();
            shared.Cpu.GetCurrentOpcode().AbortProgram = true;
            SafeHouse.Logger.Log("Craft waiting for preflight checks!");
        }
예제 #5
0
 public void LaunchShip(CraftTemplate ship, StringValue launchSiteName)
 {
     LaunchShip(ship, launchSiteName.ToString());
 }
예제 #6
0
 private void LaunchShip(CraftTemplate ship)
 {
     LaunchShip(ship, ship.LaunchFacility);
 }
예제 #7
0
 public CraftTemplate GetCraft(StringValue name, StringValue editor)
 {
     return(CraftTemplate.GetTemplateByName(name, editor));
 }
예제 #8
0
 private void LaunchShip(CraftTemplate ship, string launchSiteName)
 {
     // From EditorLogic, see launchVessel(), proceedWithVesselLaunch(), and goForLaunch()
     var manifest = VesselCrewManifest.FromConfigNode(ship.InnerTemplate.config);
     manifest = HighLogic.CurrentGame.CrewRoster.DefaultCrewForVessel(ship.InnerTemplate.config, manifest);
     PreFlightCheck preFlightCheck = new PreFlightCheck(
         () =>
         {
             SafeHouse.Logger.Log("Launch new vessel!");
             FlightDriver.StartWithNewLaunch(ship.FilePath, EditorLogic.FlagURL, launchSiteName, manifest);
         },
         () =>
         {
             SafeHouse.Logger.LogError("Could not launch vessel, did not pass preflight...");
         });
     if (launchSiteName.Equals("runway", System.StringComparison.OrdinalIgnoreCase))
     {
         preFlightCheck.AddTest(new CraftWithinPartCountLimit(ship.InnerTemplate, SpaceCenterFacility.SpaceplaneHangar, GameVariables.Instance.GetPartCountLimit(ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.SpaceplaneHangar), false)));
         preFlightCheck.AddTest(new CraftWithinSizeLimits(ship.InnerTemplate, SpaceCenterFacility.Runway, GameVariables.Instance.GetCraftSizeLimit(ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.Runway), false)));
         preFlightCheck.AddTest(new CraftWithinMassLimits(ship.InnerTemplate, SpaceCenterFacility.Runway, (double)GameVariables.Instance.GetCraftMassLimit(ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.Runway), false)));
     }
     else if (launchSiteName.Equals("launchpad", System.StringComparison.OrdinalIgnoreCase))
     {
         preFlightCheck.AddTest(new CraftWithinPartCountLimit(ship.InnerTemplate, SpaceCenterFacility.VehicleAssemblyBuilding, GameVariables.Instance.GetPartCountLimit(ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.VehicleAssemblyBuilding), true)));
         preFlightCheck.AddTest(new CraftWithinSizeLimits(ship.InnerTemplate, SpaceCenterFacility.LaunchPad, GameVariables.Instance.GetCraftSizeLimit(ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.LaunchPad), true)));
         preFlightCheck.AddTest(new CraftWithinMassLimits(ship.InnerTemplate, SpaceCenterFacility.LaunchPad, (double)GameVariables.Instance.GetCraftMassLimit(ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.LaunchPad), true)));
     }
     else
     {
         throw new KOSException("Failed to lauch vessel, unrecognized lauch site: " + launchSiteName + ". Expected \"Runway\" or \"LaunchPad\".");
     }
     preFlightCheck.AddTest(new ExperimentalPartsAvailable(manifest));
     preFlightCheck.AddTest(new CanAffordLaunchTest(ship.InnerTemplate, Funding.Instance));
     preFlightCheck.AddTest(new FacilityOperational(launchSiteName, launchSiteName));
     preFlightCheck.AddTest(new NoControlSources(manifest));
     preFlightCheck.AddTest(new LaunchSiteClear(launchSiteName, HighLogic.CurrentGame));
     preFlightCheck.RunTests();
     shared.Cpu.GetCurrentOpcode().AbortProgram = true;
     SafeHouse.Logger.Log("Craft waiting for preflight checks!");
 }
예제 #9
0
 private void LaunchShip(CraftTemplate ship)
 {
     LaunchShip(ship, ship.LaunchFacility);
 }
예제 #10
0
 public void LaunchShip(CraftTemplate ship, StringValue launchSiteName)
 {
     LaunchShip(ship, launchSiteName.ToString());
 }