diff --git a/FNPlugin/Extensions/OrbitExtensions.cs b/FNPlugin/Extensions/OrbitExtensions.cs index 098f852a..b05a5bac 100644 --- a/FNPlugin/Extensions/OrbitExtensions.cs +++ b/FNPlugin/Extensions/OrbitExtensions.cs @@ -15,35 +15,35 @@ public static Orbit Clone(this Orbit orbit0) } // Perturb an orbit by a deltaV vector - public static void Perturb(this Orbit orbit, Vector3d deltaVV, double UniversalTime, double deltaTime) + public static void Perturb(this Orbit orbit, Vector3d deltaVV, double universalTime, double deltaTime) { // If there is a deltaV, perturb orbit if (deltaVV.magnitude <= 0) return; // Transpose deltaVV Y and Z to match orbit frame Vector3d deltaVV_orbit = deltaVV.xzy; - Vector3d position = orbit.getRelativePositionAtUT(UniversalTime); - //Orbit orbit2 = orbit.Clone(); - //orbit2.UpdateFromStateVectors(position, orbit.getOrbitalVelocityAtUT(UniversalTime) + deltaVV_orbit, orbit.referenceBody, UniversalTime); - //if (!double.IsNaN(orbit2.inclination) && !double.IsNaN(orbit2.eccentricity) && !double.IsNaN(orbit2.semiMajorAxis) && orbit2.timeToAp > deltaTime) - //{ - // orbit.inclination = orbit2.inclination; - // orbit.eccentricity = orbit2.eccentricity; - // orbit.semiMajorAxis = orbit2.semiMajorAxis; - // orbit.LAN = orbit2.LAN; - // orbit.argumentOfPeriapsis = orbit2.argumentOfPeriapsis; - // orbit.meanAnomalyAtEpoch = orbit2.meanAnomalyAtEpoch; - // orbit.epoch = orbit2.epoch; - // orbit.referenceBody = orbit2.referenceBody; - // orbit.Init(); - // orbit.UpdateFromUT(UniversalTime); - //} - //else - //{ - orbit.UpdateFromStateVectors(position, orbit.getOrbitalVelocityAtUT(UniversalTime) + deltaVV_orbit, orbit.referenceBody, UniversalTime); + Vector3d position = orbit.getRelativePositionAtUT(universalTime); + Orbit orbit2 = orbit.Clone(); + orbit2.UpdateFromStateVectors(position, orbit.getOrbitalVelocityAtUT(universalTime) + deltaVV_orbit, orbit.referenceBody, universalTime); + if (!double.IsNaN(orbit2.inclination) && !double.IsNaN(orbit2.eccentricity) && !double.IsNaN(orbit2.semiMajorAxis) && orbit2.timeToAp > deltaTime) + { + orbit.inclination = orbit2.inclination; + orbit.eccentricity = orbit2.eccentricity; + orbit.semiMajorAxis = orbit2.semiMajorAxis; + orbit.LAN = orbit2.LAN; + orbit.argumentOfPeriapsis = orbit2.argumentOfPeriapsis; + orbit.meanAnomalyAtEpoch = orbit2.meanAnomalyAtEpoch; + orbit.epoch = orbit2.epoch; + orbit.referenceBody = orbit2.referenceBody; orbit.Init(); - orbit.UpdateFromUT(UniversalTime); - //} + orbit.UpdateFromUT(universalTime); + } + else + { + orbit.UpdateFromStateVectors(position, orbit.getOrbitalVelocityAtUT(universalTime) + deltaVV_orbit, orbit.referenceBody, universalTime); + orbit.Init(); + orbit.UpdateFromUT(universalTime); + } } } diff --git a/FNPlugin/Properties/AssemblyInfo.cs b/FNPlugin/Properties/AssemblyInfo.cs index 6b6b736f..c493ac0b 100644 --- a/FNPlugin/Properties/AssemblyInfo.cs +++ b/FNPlugin/Properties/AssemblyInfo.cs @@ -33,5 +33,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.6.6.0")] -[assembly: AssemblyFileVersion("1.6.6.0")] +[assembly: AssemblyVersion("1.6.7.0")] +[assembly: AssemblyFileVersion("1.6.7.0")] diff --git a/FNPlugin/Propulsion/AlcubierreDrive.cs b/FNPlugin/Propulsion/AlcubierreDrive.cs index dc988fdf..ff4b7d1b 100644 --- a/FNPlugin/Propulsion/AlcubierreDrive.cs +++ b/FNPlugin/Propulsion/AlcubierreDrive.cs @@ -646,13 +646,13 @@ public void FixedUpdate() // FixedUpdate is also called when not activated { vesselTotalMass = vessel.GetTotalMass(); gravityPull = (float)FlightGlobals.getGeeForceAtPosition(vessel.GetWorldPos3D()).magnitude; - maximumWarpForGravityPull = 1 / Mathf.Pow(gravityPull, 2); + maximumWarpForGravityPull = 1 / (Mathf.Pow(gravityPull, 1.5f) * 2); maximumWarpSpeedFactor = GetMaximumFactor(maximumWarpForGravityPull); maximumAllowedWarpThrotle = engine_throtle[maximumWarpSpeedFactor]; minimumPowerAllowedFactor = maximumWarpSpeedFactor > minimum_selected_factor ? maximumWarpSpeedFactor : minimum_selected_factor; } - if (vesselTotalMass != 0) + if (sumOfAlcubierreDrives != 0 && vesselTotalMass != 0) { warpToMassRatio = sumOfAlcubierreDrives / vesselTotalMass; exotic_power_required = (GameConstants.initial_alcubierre_megajoules_required * vesselTotalMass) / warpToMassRatio; @@ -697,7 +697,7 @@ public override void OnFixedUpdate() WarpdriveCharging(); - UpdateWarpspeed(); + UpdateWarpSpeed(); } private void UpdateWarpDriveStatus(float currentExoticMatter, double lostWarpFieldForWarp) @@ -780,7 +780,7 @@ private float GetPowerRequirementForWarp(float lightspeedFraction) private int insufficientPowerTimeout = 10; - public void UpdateWarpspeed() + public void UpdateWarpSpeed() { if (!IsEnabled || exotic_power_required <= 0) return; diff --git a/FNPlugin/Propulsion/ModuleEnginesWarp.cs b/FNPlugin/Propulsion/ModuleEnginesWarp.cs index 00a873c4..3aa74174 100644 --- a/FNPlugin/Propulsion/ModuleEnginesWarp.cs +++ b/FNPlugin/Propulsion/ModuleEnginesWarp.cs @@ -5,8 +5,6 @@ namespace FNPlugin { - //public class ModuleEnginesWarp: WarpModuleEnginesFX {} - public class ModuleEnginesWarp : ModuleEnginesFX { // GUI display values @@ -135,7 +133,7 @@ public override void OnFixedUpdate() { double vesselMass = this.vessel.GetTotalMass(); // Current mass double m1 = vesselMass - dm; // Mass at end of burn - double deltaV = IspPersistent * 9.81 * Math.Log(vesselMass / m1); // Delta V from burn + double deltaV = IspPersistent * PluginHelper.GravityConstant * Math.Log(vesselMass / m1); // Delta V from burn Vector3d thrustV = this.part.transform.up; // Thrust direction Vector3d deltaVV = deltaV * thrustV; // DeltaV vector diff --git a/FNPlugin/Propulsion/ModuleEnginesWarpvISTA.cs b/FNPlugin/Propulsion/ModuleEnginesWarpvISTA.cs new file mode 100644 index 00000000..f7c3562d --- /dev/null +++ b/FNPlugin/Propulsion/ModuleEnginesWarpvISTA.cs @@ -0,0 +1,192 @@ +using System; +using System.Linq; +using UnityEngine; +using FNPlugin.Extensions; + +namespace FNPlugin +{ + public class ModuleEnginesWarpVista : ModuleEngines + { + // GUI display values + [KSPField(isPersistant = true)] + bool IsForceActivated; + + [KSPField(guiActive = true, guiName = "Warp Thrust")] + protected string Thrust = ""; + [KSPField(guiActive = true, guiName = "Warp Isp")] + protected string Isp = ""; + [KSPField(guiActive = true, guiName = "Warp Throttle")] + protected string Throttle = ""; + + [KSPField(guiActive = true, guiName = "Mass Flow", guiFormat = "F8", guiUnits=" U")] + public float totalMassFlow; + [KSPField(guiActive = true, guiName = "Hydrogen Used", guiFormat = "F6")] + public float propellantUsed; + [KSPField(guiActive = true, guiName = "Deuterium Used", guiFormat = "F6")] + public float deuteriumUsed; + [KSPField(guiActive = true, guiName = "Tritium Used", guiFormat = "F6")] + public float tritiumUsed; + + // Numeric display values + protected double thrust_d = 0; + protected double isp_d = 0; + protected double throttle_d = 0; + + // Persistent values to use during timewarp + float IspPersistent = 0; + float ThrustPersistent = 0; + float ThrottlePersistent = 0; + float previousThrottle = 0; + + // Are we transitioning from timewarp to reatime? + [KSPField] + bool warpToReal = false; + + // Density of resource + float densityHydrogen; + float densityDeuterium; + float densityTritium; + + Propellant hydrogenPropellant; + Propellant deuteriumPropellant; + Propellant tritiumPropellant; + + // Update + public override void OnUpdate() + { + // When transitioning from timewarp to real update throttle + if (warpToReal) + { + vessel.ctrlState.mainThrottle = ThrottlePersistent; + warpToReal = false; + } + + // Persistent thrust GUI + Fields["Thrust"].guiActive = isEnabled; + Fields["Isp"].guiActive = isEnabled; + Fields["Throttle"].guiActive = isEnabled; + + // Update display values + Thrust = FormatThrust(thrust_d); + Isp = Math.Round(isp_d, 2).ToString() + " s"; + Throttle = Math.Round(throttle_d * 100).ToString() + "%"; + + if (!IsForceActivated && isEnabled && isOperational) + { + IsForceActivated = true; + part.force_activate(); + } + } + + // Initialization + public override void OnLoad(ConfigNode node) + { + // Run base OnLoad method + base.OnLoad(node); + + // Initialize density of propellant used in deltaV and mass calculations + densityHydrogen = PartResourceLibrary.Instance.GetDefinition(InterstellarResourcesConfiguration.Instance.Hydrogen).density; + densityDeuterium = PartResourceLibrary.Instance.GetDefinition(InterstellarResourcesConfiguration.Instance.Deuterium).density; + densityTritium = PartResourceLibrary.Instance.GetDefinition(InterstellarResourcesConfiguration.Instance.Tritium).density; + + hydrogenPropellant = this.propellants.FirstOrDefault(pr => pr.name == InterstellarResourcesConfiguration.Instance.Hydrogen); + deuteriumPropellant = this.propellants.FirstOrDefault(pr => pr.name == InterstellarResourcesConfiguration.Instance.Deuterium); + tritiumPropellant = this.propellants.FirstOrDefault(pr => pr.name == InterstellarResourcesConfiguration.Instance.Tritium); + } + + // Physics update + public override void OnFixedUpdate() + { + if (FlightGlobals.fetch == null || !isEnabled) return; + + totalMassFlow = this.requestedMassFlow; + + // retreive ratios + var propellant_ratio = hydrogenPropellant.ratio; + var deuterium_ratio = deuteriumPropellant.ratio; + var tritium_ratio = tritiumPropellant.ratio; + var sumOfRatios = propellant_ratio + deuterium_ratio + tritium_ratio; + + // Resource demand + float demandReqPropellant = ((propellant_ratio / sumOfRatios) * this.requestedMassFlow) / densityHydrogen; + float demandReqDeuterium = ((deuterium_ratio / sumOfRatios) * this.requestedMassFlow) / densityDeuterium; + float demandReqTritium = ((tritium_ratio / sumOfRatios) * this.requestedMassFlow) / densityTritium; + + // Realtime mode + if (!this.vessel.packed) + { + // Resource demand + propellantUsed = demandReqPropellant; + deuteriumUsed = demandReqDeuterium; + tritiumUsed = demandReqTritium; + + // if not transitioning from warp to real + // Update values to use during timewarp + if (!warpToReal) //&& vessel.ctrlState.mainThrottle == previousThrottle) + { + IspPersistent = realIsp; + ThrottlePersistent = vessel.ctrlState.mainThrottle; + + this.CalculateThrust(); + // verify we have thrust + if ((vessel.ctrlState.mainThrottle > 0 && finalThrust > 0) || (vessel.ctrlState.mainThrottle == 0 && finalThrust == 0)) + ThrustPersistent = finalThrust; + } + } + else if (part.vessel.situation != Vessel.Situations.SUB_ORBITAL) + { + // Timewarp mode: perturb orbit using thrust + warpToReal = true; // Set to true for transition to realtime + double UT = Planetarium.GetUniversalTime(); // Universal time + + propellantUsed = (float)part.RequestResource(InterstellarResourcesConfiguration.Instance.Hydrogen, demandReqPropellant * TimeWarp.fixedDeltaTime) / TimeWarp.fixedDeltaTime; + deuteriumUsed = (float)part.RequestResource(InterstellarResourcesConfiguration.Instance.Deuterium, demandReqDeuterium * TimeWarp.fixedDeltaTime) / TimeWarp.fixedDeltaTime; + tritiumUsed = (float)part.RequestResource(InterstellarResourcesConfiguration.Instance.Tritium, demandReqTritium * TimeWarp.fixedDeltaTime) / TimeWarp.fixedDeltaTime; + + // Calculate thrust and deltaV if demand output > 0 + if (propellantUsed > 0 && deuteriumUsed > 0 && tritiumUsed > 0) + { + double vesselMass = this.vessel.GetTotalMass(); // Current mass + double m1 = vesselMass - (this.requestedMassFlow * TimeWarp.fixedDeltaTime); // Mass at end of burn + + if (m1 <= 0 || vesselMass <= 0) + return; + + double deltaV = IspPersistent * PluginHelper.GravityConstant * Math.Log(vesselMass / m1); // Delta V from burn + + Vector3d thrustV = this.part.transform.up; // Thrust direction + Vector3d deltaVV = deltaV * thrustV; // DeltaV vector + vessel.orbit.Perturb(deltaVV, UT, TimeWarp.fixedDeltaTime); // Update vessel orbit + } + // Otherwise, if throttle is turned on, and demand out is 0, show warning + else if (ThrottlePersistent > 0) + { + ScreenMessages.PostScreenMessage("Out of resource", 5.0f); + } + } + else //if (vessel.ctrlState.mainThrottle > 0) + { + ScreenMessages.PostScreenMessage("Cannot accelerate and timewarp durring sub orbital spaceflight!", 5.0f, ScreenMessageStyle.UPPER_CENTER); + } + + + // Update display numbers + thrust_d = ThrustPersistent; + isp_d = IspPersistent; + throttle_d = ThrottlePersistent; + previousThrottle = vessel.ctrlState.mainThrottle; + } + + // Format thrust into mN, N, kN + public static string FormatThrust(double thrust) + { + if (thrust < 0.001) + return Math.Round(thrust * 1000000.0, 3).ToString() + " mN"; + else if (thrust < 1.0) + return Math.Round(thrust * 1000.0, 3).ToString() + " N"; + else + return Math.Round(thrust, 3).ToString() + " kN"; + } + } + +} \ No newline at end of file diff --git a/FNPlugin/Propulsion/VistaEngineController.cs b/FNPlugin/Propulsion/VistaEngineController.cs index 23089dd8..81061c71 100644 --- a/FNPlugin/Propulsion/VistaEngineController.cs +++ b/FNPlugin/Propulsion/VistaEngineController.cs @@ -217,7 +217,7 @@ public override void OnFixedUpdate() if (curEngineT == null) return; - float throttle = curEngineT.currentThrottle; + float throttle = curEngineT.currentThrottle > 0 ? Mathf.Max(curEngineT.currentThrottle, 0.01f) : 0; //double atmo_thrust_factor = Math.Min(1.0, Math.Max(1.0 - Math.Pow(vessel.atmDensity, 0.2), 0)); @@ -270,12 +270,17 @@ public override void OnFixedUpdate() } else { + var currentIsp = minISP * 100; + FloatCurve newISP = new FloatCurve(); - newISP.Add(0, (float)minISP); + newISP.Add(0, (float)currentIsp); curEngineT.atmosphereCurve = newISP; - var maxFuelFlow = MaximumThrust / minISP / PluginHelper.GravityConstant; + var maxFuelFlow = MaximumThrust / currentIsp / PluginHelper.GravityConstant; curEngineT.maxFuelFlow = (float)maxFuelFlow; + + curEngineT.propellants.FirstOrDefault(pr => pr.name == InterstellarResourcesConfiguration.Instance.Deuterium).ratio = (float)(standard_deuterium_rate); + curEngineT.propellants.FirstOrDefault(pr => pr.name == InterstellarResourcesConfiguration.Instance.Tritium).ratio = (float)(standard_tritium_rate); } radiatorPerformance = (float)Math.Max(1 - (float)(coldBathTemp / maxTempatureRadiators), 0.000001); diff --git a/FNPlugin/Propulsion/VistaEngineControllerAdvanced.cs b/FNPlugin/Propulsion/VistaEngineControllerAdvanced.cs new file mode 100644 index 00000000..12baa105 --- /dev/null +++ b/FNPlugin/Propulsion/VistaEngineControllerAdvanced.cs @@ -0,0 +1,470 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using UnityEngine; + +namespace FNPlugin +{ + enum EngineGenerationType { Mk1, Mk2, Mk3 } + + class VistaEngineControllerAdvanced : FNResourceSuppliableModule, IUpgradeableModule + { + // Persistant + [KSPField(isPersistant = true)] + bool IsEnabled; + [KSPField(isPersistant = true, guiActive = false, guiActiveEditor = false, guiName = "Upgraded")] + public bool isupgraded = false; + [KSPField(isPersistant = true)] + bool rad_safety_features = true; + + [KSPField(isPersistant = true, guiActive = true, guiName = "Power Ratio"), UI_FloatRange(stepIncrement = 20f, maxValue = 100f, minValue = 20f)] + public float powerPercentageMk1 = 100; + [KSPField(isPersistant = true, guiActive = true, guiName = "Power Ratio"), UI_FloatRange(stepIncrement = 10f, maxValue = 100f, minValue = 10f)] + public float powerPercentageMk2 = 100; + [KSPField(isPersistant = true, guiActive = true, guiName = "Power Ratio"), UI_FloatRange(stepIncrement = 5f, maxValue = 100f, minValue = 5f)] + public float powerPercentageMk3 = 100; + + // None Persistant + [KSPField(isPersistant = false, guiActive = true, guiName = "Radiation Hazard To")] + public string radhazardstr = ""; + [KSPField(isPersistant = false, guiActive = true, guiName = "Temperature")] + public string temperatureStr = ""; + + [KSPField(isPersistant = false)] + public float powerRequirement = 625; + [KSPField(isPersistant = false)] + public float powerRequirementUpgraded = 1250; + [KSPField(isPersistant = false)] + public float powerRequirementUpgraded2 = 2500; + + [KSPField(isPersistant = false)] + public float maxThrust = 75; + [KSPField(isPersistant = false)] + public float maxThrustUpgraded = 300; + [KSPField(isPersistant = false)] + public float maxThrustUpgraded2 = 1200; + + [KSPField(isPersistant = false)] + public float maxAtmosphereDensity = 0.001f; + [KSPField(isPersistant = false)] + public float leathalDistance = 2000; + [KSPField(isPersistant = false)] + public float killDivider = 50; + + [KSPField(isPersistant = false)] + public float efficiency = 0.19f; + [KSPField(isPersistant = false)] + public float efficiencyUpgraded = 0.38f; + [KSPField(isPersistant = false)] + public float efficiencyUpgraded2 = 0.76f; + + [KSPField(isPersistant = false)] + public float fusionWasteHeat = 625; + [KSPField(isPersistant = false)] + public float fusionWasteHeatUpgraded = 2500; + [KSPField(isPersistant = false)] + public float fusionWasteHeatUpgraded2 = 10000; + + [KSPField(isPersistant = false)] + public float wasteHeatMultiplier = 1; + [KSPField(isPersistant = false)] + public float maxTemp = 2500; + [KSPField(isPersistant = false)] + public float upgradeCost = 100; + [KSPField(isPersistant = false)] + public string originalName = "Prototype DT Vista Engine"; + [KSPField(isPersistant = false)] + public string upgradedName = "DT Vista Engine Mk2"; + [KSPField(isPersistant = false)] + public string upgradedName2 = "DT Vista Engine Mk3"; + + // Gui + [KSPField(isPersistant = false, guiActive = true, guiName = "Type")] + public string engineType = ""; + [KSPField(isPersistant = false, guiActive = false, guiActiveEditor = true, guiName= "upgrade tech 1")] + public string upgradeTechReq = "advFusionReactions"; + [KSPField(isPersistant = false, guiActive = false, guiActiveEditor = true, guiName = "upgrade tech 2")] + public string upgradeTechReq2 = "exoticReactions"; + + [KSPField(isPersistant = false, guiActive = false, guiActiveEditor = false, guiName = "Current Throtle", guiFormat = "F2")] + public float throttle; + [KSPField(isPersistant = false, guiActive = true, guiActiveEditor = false, guiName = "Fusion Ratio", guiFormat = "F2")] + public float fusionRatio; + [KSPField(isPersistant = false, guiActive = true, guiActiveEditor = false, guiName = "Power Requirement", guiFormat = "F2", guiUnits = " MW")] + public float enginePowerRequirement; + [KSPField(isPersistant = false, guiActive = true, guiActiveEditor = false, guiName = "Absorbed Wasteheat", guiFormat = "F2", guiUnits = " MW")] + public float absorbedWasteheat; + + [KSPField(isPersistant = false, guiActive = false, guiActiveEditor = false, guiName = "Radiator Temp")] + public float coldBathTemp; + [KSPField(isPersistant = false, guiActive = false, guiActiveEditor = false, guiName = "Max Radiator Temp")] + public float maxTempatureRadiators; + [KSPField(isPersistant = false, guiActive = false, guiActiveEditor = false, guiName = "Performance Radiators")] + public float radiatorPerformance; + [KSPField(isPersistant = false, guiActive = false, guiActiveEditor = false, guiName = "Emisiveness")] + public float partEmissiveConstant; + + protected bool hasrequiredupgrade = false; + protected bool radhazard = false; + protected double minISP = 0; + protected double standard_megajoule_rate = 0; + protected double standard_deuterium_rate = 0; + protected double standard_tritium_rate = 0; + protected ModuleEngines curEngineT; + + public EngineGenerationType EngineGenerationType { get; private set; } + + [KSPEvent(guiActive = true, guiName = "Disable Radiation Safety", active = true)] + public void DeactivateRadSafety() + { + rad_safety_features = false; + } + + [KSPEvent(guiActive = true, guiName = "Activate Radiation Safety", active = false)] + public void ActivateRadSafety() + { + rad_safety_features = true; + } + + [KSPEvent(guiActive = true, guiName = "Retrofit", active = true)] + public void RetrofitEngine() + { + if (ResearchAndDevelopment.Instance == null || isupgraded || ResearchAndDevelopment.Instance.Science < upgradeCost) return; + + upgradePartModule(); + ResearchAndDevelopment.Instance.AddScience(-upgradeCost, TransactionReasons.RnDPartPurchase); + } + + #region IUpgradeableModule + + public String UpgradeTechnology { get { return upgradeTechReq; } } + + public void upgradePartModule() + { + isupgraded = true; + + if (PluginHelper.upgradeAvailable(upgradeTechReq2)) + { + engineType = upgradedName2 ; + EngineGenerationType = EngineGenerationType.Mk3; + } + else + { + engineType = upgradedName; + EngineGenerationType = EngineGenerationType.Mk2; + } + } + + #endregion + + public float MaximumThrust { get { return PowerRatio * FullTrustMaximum; } } + + public float FusionWasteHeat + { + get + { + if (EngineGenerationType == EngineGenerationType.Mk1) + return fusionWasteHeat; + else if (EngineGenerationType == EngineGenerationType.Mk2) + return fusionWasteHeatUpgraded; + else + return fusionWasteHeatUpgraded2; + } + } + + public float FullTrustMaximum + { + get + { + if (EngineGenerationType == EngineGenerationType.Mk1) + return maxThrust; + else if (EngineGenerationType == EngineGenerationType.Mk2) + return maxThrustUpgraded; + else + return maxThrustUpgraded2; + } + } + + public float LaserEfficiency + { + get + { + if (EngineGenerationType == EngineGenerationType.Mk1) + return efficiency; + else if (EngineGenerationType == EngineGenerationType.Mk2) + return efficiencyUpgraded; + else + return efficiencyUpgraded2; + } + } + + public float CurrentPowerRequirement + { + get + { + return PowerRequirementMaximum * PowerRatio; + } + } + + public float PowerRequirementMaximum + { + get + { + if (EngineGenerationType == EngineGenerationType.Mk1) + return powerRequirement; + else if (EngineGenerationType == EngineGenerationType.Mk2) + return powerRequirementUpgraded; + else + return powerRequirementUpgraded2; + } + } + + public float PowerRatio + { + get + { + if (EngineGenerationType == EngineGenerationType.Mk1) + return powerPercentageMk1 / 100; + else if (EngineGenerationType == EngineGenerationType.Mk2) + return powerPercentageMk2 / 100; + else + return powerPercentageMk3 / 100; + } + } + + + public override void OnStart(PartModule.StartState state) + { + part.maxTemp = maxTemp; + part.thermalMass = 1; + part.thermalMassModifier = 1; + EngineGenerationType = EngineGenerationType.Mk1; + + engineType = originalName; + curEngineT = this.part.FindModuleImplementing(); + + if (curEngineT == null) return; + + minISP = curEngineT.atmosphereCurve.Evaluate(0); + + standard_deuterium_rate = curEngineT.propellants.FirstOrDefault(pr => pr.name == InterstellarResourcesConfiguration.Instance.Deuterium).ratio; + standard_tritium_rate = curEngineT.propellants.FirstOrDefault(pr => pr.name == InterstellarResourcesConfiguration.Instance.Tritium).ratio; + + // if we can upgrade, let's do so + if (isupgraded) + upgradePartModule(); + else if (this.HasTechsRequiredToUpgrade()) + hasrequiredupgrade = true; + + // calculate WasteHeat Capacity + part.Resources[FNResourceManager.FNRESOURCE_WASTEHEAT].maxAmount = part.mass * 1.0e+5 * wasteHeatMultiplier; + + + if (state == StartState.Editor && this.HasTechsRequiredToUpgrade()) + { + isupgraded = true; + upgradePartModule(); + } + + Fields["powerPercentageMk1"].guiActive = EngineGenerationType == EngineGenerationType.Mk1; + Fields["powerPercentageMk2"].guiActive = EngineGenerationType == EngineGenerationType.Mk2; + Fields["powerPercentageMk3"].guiActive = EngineGenerationType == EngineGenerationType.Mk3; + + if (state != StartState.Editor) + part.emissiveConstant = maxTempatureRadiators > 0 ? 1 - coldBathTemp / maxTempatureRadiators : 0.01; + } + + public override void OnUpdate() + { + if (curEngineT == null) return; + + Fields["powerPercentageMk1"].guiActive = EngineGenerationType == EngineGenerationType.Mk1; + Fields["powerPercentageMk2"].guiActive = EngineGenerationType == EngineGenerationType.Mk2; + Fields["powerPercentageMk3"].guiActive = EngineGenerationType == EngineGenerationType.Mk3; + + Events["DeactivateRadSafety"].active = rad_safety_features; + Events["ActivateRadSafety"].active = !rad_safety_features; + Events["RetrofitEngine"].active = !isupgraded && ResearchAndDevelopment.Instance.Science >= upgradeCost && hasrequiredupgrade; + + if (curEngineT.isOperational && !IsEnabled) + { + IsEnabled = true; + part.force_activate (); + } + + int kerbal_hazard_count = 0; + foreach (Vessel vess in FlightGlobals.Vessels) + { + float distance = (float)Vector3d.Distance (vessel.transform.position, vess.transform.position); + if (distance < leathalDistance && vess != this.vessel) + kerbal_hazard_count += vess.GetCrewCount (); + } + + if (kerbal_hazard_count > 0) + { + radhazard = true; + if (kerbal_hazard_count > 1) + radhazardstr = kerbal_hazard_count.ToString () + " Kerbals."; + else + radhazardstr = kerbal_hazard_count.ToString () + " Kerbal."; + + Fields["radhazardstr"].guiActive = true; + } + else + { + Fields["radhazardstr"].guiActive = false; + radhazard = false; + radhazardstr = "None."; + } + } + + private void ShutDown(string reason) + { + curEngineT.Events["Shutdown"].Invoke(); + curEngineT.currentThrottle = 0; + curEngineT.requestedThrottle = 0; + + ScreenMessages.PostScreenMessage(reason, 5.0f, ScreenMessageStyle.UPPER_CENTER); + foreach (FXGroup fx_group in part.fxGroups) + { + fx_group.setActive(false); + } + } + + public override void OnFixedUpdate() + { + temperatureStr = part.temperature.ToString("0.00") + "K / " + part.maxTemp.ToString("0.00") + "K"; + + if (curEngineT == null) return; + + throttle = curEngineT.currentThrottle > 0 ? Mathf.Max(curEngineT.currentThrottle, 0.01f) : 0; + + if (throttle > 0) + { + if (vessel.atmDensity > maxAtmosphereDensity) + ShutDown("Inertial Fusion cannot operate in atmosphere!"); + + if (radhazard && rad_safety_features) + ShutDown("Engines throttled down as they presently pose a radiation hazard"); + } + + KillKerbalsWithRadiation(throttle); + + if (throttle > 0) + { + // Calculate Fusion Ratio + enginePowerRequirement = CurrentPowerRequirement; + var requestedPowerFixed = enginePowerRequirement * TimeWarp.fixedDeltaTime; + var recievedPowerFixed = consumeFNResource(requestedPowerFixed, FNResourceManager.FNRESOURCE_MEGAJOULES); + var plasma_ratio = recievedPowerFixed / requestedPowerFixed; + fusionRatio = plasma_ratio >= 1 ? 1 : plasma_ratio > 0.75f ? Mathf.Pow((float)plasma_ratio, 6) : 0; + + // Lasers produce Wasteheat + supplyFNResource(recievedPowerFixed * (1 - LaserEfficiency), FNResourceManager.FNRESOURCE_WASTEHEAT); + + // The Aborbed wasteheat from Fusion + absorbedWasteheat = PowerRatio * FusionWasteHeat * wasteHeatMultiplier * fusionRatio; + supplyFNResource(absorbedWasteheat * TimeWarp.fixedDeltaTime, FNResourceManager.FNRESOURCE_WASTEHEAT); + + // change ratio propellants Hydrogen/Fusion + curEngineT.propellants.FirstOrDefault(pr => pr.name == InterstellarResourcesConfiguration.Instance.Deuterium).ratio = (float)standard_deuterium_rate / throttle / throttle; + curEngineT.propellants.FirstOrDefault(pr => pr.name == InterstellarResourcesConfiguration.Instance.Tritium).ratio = (float)standard_tritium_rate / throttle / throttle; + + // Update ISP + var currentIsp = Math.Max(minISP * fusionRatio / throttle, minISP / 10); + FloatCurve newISP = new FloatCurve(); + newISP.Add(0, (float)currentIsp); + curEngineT.atmosphereCurve = newISP; + + // Update FuelFlow + var maxFuelFlow = fusionRatio * MaximumThrust / currentIsp / PluginHelper.GravityConstant; + curEngineT.maxFuelFlow = (float)maxFuelFlow; + + if (!curEngineT.getFlameoutState && plasma_ratio < 0.75 && recievedPowerFixed > 0) + curEngineT.status = "Insufficient Electricity"; + } + else + { + enginePowerRequirement = 0; + absorbedWasteheat = 0; + fusionRatio = 0; + + var currentIsp = minISP * 100; + FloatCurve newISP = new FloatCurve(); + newISP.Add(0, (float)currentIsp); + curEngineT.atmosphereCurve = newISP; + + var maxFuelFlow = MaximumThrust / currentIsp / PluginHelper.GravityConstant; + curEngineT.maxFuelFlow = (float)maxFuelFlow; + + curEngineT.propellants.FirstOrDefault(pr => pr.name == InterstellarResourcesConfiguration.Instance.Deuterium).ratio = (float)(standard_deuterium_rate); + curEngineT.propellants.FirstOrDefault(pr => pr.name == InterstellarResourcesConfiguration.Instance.Tritium).ratio = (float)(standard_tritium_rate); + } + + coldBathTemp = (float)FNRadiator.getAverageRadiatorTemperatureForVessel(vessel); + maxTempatureRadiators = (float)FNRadiator.getAverageMaximumRadiatorTemperatureForVessel(vessel); + radiatorPerformance = Mathf.Max(1 - (coldBathTemp / maxTempatureRadiators), 0.000001f); + partEmissiveConstant = (float)part.emissiveConstant; + } + + private void KillKerbalsWithRadiation(float throttle) + { + if (!radhazard || throttle <= 0 || rad_safety_features) return; + + System.Random rand = new System.Random(new System.DateTime().Millisecond); + List vessels_to_remove = new List(); + List crew_to_remove = new List(); + double death_prob = TimeWarp.fixedDeltaTime; + + foreach (Vessel vess in FlightGlobals.Vessels) + { + float distance = (float)Vector3d.Distance(vessel.transform.position, vess.transform.position); + + if (distance >= leathalDistance || vess == this.vessel || vess.GetCrewCount() <= 0) continue; + + float inv_sq_dist = distance / killDivider; + float inv_sq_mult = 1.0f / inv_sq_dist / inv_sq_dist; + foreach (ProtoCrewMember crew_member in vess.GetVesselCrew()) + { + if (UnityEngine.Random.value < (1.0 - death_prob * inv_sq_mult)) continue; + + if (!vess.isEVA) + { + ScreenMessages.PostScreenMessage(crew_member.name + " was killed by Neutron Radiation!", 5.0f, ScreenMessageStyle.UPPER_CENTER); + crew_to_remove.Add(crew_member); + } + else + { + ScreenMessages.PostScreenMessage(crew_member.name + " was killed by Neutron Radiation!", 5.0f, ScreenMessageStyle.UPPER_CENTER); + vessels_to_remove.Add(vess); + } + } + } + + foreach (Vessel vess in vessels_to_remove) + { + vess.rootPart.Die(); + } + + foreach (ProtoCrewMember crew_member in crew_to_remove) + { + Vessel vess = FlightGlobals.Vessels.Find(p => p.GetVesselCrew().Contains(crew_member)); + Part part = vess.Parts.Find(p => p.protoModuleCrew.Contains(crew_member)); + part.RemoveCrewmember(crew_member); + crew_member.Die(); + } + } + + public override string getResourceManagerDisplayName() + { + return engineType; + } + + public override int getPowerPriority() + { + return 1; + } + } +} + diff --git a/FNPlugin/WarpPlugin.csproj b/FNPlugin/WarpPlugin.csproj index a0841104..96e3c6b2 100644 --- a/FNPlugin/WarpPlugin.csproj +++ b/FNPlugin/WarpPlugin.csproj @@ -91,12 +91,14 @@ + + diff --git a/GameData/WarpPlugin/Parts/Electrical/HeatRadiator/radiator1.cfg b/GameData/WarpPlugin/Parts/Electrical/HeatRadiator/radiator1.cfg index 84049c66..a0ab371d 100644 --- a/GameData/WarpPlugin/Parts/Electrical/HeatRadiator/radiator1.cfg +++ b/GameData/WarpPlugin/Parts/Electrical/HeatRadiator/radiator1.cfg @@ -14,7 +14,7 @@ rescaleFactor = 1.5 node_attach = 0.06, 0.0, 0.0, 1.0, 0.0, 0.0 // --- editor parameters --- -TechRequired = heatManagementSystems +TechRequired = advHeatManagement entryCost = 14500 cost = 300 category = Utility @@ -74,7 +74,7 @@ MODULE type = surface_interstellar defaultScale = 0.75 scaleFactors = 0.5, 0.75, 1, 1.5, 2, 3, 4, 6, 8, 12, 16 - techRequired = heatManagementSystems, heatManagementSystems, advHeatManagement, advHeatManagement, advHeatManagement, specializedRadiators, specializedRadiators, specializedRadiators, specializedRadiators, specializedRadiators, specializedRadiators + techRequired = advHeatManagement, advHeatManagement, advHeatManagement, advHeatManagement, advHeatManagement, specializedRadiators, specializedRadiators, specializedRadiators, specializedRadiators, specializedRadiators, specializedRadiators } MODULE diff --git a/GameData/WarpPlugin/Parts/Engines/InlineRCS/InlineRCS.cfg b/GameData/WarpPlugin/Parts/Engines/InlineRCS/InlineRCS.cfg new file mode 100644 index 00000000..1094798b --- /dev/null +++ b/GameData/WarpPlugin/Parts/Engines/InlineRCS/InlineRCS.cfg @@ -0,0 +1,195 @@ +PART +{ + name = ArcjetInlineRcs + module = Part + author = TD + mesh = NewModel.mu + scale = 1.0 + rescaleFactor = 2.0 + node_stack_top = 0.0, 0.1275, 0.0, 0.0, 1.0, 0.0, 2 + node_stack_bottom = 0.0, -0.1275, 0.0, 0.0, -1.0, 0.0, 2 + TechRequired = advFlightControl + entryCost = 3400 + cost = 9120 + category = Control + subcategory = 0 + title = Inline Arcjet RCS + manufacturer = Hypergolic Industries + description = A nifty little block of eight nozzles for larger crafts' RCS needs. + attachRules = 1,0,1,1,0 + mass = 0.4 + dragModelType = default + maximum_drag = 0.001 + minimum_drag = 0.001 + angularDrag = 2 + crashTolerance = 15 + maxTemp = 1500 + PhysicsSignificance = 1 + bulkheadProfiles = size2 + + MODULE + { + name = FNModuleRCSFX + thrusterTransformName = RCSThrust + thrusterPower = 4.0 + resourceName = Hydrazine + resourceFlowMode = STAGE_PRIORITY_FLOW + atmosphereCurve + { + key = 0 1500 + key = 1 625 + key = 4 0.015 + } + } + + MODULE + { + name = ElectricRCSController + displayName = Linear Arcjet RCS // (Optional) shows Name visible in Power management + type = 16 // Propellant category + baseThrust = 4 // Maximum Base thrust for Hydrogen + efficency = 0.51 // Power Efficency + partMass = 0.1 // (Optional) mass visible in the VAB + maxIsp = 2000 // Max powered Isp for Hydrogen + minIsp = 250 // Max unpowered Isp for Hydrogen + } + + MODULE + { + name = InterstellarFuelSwitch + resourceGui = Liquid Hydrogen;Liquid Oxygen;Liquid Methane;Liquid Ammonia;Hydrazine;Liquid Nitrogen;Liquid CarbonDioxide;Liquid CarbonMonoxide;Water;Hydrogen Peroxide;Lithium;Deuterium;Hexaborane + resourceNames = LqdHydrogen;LqdOxygen;LqdMethane;LqdAmmonia;Hydrazine;LqdNitrogen;LqdCO2;LqdCO;Water;HTP;Lithium;LqdDeuterium;Hexaborane + resourceAmounts = 2000;2000;2000;2000;2000;2000;2000;2000;2000;2000;2000;2000;2000 + basePartMass = 0.13 + tankMass = 0;0.21;0.21;0.21;0.21;0.21;0.21;0.21;0.21;0.21;0.11;0;0.21 + volumeMultiplier = 1 + massMultiplier = 1 + displayCurrentTankCost = false + hasGUI = true + availableInFlight = true + availableInEditor = true + showInfo = true + } + + MODULE + { + name = ModuleCrossFeed + } + + MODULE + { + name = TweakScale + type = stack_interstellar + defaultScale = 2.5 + scaleFactors = 0.625, 1.25, 1.875, 2.5, 3.75, 5 + scaleNames = 0.625m, 1.25m, 1.875m, 2.5m, 3.75m, 5m + } + + MODULE + { + name = FNModuleCryostat + resourceName = LqdHydrogen + resourceGUIName = LqdHydrogen + powerReqKW = 5 + boilOffRate = 0 + boilOffTemp = 20.271 + boilOffMultiplier = 1 + boilOffBase = 2000 + boilOffAddition = 8.97215e-5 + } + + + MODULE + { + name = FNModuleCryostat + resourceName = LqdDeuterium + resourceGUIName = Deuterium + powerReqKW = 5 + boilOffRate = 0 + boilOffTemp = 20.271 + boilOffMultiplier = 1 + boilOffBase = 2000 + boilOffAddition = 8.97215e-5 + } + + MODULE + { + name = FNModuleCryostat + resourceName = LqdNitrogen + resourceGUIName = LqdNitrogen + powerReqKW = 5 + boilOffRate = 0 + boilOffTemp = 77.355 + boilOffMultiplier = 1 + boilOffBase = 2000 + boilOffAddition = 8.97215e-5 + } + + MODULE + { + name = FNModuleCryostat + resourceName = LqdCO + resourceGUIName = LqdCO + powerReqKW = 5 + boilOffRate = 0 + boilOffTemp = 81.65 + boilOffMultiplier = 1 + boilOffBase = 2000 + boilOffAddition = 8.97215e-5 + } + + MODULE + { + name = FNModuleCryostat + resourceName = LqdOxygen + resourceGUIName = LqdOxygen + powerReqKW = 5 + boilOffRate = 0 + boilOffTemp = 90.188 + boilOffMultiplier = 1 + boilOffBase = 2000 + boilOffAddition = 8.97215e-5 + } + + MODULE + { + name = FNModuleCryostat + resourceName = LqdMethane + resourceGUIName = LqdMethane + powerReqKW = 5 + boilOffRate = 0 + boilOffTemp = 111.66 + boilOffMultiplier = 1 + boilOffBase = 2000 + boilOffAddition = 8.97215e-5 + } + + MODULE + { + name = FNModuleCryostat + resourceName = HTP + resourceGUIName = HTP + powerReqKW = 5 + boilOffRate = 0 + boilOffTemp = 150.2 + boilOffMultiplier = 1 + boilOffBase = 2000 + boilOffAddition = 8.97215e-5 + } + + MODULE + { + name = FNModuleCryostat + resourceName = LqdCO2 + resourceGUIName = LqdCO2 + powerReqKW = 5 + boilOffRate = 0 + boilOffTemp = 220 + boilOffMultiplier = 1 + boilOffBase = 2000 + boilOffAddition = 8.97215e-5 + } +} + + + diff --git a/GameData/WarpPlugin/Parts/Engines/InlineRCS/NewModel.mu b/GameData/WarpPlugin/Parts/Engines/InlineRCS/NewModel.mu new file mode 100644 index 00000000..afbf6f17 Binary files /dev/null and b/GameData/WarpPlugin/Parts/Engines/InlineRCS/NewModel.mu differ diff --git a/GameData/WarpPlugin/Parts/Engines/InlineRCS/NewRCSInline1.dds b/GameData/WarpPlugin/Parts/Engines/InlineRCS/NewRCSInline1.dds new file mode 100644 index 00000000..255701f2 Binary files /dev/null and b/GameData/WarpPlugin/Parts/Engines/InlineRCS/NewRCSInline1.dds differ diff --git a/GameData/WarpPlugin/Parts/Engines/InlineRCS/NewRCSInline1NRML_NRM.dds b/GameData/WarpPlugin/Parts/Engines/InlineRCS/NewRCSInline1NRML_NRM.dds new file mode 100644 index 00000000..d07f84c4 Binary files /dev/null and b/GameData/WarpPlugin/Parts/Engines/InlineRCS/NewRCSInline1NRML_NRM.dds differ diff --git a/GameData/WarpPlugin/Parts/Engines/InlineRCS/dark_swatch.dds b/GameData/WarpPlugin/Parts/Engines/InlineRCS/dark_swatch.dds new file mode 100644 index 00000000..9170af4e Binary files /dev/null and b/GameData/WarpPlugin/Parts/Engines/InlineRCS/dark_swatch.dds differ diff --git a/GameData/WarpPlugin/Parts/Engines/LinearRCS/linearRCS.cfg b/GameData/WarpPlugin/Parts/Engines/LinearRCS/linearRCS.cfg index ed6493e4..47630cda 100644 --- a/GameData/WarpPlugin/Parts/Engines/LinearRCS/linearRCS.cfg +++ b/GameData/WarpPlugin/Parts/Engines/LinearRCS/linearRCS.cfg @@ -17,7 +17,7 @@ PART manufacturer = Reaction Systems Ltd description = Highly efficient Arcjet RCS port which requires Hydrazine and MW power to operate! attachRules = 0,1,0,0,0 - mass = 0.1 + mass = 0.25 dragModelType = default maximum_drag = 0.01 minimum_drag = 0.01 @@ -33,7 +33,7 @@ PART MODULE { name = FNModuleRCSFX - thrusterTransformName = RCSthruster + thrusterTransformName = RCSThrust thrusterPower = 3.0 resourceName = Hydrazine resourceFlowMode = STAGE_PRIORITY_FLOW @@ -65,12 +65,140 @@ PART maxAmount = 700 } - MODULE - { - name = TweakScale - type = stack - defaultScale = 0.25 - scaleFactors = 0.25, 0.5, 1 - scaleNames = 0.25m, 0.5m, 1m - } + MODULE + { + name = InterstellarFuelSwitch + resourceGui = Liquid Hydrogen;Liquid Oxygen;Liquid Methane;Liquid Ammonia;Hydrazine;Liquid Nitrogen;Liquid CarbonDioxide;Liquid CarbonMonoxide;Water;Hydrogen Peroxide;Lithium;Deuterium;Hexaborane + resourceNames = LqdHydrogen;LqdOxygen;LqdMethane;LqdAmmonia;Hydrazine;LqdNitrogen;LqdCO2;LqdCO;Water;HTP;Lithium;LqdDeuterium;Hexaborane + resourceAmounts = 2000;2000;2000;2000;2000;2000;2000;2000;2000;2000;2000;2000;2000 + basePartMass = 0.13 + tankMass = 0;0.21;0.21;0.21;0.21;0.21;0.21;0.21;0.21;0.21;0.11;0;0.21 + volumeMultiplier = 1 + massMultiplier = 1 + displayCurrentTankCost = false + hasGUI = true + availableInFlight = true + availableInEditor = true + showInfo = true + } + + MODULE + { + name = ModuleCrossFeed + } + + MODULE + { + name = TweakScale + type = stack_interstellar + defaultScale = 2.5 + scaleFactors = 0.625, 1.25, 1.875, 2.5, 3.75, 5 + scaleNames = 0.625m, 1.25m, 1.875m, 2.5m, 3.75m, 5m + } + + MODULE + { + name = FNModuleCryostat + resourceName = LqdHydrogen + resourceGUIName = LqdHydrogen + powerReqKW = 5 + boilOffRate = 0 + boilOffTemp = 20.271 + boilOffMultiplier = 1 + boilOffBase = 2000 + boilOffAddition = 8.97215e-5 + } + + + MODULE + { + name = FNModuleCryostat + resourceName = LqdDeuterium + resourceGUIName = Deuterium + powerReqKW = 5 + boilOffRate = 0 + boilOffTemp = 20.271 + boilOffMultiplier = 1 + boilOffBase = 2000 + boilOffAddition = 8.97215e-5 + } + + MODULE + { + name = FNModuleCryostat + resourceName = LqdNitrogen + resourceGUIName = LqdNitrogen + powerReqKW = 5 + boilOffRate = 0 + boilOffTemp = 77.355 + boilOffMultiplier = 1 + boilOffBase = 2000 + boilOffAddition = 8.97215e-5 + } + + MODULE + { + name = FNModuleCryostat + resourceName = LqdCO + resourceGUIName = LqdCO + powerReqKW = 5 + boilOffRate = 0 + boilOffTemp = 81.65 + boilOffMultiplier = 1 + boilOffBase = 2000 + boilOffAddition = 8.97215e-5 + } + + MODULE + { + name = FNModuleCryostat + resourceName = LqdOxygen + resourceGUIName = LqdOxygen + powerReqKW = 5 + boilOffRate = 0 + boilOffTemp = 90.188 + boilOffMultiplier = 1 + boilOffBase = 2000 + boilOffAddition = 8.97215e-5 + } + + MODULE + { + name = FNModuleCryostat + resourceName = LqdMethane + resourceGUIName = LqdMethane + powerReqKW = 5 + boilOffRate = 0 + boilOffTemp = 111.66 + boilOffMultiplier = 1 + boilOffBase = 2000 + boilOffAddition = 8.97215e-5 + } + + MODULE + { + name = FNModuleCryostat + resourceName = HTP + resourceGUIName = HTP + powerReqKW = 5 + boilOffRate = 0 + boilOffTemp = 150.2 + boilOffMultiplier = 1 + boilOffBase = 2000 + boilOffAddition = 8.97215e-5 + } + + MODULE + { + name = FNModuleCryostat + resourceName = LqdCO2 + resourceGUIName = LqdCO2 + powerReqKW = 5 + boilOffRate = 0 + boilOffTemp = 220 + boilOffMultiplier = 1 + boilOffBase = 2000 + boilOffAddition = 8.97215e-5 + } + } diff --git a/GameData/WarpPlugin/Parts/Engines/RCSTank/serviceModule.cfg b/GameData/WarpPlugin/Parts/Engines/RCSTank/serviceModule.cfg index 23e39771..6dcd02be 100644 --- a/GameData/WarpPlugin/Parts/Engines/RCSTank/serviceModule.cfg +++ b/GameData/WarpPlugin/Parts/Engines/RCSTank/serviceModule.cfg @@ -18,7 +18,7 @@ PART cost = 500 category = Control subcategory = 0 - title = Arcjet RCS Tank + title = Arcjet RCS Service Tank manufacturer = Boeing description = The service module for the CST-100 to keep your kerbals alive. If you forget this your kerbals can't abort! attachRules = 1,1,1,1,0 @@ -41,7 +41,7 @@ PART { name = FNModuleRCSFX thrusterTransformName = RCS - thrusterPower = 1.0 + thrusterPower = 2.0 resourceName = Hydrazine resourceFlowMode = STAGE_PRIORITY_FLOW atmosphereCurve @@ -57,7 +57,7 @@ PART name = ElectricRCSController displayName = Linear Arcjet RCS // (Optional) shows Name visible in Power management type = 16 // Propellant category - baseThrust = 1 // Maximum Base thrust for Hydrogen + baseThrust = 2 // Maximum Base thrust for Hydrogen efficency = 0.51 // Power Efficency partMass = 0.1 // (Optional) mass visible in the VAB maxIsp = 2000 // Max powered Isp for Hydrogen @@ -69,7 +69,7 @@ PART { name = WasteHeat amount = 0 - maxAmount = 12000 + maxAmount = 120000 } MODULE diff --git a/GameData/WarpPlugin/Parts/Engines/vista/Vista.cfg b/GameData/WarpPlugin/Parts/Engines/vista/Vista.cfg new file mode 100644 index 00000000..19f66e07 --- /dev/null +++ b/GameData/WarpPlugin/Parts/Engines/vista/Vista.cfg @@ -0,0 +1,185 @@ +PART +{ +name = VISTAEngine +module = Part +author = Fractal and FreeThinker + +mesh = model.mu +scale = 1 +rescaleFactor = 1.5 + +node_stack_top = 0.0, 0.47383, 0.0, 0.0, 1.0, 0.0, 2 +node_stack_bottom = 0.0, -0.671957, 0.0, 0.0, -1.0, 0.0, 2 + +//fx_exhaustFlame_blue_small = 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, running +fx_exhaustFlame_blue = 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, running +fx_exhaustLight_blue = 0.0, 0, 0.0, 0.0, 0.0, 1.0, running + +sound_vent_medium = engage +sound_rocket_hard = running +sound_vent_soft = disengage +sound_explosion_low = flameout + +TechRequired = fusionRockets +entryCost = 800000 +cost = 800000 +category = Engine +subcategory = 0 +title = Vista +manufacturer = Kerbal Ignition Facility Junkyard Co. +description = The DT Vista propulsion system is an engine that utilises laser induced interial fusion for propulsion. Pellets of Deuterium and Tritium are compressed to ultra-high densities using a high power laser. It uses a novel throttle system that actually varies the specific impulse rather than the energy output, it thus always requires 2.5GW of input power, even on minimal throttle. The crew onboard are shielded by the engine from the intense neutron flux of the fusion reaction but because the reaction occurs outside the ship, other nearby vessels aren't so protected - Beware! + +// attachment rules: stack, srfAttach, allowStack, allowSrfAttach, allowCollision +attachRules = 1,0,1,0,0 + +mass = 12 +dragModelType = default +maximum_drag = 0.2 +minimum_drag = 0.2 +angularDrag = 2 +crashTolerance = 12 +breakingForce = 1500 +breakingTorque = 1500 +maxTemp = 3200 +heatConductivity = 0.01 +emissiveConstant = 0.95 + + + MODULE + { + name = ModuleEnginesWarpVista + resourceDeltaV = LqdHydrogen + thrustVectorTransformName = T_T + exhaustDamage = True + ignitionThreshold = 0.1 + minThrust = 0 + maxThrust = 1200 + heatProduction = 100 + fxOffset = 0, 0, 0 + PROPELLANT + { + name = LqdHydrogen + ratio = 1.44 + DrawGauge = True + } + PROPELLANT + { + name = LqdDeuterium + ratio = 1.38337941e-3 + DrawGauge = True + } + PROPELLANT + { + name = LqdTritium + ratio = 1.38337941e-3 + DrawGauge = True + } + + atmosphereCurve + { + key = 0 15500 + } + } + + + MODULE + { + name = VistaEngineControllerAdvanced + + originalName = Prototype DT Vista Engine + upgradedName= DT Vista Engine Mk2 + upgradedName2= DT Vista Engine Mk3 + + upgradeTechReq = advFusionReactions + upgradeTechReq2 = exoticReactions + + killDivider = 50 + leathalDistance = 2000 + + efficiency = 0.19 + efficiencyUpgraded = 0.38 + efficiencyUpgraded2 = 0.76 + + maxThrust = 75 + maxThrustUpgraded = 300 + maxThrustUpgraded2 = 1200 + + powerRequirement = 625 + powerRequirementUpgraded = 1250 + powerRequirementUpgraded2 = 2500 + + fusionWasteHeat = 625 + fusionWasteHeatUpgraded = 2500 + fusionWasteHeatUpgraded2 = 10000 + + maxTemp = 2500 + wasteHeatMultiplier = 1 + maxAtmosphereDensity = 0.001 + } + + RESOURCE + { + name = LqdDeuterium + amount = 100 + maxAmount = 100 + } + + RESOURCE + { + name = LqdTritium + amount = 100 + maxAmount = 100 + } + + MODULE + { + name = ModuleElementRadioactiveDecay + decayConstant = 1.7915586e-9 + resourceName = LqdTritium + decayProduct = LqdHe3 + convFactor = 1 + } + + //MODULE + //{ + // name = ModuleGimbal + // gimbalTransformName = T_T + // gimbalRange = 1 + //} + + MODULE + { + name = FXModuleAnimateThrottle + animationName = e22 + dependOnEngineState = True + responseSpeed = 0.5 + } + + MODULE + { + name = ModuleJettison + jettisonName = fairing + bottomNodeName = bottom + isFairing = True + jettisonedObjectMass = 0.1 + jettisonForce = 5 + jettisonDirection = 0 0 1 + } + + RESOURCE + { + name = WasteHeat + amount = 0 + maxAmount = 1200000 + } + + MODULE + { + name = TweakScale + type = stack_square + defaultScale = 3.75 + scaleFactors = 3.75, 5.0, 7.5, 10 + scaleNames = 3.75m, 5m, 7.5m, 10m + } + +} diff --git a/GameData/WarpPlugin/Parts/Engines/vista/part.cfg b/GameData/WarpPlugin/Parts/Engines/vista/part.cfg index c3ca0aeb..1a647546 100644 --- a/GameData/WarpPlugin/Parts/Engines/vista/part.cfg +++ b/GameData/WarpPlugin/Parts/Engines/vista/part.cfg @@ -20,12 +20,12 @@ sound_rocket_hard = running sound_vent_soft = disengage sound_explosion_low = flameout -TechRequired = fusionRockets +TechRequired = none entryCost = 800000 cost = 800000 -category = Engine +category = none subcategory = 0 -title = DT Vista Inertial Fusion Engine +title = Vista (legacy) manufacturer = Kerbal Ignition Facility Junkyard Co. description = The DT Vista propulsion system is an engine that utilises laser induced interial fusion for propulsion. Pellets of Deuterium and Tritium are compressed to ultra-high densities using a high power laser. It uses a novel throttle system that actually varies the specific impulse rather than the energy output, it thus always requires 2.5GW of input power, even on minimal throttle. The crew onboard are shielded by the engine from the intense neutron flux of the fusion reaction but because the reaction occurs outside the ship, other nearby vessels aren't so protected - Beware! diff --git a/GameData/WarpPlugin/Parts/Science/ParticleAcceleratorexperiment/part.cfg b/GameData/WarpPlugin/Parts/Science/ParticleAcceleratorexperiment/part.cfg index e1b6c031..11a03b97 100644 --- a/GameData/WarpPlugin/Parts/Science/ParticleAcceleratorexperiment/part.cfg +++ b/GameData/WarpPlugin/Parts/Science/ParticleAcceleratorexperiment/part.cfg @@ -12,7 +12,7 @@ node_stack_bottom = 0.0, -1.8, 0.0, 0.0, -1.0, 0.0 ,3 node_attach = 1.25, 0.0, 0.0, 1.0, 0.0, 0.0, 1 attachRules = 1,0,1,0,0 -TechRequired = longTermScienceTech +TechRequired = none entryCost = 45000 cost = 45000 category = Science diff --git a/GameData/WarpPlugin/Patches/KSPI_CTT.cfg b/GameData/WarpPlugin/Patches/KSPI_CTT.cfg index 4570ade8..9ed313da 100644 --- a/GameData/WarpPlugin/Patches/KSPI_CTT.cfg +++ b/GameData/WarpPlugin/Patches/KSPI_CTT.cfg @@ -528,9 +528,9 @@ scale = 0.6 Parent { - parentID = expNuclearPropulsion - lineFrom = TOP - lineTo = BOTTOM + parentID = advNuclearPropulsion + lineFrom = RIGHT + lineTo = LEFT } } RDNode diff --git a/GameData/WarpPlugin/Plugins/Interstellar.dll b/GameData/WarpPlugin/Plugins/Interstellar.dll index 0c686c58..8b9d05a4 100644 Binary files a/GameData/WarpPlugin/Plugins/Interstellar.dll and b/GameData/WarpPlugin/Plugins/Interstellar.dll differ diff --git a/GameData/WarpPlugin/Plugins/KSP-Interstellar-Extended.version b/GameData/WarpPlugin/Plugins/KSP-Interstellar-Extended.version index 76e1225e..87233253 100644 --- a/GameData/WarpPlugin/Plugins/KSP-Interstellar-Extended.version +++ b/GameData/WarpPlugin/Plugins/KSP-Interstellar-Extended.version @@ -6,7 +6,7 @@ { "MAJOR":1, "MINOR":6, - "PATCH":4, + "PATCH":7, "BUILD":0 }, "KSP_VERSION": diff --git a/GameData/WarpPlugin/Plugins/OpenResourceSystem_KSPIE.dll b/GameData/WarpPlugin/Plugins/OpenResourceSystem_KSPIE.dll index 57da3aee..ad74e036 100644 Binary files a/GameData/WarpPlugin/Plugins/OpenResourceSystem_KSPIE.dll and b/GameData/WarpPlugin/Plugins/OpenResourceSystem_KSPIE.dll differ diff --git a/WarpPlugin.v12.suo b/WarpPlugin.v12.suo index 5b6d90de..5ea89ff0 100644 Binary files a/WarpPlugin.v12.suo and b/WarpPlugin.v12.suo differ