Skip to content

Commit

Permalink
0.3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
BobPalmer committed Feb 2, 2016
1 parent 60089bd commit 57e747f
Show file tree
Hide file tree
Showing 14 changed files with 142 additions and 50 deletions.
7 changes: 7 additions & 0 deletions FOR_RELEASE/GameData/000_USITools/CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
0.6.0 - 2016.02.01
------------------
Added new module for structural supports (versus horribly abusing fairings)
Auto-Repairer part module added (for use with USI-LS and UKS)
Added the concept of global bonuses to prevent circular references (i.e. between kolonization and life support)
Added custom layers to USI Animation

0.5.5 - 2016.01.18
------------------
Inflatable fuel tank module
Expand Down
Binary file modified FOR_RELEASE/GameData/000_USITools/USITools.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions FOR_RELEASE/GameData/000_USITools/USITools.version
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
},
"VERSION":{
"MAJOR":0,
"MINOR":5,
"PATCH":5,
"MINOR":6,
"PATCH":0,
"BUILD":0
},
"KSP_VERSION":{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
0.3.6 - 2016.02.01
------------------
Lots of optimizations and small bug fixes


0.3.5 - 2016.01.25
------------------
Fixed an issue with the cupola config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@
MODULE
{
name = ModuleHabitation
KerbalMonths = 12
KerbalMonths = 12.5
}
MODULE
{
name = USI_ModuleFieldRepair
}

}

@PART[cupola]
Expand All @@ -55,6 +60,11 @@
KerbalMonths = 0
HabMultiplier = 1.76
}
MODULE
{
name = USI_ModuleFieldRepair
}

}

@PART[Large_Crewed_Lab]
Expand Down Expand Up @@ -92,6 +102,12 @@
Ratio = 0.00001
}
}

MODULE
{
name = USI_ModuleFieldRepair
}

}

@PART[*]:HAS[!MODULE[ModuleLifeSupport],#CrewCapacity[*],~CrewCapacity[0]]:FOR[USILifeSupport]
Expand All @@ -109,6 +125,11 @@
@amount *= #$/CrewCapacity$
@maxAmount *= #$/CrewCapacity$
}

MODULE
{
name = USI_ModuleFieldRepair
}
}

@PART[*]:HAS[!MODULE[ModuleLifeSupport],MODULE[KerbalSeat]]:FOR[USILifeSupport]
Expand All @@ -126,4 +147,9 @@
@amount *= #$/CrewCapacity$
@maxAmount *= #$/CrewCapacity$
}

MODULE
{
name = USI_ModuleFieldRepair
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ LIFE_SUPPORT_SETTINGS
WasteAmount = 0.00075 //Mulch produced per Kerbal per second
NoSupplyEffect = 1 //Effect if a Kerbal has no supplies or EC
NoSupplyEffectVets = 1 //Effect if a Kerbal is a vet and has no supplies or EC
EVAEffect = 3 //Effect if a Kerbal exceeds EVA time
EVAEffectVets = 3 //Effect if a Kerbal is a vet and exceeds EVA time
EVAEffect = 1 //Effect if a Kerbal exceeds EVA time
EVAEffectVets = 1 //Effect if a Kerbal is a vet and exceeds EVA time
NoHomeEffect = 1 //Effect if a Kerbal becomes homesick
NoHomeEffectVets = 1 //Effect if a Kerbal is a vet and becomes homesick
HabMultiplier = 1 //Bonus to hab values (1 = default = 100% of the part's rated value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"VERSION":{
"MAJOR":0,
"MINOR":3,
"PATCH":5,
"PATCH":6,
"BUILD":0
},
"KSP_VERSION":{
Expand Down
Binary file not shown.
Binary file not shown.
13 changes: 7 additions & 6 deletions Source/USILifeSupport/LifeSupportManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public LifeSupportStatus FetchKerbal(ProtoCrewMember crew)
k.LastMeal = Planetarium.GetUniversalTime();
k.LastOnKerbin = Planetarium.GetUniversalTime();
k.MaxOffKerbinTime = Planetarium.GetUniversalTime() + 972000000;
k.TimeInVessel = 0d;
k.TimeEnteredVessel = Planetarium.GetUniversalTime();
k.LastVesselId = "??UNKNOWN??";
k.LastUpdate = Planetarium.GetUniversalTime();
k.IsGrouchy = false;
Expand All @@ -111,11 +111,11 @@ public void TrackKerbal(LifeSupportStatus status)
kerbInfo.LastOnKerbin = status.LastOnKerbin;
kerbInfo.MaxOffKerbinTime = status.MaxOffKerbinTime;
kerbInfo.LastVesselId = status.LastVesselId;
kerbInfo.TimeInVessel = status.TimeInVessel;
kerbInfo.TimeEnteredVessel = status.TimeEnteredVessel;
kerbInfo.LastUpdate = status.LastUpdate;
kerbInfo.IsGrouchy = status.IsGrouchy;
kerbInfo.OldTrait = status.OldTrait;
LifeSupportScenario.Instance.settings.SaveStatusNode(status);
LifeSupportScenario.Instance.settings.SaveStatusNode(kerbInfo);
}

