Skip to content

Commit

Permalink
Added filter button for deployed science collectors (breaking grounds).
Browse files Browse the repository at this point in the history
This shoudl fix #463
  • Loading branch information
SirMortimer committed Jul 15, 2019
1 parent 416fc10 commit 77a0b95
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/Kerbalism/System/Kerbalism.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public Kerbalism()
Fetch = this;
Communications.NetworkInitialized = false;
Communications.NetworkInitializing = false;

SerenityEnabled = Expansions.ExpansionsLoader.IsExpansionInstalled("Serenity");
}

private void OnDestroy()
Expand Down Expand Up @@ -71,10 +73,6 @@ public override void OnLoad(ConfigNode node)
Highlighter.Init();
UI.Init();

#if !KSP170 && !KSP16 && !KSP15 && !KSP14
Serenity.Init();
#endif

// prepare storm data
foreach (CelestialBody body in FlightGlobals.Bodies)
{
Expand Down Expand Up @@ -347,6 +345,8 @@ class Storm_data { public double time; public CelestialBody body; };

// last savegame unique id
static int savegame_uid;

public static bool SerenityEnabled { get; private set; }
}

public sealed class MapCameraScript: MonoBehaviour
Expand Down
4 changes: 4 additions & 0 deletions src/Kerbalism/UI/Monitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,10 @@ void Render_filter()
Render_TypeFilterButon(VesselType.Relay);
Render_TypeFilterButon(VesselType.EVA);

#if !KSP170 && !KSP16 && !KSP15 && !KSP14
if (Kerbalism.SerenityEnabled) Render_TypeFilterButon(VesselType.DeployedScienceController);
#endif

filter = Lib.TextFieldPlaceholder("Kerbalism_filter", filter, filter_placeholder, filter_style).ToUpper();
GUILayout.EndHorizontal();
GUILayout.Space(Styles.ScaleFloat(10.0f));
Expand Down
9 changes: 1 addition & 8 deletions src/Kerbalism/Utility/Serenity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,12 @@ namespace KERBALISM

public static class Serenity
{
public static bool Enabled { get; private set; }

internal static void Init()
{
Enabled = Expansions.ExpansionsLoader.IsExpansionInstalled("Serenity");
}

/// <summary>
/// Use this whenever possible. Note this cannot be used during deployment.
/// </summary>
internal static DeployedScienceCluster GetScienceCluster(Vessel v)
{
if (!Enabled)
if (!Kerbalism.SerenityEnabled)
return null;

foreach (var cluster in DeployedScience.Instance.DeployedScienceClusters.Values)
Expand Down

0 comments on commit 77a0b95

Please sign in to comment.