Skip to content

Commit

Permalink
Changed rounding for radiatorEfficiency, batteryCharge, newCapacity t…
Browse files Browse the repository at this point in the history
…o allow 2 decimal digits
  • Loading branch information
linuxgurugamer committed Jan 21, 2024
1 parent 0c625cc commit 97c7e4e
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 10 deletions.
3 changes: 3 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Changelog

1.16.0.14
Changed rounding for radiatorEfficiency, batteryCharge, newCapacity to allow 2 decimal digits

1.16.0.13
Thanks to @tgerland for providing a small update for the blacklist, to block Universal Storage 2

Expand Down
4 changes: 2 additions & 2 deletions GameData/KRnD/KRnD.version
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
"MAJOR": 1,
"MINOR": 16,
"PATCH": 0,
"BUILD": 12
"BUILD": 14
},
"KSP_VERSION": {
"MAJOR": 1,
"MINOR": 12,
"PATCH": 3
"PATCH": 5
},
"KSP_VERSION_MIN": {
"MAJOR": 1,
Expand Down
26 changes: 26 additions & 0 deletions GameData/KRnD/KRnD.version.1-12-3
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"NAME": "KRnD",
"URL": "https://raw.githubusercontent.com/linuxgurugamer/KRnD/master/KRnD.version",
"CHANGE_LOG_URL": "https://raw.githubusercontent.com/linuxgurugamer/KRnD/master/README.md",
"DOWNLOAD": "https://github.com/linuxgurugamer/KRnD/releases",
"GITHUB": {
"USERNAME": "linuxgurugamer",
"REPOSITORY": "KRnD"
},
"VERSION": {
"MAJOR": 1,
"MINOR": 16,
"PATCH": 0,
"BUILD": 12
},
"KSP_VERSION": {
"MAJOR": 1,
"MINOR": 12,
"PATCH": 3
},
"KSP_VERSION_MIN": {
"MAJOR": 1,
"MINOR": 12,
"PATCH": 0
}
}
4 changes: 2 additions & 2 deletions KRnD.version
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
"MAJOR": 1,
"MINOR": 16,
"PATCH": 0,
"BUILD": 13
"BUILD": 14
},
"KSP_VERSION": {
"MAJOR": 1,
"MINOR": 12,
"PATCH": 3
"PATCH": 5
},
"KSP_VERSION_MIN": {
"MAJOR": 1,
Expand Down
26 changes: 26 additions & 0 deletions KRnD.version.1-12-3
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"NAME": "KRnD",
"URL": "https://raw.githubusercontent.com/linuxgurugamer/KRnD/master/KRnD.version",
"CHANGE_LOG_URL": "https://raw.githubusercontent.com/linuxgurugamer/KRnD/master/README.md",
"DOWNLOAD": "https://github.com/linuxgurugamer/KRnD/releases",
"GITHUB": {
"USERNAME": "linuxgurugamer",
"REPOSITORY": "KRnD"
},
"VERSION": {
"MAJOR": 1,
"MINOR": 16,
"PATCH": 0,
"BUILD": 13
},
"KSP_VERSION": {
"MAJOR": 1,
"MINOR": 12,
"PATCH": 3
},
"KSP_VERSION_MIN": {
"MAJOR": 1,
"MINOR": 12,
"PATCH": 0
}
}
4 changes: 2 additions & 2 deletions Source/AssemblyVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@

using System.Reflection;

[assembly: AssemblyVersion("1.16.0.12")]
[assembly: AssemblyFileVersion("1.16.0.12")]
[assembly: AssemblyVersion("1.16.0.14")]
[assembly: AssemblyFileVersion("1.16.0.14")]
6 changes: 3 additions & 3 deletions Source/KRnD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ public static void updatePart(Part part, KRnDUpgrade upgradesToApply)
{
rndModule.radiatorEfficiency_upgrades = upgradesToApply.radiatorEfficiency;
double radiatorEfficiency = originalStats.radiatorEfficiency * (1 + KRnD.calculateImprovementFactor(rndModule.radiatorEfficiency_improvement, rndModule.radiatorEfficiency_improvementScale, upgradesToApply.radiatorEfficiency));
radiatorEfficiency = Math.Round(radiatorEfficiency);// Don't want decimals
radiatorEfficiency = Math.Round(radiatorEfficiency, 2);// Allow 2 decimals
activeRadiator.maxEnergyTransfer = radiatorEfficiency;
}
else
Expand Down Expand Up @@ -769,7 +769,7 @@ public static void updatePart(Part part, KRnDUpgrade upgradesToApply)
{
rndModule.batteryCharge_upgrades = upgradesToApply.batteryCharge;
double batteryCharge = originalStats.batteryCharge * (1 + KRnD.calculateImprovementFactor(rndModule.batteryCharge_improvement, rndModule.batteryCharge_improvementScale, upgradesToApply.batteryCharge));
batteryCharge = Math.Round(batteryCharge); // We don't want half units of electric charge
batteryCharge = Math.Round(batteryCharge, 2);// Allow 2 decimals

bool batteryIsFull = false;
if (electricCharge.amount == electricCharge.maxAmount) batteryIsFull = true;
Expand Down Expand Up @@ -867,7 +867,7 @@ public static void updatePart(Part part, KRnDUpgrade upgradesToApply)
if (!originalStats.fuelCapacities.ContainsKey(fuelResource.resourceName)) continue;
double originalCapacity = originalStats.fuelCapacities[fuelResource.resourceName];
double newCapacity = originalCapacity * improvementFactor;
newCapacity = Math.Round(newCapacity); // We don't want half units of fuel
newCapacity = Math.Round(newCapacity, 2);// Allow 2 decimals

bool tankIsFull = false;
if (fuelResource.amount == fuelResource.maxAmount) tankIsFull = true;
Expand Down
2 changes: 1 addition & 1 deletion buildRelease.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ rem README is the readme file
set GAMEDIR=KRnD
set GAMEDATA="GameData\"
set VERSIONFILE=%GAMEDIR%.version
set LICENSE=License.txt
set LICENSE=
set README=ReadMe.md

set RELEASEDIR=d:\Users\jbb\release
Expand Down

0 comments on commit 97c7e4e

Please sign in to comment.