public void TrackVessel(VesselSupplyStatus status)
Expand Down Expand Up @@ -201,7 +201,7 @@ internal void UpdateVesselStats()
private static int GetColonyCrewCount(Vessel vsl)
{
var crewCount = vsl.GetCrewCount();
var vList = LogisticsTools.GetNearbyVessels((float)LifeSupportSetup.Instance.LSConfig.HabRange, false, vsl, true);
var vList = LogisticsTools.GetNearbyVessels((float)LifeSupportSetup.Instance.LSConfig.HabRange, false, vsl, false);
foreach (var v in vList)
{
crewCount += v.GetCrewCount();
Expand Down Expand Up @@ -232,7 +232,7 @@ internal static double GetRecyclerMultiplier(Vessel vessel)
}
}

var vList = LogisticsTools.GetNearbyVessels((float)LifeSupportSetup.Instance.LSConfig.HabRange, false, vessel, true);
var vList = LogisticsTools.GetNearbyVessels((float)LifeSupportSetup.Instance.LSConfig.HabRange, false, vessel, false);
foreach (var v in vList)
{
foreach (var r in v.FindPartModulesImplementing<ModuleLifeSupportRecycler>())
Expand Down Expand Up @@ -261,7 +261,7 @@ internal static double GetTotalHabTime(VesselSupplyStatus sourceVessel)
double totCurCrew = sourceVessel.NumCrew;
double totMaxCrew = sourceVessel.CrewCap;

var vList = LogisticsTools.GetNearbyVessels((float)LifeSupportSetup.Instance.LSConfig.HabRange, false, vsl, true);
var vList = LogisticsTools.GetNearbyVessels((float)LifeSupportSetup.Instance.LSConfig.HabRange, false, vsl, false);
foreach (var v in vList)
{
var curVsl = LifeSupportManager.Instance.FetchVessel(v.id.ToString());
Expand All @@ -273,6 +273,7 @@ internal static double GetTotalHabTime(VesselSupplyStatus sourceVessel)
totMaxCrew += curVsl.CrewCap;
totHabMult += curVsl.VesselHabMultiplier;
}
totHabMult += USI_GlobalBonuses.Instance.GetHabBonus(vsl.mainBody.flightGlobalsIndex);
double habTotal = totHabSpace / totCurCrew * (totHabMult + 1) * LifeSupportSetup.Instance.LSConfig.HabMultiplier;
//print(String.Format("THS: {0} TC:{1} THM: {2} HM: {3}", totHabSpace, totCurCrew, totHabMult, LifeSupportSetup.Instance.LSConfig.HabMultiplier));

Expand Down
74 changes: 46 additions & 28 deletions Source/USILifeSupport/LifeSupportMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,19 @@ private void OnWindow(int windowId)
GenerateWindow();
}

