diff --git a/Changelog.txt b/Changelog.txt index f7cfd8d..d545c9e 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,3 +1,8 @@ +**v0.9.8** + +- Added the option to exclude PQSMods + + **v0.9.7** - Updated to Kopernicus 1.3.1-5 diff --git a/GameData/Sigma/Dimensions/Configs/Sigma-Dimensions.version b/GameData/Sigma/Dimensions/Configs/Sigma-Dimensions.version index 75772b3..41cc577 100644 --- a/GameData/Sigma/Dimensions/Configs/Sigma-Dimensions.version +++ b/GameData/Sigma/Dimensions/Configs/Sigma-Dimensions.version @@ -1,7 +1,7 @@ { - "NAME": "Sigma Dimensions", + "NAME": "Sigma Dimensions", "URL": "https://raw.githubusercontent.com/Sigma88/Sigma-Dimensions/master/GameData/Sigma/Dimensions/Configs/Sigma-Dimensions.version", - "DOWNLOAD": "http://forum.kerbalspaceprogram.com/index.php?/topic/126548-0", + "DOWNLOAD": "http://www.github.com/Sigma88/Sigma-Dimensions/releases/latest", "CHANGE_LOG_URL": "https://raw.githubusercontent.com/Sigma88/Sigma-Dimensions/master/Changelog.txt", "GITHUB": { @@ -13,7 +13,7 @@ { "MAJOR": 0, "MINOR": 9, - "PATCH": 7, + "PATCH": 8, "BUILD": 0 }, "KSP_VERSION": diff --git a/GameData/Sigma/Dimensions/Plugins/SigmaDimensions.dll b/GameData/Sigma/Dimensions/Plugins/SigmaDimensions.dll index a539992..e5521d1 100644 Binary files a/GameData/Sigma/Dimensions/Plugins/SigmaDimensions.dll and b/GameData/Sigma/Dimensions/Plugins/SigmaDimensions.dll differ diff --git a/GameData/Sigma/Dimensions/README.txt b/GameData/Sigma/Dimensions/README.txt index 9a13383..b5bdcac 100644 --- a/GameData/Sigma/Dimensions/README.txt +++ b/GameData/Sigma/Dimensions/README.txt @@ -1,6 +1,6 @@ ## Sigma Dimensions ## -# Forum Thread: http://forum.kerbalspaceprogram.com/index.php?/topic/126548-0 +# GitHub Repository: https://www.github.com/Sigma88/Sigma-Dimensions @@ -221,8 +221,8 @@ To apply Planet Specific Changes follow these instructions. -## For other questions, visit the Forum Thread: -# http://forum.kerbalspaceprogram.com/index.php?/topic/126548-0 +## For other questions, visit the GitHub Repository: +# https://www.github.com/Sigma88/Sigma-Dimensions diff --git a/License.txt b/License.txt index 7996101..32e5ac7 100644 --- a/License.txt +++ b/License.txt @@ -4,8 +4,8 @@ Sigma Dimensions by Sigma88 is released under the following license: All Rights Reserved -For more info visit the KSP Forum Thread: -http://forum.kerbalspaceprogram.com/index.php?/topic/126548-0 +For more info visit the GitHub Repository: +https://github.com/Sigma88/Sigma-Dimensions diff --git a/README.md b/README.md index 82e2d4c..c0c68d4 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,7 @@ **The Universal Rescale Mod for KSP** -KSP Forum Thread: http://forum.kerbalspaceprogram.com/index.php?/topic/126548-0/ - -Download Latest Release: https://github.com/Sigma88/Sigma-Dimensions/releases/latest +Latest Release: https://github.com/Sigma88/Sigma-Dimensions/releases/latest Dev version: https://github.com/Sigma88/Sigma-Dimensions/tree/Development diff --git a/[Source]/Distribution/SigmaDimensions.dll b/[Source]/Distribution/SigmaDimensions.dll index a539992..e5521d1 100644 Binary files a/[Source]/Distribution/SigmaDimensions.dll and b/[Source]/Distribution/SigmaDimensions.dll differ diff --git a/[Source]/SigmaDimensions/Configs.cs b/[Source]/SigmaDimensions/Configs.cs new file mode 100644 index 0000000..3d3de2b --- /dev/null +++ b/[Source]/SigmaDimensions/Configs.cs @@ -0,0 +1,12 @@ +/* +namespace SigmaDimensionsPlugin +{ + public class Configs + { + public static void ModuleManagerPostLoad() + { + UnityEngine.Debug.Log("SigmaLog: SD2"); + } + } +} +*/ diff --git a/[Source]/SigmaDimensions/PQSCityGroupsLoader.cs b/[Source]/SigmaDimensions/PQSCityGroupsLoader.cs index 395d154..044ca81 100644 --- a/[Source]/SigmaDimensions/PQSCityGroupsLoader.cs +++ b/[Source]/SigmaDimensions/PQSCityGroupsLoader.cs @@ -11,6 +11,7 @@ public class PQSCityGroups : MonoBehaviour { // Public Dictionary for External Groups public static Dictionary>> ExternalGroups = new Dictionary>>(); + public static Dictionary>> ExternalExceptions = new Dictionary>>(); Dictionary GroupsList = new Dictionary(); internal static List debug = new List(); @@ -53,6 +54,7 @@ void SaveGroups() Debug.Log("PQSCityGroups.SaveGroups", "> Planet: " + body.name + (body.name != body.displayName.Replace("^N", "") ? (", (A.K.A.: " + body.displayName.Replace("^N", "") + ")") : "") + (body.name != body.transform.name ? (", (A.K.A.: " + body.transform.name + ")") : "")); Debug.Log("PQSCityGroups.SaveGroups", " > Group: " + group); + bool.TryParse(Group.GetValue("exclude"), out bool exclude); // FIND GROUP CENTER Vector3Parser center = null; @@ -76,6 +78,10 @@ void SaveGroups() body.Set("PQSCityGroups", new Dictionary()); Dictionary PQSList = body.Get>("PQSCityGroups"); + if (!body.Has("ExcludedPQSCityMods")) + body.Set("ExcludedPQSCityMods", new List()); + List ExcludeList = body.Get>("ExcludedPQSCityMods"); + // If the Center position has not been found get it from the MODS node if (Group.HasNode("MODS")) { @@ -116,8 +122,16 @@ void SaveGroups() // This way custom groups will overwrite external ones if (PQSList.ContainsKey(mod)) PQSList.Remove(mod); - PQSList.Add(mod, center); - Debug.Log("PQSCityGroups.SaveGroups", " > PQSCity: " + mod.name); + if (!exclude) + { + PQSList.Add(mod, center); + Debug.Log("PQSCityGroups.SaveGroups", " > PQSCity: " + mod.name); + } + else + { + ExcludeList.Add(mod); + Debug.Log("PQSCityGroups.SaveGroups", " > Excluded PQSCity: " + mod.name); + } } } foreach (string city2 in M.GetValues("PQSCity2")) @@ -130,8 +144,16 @@ void SaveGroups() // This way custom groups will overwrite external ones if (PQSList.ContainsKey(mod)) PQSList.Remove(mod); - PQSList.Add(mod, center); - Debug.Log("PQSCityGroups.SaveGroups", " > PQSCity2: " + mod.name); + if (!exclude) + { + PQSList.Add(mod, center); + Debug.Log("PQSCityGroups.SaveGroups", " > PQSCity2: " + mod.name); + } + else + { + ExcludeList.Add(mod); + Debug.Log("PQSCityGroups.SaveGroups", " > Excluded PQSCity2: " + mod.name); + } } } } @@ -150,8 +172,16 @@ void SaveGroups() // External groups should not overwrite custom ones if (PQSList.ContainsKey(mod)) continue; - PQSList.Add(mod, center); - Debug.Log("PQSCityGroups.SaveGroups", " > external: " + mod); + if (!exclude) + { + PQSList.Add(mod, center); + Debug.Log("PQSCityGroups.SaveGroups", " > external: " + mod); + } + else + { + ExcludeList.Add(mod); + Debug.Log("PQSCityGroups.SaveGroups", " > Excluded external: " + mod); + } } ExternalGroups[body].Remove(group); } @@ -162,9 +192,12 @@ void SaveGroups() PQSCity ksc = FlightGlobals.GetHomeBody().GetComponentsInChildren(true).FirstOrDefault(m => m.name == "KSC"); if (PQSList.ContainsKey(ksc)) PQSList.Remove(ksc); + if (ExcludeList.Contains(ksc)) + ExcludeList.Remove(ksc); body.Set("PQSCityGroups", PQSList); + body.Set("ExcludedPQSCityMods", ExcludeList); // ADD THIS GROUP TO THE MOVE LIST @@ -245,6 +278,43 @@ void SaveGroups() planet.Set("PQSCityGroups", PQSList); } } + + // LOAD EXTERNAL EXCEPTIONS + Debug.Log("PQSCityGroups.SaveGroups", ">>> Loading external PQSCityGroups exceptions <<<"); + foreach (CelestialBody planet in ExternalExceptions.Keys.Where(p => p != null && ExternalExceptions[p] != null)) + { + Debug.Log("PQSCityGroups.SaveGroups", "> Planet: " + planet.name + (planet.name != planet.displayName.Replace("^N", "") ? (", (A.K.A.: " + planet.displayName.Replace("^N", "") + ")") : "") + (planet.name != planet.transform.name ? (", (A.K.A.: " + planet.transform.name + ")") : "")); + foreach (string group in ExternalExceptions[planet].Keys.Where(g => !string.IsNullOrEmpty(g) && ExternalExceptions[planet][g] != null)) + { + if (ExternalExceptions[planet][group].Count == 0) continue; + Debug.Log("PQSCityGroups.SaveGroups", " > Group: " + group); + + // Since these groups are exceptions they don't need a center + + if (!planet.Has("ExcludedPQSCityMods")) + planet.Set("ExcludedPQSCityMods", new Dictionary()); + List ExcludeList = planet.Get>("PQSCityGroups"); + + foreach (object mod in ExternalExceptions[planet][group]) + { + if (!ExcludeList.Contains(mod)) + { + ExcludeList.Add(mod); + Debug.Log("PQSCityGroups.SaveGroups", " > excluded external: " + mod); + } + } + + + // REMOVE KSC FROM THE LIST + + PQSCity ksc = FlightGlobals.GetHomeBody().GetComponentsInChildren(true).FirstOrDefault(m => m.name == "KSC"); + if (ExcludeList.Contains(ksc)) + ExcludeList.Remove(ksc); + + + planet.Set("ExcludedPQSCityMods", ExcludeList); + } + } } Vector3? GetCenter(ConfigNode node, CelestialBody body) diff --git a/[Source]/SigmaDimensions/SigmaDimensions.cs b/[Source]/SigmaDimensions/SigmaDimensions.cs index 189d649..ec6d50f 100644 --- a/[Source]/SigmaDimensions/SigmaDimensions.cs +++ b/[Source]/SigmaDimensions/SigmaDimensions.cs @@ -29,14 +29,19 @@ void Start() landscape = body.Has("landscape") ? body.Get("landscape") : 1; resizeBuildings = body.Has("resizeBuildings") ? body.Get("resizeBuildings") : 1; + // Excluded mods + List ExcludeList = body.Has("ExcludedPQSCityMods") ? body.Get>("ExcludedPQSCityMods") : new List(); // All PQSCity mods PQSCity[] cities = body.GetComponentsInChildren(true); for (int j = 0; j < cities?.Length; j++) { - CityFixer(cities[j]); - cities[j].Orientate(); + if (!ExcludeList.Contains(cities[j])) + { + CityFixer(cities[j]); + cities[j].Orientate(); + } } @@ -45,8 +50,11 @@ void Start() for (int j = 0; j < cities2?.Length; j++) { - City2Fixer(cities2[j]); - cities2[j].Orientate(); + if (!ExcludeList.Contains(cities2[j])) + { + City2Fixer(cities2[j]); + cities2[j].Orientate(); + } } } } diff --git a/[Source]/SigmaDimensions/SigmaDimensions.csproj b/[Source]/SigmaDimensions/SigmaDimensions.csproj index c134f3f..37ca317 100644 --- a/[Source]/SigmaDimensions/SigmaDimensions.csproj +++ b/[Source]/SigmaDimensions/SigmaDimensions.csproj @@ -33,6 +33,7 @@ + diff --git a/[Source]/SigmaDimensions/Version.cs b/[Source]/SigmaDimensions/Version.cs index 0dbe412..3945a93 100644 --- a/[Source]/SigmaDimensions/Version.cs +++ b/[Source]/SigmaDimensions/Version.cs @@ -6,7 +6,7 @@ namespace SigmaDimensionsPlugin [KSPAddon(KSPAddon.Startup.Instantly, true)] public class Version : MonoBehaviour { - public static readonly System.Version number = new System.Version("0.9.7"); + public static readonly System.Version number = new System.Version("0.9.8"); void Awake() {