-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- New KSP bugfix : [EnginePlateAirstreamShieldedTopPart](#52) (Thanks to @yalov (flart) for reporting and to @Aelfhe1m for coming up with a clever solution). - New KSP bugfix : [AsteroidInfiniteMining](#51) (Thanks to @Rodg88 for reporting).
- Loading branch information
1 parent
1444188
commit 7b6dc72
Showing
7 changed files
with
100 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<PatchInfo> 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; | ||
} | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
KSPCommunityFixes/BugFixes/EnginePlateAirstreamShieldedTopPart.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<PatchInfo> 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<AttachNode> 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; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters