From bd7bdc36b7406b4cbb765b70a97740887b31a602 Mon Sep 17 00:00:00 2001 From: severedsolo Date: Mon, 19 Nov 2018 14:02:39 +0000 Subject: [PATCH] Fix infinite reliability on high gen parts --- OhScrap/BaseFailureModule.cs | 5 ++- OhScrap/OhScrap.csproj | 10 +++--- .../OhScrap.csproj.FileListAbsolute.txt | 34 +++++++++---------- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/OhScrap/BaseFailureModule.cs b/OhScrap/BaseFailureModule.cs index 507343b..d5807b0 100644 --- a/OhScrap/BaseFailureModule.cs +++ b/OhScrap/BaseFailureModule.cs @@ -127,6 +127,7 @@ public void Initialise() if (SYP.TimesRecovered == 0 || !UPFMUtils.instance.testedParts.Contains(SYP.ID)) chanceOfFailure = CalculateInitialFailureRate(); else chanceOfFailure = CalculateInitialFailureRate() * (SYP.TimesRecovered / (float)expectedLifetime); if (chanceOfFailure < UPFMUtils.instance.minimumFailureChance) chanceOfFailure = UPFMUtils.instance.minimumFailureChance; + if (SYP.TimesRecovered > expectedLifetime) chanceOfFailure += 1 - (expectedLifetime / SYP.TimesRecovered); //if the part has already failed turn the repair and highlight events on. if (hasFailed) { @@ -154,7 +155,9 @@ public void Initialise() private float CalculateInitialFailureRate() { - return baseChanceOfFailure - (OhScrap.generation * (baseChanceOfFailure / 10)); + int generation = OhScrap.generation; + if (generation > 10) generation = 10; + return baseChanceOfFailure+0.01f - (generation * (baseChanceOfFailure / 10)); } //These methods all are overriden by the failure modules diff --git a/OhScrap/OhScrap.csproj b/OhScrap/OhScrap.csproj index 814aaee..74a30ed 100644 --- a/OhScrap/OhScrap.csproj +++ b/OhScrap/OhScrap.csproj @@ -42,19 +42,19 @@ - ..\..\Kerbal Space Program\KSP_Data\Managed\Assembly-CSharp.dll + C:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\Assembly-CSharp.dll - ..\..\Kerbal Space Program\KSP_Data\Managed\Assembly-CSharp-firstpass.dll + C:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\Assembly-CSharp-firstpass.dll - ..\..\Kerbal Space Program\KSP_Data\Managed\UnityEngine.dll + C:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.dll - ..\..\Kerbal Space Program\KSP_Data\Managed\UnityEngine.UI.dll + C:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.UI.dll - ..\..\Kerbal Space Program\GameData\ScrapYard\ScrapYard.dll + C:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program - ModDev\GameData\ScrapYard\ScrapYard.dll diff --git a/OhScrap/obj/Release/OhScrap.csproj.FileListAbsolute.txt b/OhScrap/obj/Release/OhScrap.csproj.FileListAbsolute.txt index acc7e05..8c89e69 100644 --- a/OhScrap/obj/Release/OhScrap.csproj.FileListAbsolute.txt +++ b/OhScrap/obj/Release/OhScrap.csproj.FileListAbsolute.txt @@ -16,23 +16,6 @@ C:/Users/evilp/source/repos/OhScrap/OhScrap/bin/Release/TDx.TDxInput.dll C:/Users/evilp/source/repos/OhScrap/OhScrap/bin/Release/RedShellSDK.dll C:/Users/evilp/source/repos/OhScrap/OhScrap/obj/Release/OhScrap.csproj.CopyComplete C:/Users/evilp/source/repos/OhScrap/OhScrap/obj/Release/OhScrap.csprojAssemblyReference.cache -D:/OneDrive/Documents/Github/OhScrap/OhScrap/bin/Release/OhScrap.dll -D:/OneDrive/Documents/Github/OhScrap/OhScrap/bin/Release/OhScrap.pdb -D:/OneDrive/Documents/Github/OhScrap/OhScrap/bin/Release/Assembly-CSharp-firstpass.dll -D:/OneDrive/Documents/Github/OhScrap/OhScrap/bin/Release/Assembly-CSharp.dll -D:/OneDrive/Documents/Github/OhScrap/OhScrap/bin/Release/ScrapYard.dll -D:/OneDrive/Documents/Github/OhScrap/OhScrap/bin/Release/UnityEngine.dll -D:/OneDrive/Documents/Github/OhScrap/OhScrap/bin/Release/UnityEngine.UI.dll -D:/OneDrive/Documents/Github/OhScrap/OhScrap/bin/Release/KSPTrackIR.dll -D:/OneDrive/Documents/Github/OhScrap/OhScrap/bin/Release/KSPAssets.dll -D:/OneDrive/Documents/Github/OhScrap/OhScrap/bin/Release/Mono.Cecil.dll -D:/OneDrive/Documents/Github/OhScrap/OhScrap/bin/Release/Ionic.Zip.dll -D:/OneDrive/Documents/Github/OhScrap/OhScrap/bin/Release/TDx.TDxInput.dll -D:/OneDrive/Documents/Github/OhScrap/OhScrap/obj/Release/OhScrap.csprojAssemblyReference.cache -D:/OneDrive/Documents/Github/OhScrap/OhScrap/obj/Release/OhScrap.csproj.CoreCompileInputs.cache -D:/OneDrive/Documents/Github/OhScrap/OhScrap/obj/Release/OhScrap.csproj.CopyComplete -D:/OneDrive/Documents/Github/OhScrap/OhScrap/obj/Release/OhScrap.dll -D:/OneDrive/Documents/Github/OhScrap/OhScrap/obj/Release/OhScrap.pdb /home/martin/.steam/steam/steamapps/common/OhScrap-master/OhScrap/bin/Release/OhScrap.dll /home/martin/.steam/steam/steamapps/common/OhScrap-master/OhScrap/bin/Release/OhScrap.pdb /home/martin/.steam/steam/steamapps/common/OhScrap-master/OhScrap/bin/Release/Assembly-CSharp-firstpass.dll @@ -50,3 +33,20 @@ D:/OneDrive/Documents/Github/OhScrap/OhScrap/obj/Release/OhScrap.pdb /home/martin/.steam/steam/steamapps/common/OhScrap-master/OhScrap/obj/Release/OhScrap.dll /home/martin/.steam/steam/steamapps/common/OhScrap-master/OhScrap/obj/Release/OhScrap.pdb /home/martin/.steam/steam/steamapps/common/OhScrap-master/OhScrap/obj/Release/OhScrap.csprojAssemblyReference.cache +D:\OneDrive\Documents\Github\OhScrap\OhScrap\obj\Release\OhScrap.csprojAssemblyReference.cache +D:\OneDrive\Documents\Github\OhScrap\OhScrap\obj\Release\OhScrap.csproj.CoreCompileInputs.cache +D:\OneDrive\Documents\Github\OhScrap\OhScrap\bin\Release\OhScrap.dll +D:\OneDrive\Documents\Github\OhScrap\OhScrap\bin\Release\OhScrap.pdb +D:\OneDrive\Documents\Github\OhScrap\OhScrap\bin\Release\Assembly-CSharp-firstpass.dll +D:\OneDrive\Documents\Github\OhScrap\OhScrap\bin\Release\Assembly-CSharp.dll +D:\OneDrive\Documents\Github\OhScrap\OhScrap\bin\Release\ScrapYard.dll +D:\OneDrive\Documents\Github\OhScrap\OhScrap\bin\Release\UnityEngine.dll +D:\OneDrive\Documents\Github\OhScrap\OhScrap\bin\Release\UnityEngine.UI.dll +D:\OneDrive\Documents\Github\OhScrap\OhScrap\bin\Release\KSPTrackIR.dll +D:\OneDrive\Documents\Github\OhScrap\OhScrap\bin\Release\KSPAssets.dll +D:\OneDrive\Documents\Github\OhScrap\OhScrap\bin\Release\Mono.Cecil.dll +D:\OneDrive\Documents\Github\OhScrap\OhScrap\bin\Release\Ionic.Zip.dll +D:\OneDrive\Documents\Github\OhScrap\OhScrap\bin\Release\TDx.TDxInput.dll +D:\OneDrive\Documents\Github\OhScrap\OhScrap\obj\Release\OhScrap.csproj.CopyComplete +D:\OneDrive\Documents\Github\OhScrap\OhScrap\obj\Release\OhScrap.dll +D:\OneDrive\Documents\Github\OhScrap\OhScrap\obj\Release\OhScrap.pdb