private double LastUpdate;
private double checkTime = 1d;

private void FixedUpdate()
{
//if (LastUpdate < ResourceUtilities.FLOAT_TOLERANCE)
// LastUpdate = Planetarium.GetUniversalTime();

//if (Planetarium.GetUniversalTime() < checkTime + LastUpdate)
// return;

//LastUpdate = Planetarium.GetUniversalTime();
//_guiStats = UpdateGUIStats();
CheckEVAKerbals();
LifeSupportManager.Instance.UpdateVesselStats();
}
Expand Down Expand Up @@ -405,15 +416,8 @@ public static List<Vessel> GetNearbyVessels(int range, bool includeSelf, Vessel
}
}

private void GenerateWindow()
private List<LifeSupportVesselDisplayStat> UpdateGUIStats()
{
GUILayout.BeginVertical();
scrollPos = GUILayout.BeginScrollView(scrollPos, _scrollStyle, GUILayout.Width(600), GUILayout.Height(350));
GUILayout.BeginVertical();


try
{
var useHabPenalties = (LifeSupportSetup.Instance.LSConfig.NoHomeEffectVets +
LifeSupportSetup.Instance.LSConfig.NoHomeEffect > 0);
LifeSupportManager.Instance.UpdateVesselStats();
Expand Down Expand Up @@ -476,15 +480,16 @@ private void GenerateWindow()
supAmount = Math.Max(0, (vsl.SuppliesLeft * supmult) - estFood);

var lblColor = "ACFF40";
if (Planetarium.GetUniversalTime() - vsl.LastUpdate > 1)
if (Planetarium.GetUniversalTime() - vsl.LastUpdate > 2)
lblColor = "C4C4C4";
vstat.VesselName = String.Format("<color=#{0}>{1}</color>", lblColor, vsl.VesselName);
vstat.LastUpdate = vsl.LastUpdate;
var sitString = "Orbiting";
if (thisVessel.Landed)
if (thisVessel.Splashed || thisVessel.heightFromTerrain < 1000)
sitString = "Splashed";
if (thisVessel.Landed || thisVessel.heightFromTerrain < 1000)
sitString = "Landed";
if (thisVessel.Splashed)
sitString = "Splashed";

var habString = "indefinite";
if (useHabPenalties)
habString = LifeSupportUtilities.SecondsToKerbinTime(habTime,true);
Expand Down Expand Up @@ -522,8 +527,7 @@ private void GenerateWindow()
lblSup = "FF5E5E";
}
cStat.SupplyLabel = String.Format("<color=#{0}>{1}</color>",lblSup,LifeSupportUtilities.SecondsToKerbinTime(snacksLeft));
var timeDelta = Planetarium.GetUniversalTime() - cls.LastUpdate;
var timeLeft = Math.Min(cls.MaxOffKerbinTime - Planetarium.GetUniversalTime(), habTime - (cls.TimeInVessel + timeDelta));
var timeLeft = Math.Min(cls.MaxOffKerbinTime - Planetarium.GetUniversalTime(), habTime - (Planetarium.GetUniversalTime() - cls.TimeEnteredVessel));

var lblHab = "6FFF00";
if (timeLeft < 60 * 60 * 6 * 15) //15 days
Expand All @@ -547,26 +551,40 @@ private void GenerateWindow()
statList.Add(vstat);
}

return statList;
}

foreach (var v in statList.OrderByDescending(s => s.LastUpdate))
private List<LifeSupportVesselDisplayStat> _guiStats;

