Skip to content

Commit fba387f

Browse files
committed
Merge pull request #16 from Sigma88/Dev1.5.0
Updating to KSP 1.1 and Kopernicus 1.0
2 parents 2c9a9c7 + 8c9d9bc commit fba387f

File tree

12 files changed

+139
-166
lines changed

12 files changed

+139
-166
lines changed

Changelog.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
**v1.5.0**
2+
3+
- Updated to KSP 1.1 and Kopernicus 1.0
4+
- Fixed a bug that sometimes occurred while exiting the Primary SoI
5+
6+
17
**v1.4.9.2**
28

39
- Fixed an issue with bodies using cbNameLater

GameData/Sigma/Binary/Configs/archivesFixer.cfg

Lines changed: 0 additions & 104 deletions
This file was deleted.

GameData/Sigma/Binary/Configs/generateBarycenters.cfg

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
@Kopernicus:FOR[SigmaBinary]
22
{
3-
%SigmaBinary
4-
{
5-
%SBreference = Sun
6-
}
73
@Body:HAS[@Orbit:HAS[#referenceBody[Sun]]]
84
{
95
!SigmaBinary,* {}
@@ -42,8 +38,7 @@
4238
}
4339
Orbit
4440
{
45-
referenceBody = #$/SigmaBinary/SBreference$
46-
semiMajorAxis = #$@SigmaBinary/SBmaxDistance$
41+
referenceBody = Sun
4742
}
4843
Atmosphere
4944
{
@@ -65,21 +60,10 @@
6560
exportMesh = false
6661
}
6762
}
68-
@SigmaBinary
69-
{
70-
@SBreference = #$/Body:HAS[#SigmaBarycenter[True]]/name$
71-
}
7263
@Body:HAS[#SigmaBarycenter[True]]
7364
{
7465
!SigmaBarycenter = DEL
7566
}
7667
!Body[SigmaBarycenter] {}
7768
MM_PATCH_LOOP {}
7869
}
79-
80-
@Kopernicus:FOR[SigmaBinary]
81-
{
82-
!SigmaBinary {}
83-
}
84-
85-
!SigmaBinary:FOR[SigmaBinary] {}
512 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"NAME":"Sigma: Binary","URL":"http://ksp-avc.cybutek.net/version.php?id=188","DOWNLOAD":"http://forum.kerbalspaceprogram.com/threads/127820","CHANGE_LOG_URL":"https://github.com/Sigma88/Sigma-Binary/raw/master/Changelog.txt","VERSION":{"MAJOR":1,"MINOR":4,"PATCH":9,"BUILD":2},"KSP_VERSION":{"MAJOR":1,"MINOR":0,"PATCH":5}}
1+
{"NAME":"Sigma: Binary","URL":"http://ksp-avc.cybutek.net/version.php?id=188","DOWNLOAD":"http://forum.kerbalspaceprogram.com/threads/127820","CHANGE_LOG_URL":"https://github.com/Sigma88/Sigma-Binary/raw/master/Changelog.txt","VERSION":{"MAJOR":1,"MINOR":5,"PATCH":0,"BUILD":0},"KSP_VERSION":{"MAJOR":1,"MINOR":1,"PATCH":0}}

License.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
Sigma Binary by Sigma88 is released under the following license:
22

33

4-
Creative Commons - Attribution-NonCommercial-ShareAlike 4.0 International
5-
http://creativecommons.org/licenses/by-nc-sa/4.0/
4+
All Rights Reserved
65

76

87
For more info visit the KSP Forum Thread:
512 Bytes
Binary file not shown.

[Source]/SigmaBinary/ArchivesFixer.cs

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
using System;
2+
using System.Linq;
3+
using System.Collections.Generic;
4+
5+
using UnityEngine;
6+
7+
using Kopernicus.Components;
8+
using Kopernicus.Configuration;
9+
10+
using SigmaBinaryPlugin.Components;
11+
12+
13+
namespace SigmaBinaryPlugin
14+
{
15+
namespace Configuration
16+
{
17+
[ExternalParserTarget("Orbit")]
18+
public class ColorSwitcher : ExternalParserTargetLoader, IParserEventSubscriber
19+
{
20+
public static Dictionary<string, string> colorSwitcher = new Dictionary<string, string>();
21+
public static Dictionary<PSystemBody, string> referenceSwitcher = new Dictionary<PSystemBody, string>();
22+
23+
[ParserTarget("referenceBody", optional = true)]
24+
public string referenceBody
25+
{
26+
set { referenceSwitcher.Add(generatedBody, value); }
27+
}
28+
void IParserEventSubscriber.Apply(ConfigNode node)
29+
{
30+
}
31+
32+
void IParserEventSubscriber.PostApply(ConfigNode node)
33+
{
34+
// Debug.Log("ColorSwitcherLog: Starting PostApply for generatedBody " + generatedBody.name);
35+
36+
// If the color is stored in "sigmabinaryColor" apply the color to the current orbit
37+
if (SigmaBinaryLoader.sigmabinaryColor.ContainsKey(generatedBody.name))
38+
{
39+
// Debug.Log("ColorSwitcherLog: found color for generatedBody " + generatedBody.name);
40+
generatedBody.orbitRenderer.orbitColor = SigmaBinaryLoader.sigmabinaryColor[generatedBody.name];
41+
generatedBody.orbitRenderer.nodeColor = SigmaBinaryLoader.sigmabinaryColor[generatedBody.name];
42+
// Debug.Log("generatedBody.orbitRenderer.orbitColor = " + generatedBody.orbitRenderer.orbitColor);
43+
// Debug.Log("SigmaBinaryLoader.sigmabinaryColor[generatedBody.name] = " + SigmaBinaryLoader.sigmabinaryColor[generatedBody.name]);
44+
}
45+
else
46+
{
47+
// Debug.Log("ColorSwitcherLog: no colors found for generatedBody " + generatedBody.name);
48+
// Otherwise, This might be the color of the Primary Body
49+
if (colorSwitcher.ContainsKey(generatedBody.name))
50+
{
51+
// Debug.Log("ColorSwitcherLog: the color has been requested for body " + colorSwitcher[generatedBody.name]);
52+
// if the color has been requested provide it
53+
SigmaBinaryLoader.sigmabinaryColor.Add(colorSwitcher[generatedBody.name], generatedBody.orbitRenderer.orbitColor);
54+
// Debug.Log("ColorSwitcherLog: provided the requested color - sigmabinaryColor.Add(" + colorSwitcher[generatedBody.name] + ", " + generatedBody.orbitRenderer.orbitColor);
55+
}
56+
else
57+
{
58+
// Debug.Log("ColorSwitcherLog: there was no request for the color of generatedBody " + generatedBody.name);
59+
// otherwise store it for later
60+
SigmaBinaryLoader.sigmabinaryColor.Add(generatedBody.name, generatedBody.orbitRenderer.orbitColor);
61+
// Debug.Log("ColorSwitcherLog: stored for later the color - sigmabinaryColor.Add(" + generatedBody.name + ", " + generatedBody.orbitRenderer.orbitColor);
62+
}
63+
}
64+
// Debug.Log("ColorSwitcherLog: Ending PostApply for generatedBody " + generatedBody.name);
65+
}
66+
public ColorSwitcher ()
67+
{
68+
}
69+
}
70+
}
71+
}

[Source]/SigmaBinary/SigmaBinary.cs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class SigmaBinary : MonoBehaviour
4040
void Start()
4141
{
4242
CelestialBody body = GetComponent<CelestialBody>();
43-
43+
4444
if (!string.IsNullOrEmpty(after))
4545
{
4646
SigmaBinaryLoader.sigmabinaryLoadAfter.Add(after, body);
@@ -64,7 +64,6 @@ void Start()
6464
if (sb.bodyName == sbName)
6565
{
6666
sbBarycenter = sb;
67-
SigmaBinaryLoader.ArchivesFixerList.Add(sb.name);
6867
}
6968
}
7069
if (redrawOrbit)
@@ -107,7 +106,7 @@ void Start()
107106
sbBarycenter.orbit.referenceBody = sbPrimary.orbit.referenceBody;
108107
sbBarycenter.orbit.period = sbPrimary.orbit.period;
109108
sbBarycenter.orbit.ObTAtEpoch = sbPrimary.orbit.ObTAtEpoch;
110-
sbBarycenter.GeeASL = (body.Mass + sbPrimary.Mass) * 6.674e-11d / Math.Pow(sbBarycenter.Radius, 2) / 9.81d;
109+
sbBarycenter.GeeASL = 6.674e-11d / Math.Pow(sbBarycenter.Radius, 2) / 9.81d;
111110
sbBarycenter.rotationPeriod = body.orbit.period;
112111
sbBarycenter.orbitDriver.orbitColor = sbPrimary.orbitDriver.orbitColor;
113112

@@ -159,7 +158,7 @@ void Start()
159158
sbPrimary.orbit.referenceBody = sbBarycenter;
160159
sbPrimary.orbit.period = body.orbit.period;
161160
sbPrimary.orbit.ObTAtEpoch = body.orbit.ObTAtEpoch;
162-
161+
163162
if (Kopernicus.Templates.drawMode.ContainsKey(sbPrimary.name))
164163
Kopernicus.Templates.drawMode.Remove(sbPrimary.name);
165164
if (Kopernicus.Templates.drawIcons.ContainsKey(sbPrimary.name))
@@ -176,19 +175,20 @@ void Start()
176175
{
177176
sbOrbit.orbitDriver.orbit = new Orbit(body.orbit.inclination, body.orbit.eccentricity, body.orbit.semiMajorAxis - sbPrimary.orbit.semiMajorAxis, body.orbit.LAN, body.orbit.argumentOfPeriapsis, body.orbit.meanAnomalyAtEpoch, body.orbit.epoch, sbOrbit);
178177
sbOrbit.orbit.referenceBody = sbBarycenter;
179-
sbOrbit.orbitDriver.orbitColor = body.orbitDriver.orbitColor;
178+
sbOrbit.orbit.period = body.orbit.period;
179+
sbOrbit.orbit.ObTAtEpoch = body.orbit.ObTAtEpoch;
180180

181181
if (body.GetComponent<NameChanger>())
182182
{
183183
if (Kopernicus.Templates.drawMode.ContainsKey(body.GetComponent<NameChanger>().oldName))
184184
Kopernicus.Templates.drawMode.Remove(body.GetComponent<NameChanger>().oldName);
185-
Kopernicus.Templates.drawMode.Add(body.GetComponent<NameChanger>().oldName, OrbitRenderer.DrawMode.REDRAW_AND_FOLLOW);
185+
Kopernicus.Templates.drawMode.Add(body.GetComponent<NameChanger>().oldName, OrbitRenderer.DrawMode.OFF);
186186
}
187187
else
188188
{
189189
if (Kopernicus.Templates.drawMode.ContainsKey(body.name))
190190
Kopernicus.Templates.drawMode.Remove(body.name);
191-
Kopernicus.Templates.drawMode.Add(body.name, OrbitRenderer.DrawMode.REDRAW_AND_FOLLOW);
191+
Kopernicus.Templates.drawMode.Add(body.name, OrbitRenderer.DrawMode.OFF);
192192
}
193193
}
194194

@@ -202,7 +202,9 @@ void Start()
202202
}
203203
sbBarycenter.sphereOfInfluence = sbPrimary.sphereOfInfluence;
204204
Kopernicus.Templates.sphereOfInfluence.Add(sbBarycenter.name, sbBarycenter.sphereOfInfluence);
205+
205206
sbPrimary.sphereOfInfluence = sbPrimary.orbit.semiMajorAxis * (sbPrimary.orbit.eccentricity + 1) + sbBarycenter.sphereOfInfluence;
207+
Kopernicus.Templates.sphereOfInfluence.Add(sbPrimary.name, sbPrimary.sphereOfInfluence);
206208

207209

208210
// Reorder Trackingstation Bodies
@@ -225,8 +227,8 @@ void Start()
225227

226228
// Log
227229
Debug.Log("--- BINARY SYSTEM LOADED ---\nReferenceBody: " + sbBarycenter.orbit.referenceBody.name + "\n Barycenter: " + sbBarycenter.name + "\n Primary: " + sbPrimary.name + "\n Secondary: " + body.name);
228-
229-
230+
231+
230232
if (SigmaBinaryLoader.sigmabinaryLoadAfter.ContainsKey(body.name))
231233
{
232234
body = SigmaBinaryLoader.sigmabinaryLoadAfter[body.name];

0 commit comments

Comments
 (0)