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); }
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); }
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); }
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!"); }
public void LaunchShip(CraftTemplate ship, StringValue launchSiteName) { LaunchShip(ship, launchSiteName.ToString()); }
private void LaunchShip(CraftTemplate ship) { LaunchShip(ship, ship.LaunchFacility); }
public CraftTemplate GetCraft(StringValue name, StringValue editor) { return(CraftTemplate.GetTemplateByName(name, editor)); }
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!"); }