Skip to content

Commit

Permalink
Release-187. SinkingBody bugfix optimization.
Browse files Browse the repository at this point in the history
  • Loading branch information
R-T-B committed Aug 30, 2023
1 parent bb067a1 commit f24a6bd
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 8 deletions.
8 changes: 4 additions & 4 deletions README.md
@@ -1,17 +1,17 @@
Kopernicus
==============================
August 27th, 2023
August 30th, 2023
* Created by: BryceSchroeder and Nathaniel R. Lewis (Teknoman117)
* Actively maintained by: Prestja and R-T-B.
* Formerly maintained by: Thomas P., NathanKell and KillAshley
* Additional Content by: Democat3457, Gravitasi, aftokino, KCreator, Padishar, Kragrathea, OvenProofMars, zengei, MrHappyFace, Sigma88, Majiir (CompatibilityChecker), blackrack/LGHassen (shaders/GPL'd scatterer code)
* Much thanks to Sarbian for ModuleManager and ModularFlightIntegrator

New in this latest version release-186:
New in this latest version release-187:

1.) Hotfix for a default config issue that may affect fresh installs ("DisableFarAwayColliders" was mistakenly being set to false on fresh games, resulting in deep space bugs).
1.) A transparent optimization was applied to the SinkingBody bugfix, which was proving rather expensive in CPU usage. Basically, it only runs if you are within 1000m of the ground of a celestial with a PQS, now.

2.) If you want to ensure you weren't affected by this, just check the GUI and ensure option "DisableFarAwayColliders" is checked. It should be "on/checked" in nearly all cirucmstances.
2.) This optimization should be completely safe, but testing around grabbing and landing on far-from-system-center asteroids would be appreciated.

Known Bugs:

Expand Down
Expand Up @@ -8,7 +8,7 @@
"MAJOR": 1,
"MINOR": 12,
"PATCH": 1,
"BUILD": 186
"BUILD": 187
},
"KSP_VERSION_MIN":
{
Expand Down
2 changes: 1 addition & 1 deletion src/Kopernicus/Constants/CompatibilityChecker.cs
Expand Up @@ -56,7 +56,7 @@ public class CompatibilityChecker : MonoBehaviour
#endif
internal const string VERSION_MINOR_LOWER_LIMIT = "8";
internal const string REVISION = "1";
internal const string KOPERNICUS = "186";
internal const string KOPERNICUS = "187";
public static Boolean IsCompatible()
{
/*-----------------------------------------------*\
Expand Down
26 changes: 24 additions & 2 deletions src/Kopernicus/RuntimeUtility/SinkingBugFix.cs
Expand Up @@ -32,8 +32,9 @@ namespace Kopernicus.RuntimeUtility
public class SinkingBugFix : MonoBehaviour
{
internal static Dictionary<int, bool>[] colliderStatus;
internal uint counter = 25;
internal uint counter = 1500;
private static SinkingBugFix instance = null;
private static bool safeToJustDisengage = false;

private void Start()
{
Expand Down Expand Up @@ -86,9 +87,30 @@ private void FixedUpdate()
}
CelestialBody mainBody = null;
counter++;
if (counter > 25)
if (counter > 1500)
{
counter = 0;
try
{
if ((FlightGlobals.ActiveVessel.radarAltitude > 1000) && (FlightGlobals.currentMainBody.hasSolidSurface))
{
if (safeToJustDisengage == false)
{
ReenableAll();
safeToJustDisengage = true;
return;
}
else
{
return;
}
}
}
catch
{
//No Active Vessel, proceed.
}
safeToJustDisengage = false;
Vector3 sceneCenter = Vector3.zero;
try
{
Expand Down

0 comments on commit f24a6bd

Please sign in to comment.