Skip to content

Commit

Permalink
Merge pull request #226 from BobPalmer/DEVELOP
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
BobPalmer authored Feb 24, 2017
2 parents c9571e8 + 571d375 commit 12d4e7f
Show file tree
Hide file tree
Showing 14 changed files with 59 additions and 7 deletions.
9 changes: 9 additions & 0 deletions FOR_RELEASE/GameData/000_USITools/CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
0.8.16 - 2017.02.11
-------------------
Mechanics can now perform EVA maintenance
Fixed an issue where resources were being double-consumed when converters were swapped

0.8.15 - 2017.02.08
------------------
Fixed more nullref spam

0.8.13 - 2017.02.04
------------------
Fixed some nullref spam in Animations related to logistics
Expand Down
4 changes: 4 additions & 0 deletions FOR_RELEASE/GameData/000_USITools/TraitsAndEffects.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
EFFECT {
name = GeologySkill
}
EFFECT
{
name = ConstructionSkill
}
}

@EXPERIENCE_TRAIT[Scientist] {
Expand Down
Binary file modified FOR_RELEASE/GameData/000_USITools/USITools.dll
Binary file not shown.
Binary file modified FOR_RELEASE/GameData/000_USITools/USITools.dll.mdb
Binary file not shown.
Binary file modified FOR_RELEASE/GameData/000_USITools/USITools.pdb
Binary file not shown.
2 changes: 1 addition & 1 deletion FOR_RELEASE/GameData/000_USITools/USITools.version
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"VERSION":{
"MAJOR":0,
"MINOR":8,
"PATCH":14,
"PATCH":16,
"BUILD":0
},
"KSP_VERSION":{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
0.5.23 - 2017.02.24
-------------------
Fixed an issue where habitation was not being shared correctly

0.5.22 - 2017.02.05
-------------------
Dependency Updates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"VERSION":{
"MAJOR":0,
"MINOR":5,
"PATCH":22,
"PATCH":23,
"BUILD":0
},
"KSP_VERSION":{
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Source/USILifeSupport/.vs/USILifeSupport/v14/.suo
Binary file not shown.
7 changes: 3 additions & 4 deletions Source/USILifeSupport/LifeSupportManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,6 @@ internal static double GetTotalHabTime(VesselSupplyStatus sourceVessel, Vessel v
return sourceVessel.CachedHabTime;
}

double totHabSpace = sourceVessel.ExtraHabSpace;
double totHabMult = sourceVessel.VesselHabMultiplier;

int totCurCrew = sourceVessel.NumCrew;
int totMaxCrew = sourceVessel.CrewCap;

Expand All @@ -402,6 +399,8 @@ internal static double GetTotalHabTime(VesselSupplyStatus sourceVessel, Vessel v
hList.Add(v);
}
}
double totHabSpace = sourceVessel.ExtraHabSpace;
double totHabMult = CalculateVesselHabMultiplier(vsl,totCurCrew);
totHabSpace += (LifeSupportScenario.Instance.settings.GetSettings().BaseHabTime * totMaxCrew);

var hCount = hList.Count;
Expand All @@ -410,7 +409,7 @@ internal static double GetTotalHabTime(VesselSupplyStatus sourceVessel, Vessel v
var v = hList[i];
// Calculate HabSpace and HabMult after we know totCurCrew and totMaxCrew
totHabSpace += CalculateVesselHabExtraTime(v);
totHabMult *= Math.Min(1,CalculateVesselHabMultiplier(v, totCurCrew));
totHabMult += CalculateVesselHabMultiplier(v, totCurCrew);
}

totHabMult += USI_GlobalBonuses.Instance.GetHabBonus(vsl.mainBody.flightGlobalsIndex);
Expand Down
38 changes: 37 additions & 1 deletion Source/USILifeSupport/ModuleLifeSupportExtender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ public class ModuleLifeSupportExtender : ModuleResourceConverter_USI
[KSPField]
public bool habTimer = true;

[KSPField(guiName = "Kolony Growth", guiActive = true, guiActiveEditor = true, isPersistant = true), UI_Toggle(disabledText = "disabled", enabledText = "enabled")]
public bool KolonyGrowthEnabled = false;

[KSPField(isPersistant = true)]
public double GrowthTime = 0d;

public const double GestationTime = 9720000d;

protected override void PreProcessing()
{
if (!HighLogic.LoadedSceneIsFlight)
Expand Down Expand Up @@ -49,11 +57,19 @@ protected override void PostProcess(ConverterResults result, double deltaTime)
if (PartOnly)
crew = part.protoModuleCrew;

var hasMale = false;
var hasFemale = false;

var count = crew.Count;
for (int i = 0; i < count; ++i)
{
var c = crew[i];
if(string.IsNullOrEmpty(restrictedClass) || c.experienceTrait.Title == restrictedClass)
if (c.gender == ProtoCrewMember.Gender.Male)
hasMale = true;
if (c.gender == ProtoCrewMember.Gender.Female)
hasFemale = true;

if (string.IsNullOrEmpty(restrictedClass) || c.experienceTrait.Title == restrictedClass)
kerbals.Add(c);
}

Expand All @@ -71,6 +87,26 @@ protected override void PostProcess(ConverterResults result, double deltaTime)

LifeSupportManager.Instance.TrackKerbal(lsKerbal);
}

//Kolony Growth
if (KolonyGrowthEnabled && part.CrewCapacity > part.protoModuleCrew.Count)
{
GrowthTime += result.TimeFactor;
if (GrowthTime >= GestationTime)
{
GrowthTime = 0d;
SpawnKerbal();
}
}
}

private void SpawnKerbal()
{
ProtoCrewMember newKerb = HighLogic.CurrentGame.CrewRoster.GetNewKerbal();
newKerb.rosterStatus = ProtoCrewMember.RosterStatus.Assigned;
part.AddCrewmember(newKerb);
var msg = String.Format("{0}, a new {1}, has joined your crew!", newKerb.name, newKerb.experienceTrait.TypeName);
ScreenMessages.PostScreenMessage(msg, 5f, ScreenMessageStyle.UPPER_CENTER);
}
}
}

0 comments on commit 12d4e7f

Please sign in to comment.