Skip to content

Commit 812d399

Browse files
authored
Suits v0.1.1
Suits v0.1.1
2 parents e10e017 + 4fd38ab commit 812d399

File tree

8 files changed

+55
-22
lines changed

8 files changed

+55
-22
lines changed

Suits/Changelog.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
**v0.1.1**
2+
3+
- Fixed collections
4+
- Added pressure ranges for suits
5+
6+
17
**v0.1.0**
28

39
- First Beta Release
Binary file not shown.

Suits/GameData/Sigma/Replacements/Suits/Plugins/SigmaReplacementsSuits.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
{
1414
"MAJOR": 0,
1515
"MINOR": 1,
16-
"PATCH": 0,
16+
"PATCH": 1,
1717
"BUILD": 0
1818
},
1919
"KSP_VERSION":
1 KB
Binary file not shown.

[Source]/SigmaReplacements/Common/UIKerbals.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ internal class UIKerbals : MonoBehaviour
1212
static CrewMember orbit3 = new CrewMember(ProtoCrewMember.KerbalType.Crew, "Jebediah Kerman", ProtoCrewMember.Gender.Male, "Pilot", true, true, 0.5f, 0.5f, 0);
1313
static CrewMember orbit4 = new CrewMember(ProtoCrewMember.KerbalType.Crew, "Valentina Kerman", ProtoCrewMember.Gender.Female, "Pilot", true, true, 0.55f, 0.4f, 0);
1414
// Instructors
15-
static CrewMember gene = new CrewMember(ProtoCrewMember.KerbalType.Crew, "Gene Kerman", ProtoCrewMember.Gender.Male, "Instructor", false, false, 0.6f, 0.45f, 0);
16-
static CrewMember werner = new CrewMember(ProtoCrewMember.KerbalType.Crew, "Wernher von Kerman", ProtoCrewMember.Gender.Male, "Instructor", false, false, 0.25f, 0.25f, 0);
15+
static CrewMember gene = new CrewMember(ProtoCrewMember.KerbalType.Unowned, "Gene Kerman", ProtoCrewMember.Gender.Male, "Instructor", false, false, 0.6f, 0.45f, 0);
16+
static CrewMember werner = new CrewMember(ProtoCrewMember.KerbalType.Unowned, "Wernher von Kerman", ProtoCrewMember.Gender.Male, "Instructor", false, false, 0.25f, 0.25f, 0);
1717
// Strategy
18-
static CrewMember mort = new CrewMember(ProtoCrewMember.KerbalType.Crew, "Mortimer Kerman", ProtoCrewMember.Gender.Male, "StockBroker", false, false, 0.65f, 0.35f, 0);
19-
static CrewMember linus = new CrewMember(ProtoCrewMember.KerbalType.Crew, "Linus Kerman", ProtoCrewMember.Gender.Male, "Researcher", false, false, 0.35f, 0.3f, 0);
20-
static CrewMember walt = new CrewMember(ProtoCrewMember.KerbalType.Crew, "Walt Kerman", ProtoCrewMember.Gender.Male, "Marketer", false, false, 0.45f, 0.9f, 0);
21-
static CrewMember gus = new CrewMember(ProtoCrewMember.KerbalType.Crew, "Gus Kerman", ProtoCrewMember.Gender.Male, "Mechanic", false, false, 0.45f, 0.45f, 0);
18+
static CrewMember mort = new CrewMember(ProtoCrewMember.KerbalType.Unowned, "Mortimer Kerman", ProtoCrewMember.Gender.Male, "StrategyKerbal", false, false, 0.65f, 0.35f, 0);
19+
static CrewMember linus = new CrewMember(ProtoCrewMember.KerbalType.Unowned, "Linus Kerman", ProtoCrewMember.Gender.Male, "StrategyKerbal", false, false, 0.35f, 0.3f, 0);
20+
static CrewMember walt = new CrewMember(ProtoCrewMember.KerbalType.Unowned, "Walt Kerman", ProtoCrewMember.Gender.Male, "StrategyKerbal", false, false, 0.45f, 0.9f, 0);
21+
static CrewMember gus = new CrewMember(ProtoCrewMember.KerbalType.Unowned, "Gus Kerman", ProtoCrewMember.Gender.Male, "StrategyKerbal", false, false, 0.45f, 0.45f, 0);
2222

