Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Angel-125 committed Feb 17, 2023
1 parent 673c3b4 commit 9b2bd80
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 5 deletions.
Binary file modified .vs/WildBlueTools/v16/.suo
Binary file not shown.
Binary file not shown.
Binary file not shown.
7 changes: 7 additions & 0 deletions GameData/WildBlueIndustries/000WildBlueTools/Readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ A KSP mod that provides common functionality for mods by Wild Blue Industries.

Copy the contents of the mod's GameData directory into your GameData folder.

1.89

WBIModuleScienceExperiment
- Added showRequiredBodies field to hide the celestial bodies required to run an experiment. The default value is true.
- Added requiredCelestialBodiesMsg to show a custom status message when the experiment isn't run on a required celestial body. The default value is "Failed to yield results."
- Fixed issue were minAltitude and maxAltitude weren't showing up.

1.88.2
- Bug fixes

Expand Down
2 changes: 1 addition & 1 deletion Notes/WildBlueTools.version
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{
"MAJOR":1,
"MINOR":88,
"PATCH":1
"PATCH":2
},
"KSP_VERSION_MIN":
{
Expand Down
20 changes: 16 additions & 4 deletions Science/WBIModuleScienceExperiment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using UnityEngine;
using KSP.IO;
using KSP.UI.Screens;
using KSP.Localization;

/*
Source code copyrighgt 2015, by Michael Billard (Angel-125)
Expand Down Expand Up @@ -49,6 +50,12 @@ public class WBIModuleScienceExperiment : ModuleScienceExperiment
[KSPField]
public string celestialBodies = string.Empty;

[KSPField]
public bool showRequiredBodies = true;

[KSPField]
public string requiredCelestialBodiesMsg = string.Empty;

[KSPField]
public double minAltitude;

Expand Down Expand Up @@ -277,7 +284,7 @@ public override string GetInfo()
info.Append(description + "\r\n\r\n");

//Celestial bodies
if (string.IsNullOrEmpty(celestialBodies) == false)
if (string.IsNullOrEmpty(celestialBodies) == false && showRequiredBodies)
requirements.Append("<b>Allowed Planets: </b>" + celestialBodies + "\r\n");
//Flight states
if (string.IsNullOrEmpty(situations) == false)
Expand All @@ -286,10 +293,10 @@ public override string GetInfo()
if (minCrew > 0)
requirements.Append("<b>Minimum Crew: </b>" + minCrew + "\r\n");
//Min Altitude
if (minAltitude > 0.001f)
if (Math.Abs(minAltitude) > 0.001f)
requirements.Append(string.Format("<b>Min altitude: </b>{0:f2}m\r\n", minAltitude));
//Max Altitude
if (maxAltitude > 0.001f)
if (Math.Abs(maxAltitude) > 0.001f)
requirements.Append(string.Format("<b>Max altitude: </b>{0:f2}m\r\n", maxAltitude));
//Asteroid Mass
if (minimumAsteroidMass > 0.001f)
Expand Down Expand Up @@ -434,7 +441,12 @@ public virtual bool CheckCompletion()
{
if (celestialBodies.Contains(this.part.vessel.mainBody.displayName) == false)
{
status = "Needs one: " + celestialBodies;
if (showRequiredBodies)
status = "Needs one: " + celestialBodies;
else if (!string.IsNullOrEmpty(requiredCelestialBodiesMsg))
status = Localizer.Format(requiredCelestialBodiesMsg);
else
status = "Failed to yield results";
return false;
}
}
Expand Down
Binary file modified bin/Debug/WildBlueTools.dll
Binary file not shown.
Binary file modified bin/Debug/WildBlueTools.pdb
Binary file not shown.

0 comments on commit 9b2bd80

Please sign in to comment.