diff --git a/Assets/Plugins/KerbalEngineer.Unity.dll b/Assets/Plugins/KerbalEngineer.Unity.dll index 0a976d58..064741e1 100644 Binary files a/Assets/Plugins/KerbalEngineer.Unity.dll and b/Assets/Plugins/KerbalEngineer.Unity.dll differ diff --git a/Documents/CHANGES.txt b/Documents/CHANGES.txt index a7131c44..578bce63 100644 --- a/Documents/CHANGES.txt +++ b/Documents/CHANGES.txt @@ -1,3 +1,6 @@ +1.1.9.0, 2021-6-27, KSP 1.12.0 #3140 + - Fix backwards compatibility + 1.1.8.4, 2021-6-24, KSP 1.12.0 #3140 - Update to KSP 1.12. No changes. diff --git a/KerbalEngineer/Editor/BuildOverlayPartInfo.cs b/KerbalEngineer/Editor/BuildOverlayPartInfo.cs index 7e47aa24..c5172374 100644 --- a/KerbalEngineer/Editor/BuildOverlayPartInfo.cs +++ b/KerbalEngineer/Editor/BuildOverlayPartInfo.cs @@ -216,7 +216,7 @@ private void ResetInfo() private void SetAlternatorInfo() { - ModuleAlternator moduleAlternator = selectedPart.GetModule(); + ModuleAlternator moduleAlternator = PartExtensions.GetModule(selectedPart); if (moduleAlternator != null) { infoItems.Add(PartInfoItem.Create("Alternator")); @@ -230,12 +230,12 @@ private void SetAlternatorInfo() private void SetCostInfo() { - infoItems.Add(PartInfoItem.Create("Cost", Units.ConcatF(selectedPart.GetCostDry(), selectedPart.GetCostWet()))); + infoItems.Add(PartInfoItem.Create("Cost", Units.ConcatF(PartExtensions.GetCostDry(selectedPart), PartExtensions.GetCostWet(selectedPart)))); } private void SetDecouplerInfo() { - var protoModuleDecoupler = selectedPart.GetProtoModuleDecoupler(); + var protoModuleDecoupler = PartExtensions.GetProtoModuleDecoupler(selectedPart); if (protoModuleDecoupler != null) { infoItems.Add(PartInfoItem.Create("Ejection Force", protoModuleDecoupler.EjectionForce.ToForce())); @@ -248,7 +248,7 @@ private void SetDecouplerInfo() private void SetEngineInfo() { - var protoModuleEngine = selectedPart.GetProtoModuleEngine(); + var protoModuleEngine = PartExtensions.GetProtoModuleEngine(selectedPart); if (protoModuleEngine != null) { infoItems.Add(PartInfoItem.Create("Thrust", Units.ToForce(protoModuleEngine.MinimumThrust, protoModuleEngine.MaximumThrust))); @@ -274,7 +274,7 @@ private void SetEngineInfo() private void SetGeneratorInfo() { - var moduleGenerator = selectedPart.GetModule(); + var moduleGenerator = PartExtensions.GetModule(selectedPart); if (moduleGenerator != null) { if (moduleGenerator.resHandler.inputResources.Count > 0) @@ -306,7 +306,7 @@ private void SetGeneratorInfo() private void SetGimbalInfo() { - var moduleGimbal = selectedPart.GetModule(); + var moduleGimbal = PartExtensions.GetModule(selectedPart); if (moduleGimbal != null) { infoItems.Add(PartInfoItem.Create("Thrust Vectoring", moduleGimbal.gimbalRange.ToString("F2"))); @@ -317,13 +317,13 @@ private void SetMassItems() { if (selectedPart.physicalSignificance == Part.PhysicalSignificance.FULL) { - infoItems.Add(PartInfoItem.Create("Mass", Units.ToMass(selectedPart.GetDryMass(), selectedPart.GetWetMass()))); + infoItems.Add(PartInfoItem.Create("Mass", Units.ToMass(PartExtensions.GetDryMass(selectedPart), PartExtensions.GetWetMass(selectedPart)))); } } private void SetParachuteInfo() { - var moduleParachute = selectedPart.GetModule(); + var moduleParachute = PartExtensions.GetModule(selectedPart); if (moduleParachute != null) { infoItems.Add(PartInfoItem.Create("Deployed Drag", Units.ConcatF(moduleParachute.semiDeployedDrag, moduleParachute.fullyDeployedDrag))); @@ -334,7 +334,7 @@ private void SetParachuteInfo() private void SetRcsInfo() { - var moduleRcs = selectedPart.GetModule(); + var moduleRcs = PartExtensions.GetModule(selectedPart); if (moduleRcs != null) { infoItems.Add(PartInfoItem.Create("Thruster Power", moduleRcs.thrusterPower.ToForce())); @@ -344,7 +344,7 @@ private void SetRcsInfo() private void SetReactionWheelInfo() { - var moduleReactionWheel = selectedPart.GetModule(); + var moduleReactionWheel = PartExtensions.GetModule(selectedPart); if (moduleReactionWheel != null) { infoItems.Add(PartInfoItem.Create("Reaction Wheel Torque")); @@ -380,8 +380,8 @@ private void SetResourceItems() if (partResource.hideFlow == false) { - infoItems.Add(partResource.GetDensity() > 0 - ? PartInfoItem.Create("\t" + partResource.info.name, "(" + partResource.GetMass().ToMass() + ") " + partResource.amount.ToString("F1")) + infoItems.Add(PartResourceExtensions.GetDensity(partResource) > 0 + ? PartInfoItem.Create("\t" + partResource.info.name, "(" + PartResourceExtensions.GetMass(partResource).ToMass() + ") " + partResource.amount.ToString("F1")) : PartInfoItem.Create("\t" + partResource.info.name, partResource.amount.ToString("F1"))); } } @@ -390,7 +390,7 @@ private void SetResourceItems() private void SetSasInfo() { - if (selectedPart.HasModule()) + if (PartExtensions.HasModule(selectedPart)) { infoItems.Add(PartInfoItem.Create("SAS Equiped")); } @@ -398,7 +398,7 @@ private void SetSasInfo() private void SetScienceContainerInfo() { - if (selectedPart.HasModule()) + if (PartExtensions.HasModule(selectedPart)) { infoItems.Add(PartInfoItem.Create("Science Container")); } @@ -406,7 +406,7 @@ private void SetScienceContainerInfo() private void SetScienceExperimentInfo() { - var moduleScienceExperiment = selectedPart.GetModule(); + var moduleScienceExperiment = PartExtensions.GetModule(selectedPart); if (moduleScienceExperiment != null) { infoItems.Add(PartInfoItem.Create("Science Experiment", moduleScienceExperiment.experimentActionName)); @@ -420,7 +420,7 @@ private void SetScienceExperimentInfo() private void SetSingleActivationInfo() { - if (selectedPart.HasModule(m => m.isOneShot)) + if (PartExtensions.HasModule(selectedPart, m => m.isOneShot)) { infoItems.Add(PartInfoItem.Create("Single Activation")); } @@ -428,7 +428,7 @@ private void SetSingleActivationInfo() private void SetSolarPanelInfo() { - var moduleDeployableSolarPanel = selectedPart.GetModule(); + var moduleDeployableSolarPanel = PartExtensions.GetModule(selectedPart); if (moduleDeployableSolarPanel != null) { infoItems.Add(PartInfoItem.Create("Charge Rate", moduleDeployableSolarPanel.chargeRate.ToRate())); @@ -446,7 +446,7 @@ private void SetSolarPanelInfo() private void SetTransmitterInfo() { - var moduleDataTransmitter = selectedPart.GetModule(); + var moduleDataTransmitter = PartExtensions.GetModule(selectedPart); if (moduleDataTransmitter != null) { infoItems.Add(PartInfoItem.Create("Packet Size", moduleDataTransmitter.packetSize.ToString("F2") + " Mits")); diff --git a/KerbalEngineer/Editor/ResourceInfoItem.cs b/KerbalEngineer/Editor/ResourceInfoItem.cs index 5410272e..db61ef55 100644 --- a/KerbalEngineer/Editor/ResourceInfoItem.cs +++ b/KerbalEngineer/Editor/ResourceInfoItem.cs @@ -31,7 +31,7 @@ public class ResourceInfoItem public ResourceInfoItem(PartResource resource) { - this.Definition = resource.GetDefinition(); + this.Definition = PartResourceExtensions.GetDefinition(resource); this.Name = this.Definition.name; this.Amount = resource.amount; } diff --git a/KerbalEngineer/EngineerGlobals.cs b/KerbalEngineer/EngineerGlobals.cs index b269c0f5..6da31518 100644 --- a/KerbalEngineer/EngineerGlobals.cs +++ b/KerbalEngineer/EngineerGlobals.cs @@ -21,7 +21,7 @@ public static class EngineerGlobals /// /// Current version of the Kerbal Engineer assembly. /// - public const string ASSEMBLY_VERSION = "1.1.8.4"; + public const string ASSEMBLY_VERSION = "1.1.9.0"; private static string assemblyFile; private static string assemblyName; diff --git a/KerbalEngineer/Extensions/OrbitExtensions.cs b/KerbalEngineer/Extensions/OrbitExtensions.cs index bf2dda7b..b4935fbb 100644 --- a/KerbalEngineer/Extensions/OrbitExtensions.cs +++ b/KerbalEngineer/Extensions/OrbitExtensions.cs @@ -1,21 +1,7 @@ // // Kerbal Engineer Redux -// -// Copyright (C) 2014 CYBUTEK -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// +// +// Extensions methods are bad. #region Using Directives @@ -39,22 +25,22 @@ public static class OrbitExtensions #region Methods: public - public static double GetAngleToAscendingNode(this Orbit orbit) + public static double GetAngleToAscendingNode(Orbit orbit) { return GetAngleToTrueAnomaly(orbit, GetTrueAnomalyOfAscendingNode(orbit)); } - public static double GetAngleToDescendingNode(this Orbit orbit) + public static double GetAngleToDescendingNode(Orbit orbit) { return GetAngleToTrueAnomaly(orbit, GetTrueAnomalyOfDescendingNode(orbit)); } - public static double GetAngleToPrograde(this Orbit orbit) + public static double GetAngleToPrograde(Orbit orbit) { return GetAngleToPrograde(orbit, Planetarium.GetUniversalTime()); } - public static double GetAngleToPrograde(this Orbit orbit, double universalTime) + public static double GetAngleToPrograde(Orbit orbit, double universalTime) { if (orbit.referenceBody == CelestialBodies.SystemBody.CelestialBody) { @@ -72,12 +58,12 @@ public static double GetAngleToPrograde(this Orbit orbit, double universalTime) return AngleHelper.Clamp360(orbit.inclination < 90.0 ? angle : 360.0 - angle); } - public static double GetAngleToRetrograde(this Orbit orbit) + public static double GetAngleToRetrograde(Orbit orbit) { return GetAngleToRetrograde(orbit, Planetarium.GetUniversalTime()); } - public static double GetAngleToRetrograde(this Orbit orbit, double universalTime) + public static double GetAngleToRetrograde(Orbit orbit, double universalTime) { if (orbit.referenceBody == CelestialBodies.SystemBody.CelestialBody) { @@ -95,59 +81,59 @@ public static double GetAngleToRetrograde(this Orbit orbit, double universalTime return AngleHelper.Clamp360(orbit.inclination < 90.0 ? angle : 360.0 - angle); } - public static double GetAngleToTrueAnomaly(this Orbit orbit, double trueAnomaly) + public static double GetAngleToTrueAnomaly(Orbit orbit, double trueAnomaly) { return AngleHelper.Clamp360(trueAnomaly - (orbit.trueAnomaly * Units.RAD_TO_DEG)); } - public static double GetAngleToVector(this Orbit orbit, Vector3d vector) + public static double GetAngleToVector(Orbit orbit, Vector3d vector) { return GetAngleToTrueAnomaly(orbit, GetTrueAnomalyFromVector(orbit, Vector3d.Exclude(orbit.GetOrbitNormal(), vector))); } - public static double GetPhaseAngle(this Orbit orbit, Orbit target) + public static double GetPhaseAngle(Orbit orbit, Orbit target) { var angle = AngleHelper.GetAngleBetweenVectors(Vector3d.Exclude(orbit.GetOrbitNormal(), target.pos), orbit.pos); return (orbit.semiMajorAxis < target.semiMajorAxis) ? angle : angle - 360.0; } - public static double GetRelativeInclination(this Orbit orbit, Orbit target) + public static double GetRelativeInclination(Orbit orbit, Orbit target) { return Vector3d.Angle(orbit.GetOrbitNormal(), target.GetOrbitNormal()); } - public static double GetTimeToAscendingNode(this Orbit orbit) + public static double GetTimeToAscendingNode(Orbit orbit) { return GetTimeToTrueAnomaly(orbit, GetTrueAnomalyOfAscendingNode(orbit)); } - public static double GetTimeToDescendingNode(this Orbit orbit) + public static double GetTimeToDescendingNode(Orbit orbit) { return GetTimeToTrueAnomaly(orbit, GetTrueAnomalyOfDescendingNode(orbit)); } - public static double GetTimeToTrueAnomaly(this Orbit orbit, double trueAnomaly) + public static double GetTimeToTrueAnomaly(Orbit orbit, double trueAnomaly) { var time = orbit.GetDTforTrueAnomaly(trueAnomaly * Mathf.Deg2Rad, orbit.period); return time < 0.0 ? time + orbit.period : time; } - public static double GetTimeToVector(this Orbit orbit, Vector3d vector) + public static double GetTimeToVector(Orbit orbit, Vector3d vector) { return GetTimeToTrueAnomaly(orbit, GetTrueAnomalyFromVector(orbit, vector)); } - public static double GetTrueAnomalyFromVector(this Orbit orbit, Vector3d vector) + public static double GetTrueAnomalyFromVector(Orbit orbit, Vector3d vector) { return orbit.GetTrueAnomalyOfZupVector(vector) * Mathf.Rad2Deg; } - public static double GetTrueAnomalyOfAscendingNode(this Orbit orbit) + public static double GetTrueAnomalyOfAscendingNode(Orbit orbit) { return 360.0 - orbit.argumentOfPeriapsis; } - public static double GetTrueAnomalyOfDescendingNode(this Orbit orbit) + public static double GetTrueAnomalyOfDescendingNode(Orbit orbit) { return 180.0 - orbit.argumentOfPeriapsis; } diff --git a/KerbalEngineer/Extensions/PartExtensions.cs b/KerbalEngineer/Extensions/PartExtensions.cs index 445d10cf..ad5de690 100644 --- a/KerbalEngineer/Extensions/PartExtensions.cs +++ b/KerbalEngineer/Extensions/PartExtensions.cs @@ -1,21 +1,7 @@ // // Kerbal Engineer Redux // -// Copyright (C) 2014 CYBUTEK -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// +// Extension methods are bad namespace KerbalEngineer.Extensions { @@ -32,7 +18,7 @@ public static class PartExtensions /// /// Gets whether the part contains a specific resource. /// - public static bool ContainsResource(this Part part, int resourceId) + public static bool ContainsResource(Part part, int resourceId) { return part.Resources.Contains(resourceId); } @@ -40,7 +26,7 @@ public static bool ContainsResource(this Part part, int resourceId) /// /// Gets whether the part contains resources. /// - public static bool ContainsResources(this Part part) + public static bool ContainsResources(Part part) { for (int i = 0; i < part.Resources.dict.Count; ++i) { @@ -56,7 +42,7 @@ public static bool ContainsResources(this Part part) /// Gets whether the part has fuel. /// /* not used - public static bool EngineHasFuel(this Part part) + public static bool EngineHasFuel(Part part) { PartModule cachePartModule = GetModule(part); if (cachePartModule != null) @@ -76,7 +62,7 @@ public static bool EngineHasFuel(this Part part) /// /// Gets the cost of the part excluding resources. /// - public static double GetCostDry(this Part part) + public static double GetCostDry(Part part) { return part.partInfo.cost - GetResourceCostMax(part) + part.GetModuleCosts(0.0f); } @@ -84,7 +70,7 @@ public static double GetCostDry(this Part part) /// /// Gets the cost of the part including maximum resources. /// - public static double GetCostMax(this Part part) + public static double GetCostMax(Part part) { return part.partInfo.cost + part.GetModuleCosts(0.0f); } @@ -93,7 +79,7 @@ public static double GetCostMax(this Part part) /// Gets the cost of the part modules /// Same as stock but without mem allocation /// - public static double GetModuleCostsNoAlloc(this Part part, float defaultCost) + public static double GetModuleCostsNoAlloc(Part part, float defaultCost) { float cost = 0f; for (int i = 0; i < part.Modules.Count; i++) @@ -108,23 +94,23 @@ public static double GetModuleCostsNoAlloc(this Part part, float defaultCost) /// /// Gets the cost of the part including resources. /// - public static double GetCostWet(this Part part) + public static double GetCostWet(Part part) { - return part.partInfo.cost - GetResourceCostInverted(part) + part.GetModuleCostsNoAlloc(0.0f); // part.GetModuleCosts allocate 44B per call. + return part.partInfo.cost - GetResourceCostInverted(part) + PartExtensions.GetModuleCostsNoAlloc(part,0.0f); // part.GetModuleCosts allocate 44B per call. } /// /// Gets the dry mass of the part. /// - public static double GetDryMass(this Part part) + public static double GetDryMass(Part part) { - return (part.physicalSignificance == Part.PhysicalSignificance.FULL) ? part.mass + part.getCrewAdjustment() : 0d; + return (part.physicalSignificance == Part.PhysicalSignificance.FULL) ? part.mass + PartExtensions.getCrewAdjustment(part) : 0d; } - public static double getCrewAdjustment(this Part part) + public static double getCrewAdjustment(Part part) { //if (HighLogic.LoadedSceneIsEditor && PhysicsGlobals.KerbalCrewMass != 0 && ShipConstruction.ShipManifest != null) - //{ //fix weird stock behavior with this physics setting. + //{ //fix weird stock behavior with physics setting. // var crewlist = ShipConstruction.ShipManifest.GetAllCrew(false); @@ -163,7 +149,7 @@ public static double getCrewAdjustment(this Part part) /// Gets the maximum thrust of the part if it's an engine. /// /* not used - public static double GetMaxThrust(this Part part) + public static double GetMaxThrust(Part part) { PartModule cachePartModule = GetModule(part); if (cachePartModule != null) @@ -184,7 +170,7 @@ public static double GetMaxThrust(this Part part) /// /// Gets the first typed PartModule in the part's module list. /// - public static T GetModule(this Part part) where T : PartModule + public static T GetModule(Part part) where T : PartModule { for (int i = 0; i < part.Modules.Count; i++) { @@ -198,7 +184,7 @@ public static T GetModule(this Part part) where T : PartModule /// /// Gets a typed PartModule. /// - public static T GetModule(this Part part, string className) where T : PartModule + public static T GetModule(Part part, string className) where T : PartModule { return part.Modules[className] as T; } @@ -206,7 +192,7 @@ public static T GetModule(this Part part, string className) where T : PartMod /// /// Gets a typed PartModule. /// - public static T GetModule(this Part part, int classId) where T : PartModule + public static T GetModule(Part part, int classId) where T : PartModule { return part.Modules[classId] as T; } @@ -214,7 +200,7 @@ public static T GetModule(this Part part, int classId) where T : PartModule /// /// Gets a ModuleAlternator typed PartModule. /// - public static ModuleAlternator GetModuleAlternator(this Part part) + public static ModuleAlternator GetModuleAlternator(Part part) { return GetModule(part); } @@ -222,7 +208,7 @@ public static ModuleAlternator GetModuleAlternator(this Part part) /// /// Gets a ModuleDeployableSolarPanel typed PartModule. /// - public static ModuleDeployableSolarPanel GetModuleDeployableSolarPanel(this Part part) + public static ModuleDeployableSolarPanel GetModuleDeployableSolarPanel(Part part) { return GetModule(part); } @@ -230,12 +216,12 @@ public static ModuleDeployableSolarPanel GetModuleDeployableSolarPanel(this Part /// /// Gets a ModuleEngines typed PartModule. /// - public static ModuleEngines GetModuleEngines(this Part part) + public static ModuleEngines GetModuleEngines(Part part) { return GetModule(part); } -/* public static ModuleEnginesFX GetModuleEnginesFx(this Part part) +/* public static ModuleEnginesFX GetModuleEnginesFx(Part part) { return GetModule(part); }*/ @@ -243,7 +229,7 @@ public static ModuleEngines GetModuleEngines(this Part part) /// /// Gets a ModuleGenerator typed PartModule. /// - public static ModuleGenerator GetModuleGenerator(this Part part) + public static ModuleGenerator GetModuleGenerator(Part part) { return GetModule(part); } @@ -251,7 +237,7 @@ public static ModuleGenerator GetModuleGenerator(this Part part) /// /// Gets a ModuleGimbal typed PartModule. /// - public static ModuleGimbal GetModuleGimbal(this Part part) + public static ModuleGimbal GetModuleGimbal(Part part) { return GetModule(part); } @@ -259,7 +245,7 @@ public static ModuleGimbal GetModuleGimbal(this Part part) /// /// Gets the current selected ModuleEnginesFX. /// - public static ModuleEngines GetModuleMultiModeEngine(this Part part) + public static ModuleEngines GetModuleMultiModeEngine(Part part) { ModuleEngines moduleEngines; MultiModeEngine multiMod = GetModule(part); @@ -281,12 +267,12 @@ public static ModuleEngines GetModuleMultiModeEngine(this Part part) /// /// Gets a ModuleParachute typed PartModule. /// - public static ModuleParachute GetModuleParachute(this Part part) + public static ModuleParachute GetModuleParachute(Part part) { return GetModule(part); } - public static ModuleRCS GetModuleRcs(this Part part) + public static ModuleRCS GetModuleRcs(Part part) { return GetModule(part); } @@ -294,7 +280,7 @@ public static ModuleRCS GetModuleRcs(this Part part) /// /// Gets a typed list of PartModules. /// - public static List GetModules(this Part part) where T : PartModule + public static List GetModules(Part part) where T : PartModule { List list = new List(); for (int i = 0; i < part.Modules.Count; ++i) @@ -308,7 +294,7 @@ public static List GetModules(this Part part) where T : PartModule return list; } - public static ProtoModuleDecoupler GetProtoModuleDecoupler(this Part part) + public static ProtoModuleDecoupler GetProtoModuleDecoupler(Part part) { PartModule cachePartModule = GetModule(part); if (cachePartModule == null) @@ -326,7 +312,7 @@ public static ProtoModuleDecoupler GetProtoModuleDecoupler(this Part part) /// /// Gets a generic proto engine for the current engine module attached to the part. /// - public static ProtoModuleEngine GetProtoModuleEngine(this Part part) + public static ProtoModuleEngine GetProtoModuleEngine(Part part) { PartModule cachePartModule = GetModule(part); if (cachePartModule != null) @@ -346,7 +332,7 @@ public static ProtoModuleEngine GetProtoModuleEngine(this Part part) /// /// Gets the cost of the part's contained resources. /// - public static double GetResourceCost(this Part part) + public static double GetResourceCost(Part part) { double cost = 0.0; for (int i = 0; i < part.Resources.dict.Count; ++i) @@ -360,7 +346,7 @@ public static double GetResourceCost(this Part part) /// /// Gets the cost of the part's contained resources, inverted. /// - public static double GetResourceCostInverted(this Part part) + public static double GetResourceCostInverted(Part part) { double sum = 0; for (int i = 0; i < part.Resources.dict.Count; i++) @@ -374,7 +360,7 @@ public static double GetResourceCostInverted(this Part part) /// /// Gets the cost of the part's maximum contained resources. /// - public static double GetResourceCostMax(this Part part) + public static double GetResourceCostMax(Part part) { double cost = 0.0; for (int i = 0; i < part.Resources.dict.Count; ++i) @@ -389,7 +375,7 @@ public static double GetResourceCostMax(this Part part) /// Gets the current specific impulse for the engine. /// /* not used - public static double GetSpecificImpulse(this Part part, float atmosphere) + public static double GetSpecificImpulse(Part part, float atmosphere) { PartModule cachePartModule = GetModule(part); if (cachePartModule != null) @@ -410,15 +396,15 @@ public static double GetSpecificImpulse(this Part part, float atmosphere) /// /// Gets the total mass of the part including resources. /// - public static double GetWetMass(this Part part) + public static double GetWetMass(Part part) { - return (part.physicalSignificance == Part.PhysicalSignificance.FULL) ? part.mass + part.GetResourceMass() + part.getCrewAdjustment() : part.GetResourceMass(); + return (part.physicalSignificance == Part.PhysicalSignificance.FULL) ? part.mass + part.GetResourceMass() + getCrewAdjustment(part) : part.GetResourceMass(); } /// /// Gets whether the part contains a PartModule. /// - public static bool HasModule(this Part part) where T : PartModule + public static bool HasModule(Part part) where T : PartModule { for (int i = 0; i < part.Modules.Count; i++) { @@ -431,7 +417,7 @@ public static bool HasModule(this Part part) where T : PartModule /// /// Gets whether the part contains a PartModule conforming to the supplied predicate. /// - public static bool HasModule(this Part part, Func predicate) where T : PartModule + public static bool HasModule(Part part, Func predicate) where T : PartModule { for (int i = 0; i < part.Modules.Count; i++) { @@ -445,7 +431,7 @@ public static bool HasModule(this Part part, Func predicate) where T /// /// Gets whether the part contains a PartModule. /// - public static bool HasModule(this Part part, string className) + public static bool HasModule(Part part, string className) { return part.Modules.Contains(className); } @@ -453,7 +439,7 @@ public static bool HasModule(this Part part, string className) /// /// Gets whether the part contains a PartModule. /// - public static bool HasModule(this Part part, int moduleId) + public static bool HasModule(Part part, int moduleId) { return part.Modules.Contains(moduleId); } @@ -461,7 +447,7 @@ public static bool HasModule(this Part part, int moduleId) /// /// Gets whether the part has a one shot animation. /// - public static bool HasOneShotAnimation(this Part part) + public static bool HasOneShotAnimation(Part part) { PartModule cachePartModule = GetModule(part); return cachePartModule != null && (cachePartModule as ModuleAnimateGeneric).isOneShot; @@ -470,7 +456,7 @@ public static bool HasOneShotAnimation(this Part part) /// /// Gets whether the part is a command module. /// - public static bool IsCommandModule(this Part part) + public static bool IsCommandModule(Part part) { return HasModule(part); } @@ -478,7 +464,7 @@ public static bool IsCommandModule(this Part part) /// /// Gets whether the part is decoupled in a specified stage. /// - public static bool IsDecoupledInStage(this Part part, int stage) + public static bool IsDecoupledInStage(Part part, int stage) { if ((IsDecoupler(part) || IsLaunchClamp(part)) && part.inverseStage == stage) { @@ -494,7 +480,7 @@ public static bool IsDecoupledInStage(this Part part, int stage) /// /// Gets whether the part is a decoupler. /// - public static bool IsDecoupler(this Part part) + public static bool IsDecoupler(Part part) { return HasModule(part) || HasModule(part); } @@ -502,7 +488,7 @@ public static bool IsDecoupler(this Part part) /// /// Gets whether the part is an active engine. /// - public static bool IsEngine(this Part part) + public static bool IsEngine(Part part) { return HasModule(part); } @@ -510,7 +496,7 @@ public static bool IsEngine(this Part part) /// /// Gets whether the part is a fuel line. /// - public static bool IsFuelLine(this Part part) + public static bool IsFuelLine(Part part) { return HasModule(part); } @@ -518,7 +504,7 @@ public static bool IsFuelLine(this Part part) /// /// Gets whether the part is a generator. /// - public static bool IsGenerator(this Part part) + public static bool IsGenerator(Part part) { return HasModule(part); } @@ -526,7 +512,7 @@ public static bool IsGenerator(this Part part) /// /// Gets whether the part is a launch clamp. /// - public static bool IsLaunchClamp(this Part part) + public static bool IsLaunchClamp(Part part) { return HasModule(part); } @@ -534,7 +520,7 @@ public static bool IsLaunchClamp(this Part part) /// /// Gets whether the part is a parachute. /// - public static bool IsParachute(this Part part) + public static bool IsParachute(Part part) { return HasModule(part); } @@ -542,12 +528,12 @@ public static bool IsParachute(this Part part) /// /// Gets whether the part is considered a primary part on the vessel. /// - public static bool IsPrimary(this Part part, List partsList, PartModule module) + public static bool IsPrimary(Part part, List partsList, PartModule module) { for (int i = 0; i < partsList.Count; i++) { var vesselPart = partsList[i]; - if (!vesselPart.HasModule(module.ClassID)) + if (!HasModule(vesselPart, module.ClassID)) { continue; } @@ -561,7 +547,7 @@ public static bool IsPrimary(this Part part, List partsList, PartModule mo return false; } - public static bool IsRcsModule(this Part part) + public static bool IsRcsModule(Part part) { return HasModule(part); } @@ -569,7 +555,7 @@ public static bool IsRcsModule(this Part part) /// /// Gets whether the part is a sepratron. /// - public static bool IsSepratron(this Part part) + public static bool IsSepratron(Part part) { for (int i = 0; i < part.Modules.Count; i++) { @@ -582,7 +568,7 @@ public static bool IsSepratron(this Part part) return false; } - public static bool ContainedPart(this Part part, List chain) + public static bool ContainedPart(Part part, List chain) { for (int i = 0; i < chain.Count; i++) { @@ -596,7 +582,7 @@ public static bool ContainedPart(this Part part, List chain) /// /// Gets whether the part is a deployable solar panel. /// - public static bool IsSolarPanel(this Part part) + public static bool IsSolarPanel(Part part) { return HasModule(part); } @@ -604,9 +590,9 @@ public static bool IsSolarPanel(this Part part) /// /// Gets whether the part is a solid rocket motor. /// - public static bool IsSolidRocket(this Part part) + public static bool IsSolidRocket(Part part) { - return (part.HasModule() && part.GetModuleEngines().throttleLocked); + return (PartExtensions.HasModule(part) && PartExtensions.GetModuleEngines(part).throttleLocked); } public class ProtoModuleDecoupler @@ -657,7 +643,7 @@ private void SetModuleDecouple() } } - // This needs updating to handle multi-mode engines and engines with multiple ModuleEngines correctly. + // needs updating to handle multi-mode engines and engines with multiple ModuleEngines correctly. // It currently just shows the stats of the currently active module for multi-mode engines and just // the first ModuleEngines for engines with multiple modules. // It should really show all the modes for multi-mode engines as separate sections. diff --git a/KerbalEngineer/Extensions/PartResourceExtensions.cs b/KerbalEngineer/Extensions/PartResourceExtensions.cs index 09601e3d..f616054a 100644 --- a/KerbalEngineer/Extensions/PartResourceExtensions.cs +++ b/KerbalEngineer/Extensions/PartResourceExtensions.cs @@ -1,21 +1,7 @@ // // Kerbal Engineer Redux // -// Copyright (C) 2014 CYBUTEK -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// +// Extension methods are bad. namespace KerbalEngineer.Extensions { @@ -26,7 +12,7 @@ public static class PartResourceExtensions /// /// Gets the cost of the resource. /// - public static double GetCost(this PartResource resource) + public static double GetCost(PartResource resource) { return resource.amount * resource.info.unitCost; } @@ -34,7 +20,7 @@ public static double GetCost(this PartResource resource) /// /// Gets the definition object for the resource. /// - public static PartResourceDefinition GetDefinition(this PartResource resource) + public static PartResourceDefinition GetDefinition(PartResource resource) { return PartResourceLibrary.Instance.GetDefinition(resource.info.id); } @@ -42,17 +28,17 @@ public static PartResourceDefinition GetDefinition(this PartResource resource) /// /// Gets the density of the resource. /// - public static double GetDensity(this PartResource resource) + public static double GetDensity(PartResource resource) { - return resource.GetDefinition().density; + return GetDefinition(resource).density; } /// /// Gets the mass of the resource. /// - public static double GetMass(this PartResource resource) + public static double GetMass(PartResource resource) { - return resource.amount * resource.GetDensity(); + return resource.amount * GetDensity(resource); } #endregion diff --git a/KerbalEngineer/Flight/FlightEngineerCore.cs b/KerbalEngineer/Flight/FlightEngineerCore.cs index 225efb37..c1d9337f 100644 --- a/KerbalEngineer/Flight/FlightEngineerCore.cs +++ b/KerbalEngineer/Flight/FlightEngineerCore.cs @@ -114,7 +114,7 @@ public static bool IsDisplayable { if (isTrackingStationLimited && ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.TrackingStation) == 1.0f) { return true; } - return FlightGlobals.ActiveVessel.parts.Any(p => p.HasModule()); + return FlightGlobals.ActiveVessel.parts.Any(p => PartExtensions.HasModule(p)); } return true; diff --git a/KerbalEngineer/Flight/Readouts/Orbital/AngleToEquatorialAscendingNode.cs b/KerbalEngineer/Flight/Readouts/Orbital/AngleToEquatorialAscendingNode.cs index 80d80b96..6a641d83 100644 --- a/KerbalEngineer/Flight/Readouts/Orbital/AngleToEquatorialAscendingNode.cs +++ b/KerbalEngineer/Flight/Readouts/Orbital/AngleToEquatorialAscendingNode.cs @@ -44,7 +44,7 @@ public AngleToEquatorialAscendingNode() public override void Draw(Unity.Flight.ISectionModule section) { - this.DrawLine(FlightGlobals.ActiveVessel.orbit.GetAngleToAscendingNode().ToAngle(), section.IsHud); + this.DrawLine(OrbitExtensions.GetAngleToAscendingNode(FlightGlobals.ActiveVessel.orbit).ToAngle(), section.IsHud); } #endregion diff --git a/KerbalEngineer/Flight/Readouts/Orbital/AngleToEquatorialDescendingNode.cs b/KerbalEngineer/Flight/Readouts/Orbital/AngleToEquatorialDescendingNode.cs index c967c948..e4decab6 100644 --- a/KerbalEngineer/Flight/Readouts/Orbital/AngleToEquatorialDescendingNode.cs +++ b/KerbalEngineer/Flight/Readouts/Orbital/AngleToEquatorialDescendingNode.cs @@ -44,7 +44,7 @@ public AngleToEquatorialDescendingNode() public override void Draw(Unity.Flight.ISectionModule section) { - this.DrawLine(FlightGlobals.ActiveVessel.orbit.GetAngleToDescendingNode().ToAngle(), section.IsHud); + this.DrawLine(OrbitExtensions.GetAngleToDescendingNode(FlightGlobals.ActiveVessel.orbit).ToAngle(), section.IsHud); } #endregion diff --git a/KerbalEngineer/Flight/Readouts/Orbital/AngleToPrograde.cs b/KerbalEngineer/Flight/Readouts/Orbital/AngleToPrograde.cs index ab45e636..fd72923e 100644 --- a/KerbalEngineer/Flight/Readouts/Orbital/AngleToPrograde.cs +++ b/KerbalEngineer/Flight/Readouts/Orbital/AngleToPrograde.cs @@ -46,7 +46,7 @@ public AngleToPrograde() public override void Draw(Unity.Flight.ISectionModule section) { - this.DrawLine(FlightGlobals.ship_orbit.GetAngleToPrograde().ToAngle(), section.IsHud); + this.DrawLine(OrbitExtensions.GetAngleToPrograde(FlightGlobals.ship_orbit).ToAngle(), section.IsHud); } #endregion diff --git a/KerbalEngineer/Flight/Readouts/Orbital/AngleToRetrograde.cs b/KerbalEngineer/Flight/Readouts/Orbital/AngleToRetrograde.cs index a1f66414..7e35fdd9 100644 --- a/KerbalEngineer/Flight/Readouts/Orbital/AngleToRetrograde.cs +++ b/KerbalEngineer/Flight/Readouts/Orbital/AngleToRetrograde.cs @@ -46,7 +46,7 @@ public AngleToRetrograde() public override void Draw(Unity.Flight.ISectionModule section) { - this.DrawLine(FlightGlobals.ship_orbit.GetAngleToRetrograde().ToAngle(), section.IsHud); + this.DrawLine(OrbitExtensions.GetAngleToRetrograde(FlightGlobals.ship_orbit).ToAngle(), section.IsHud); } #endregion diff --git a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/ManoeuvreProcessor.cs b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/ManoeuvreProcessor.cs index e19d4a57..0d1f744c 100644 --- a/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/ManoeuvreProcessor.cs +++ b/KerbalEngineer/Flight/Readouts/Orbital/ManoeuvreNode/ManoeuvreProcessor.cs @@ -132,8 +132,8 @@ public void Update() PostBurnPeriod = node.nextPatch != null ? node.nextPatch.period : 0; UniversalTime = FlightGlobals.ActiveVessel.patchedConicSolver.maneuverNodes[0].UT; - AngleToPrograde = FlightGlobals.ActiveVessel.patchedConicSolver.maneuverNodes[0].patch.GetAngleToPrograde(UniversalTime); - AngleToRetrograde = FlightGlobals.ActiveVessel.patchedConicSolver.maneuverNodes[0].patch.GetAngleToRetrograde(UniversalTime); + AngleToPrograde = OrbitExtensions.GetAngleToPrograde(FlightGlobals.ActiveVessel.patchedConicSolver.maneuverNodes[0].patch, UniversalTime); + AngleToRetrograde = OrbitExtensions.GetAngleToRetrograde(FlightGlobals.ActiveVessel.patchedConicSolver.maneuverNodes[0].patch, UniversalTime); var burnTime = 0.0; var midPointTime = 0.0; diff --git a/KerbalEngineer/Flight/Readouts/Orbital/TimeToEquatorialAscendingNode.cs b/KerbalEngineer/Flight/Readouts/Orbital/TimeToEquatorialAscendingNode.cs index 604a13f0..a41f89a2 100644 --- a/KerbalEngineer/Flight/Readouts/Orbital/TimeToEquatorialAscendingNode.cs +++ b/KerbalEngineer/Flight/Readouts/Orbital/TimeToEquatorialAscendingNode.cs @@ -45,7 +45,7 @@ public TimeToEquatorialAscendingNode() public override void Draw(Unity.Flight.ISectionModule section) { - this.DrawLine(TimeFormatter.ConvertToString(FlightGlobals.ActiveVessel.orbit.GetTimeToAscendingNode()), section.IsHud); + this.DrawLine(TimeFormatter.ConvertToString(OrbitExtensions.GetTimeToAscendingNode(FlightGlobals.ActiveVessel.orbit)), section.IsHud); } #endregion diff --git a/KerbalEngineer/Flight/Readouts/Orbital/TimeToEquatorialDescendingNode.cs b/KerbalEngineer/Flight/Readouts/Orbital/TimeToEquatorialDescendingNode.cs index 9cce768d..7e93dbce 100644 --- a/KerbalEngineer/Flight/Readouts/Orbital/TimeToEquatorialDescendingNode.cs +++ b/KerbalEngineer/Flight/Readouts/Orbital/TimeToEquatorialDescendingNode.cs @@ -45,7 +45,7 @@ public TimeToEquatorialDescendingNode() public override void Draw(Unity.Flight.ISectionModule section) { - this.DrawLine(TimeFormatter.ConvertToString(FlightGlobals.ActiveVessel.orbit.GetTimeToDescendingNode()), section.IsHud); + this.DrawLine(TimeFormatter.ConvertToString(OrbitExtensions.GetTimeToDescendingNode(FlightGlobals.ActiveVessel.orbit)), section.IsHud); } #endregion diff --git a/KerbalEngineer/Flight/Readouts/Rendezvous/RendezvousProcessor.cs b/KerbalEngineer/Flight/Readouts/Rendezvous/RendezvousProcessor.cs index b61f68a3..9606a8f2 100644 --- a/KerbalEngineer/Flight/Readouts/Rendezvous/RendezvousProcessor.cs +++ b/KerbalEngineer/Flight/Readouts/Rendezvous/RendezvousProcessor.cs @@ -378,7 +378,7 @@ public void Update() { } RelativeInclination = targetOrbit.inclination; - PhaseAngle = actualSourceOrbit.GetPhaseAngle(actualTargetOrbit); //this works for some reason. + PhaseAngle = OrbitExtensions.GetPhaseAngle(actualSourceOrbit,actualTargetOrbit); //this works for some reason. } else if (overrideANDNRev) { //landing @@ -393,12 +393,12 @@ public void Update() { RelativeInclination = originOrbit.inclination; Distance = Vector3d.Distance(target.GetVessel().GetWorldPos3D(), vessel.GetWorldPos3D()); AltitudeSeaLevel = tgt.altitude; - PhaseAngle = actualSourceOrbit.GetPhaseAngle(actualTargetOrbit); //this works for some reason. + PhaseAngle = OrbitExtensions.GetPhaseAngle(actualSourceOrbit, actualTargetOrbit); //this works for some reason. } else { //standard 2 orbits - RelativeInclination = originOrbit.GetRelativeInclination(targetOrbit); + RelativeInclination = OrbitExtensions.GetRelativeInclination(originOrbit, targetOrbit); @@ -408,7 +408,7 @@ public void Update() { } else { var node = FlightGlobals.ActiveVessel.patchedConicSolver.maneuverNodes[0]; if (node != null && node.nextPatch != null) - Orbital.ManoeuvreNode.ManoeuvreProcessor.PostBurnRelativeInclination = node.nextPatch.GetRelativeInclination(FlightGlobals.ActiveVessel.targetObject.GetOrbit()); + Orbital.ManoeuvreNode.ManoeuvreProcessor.PostBurnRelativeInclination = OrbitExtensions.GetRelativeInclination(node.nextPatch, FlightGlobals.ActiveVessel.targetObject.GetOrbit()); } @@ -419,7 +419,7 @@ public void Update() { // FlightGlobals.ship_tgtVelocity = FlightGlobals.ship_obtVelocity - this.VesselTarget.GetObtVelocity(); // FlightGlobals.ship_tgtSpeed = FlightGlobals.ship_tgtVelocity.magnitude; - PhaseAngle = originOrbit.GetPhaseAngle(targetOrbit); + PhaseAngle = OrbitExtensions.GetPhaseAngle(originOrbit, targetOrbit); InterceptAngle = CalcInterceptAngle(targetOrbit, originOrbit); double tspd = 360 / targetOrbit.period; @@ -438,10 +438,10 @@ public void Update() { } - TimeToAscendingNode = originOrbit.GetTimeToVector(GetAscendingNode(targetOrbit, originOrbit)); - TimeToDescendingNode = originOrbit.GetTimeToVector(GetDescendingNode(targetOrbit, originOrbit)); - AngleToAscendingNode = originOrbit.GetAngleToVector(GetAscendingNode(targetOrbit, originOrbit)); - AngleToDescendingNode = originOrbit.GetAngleToVector(GetDescendingNode(targetOrbit, originOrbit)); + TimeToAscendingNode = OrbitExtensions.GetTimeToVector(originOrbit, GetAscendingNode(targetOrbit, originOrbit)); + TimeToDescendingNode = OrbitExtensions.GetTimeToVector(originOrbit, GetDescendingNode(targetOrbit, originOrbit)); + AngleToAscendingNode = OrbitExtensions.GetAngleToVector(originOrbit, GetAscendingNode(targetOrbit, originOrbit)); + AngleToDescendingNode = OrbitExtensions.GetAngleToVector(originOrbit, GetDescendingNode(targetOrbit, originOrbit)); Distance = Vector3d.Distance(targetOrbit.pos, originOrbit.pos); diff --git a/KerbalEngineer/Flight/Readouts/Surface/AtmosphericProcessor.cs b/KerbalEngineer/Flight/Readouts/Surface/AtmosphericProcessor.cs index 71920df8..1df8f135 100644 --- a/KerbalEngineer/Flight/Readouts/Surface/AtmosphericProcessor.cs +++ b/KerbalEngineer/Flight/Readouts/Surface/AtmosphericProcessor.cs @@ -137,7 +137,7 @@ public void Update() } else { - var m = FlightGlobals.ActiveVessel.parts.Sum(part => part.GetWetMass()) * 1000.0; + var m = FlightGlobals.ActiveVessel.parts.Sum(part => PartExtensions.GetWetMass(part)) * 1000.0; var g = FlightGlobals.getGeeForceAtPosition(FlightGlobals.ship_position).magnitude; var a = FlightGlobals.ActiveVessel.parts.Sum(part => part.DragCubes.AreaDrag) * PhysicsGlobals.DragCubeMultiplier; var p = FlightGlobals.ActiveVessel.atmDensity; diff --git a/KerbalEngineer/KerbalEngineer.csproj b/KerbalEngineer/KerbalEngineer.csproj index b575835d..e0af6a3a 100644 --- a/KerbalEngineer/KerbalEngineer.csproj +++ b/KerbalEngineer/KerbalEngineer.csproj @@ -348,6 +348,7 @@ {5387bb1e-32b1-4bac-b03f-100570b9554c} KerbalEngineer.Unity + False diff --git a/KerbalEngineer/VesselSimulator/PartSim.cs b/KerbalEngineer/VesselSimulator/PartSim.cs index a9e4e150..9002a208 100644 --- a/KerbalEngineer/VesselSimulator/PartSim.cs +++ b/KerbalEngineer/VesselSimulator/PartSim.cs @@ -121,16 +121,16 @@ public static PartSim New(Part p, int id, double atmosphere, LogMsg log) { if (partSim.isEnginePlate) partSim.noCrossFeedNodeKey = "bottom"; //sadly this only works in one direction. partSim.decoupledInStage = partSim.DecoupledInStage(p); - partSim.isFuelLine = p.HasModule(); - partSim.isRCS = p.HasModule() || p.HasModule(); //I don't think it checks inheritance. - partSim.isSepratron = p.IsSepratron(); + partSim.isFuelLine = PartExtensions.HasModule(p); + partSim.isRCS = PartExtensions.HasModule(p) || PartExtensions.HasModule(p); //I don't think it checks inheritance. + partSim.isSepratron = PartExtensions.IsSepratron(p); partSim.inverseStage = p.inverseStage; if (log != null) log.AppendLine("inverseStage = ", partSim.inverseStage); partSim.resPriorityOffset = p.resourcePriorityOffset; partSim.resPriorityUseParentInverseStage = p.resourcePriorityUseParentInverseStage; partSim.resRequestRemainingThreshold = p.resourceRequestRemainingThreshold; - partSim.baseCost = p.GetCostDry(); + partSim.baseCost = PartExtensions.GetCostDry(p); if (log != null) log.AppendLine("Parent part = ", (p.parent == null ? "null" : p.parent.partInfo.name)) .AppendLine("physicalSignificance = ", p.physicalSignificance) @@ -141,11 +141,11 @@ public static PartSim New(Part p, int id, double atmosphere, LogMsg log) { partSim.isNoPhysics = p.physicalSignificance == Part.PhysicalSignificance.NONE || p.PhysicsSignificance == 1; - if (p.HasModule()) { + if (PartExtensions.HasModule(p)) { partSim.realMass = 0d; if (log != null) log.AppendLine("Ignoring mass of launch clamp"); } else { - partSim.crewMassOffset = p.getCrewAdjustment(); + partSim.crewMassOffset = PartExtensions.getCrewAdjustment(p); partSim.realMass = p.mass + partSim.crewMassOffset; if (log != null) log.AppendLine("Using part.mass of " + partSim.realMass); @@ -194,8 +194,8 @@ public static PartSim New(Part p, int id, double atmosphere, LogMsg log) { } partSim.initialVesselName = p.initialVesselName; - partSim.hasMultiModeEngine = p.HasModule(); - partSim.hasModuleEngines = p.HasModule(); + partSim.hasMultiModeEngine = PartExtensions.HasModule(p); + partSim.hasModuleEngines = PartExtensions.HasModule(p); partSim.isEngine = partSim.hasMultiModeEngine || partSim.hasModuleEngines; @@ -873,9 +873,9 @@ private int DecoupledInStage(Part thePart) { if (thePart.inverseStage > stage) { - ModuleDecouple mdec = thePart.GetModule(); - ModuleDockingNode mdock = thePart.GetModule(); - ModuleAnchoredDecoupler manch = thePart.GetModule(); + ModuleDecouple mdec = PartExtensions.GetModule(thePart); + ModuleDockingNode mdock = PartExtensions.GetModule(thePart); + ModuleAnchoredDecoupler manch = PartExtensions.GetModule(thePart); if (mdec != null) { AttachNode att = thePart.FindAttachNode(mdec.explosiveNodeID); @@ -883,7 +883,7 @@ private int DecoupledInStage(Part thePart) { stage = thePart.inverseStage; else { if (att != null) { - if ((thePart.parent != null && att.attachedPart == thePart.parent) || att.attachedPart.ContainedPart(chain)) + if ((thePart.parent != null && att.attachedPart == thePart.parent) || PartExtensions.ContainedPart(att.attachedPart, chain)) stage = thePart.inverseStage; } else stage = thePart.inverseStage; } @@ -893,7 +893,7 @@ private int DecoupledInStage(Part thePart) { { AttachNode att = thePart.FindAttachNode(manch.explosiveNodeID); // these stupid fuckers don't initialize in the Editor scene. if (att != null) { - if ((thePart.parent != null && att.attachedPart == thePart.parent) || att.attachedPart.ContainedPart(chain)) + if ((thePart.parent != null && att.attachedPart == thePart.parent) || PartExtensions.ContainedPart(att.attachedPart, chain)) stage = thePart.inverseStage; } else stage = thePart.inverseStage; //radial decouplers it seems the attach node ('surface') comes back null. } @@ -914,9 +914,9 @@ private int DecoupledInStage(Part thePart) { } private static bool IsEnginePlate(Part thePart) { - ModuleDecouple mdec = thePart.GetModule(); + ModuleDecouple mdec = PartExtensions.GetModule(thePart); if (mdec != null && mdec.IsStageable()) { - ModuleDynamicNodes mdyn = thePart.GetModule(); + ModuleDynamicNodes mdyn = PartExtensions.GetModule(thePart); if (mdyn != null) return true; } diff --git a/KerbalEngineer/VesselSimulator/Simulation.cs b/KerbalEngineer/VesselSimulator/Simulation.cs index 613badcc..9bd1740d 100644 --- a/KerbalEngineer/VesselSimulator/Simulation.cs +++ b/KerbalEngineer/VesselSimulator/Simulation.cs @@ -211,7 +211,7 @@ public bool PrepareSimulation(LogMsg _log, List parts, double theGravity, for (int i = 0; i < allFuelLines.Count; ++i) { PartSim partSim = allFuelLines[i]; - CModuleFuelLine fuelLine = partSim.part.GetModule(); + CModuleFuelLine fuelLine = PartExtensions.GetModule(partSim.part); if (fuelLine.target != null) { PartSim targetSim; if (partSimLookup.TryGetValue(fuelLine.target, out targetSim)) { diff --git a/Output/KerbalEngineer/KerbalEngineer.Unity.dll b/Output/KerbalEngineer/KerbalEngineer.Unity.dll index 0a976d58..064741e1 100644 Binary files a/Output/KerbalEngineer/KerbalEngineer.Unity.dll and b/Output/KerbalEngineer/KerbalEngineer.Unity.dll differ diff --git a/Output/KerbalEngineer/KerbalEngineer.dll b/Output/KerbalEngineer/KerbalEngineer.dll index 9a527463..3a89ffce 100644 Binary files a/Output/KerbalEngineer/KerbalEngineer.dll and b/Output/KerbalEngineer/KerbalEngineer.dll differ diff --git a/Output/KerbalEngineer/KerbalEngineer.version b/Output/KerbalEngineer/KerbalEngineer.version index 35eb2624..e0040b38 100644 --- a/Output/KerbalEngineer/KerbalEngineer.version +++ b/Output/KerbalEngineer/KerbalEngineer.version @@ -6,8 +6,8 @@ { "MAJOR":1, "MINOR":1, - "PATCH":8, - "BUILD":4 + "PATCH":9, + "BUILD":0 }, "KSP_VERSION": {