2323
internal static CrewMember[] menuKerbals = new[] { mun1, orbit1, orbit2, orbit3, orbit4 };
2424
internal static CrewMember[] instructors = new[] { gene, werner };

[Source]/SigmaReplacements/Suits/CustomSuit.cs

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@ void LoadFor(ProtoCrewMember kerbal)
124124

125125
Info.hash = "";
126126
int? useChance = null;
127+
string collection = "";
127128

128129
for (int i = 0; i < SuitInfo.DataBase?.Count; i++)
129130
{
130131
SuitInfo info = (SuitInfo)SuitInfo.DataBase[i].GetFor(kerbal);
131-
string collection = "";
132132

133133
if (info != null)
134134
{
@@ -139,26 +139,43 @@ void LoadFor(ProtoCrewMember kerbal)
139139
if (info.type != null && info.type != type) continue;
140140
Debug.Log("CustomSuit.LoadFor", "Matched suit type = " + info.type + " to current activity = " + type);
141141

142+
bool useSuit = true;
143+
if (eva != null)
144+
{
145+
double pressure = FlightGlobals.getStaticPressure();
146+
useSuit = !(pressure < info.suitMinPressure) && !(pressure > info.suitMaxPressure);
147+
if (useSuit) Debug.Log("CustomSuit.LoadFor", "Matched suitMinPressure = " + info.suitMinPressure + ", suitMaxPressure = " + info.suitMaxPressure + " to current atmospheric pressure = " + pressure);
148+
}
149+
150+
142151
if (string.IsNullOrEmpty(collection) || collection == info.collection)
143152
{
144153
if (info.useChance != 1)
145154
useChance = kerbal.Hash(info.useGameSeed) % 100;
146155

147156
if (info.useChance == 1 || useChance < info.useChance * 100)
148157
{
158+
Debug.Log("CustomSuit.LoadFor", "Matched suit useChance = " + info.useChance + " to generated chance = " + useChance + " %");
159+
Debug.Log("CustomSuit.LoadFor", "Matched suit collection = " + info.collection + " to current collection = " + collection);
149160
// Collection
150161
collection = info.collection;
151162

152163
// Suit Specific Requirements
153-
helmetLowPressure = helmetLowPressure ?? info.helmetLowPressure;
154-
helmetHighPressure = helmetHighPressure ?? info.helmetHighPressure;
164+
if (useSuit)
165+
{
166+
helmetLowPressure = helmetLowPressure ?? info.helmetLowPressure;
167+
helmetHighPressure = helmetHighPressure ?? info.helmetHighPressure;
168+
}
155169
jetpackMaxGravity = jetpackMaxGravity ?? info.jetpackMaxGravity;
156170

157171
// Colors
158-
body = body ?? info.body.Pick(kerbal, info.useGameSeed);
159-
helmet = helmet ?? info.helmet.Pick(kerbal, info.useGameSeed);
160-
visor = visor ?? info.visor.Pick(kerbal, info.useGameSeed);
161-
flares = flares ?? info.flares.Pick(kerbal, info.useGameSeed);
172+
if (useSuit)
173+
{
174+
body = body ?? info.body.Pick(kerbal, info.useGameSeed);
175+
helmet = helmet ?? info.helmet.Pick(kerbal, info.useGameSeed);
176+
visor = visor ?? info.visor.Pick(kerbal, info.useGameSeed);
177+
flares = flares ?? info.flares.Pick(kerbal, info.useGameSeed);
178+
}
162179
jetpack = jetpack ?? info.jetpack.Pick(kerbal, info.useGameSeed);
163180
flag = flag ?? info.flag.Pick(kerbal, info.useGameSeed);
164181
headset = headset ?? info.headset.Pick(kerbal, info.useGameSeed);
@@ -167,10 +184,13 @@ void LoadFor(ProtoCrewMember kerbal)
167184
backdrop = backdrop ?? info.backdrop.Pick(kerbal, info.useGameSeed);
168185

169186
// Textures
170-
bodyTex = bodyTex ?? info.bodyTex.Pick(kerbal, info.useGameSeed);
171-
helmetTex = helmetTex ?? info.helmetTex.Pick(kerbal, info.useGameSeed);
172-
visorTex = visorTex ?? info.visorTex.Pick(kerbal, info.useGameSeed);
173-
flaresTex = flaresTex ?? info.flaresTex.Pick(kerbal, info.useGameSeed);
187+
if (useSuit)
188+
{
189+
bodyTex = bodyTex ?? info.bodyTex.Pick(kerbal, info.useGameSeed);
190+
helmetTex = helmetTex ?? info.helmetTex.Pick(kerbal, info.useGameSeed);
191+
visorTex = visorTex ?? info.visorTex.Pick(kerbal, info.useGameSeed);
192+
flaresTex = flaresTex ?? info.flaresTex.Pick(kerbal, info.useGameSeed);
193+
}
174194
jetpackTex = jetpackTex ?? info.jetpackTex.Pick(kerbal, info.useGameSeed);
175195
flagTex = flagTex ?? info.flagTex.Pick(kerbal, info.useGameSeed);
176196
gasjetsTex = gasjetsTex ?? info.gasjetsTex.Pick(kerbal, info.useGameSeed);
@@ -180,9 +200,12 @@ void LoadFor(ProtoCrewMember kerbal)
180200
backdropTex = backdropTex ?? info.backdropTex.Pick(kerbal, info.useGameSeed);
181201

182202
// Normals
183-
bodyNrm = bodyNrm ?? info.bodyNrm.Pick(kerbal, info.useGameSeed);
184-
helmetNrm = helmetNrm ?? info.helmetNrm.Pick(kerbal, info.useGameSeed);
185-
visorNrm = visorNrm ?? info.visorNrm.Pick(kerbal, info.useGameSeed);
203+
if (useSuit)
204+
{
205+
bodyNrm = bodyNrm ?? info.bodyNrm.Pick(kerbal, info.useGameSeed);
206+
helmetNrm = helmetNrm ?? info.helmetNrm.Pick(kerbal, info.useGameSeed);
207+
visorNrm = visorNrm ?? info.visorNrm.Pick(kerbal, info.useGameSeed);
208+
}
186209
jetpackNrm = jetpackNrm ?? info.jetpackNrm.Pick(kerbal, info.useGameSeed);
187210
flagNrm = flagNrm ?? info.flagNrm.Pick(kerbal, info.useGameSeed);
188211
headsetNrm = headsetNrm ?? info.headsetNrm.Pick(kerbal, info.useGameSeed);

[Source]/SigmaReplacements/Suits/SuitInfo.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ internal class SuitInfo : Info
1515

1616
// Suit Specific Requirements
1717
internal Type? type = null;
18+
internal float? suitMinPressure = null;
19+
internal float? suitMaxPressure = null;
1820
internal float? helmetLowPressure = null;
1921
internal float? helmetHighPressure = null;
2022
internal float? jetpackMaxGravity = null;
@@ -64,6 +66,8 @@ internal SuitInfo(ConfigNode requirements, ConfigNode info) : base(requirements,
6466

6567
// Suit Specific Requirements
6668
type = Parse(info.GetValue("type"), type);
69+
suitMinPressure = Parse(info.GetValue("suitMinPressure"), suitMinPressure);
70+
suitMaxPressure = Parse(info.GetValue("suitMaxPressure"), suitMaxPressure);
6771
helmetLowPressure = Parse(info.GetValue("helmetLowPressure"), helmetLowPressure);
6872
helmetHighPressure = Parse(info.GetValue("helmetHighPressure"), helmetHighPressure);
6973
jetpackMaxGravity = Parse(info.GetValue("jetpackMaxGravity"), jetpackMaxGravity);

[Source]/SigmaReplacements/Suits/Version.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Suits
88
[KSPAddon(KSPAddon.Startup.Instantly, true)]
99
public class Version : MonoBehaviour
1010
{
11-
public static readonly System.Version number = new System.Version("0.1.0");
11+
public static readonly System.Version number = new System.Version("0.1.1");
1212

1313
void Awake()
1414
{

0 commit comments

Comments
 (0)