Skip to content

Commit

Permalink
Remove DLC launch sites
Browse files Browse the repository at this point in the history
StollD committed May 2, 2018

Verified

This commit was signed with the committer’s verified signature.
StollD Dorian Stoll
1 parent 54d4c81 commit 7bbbaa0
Showing 3 changed files with 27 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Kopernicus/Configuration/Loader.cs
Original file line number Diff line number Diff line change
@@ -151,6 +151,18 @@ public NumericParser<Double> scaledSpaceFaderMult
get { return ScaledSpaceFader.faderMult; }
set { ScaledSpaceFader.faderMult = value; }
}

// Remove Launch Sites added by DLCs
// * Island_Airfield
// * Woomerang_Launch_Site
// * Desert_Launch_Site
// * Desert_Airfield
[ParserTargetCollection("self", Key = "removeLaunchSites", AllowMerge = false, NameSignificance = NameSignificance.Key)]
public List<StringCollectionParser> removeLaunchSites
{
get { return new List<StringCollectionParser> { new StringCollectionParser(Templates.RemoveLaunchSites)}; }
set { Templates.RemoveLaunchSites = value.SelectMany(v => v.Value).ToList(); }
}

// Instance
public Loader()
9 changes: 9 additions & 0 deletions src/Kopernicus/RuntimeUtility/RuntimeUtility.cs
Original file line number Diff line number Diff line change
@@ -35,6 +35,7 @@
using System.IO;
using System.Linq;
using System.Reflection;
using Expansions;
using Kopernicus.OnDemand;
using KSP.UI.Screens.Settings.Controls;
using UnityEngine;
@@ -249,6 +250,14 @@ void Start()
fixes[b.transform.name].Key.orbitingBodies.Add(b);
fixes[b.transform.name].Key.orbitingBodies = fixes[b.transform.name].Key.orbitingBodies.OrderBy(cb => cb.orbit.semiMajorAxis).ToList();
}

if (ExpansionsLoader.IsExpansionInstalled("MakingHistory"))

This comment has been minimized.

Copy link
@Kerbas-ad-astra

Kerbas-ad-astra May 4, 2018

Since currently the only source of 'stock' extra launch sites (which are not end-user configurable, as with Kerbal Konstructs) is Making History, this is fine, but is it necessary? Someday there may be more launch sites in other expansions, or in stock, or whatever.

This comment has been minimized.

Copy link
@Galileo88

Galileo88 May 4, 2018

Yes, it’s necessary now. If some day more are added, this can be amended. No big deal. If this wasn’t in kopernicus, planet packs would need to apply changes to maps of the homeworld in order to accommodate these sites. That’s a huge hassle, in my opinion.

This comment has been minimized.

Copy link
@Kerbas-ad-astra

Kerbas-ad-astra May 4, 2018

What I mean is, is it necessary to check if Making History is installed before attempting to remove the extra launch sites?

This comment has been minimized.

Copy link
@StollD

StollD May 4, 2018

Author Member

The LaunchSites API has the same check, but if MH isn't installed it floods your log with error messages.

The check simply avoids the misleading log messages.

{
foreach (String site in Templates.RemoveLaunchSites)
{
PSystemSetup.Instance.RemoveLaunchSite(site);
}
}
#if FALSE
// AFG-Ception
foreach (CelestialBody body in PSystemManager.Instance.localBodies)
6 changes: 6 additions & 0 deletions src/Kopernicus/Templates.cs
Original file line number Diff line number Diff line change
@@ -58,6 +58,9 @@ public class Templates
// The localized names of the presets
public static List<String> PresetDisplayNames { get; set; }

// The launch sites that should get removed
public static List<String> RemoveLaunchSites { get; set; }

// Initialisation
static Templates()
{
@@ -80,6 +83,9 @@ static Templates()
Localizer.Format("#autoLOC_6001507"),
Localizer.Format("#autoLOC_6001508")
};

// Launch Sites
RemoveLaunchSites = new List<String>();
}
}
}

0 comments on commit 7bbbaa0

Please sign in to comment.