Skip to content

Commit

Permalink
v0.9.8
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
Sigma88 authored Mar 28, 2018
2 parents d57f50e + a91dd2e commit 7a2f61c
Show file tree
Hide file tree
Showing 12 changed files with 116 additions and 22 deletions.
5 changes: 5 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
**v0.9.8**

- Added the option to exclude PQSMods


**v0.9.7**

- Updated to Kopernicus 1.3.1-5
Expand Down
6 changes: 3 additions & 3 deletions GameData/Sigma/Dimensions/Configs/Sigma-Dimensions.version
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"NAME": "<b><color=#7080FF>Sigma Dimensions</color></b>",
"NAME": "<b><color=#9B59B6>Sigma Dimensions</color></b>",
"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":
{
Expand All @@ -13,7 +13,7 @@
{
"MAJOR": 0,
"MINOR": 9,
"PATCH": 7,
"PATCH": 8,
"BUILD": 0
},
"KSP_VERSION":
Expand Down
Binary file modified GameData/Sigma/Dimensions/Plugins/SigmaDimensions.dll
Binary file not shown.
6 changes: 3 additions & 3 deletions GameData/Sigma/Dimensions/README.txt
Original file line number Diff line number Diff line change
@@ -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



Expand Down Expand Up @@ -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



Expand Down
4 changes: 2 additions & 2 deletions License.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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



Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Binary file modified [Source]/Distribution/SigmaDimensions.dll
Binary file not shown.
12 changes: 12 additions & 0 deletions [Source]/SigmaDimensions/Configs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
namespace SigmaDimensionsPlugin
{
public class Configs
{
public static void ModuleManagerPostLoad()
{
UnityEngine.Debug.Log("SigmaLog: SD2");
}
}
}
*/
82 changes: 76 additions & 6 deletions [Source]/SigmaDimensions/PQSCityGroupsLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class PQSCityGroups : MonoBehaviour
{
// Public Dictionary for External Groups
public static Dictionary<CelestialBody, Dictionary<string, List<object>>> ExternalGroups = new Dictionary<CelestialBody, Dictionary<string, List<object>>>();
public static Dictionary<CelestialBody, Dictionary<string, List<object>>> ExternalExceptions = new Dictionary<CelestialBody, Dictionary<string, List<object>>>();

Dictionary<string, ConfigNode> GroupsList = new Dictionary<string, ConfigNode>();
internal static List<Vector3> debug = new List<Vector3>();
Expand Down Expand Up @@ -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;
Expand All @@ -76,6 +78,10 @@ void SaveGroups()
body.Set("PQSCityGroups", new Dictionary<object, Vector3>());
Dictionary<object, Vector3> PQSList = body.Get<Dictionary<object, Vector3>>("PQSCityGroups");

if (!body.Has("ExcludedPQSCityMods"))
body.Set("ExcludedPQSCityMods", new List<object>());
List<object> ExcludeList = body.Get<List<object>>("ExcludedPQSCityMods");

// If the Center position has not been found get it from the MODS node
if (Group.HasNode("MODS"))
{
Expand Down Expand Up @@ -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"))
Expand All @@ -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);
}
}
}
}
Expand All @@ -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);
}
Expand All @@ -162,9 +192,12 @@ void SaveGroups()
PQSCity ksc = FlightGlobals.GetHomeBody().GetComponentsInChildren<PQSCity>(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
Expand Down Expand Up @@ -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<object, Vector3>());
List<object> ExcludeList = planet.Get<List<object>>("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<PQSCity>(true).FirstOrDefault(m => m.name == "KSC");
if (ExcludeList.Contains(ksc))
ExcludeList.Remove(ksc);


planet.Set("ExcludedPQSCityMods", ExcludeList);
}
}
}

Vector3? GetCenter(ConfigNode node, CelestialBody body)
Expand Down
16 changes: 12 additions & 4 deletions [Source]/SigmaDimensions/SigmaDimensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,19 @@ void Start()
landscape = body.Has("landscape") ? body.Get<double>("landscape") : 1;
resizeBuildings = body.Has("resizeBuildings") ? body.Get<double>("resizeBuildings") : 1;

// Excluded mods
List<object> ExcludeList = body.Has("ExcludedPQSCityMods") ? body.Get<List<object>>("ExcludedPQSCityMods") : new List<object>();

// All PQSCity mods
PQSCity[] cities = body.GetComponentsInChildren<PQSCity>(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();
}
}


Expand All @@ -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();
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions [Source]/SigmaDimensions/SigmaDimensions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<ItemGroup>
<Compile Include="AtmosphereTopLayer.cs" />
<Compile Include="Compatibility.cs" />
<Compile Include="Configs.cs" />
<Compile Include="PQSCityFixer.cs" />
<Compile Include="PQSCityGroupsLoader.cs" />
<Compile Include="PQSMod_SigmaDimensions.cs" />
Expand Down
2 changes: 1 addition & 1 deletion [Source]/SigmaDimensions/Version.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down

0 comments on commit 7a2f61c

Please sign in to comment.