diff --git a/GameData/KSPCommunityFixes/KSPCommunityFixes.version b/GameData/KSPCommunityFixes/KSPCommunityFixes.version index 9d9164f..6b0dba8 100644 --- a/GameData/KSPCommunityFixes/KSPCommunityFixes.version +++ b/GameData/KSPCommunityFixes/KSPCommunityFixes.version @@ -2,7 +2,7 @@ "NAME": "KSPCommunityFixes", "URL": "https://raw.githubusercontent.com/KSPModdingLibs/KSPCommunityFixes/master/GameData/KSPCommunityFixes/KSPCommunityFixes.version", "DOWNLOAD": "https://github.com/KSPModdingLibs/KSPCommunityFixes/releases", - "VERSION": {"MAJOR": 1, "MINOR": 18, "PATCH": 3, "BUILD": 0}, + "VERSION": {"MAJOR": 1, "MINOR": 19, "PATCH": 0, "BUILD": 0}, "KSP_VERSION": {"MAJOR": 1, "MINOR": 12, "PATCH": 3}, "KSP_VERSION_MIN": {"MAJOR": 1, "MINOR": 8, "PATCH": 0}, "KSP_VERSION_MAX": {"MAJOR": 1, "MINOR": 12, "PATCH": 3} diff --git a/GameData/KSPCommunityFixes/Settings.cfg b/GameData/KSPCommunityFixes/Settings.cfg index 34c1067..44214b0 100644 --- a/GameData/KSPCommunityFixes/Settings.cfg +++ b/GameData/KSPCommunityFixes/Settings.cfg @@ -114,6 +114,12 @@ KSP_COMMUNITY_FIXES // Fix rescaled servo parts propagating their scale to childrens after actuating the servo in the editor RescaledRoboticParts = true + // Fix engine plates causing the part attached above them to be incorrectly shielded from airstream + EnginePlateAirstreamShieldedTopPart = true + + // Fix asteroid/comet mass being restored to 100% when reloading after having mined it down to 0% + AsteroidInfiniteMining = true + // ########################## // Obsolete bugfixes // ########################## diff --git a/KSPCommunityFixes/BugFixes/AsteroidInfiniteMining.cs b/KSPCommunityFixes/BugFixes/AsteroidInfiniteMining.cs new file mode 100644 index 0000000..a0d8051 --- /dev/null +++ b/KSPCommunityFixes/BugFixes/AsteroidInfiniteMining.cs @@ -0,0 +1,30 @@ +// see https://github.com/KSPModdingLibs/KSPCommunityFixes/issues/51 + +using HarmonyLib; +using System; +using System.Collections.Generic; + +namespace KSPCommunityFixes.BugFixes +{ + class AsteroidInfiniteMining : BasePatch + { + protected override Version VersionMin => new Version(1, 10, 0); + + protected override void ApplyPatches(List patches) + { + patches.Add(new PatchInfo( + PatchMethodType.Prefix, + AccessTools.PropertySetter(typeof(ModuleSpaceObjectInfo), nameof(ModuleSpaceObjectInfo.currentMassVal)), + this, nameof(ModuleSpaceObjectInfo_currentMassVal_Setter_Prefix))); + } + + static bool ModuleSpaceObjectInfo_currentMassVal_Setter_Prefix(ModuleSpaceObjectInfo __instance, double value) + { + if (value <= 1e-9) + value = 1e-8; + + __instance.currentMass = value.ToString("G17"); + return false; + } + } +} diff --git a/KSPCommunityFixes/BugFixes/EnginePlateAirstreamShieldedTopPart.cs b/KSPCommunityFixes/BugFixes/EnginePlateAirstreamShieldedTopPart.cs new file mode 100644 index 0000000..ab99f5b --- /dev/null +++ b/KSPCommunityFixes/BugFixes/EnginePlateAirstreamShieldedTopPart.cs @@ -0,0 +1,53 @@ +// see https://github.com/KSPModdingLibs/KSPCommunityFixes/issues/52 + +using HarmonyLib; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace KSPCommunityFixes.BugFixes +{ + class EnginePlateAirstreamShieldedTopPart : BasePatch + { + protected override Version VersionMin => new Version(1, 11, 0); + + protected override void ApplyPatches(List patches) + { + patches.Add(new PatchInfo( + PatchMethodType.Prefix, + AccessTools.Method(typeof(ModuleDecouplerBase), nameof(ModuleDecouplerBase.SetAirstream)), + this)); + } + + static bool ModuleDecouplerBase_SetAirstream_Prefix(ModuleDecouplerBase __instance, bool enclosed) + { + __instance.shroudOn = enclosed; + + if (__instance.jettisonModule.IsNullOrDestroyed()) + return false; + + List attachNodes = __instance.part.attachNodes; + AttachNode bottomNode = attachNodes.Find(node => node.id == __instance.jettisonModule.bottomNodeName); + + foreach (AttachNode attachNode in attachNodes) + { + if (attachNode.attachedPart.IsNullOrDestroyed()) + continue; + + if (attachNode == bottomNode) + continue; + + if (Vector3.Angle(bottomNode.orientation, attachNode.orientation) < 30f) + { + attachNode.attachedPart.ShieldedFromAirstream = enclosed; + if (enclosed) + attachNode.attachedPart.AddShield(__instance); + else + attachNode.attachedPart.RemoveShield(__instance); + } + } + + return false; + } + } +} diff --git a/KSPCommunityFixes/KSPCommunityFixes.csproj b/KSPCommunityFixes/KSPCommunityFixes.csproj index dca35a3..c75a560 100644 --- a/KSPCommunityFixes/KSPCommunityFixes.csproj +++ b/KSPCommunityFixes/KSPCommunityFixes.csproj @@ -91,6 +91,8 @@ + + diff --git a/KSPCommunityFixes/Properties/AssemblyInfo.cs b/KSPCommunityFixes/Properties/AssemblyInfo.cs index 990eaee..8e00d98 100644 --- a/KSPCommunityFixes/Properties/AssemblyInfo.cs +++ b/KSPCommunityFixes/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("1.18.3.0")] -[assembly: AssemblyFileVersion("1.18.3.0")] +[assembly: AssemblyVersion("1.19.0.0")] +[assembly: AssemblyFileVersion("1.19.0.0")] diff --git a/README.md b/README.md index b86331e..b387853 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,8 @@ User options are available from the "ESC" in-game settings menu :