private void GenerateWindow()
{
_guiStats = UpdateGUIStats();
GUILayout.BeginVertical();
scrollPos = GUILayout.BeginScrollView(scrollPos, _scrollStyle, GUILayout.Width(600), GUILayout.Height(350));
GUILayout.BeginVertical();


try
{
GUILayout.BeginHorizontal();
GUILayout.Label("", _labelStyle, GUILayout.Width(10));
GUILayout.Label(v.VesselName, _labelStyle, GUILayout.Width(155));
GUILayout.Label(v.SummaryLabel, _labelStyle, GUILayout.Width(370));
GUILayout.EndHorizontal();
foreach (var c in v.crew)
foreach (var v in _guiStats.OrderByDescending(s => s.LastUpdate))
{
GUILayout.BeginHorizontal();
GUILayout.Label("", _labelStyle, GUILayout.Width(30));
GUILayout.Label(c.CrewName, _labelStyle, GUILayout.Width(135));
GUILayout.Label("<color=#EDEDED>sup:</color>", _labelStyle, GUILayout.Width(32));
GUILayout.Label(c.SupplyLabel, _labelStyle, GUILayout.Width(155));
GUILayout.Label("<color=#EDEDED>hab:</color>", _labelStyle, GUILayout.Width(32));
GUILayout.Label(c.HabLabel, _labelStyle, GUILayout.Width(155));
GUILayout.Label("", _labelStyle, GUILayout.Width(10));
GUILayout.Label(v.VesselName, _labelStyle, GUILayout.Width(155));
GUILayout.Label(v.SummaryLabel, _labelStyle, GUILayout.Width(370));
GUILayout.EndHorizontal();
foreach (var c in v.crew)
{
GUILayout.BeginHorizontal();
GUILayout.Label("", _labelStyle, GUILayout.Width(30));
GUILayout.Label(c.CrewName, _labelStyle, GUILayout.Width(135));
GUILayout.Label("<color=#EDEDED>sup:</color>", _labelStyle, GUILayout.Width(32));
GUILayout.Label(c.SupplyLabel, _labelStyle, GUILayout.Width(155));
GUILayout.Label("<color=#EDEDED>hab:</color>", _labelStyle, GUILayout.Width(32));
GUILayout.Label(c.HabLabel, _labelStyle, GUILayout.Width(155));
GUILayout.EndHorizontal();
}
}
}

}
catch (Exception ex)
Expand Down
4 changes: 2 additions & 2 deletions Source/USILifeSupport/LifeSupportPersistance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void Save(ConfigNode node)
rNode.AddValue("LastOnKerbin", r.LastOnKerbin);
rNode.AddValue("MaxOffKerbinTime", r.MaxOffKerbinTime);
rNode.AddValue("LastVesselId", r.LastVesselId);
rNode.AddValue("TimeInVessel", r.TimeInVessel);
rNode.AddValue("TimeEnteredVessel", r.TimeEnteredVessel);
rNode.AddValue("IsGrouchy", r.IsGrouchy);
rNode.AddValue("OldTrait", r.OldTrait);
rNode.AddValue("LastUpdate", r.LastUpdate);
Expand Down Expand Up @@ -199,7 +199,7 @@ public void SaveStatusNode(LifeSupportStatus status)
kerbInfo.LastMeal = status.LastMeal;
kerbInfo.LastOnKerbin = status.LastOnKerbin;
kerbInfo.MaxOffKerbinTime = status.MaxOffKerbinTime;
kerbInfo.TimeInVessel = status.TimeInVessel;
kerbInfo.TimeEnteredVessel = status.TimeEnteredVessel;
kerbInfo.LastVesselId = status.LastVesselId;
kerbInfo.IsGrouchy = status.IsGrouchy;
kerbInfo.OldTrait = status.OldTrait;
Expand Down
2 changes: 1 addition & 1 deletion Source/USILifeSupport/LifeSupportStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class LifeSupportStatus
public string OldTrait { get; set; }
public double LastOnKerbin { get; set; }
public double MaxOffKerbinTime { get; set; }
public double TimeInVessel { get; set; }
public double TimeEnteredVessel { get; set; }
public string LastVesselId { get; set; }
}
}
Loading

0 comments on commit 57e747f

Please sign in to comment.