Skip to content

Commit 49eba6b

Browse files
authored
Merge pull request #116 from KSP-RO/Develop
Fixes for Making History
2 parents f646748 + 78a3806 commit 49eba6b

File tree

6 files changed

+38
-19
lines changed

6 files changed

+38
-19
lines changed

GameData/ThunderAerospace/ChangeLog.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
V0.13.11
2+
Add test subject to Making History parts.
3+
Fix LS resources not appearing for Female Kerbals on EVA without Making History installed.
14
V0.13.10
25
Re-compile for KSP 1.5.x.
36
Should now show converter name in converter part extended part tooltip in VAB/SPH.

GameData/ThunderAerospace/TacLifeSupport/MM_CrewablePartTests.cfg

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Add the test subject module for all stock crewable parts. This will make the contract system generate part tests for them.
2-
@PART[Mark1-2Pod|cupola|Mark1Cockpit|Mark2Cockpit|landerCabinSmall|mk2Cockpit_Inline|mk1pod|mk2LanderCabin|mk2Cockpit_Standard|mk3Cockpit_Shuttle|crewCabin|]:HAS[!MODULE[ModuleTestSubject]]:FOR[TacLifeSupport]
2+
@PART[Mark1-2Pod|Mark1-3Pod|cupola|Mark1Cockpit|Mark2Cockpit|landerCabinSmall|mk2Cockpit_Inline|mk1pod_v2|mk2LanderCabin|mk2Cockpit_Standard|mk3Cockpit_Shuttle|crewCabin|]:HAS[!MODULE[ModuleTestSubject]]:FOR[TacLifeSupport]
33
{
44
MODULE
55
{
@@ -10,3 +10,14 @@
1010
useEvent = True
1111
}
1212
}
13+
@PART[Mk2Pod|kv1Pod|kv2Pod|kv3Pod|MEMLander]:HAS[!MODULE[ModuleTestSubject]]:NEEDS[SquadExpansion/MakingHistory]:FOR[TacLifeSupport]
14+
{
15+
MODULE
16+
{
17+
name = ModuleTestSubject
18+
// nowhere: 0, srf: 1, ocean: 2, atmo: 4, space: 8
19+
environments = 15
20+
useStaging = False
21+
useEvent = True
22+
}
23+
}

GameData/ThunderAerospace/TacLifeSupport/TacLifeSupport.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"URL": "http://ksp-avc.cybutek.net/version.php?id=9",
44
"DOWNLOAD": "https://github.com/KSP-RO/TacLifeSupport/releases",
55
"CHANGE_LOG_URL": "https://github.com/KSP-RO/TacLifeSupport/wiki/Changes",
6-
"VERSION": "0.13.10.0",
6+
"VERSION": "0.13.11.0",
77
"KSP_VERSION": {
88
"MAJOR": 1,
99
"MINOR": 5,

GameData/ThunderAerospace/TacLifeSupport_v0.13.10.0.txt renamed to GameData/ThunderAerospace/TacLifeSupport_v0.13.11.0.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
You have installed the TAC Life Support, version 0.13.10.0 (+ ).
1+
You have installed the TAC Life Support, version 0.13.11.0 (+ ).
22

33
See the Readme.txt and LICENSE.txt files for more information.

Source/AddLifeSupport.cs

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
*/
2828

2929
using System;
30+
using System.Collections.Generic;
3031
using System.Linq;
3132
using UnityEngine;
3233

@@ -53,10 +54,13 @@ public void run()
5354

5455
try
5556
{
56-
var evaParts = PartLoader.LoadedPartsList.Where(p => p.name.Contains("kerbalEVA"));
57-
foreach (var evaPart in evaParts)
57+
IEnumerable<AvailablePart> evaParts = PartLoader.LoadedPartsList.Where(p => p.name.Contains("kerbalEVA"));
58+
foreach (AvailablePart evaPart in evaParts)
5859
{
59-
EvaAddLifeSupport(evaPart);
60+
if (evaPart.partPrefab != null && evaPart.partPrefab.Resources != null)
61+
{
62+
EvaAddLifeSupport(evaPart);
63+
}
6064
}
6165
}
6266
catch (Exception ex)
@@ -86,11 +90,19 @@ public void ChangeValues()
8690
private void EvaAddLifeSupport(AvailablePart part)
8791
{
8892
Part prefabPart = part.partPrefab;
89-
93+
if (prefabPart == null)
94+
{
95+
this.Log("Part " + part.name + " has no partPrefab");
96+
return;
97+
}
9098
this.Log("Adding resources to " + part.name + "/" + prefabPart.partInfo.title);
9199

92100
EvaAddPartModule(prefabPart);
93101
if (HighLogic.CurrentGame == null) return;
102+
if (prefabPart.Resources == null || !prefabPart.Resources.IsValid || prefabPart.SimulationResources == null || !prefabPart.SimulationResources.IsValid)
103+
{
104+
prefabPart.SetupResources();
105+
}
94106
EvaAddResource(prefabPart, HighLogic.CurrentGame.Parameters.CustomParams<TAC_SettingsParms_Sec2>().EvaElectricityConsumptionRate, globalSettings.Electricity, false);
95107
EvaAddResource(prefabPart, HighLogic.CurrentGame.Parameters.CustomParams<TAC_SettingsParms_Sec2>().FoodConsumptionRate, globalSettings.Food, false);
96108
EvaAddResource(prefabPart, HighLogic.CurrentGame.Parameters.CustomParams<TAC_SettingsParms_Sec2>().WaterConsumptionRate, globalSettings.Water, false);
@@ -111,20 +123,13 @@ private void EvaAddPartModule(Part part)
111123
{
112124
ConfigNode node = new ConfigNode("MODULE");
113125
node.AddValue("name", "LifeSupportModule");
114-
int c = part.Modules.Count;
115-
bool Found = false;
116-
for (int mI = 0; mI < c; ++mI)
126+
node.AddValue("moduleName", "LifeSupportModule");
127+
if (part.FindModuleImplementing<LifeSupportModule>() == null)
117128
{
118-
if (part.Modules[mI].moduleName == "LifeSupportModule")
119-
{
120-
Found = true;
121-
break;
122-
}
123-
}
124-
if (!Found)
125129
part.AddModule(node);
130+
}
126131

127-
this.LogWarning("The expected exception did not happen when adding the Life Support part module to the EVA!");
132+
//this.LogWarning("The expected exception did not happen when adding the Life Support part module to " + part.partInfo.name + "-" + part.partInfo.title);
128133
}
129134
catch (Exception ex)
130135
{

Source/TacLifeSupport.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
<PropertyGroup>
113113
<AssemblyMajorVersion>0</AssemblyMajorVersion>
114114
<AssemblyMinorVersion>13</AssemblyMinorVersion>
115-
<AssemblyBuildNumber>10</AssemblyBuildNumber>
115+
<AssemblyBuildNumber>11</AssemblyBuildNumber>
116116
<AssemblyFileMajorVersion>$(AssemblyMajorVersion)</AssemblyFileMajorVersion>
117117
<AssemblyFileMinorVersion>$(AssemblyMinorVersion)</AssemblyFileMinorVersion>
118118
<AssemblyFileBuildNumber>$(AssemblyBuildNumber)</AssemblyFileBuildNumber>

0 commit comments

Comments
 (0)