Skip to content

Commit

Permalink
Merge pull request #47 from BobPalmer/DEVELOP
Browse files Browse the repository at this point in the history
0.2.1
  • Loading branch information
BobPalmer committed Jan 1, 2016
2 parents 4b475a9 + 23948c2 commit be6d17d
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
0.2.1 - 2016.01.01
------------------
Fixed bug where crew were starving on Kerbin
Fixed vessel display issues (hopefully) in flight

0.2.0 - 2015.12.29
------------------
24-hour clock support and cost fixes (thanks Kerbas-ad-astra!)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ LIFE_SUPPORT_SETTINGS
SupplyTime = 324000 //How many seconds before Kerbals are affected by no supplies
EVATime = 21600 //How many seconds before ill effects on EVA
ECAmount = 0.01 //EC per Kerbal per second
SupplyAmount = 0.00005 //Supplies consumed per Kerbal per second
WasteAmount = 0.00005 //Mulch produced per Kerbal per second
SupplyAmount = 0.00005 //Supplies consumed per Kerbal per second
WasteAmount = 0.00005 //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
NoSupplyEffectVets = 1 //Effect if a Kerbal is a vet and has no supplies or EC
EVAEffect = 1 //Effect if a Kerbal exceeds EVA time
EVAEffectVets = 1 //Effect if a Kerbal is a vet and exceeds EVA time
NoHomeEffect = 0 //Effect if a Kerbal becomes homesick
NoHomeEffectVets = 0 //Effect if a Kerbai is a vet and becomes homesick
NoHomeEffectVets = 0 //Effect if a Kerbai is a vet and becomes homesick
HabMultiplier = 1 //Bonus to hab values (1 = default = 100% of the part's rated value)
HomeworldAltitude = 25000 //Altitude on Kerbin that negative effects are removed
VetNames = Jeb,Valentina,Bill,Bob
HomeWorldAltitude = 25000 //Altitude on Kerbin that negative effects are removed
VetNames = Jebediah,Valentina,Bill,Bob
}
// SIDE EFFECTS:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"VERSION":{
"MAJOR":0,
"MINOR":2,
"PATCH":0,
"PATCH":1,
"BUILD":0
},
"KSP_VERSION":{
Expand Down
Binary file not shown.
24 changes: 8 additions & 16 deletions Source/USILifeSupport/LifeSupportMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,27 +62,18 @@ private void OnWindow(int windowId)
private void FixedUpdate()
{
CheckEVAKerbals();
CleanupEmptyVessels();
}

private void CleanupEmptyVessels()
{
foreach (var lsv in LifeSupportManager.Instance.VesselSupplyInfo)
{
var vsl = FlightGlobals.Vessels.FirstOrDefault(v => v.id.ToString() == lsv.VesselId);
if(vsl == null || vsl.GetCrewCount() == 0)
LifeSupportManager.Instance.UntrackVessel(lsv.VesselId);
}
LifeSupportManager.Instance.UpdateVesselStats();
}


private void CheckEVAKerbals()
{
foreach (var v in FlightGlobals.Vessels.Where(v => v.isEVA))
{
var c = v.GetVesselCrew().First();
//Lone exception is a landed EVA Kerbal on Kerbin.
if (v.situation == Vessel.Situations.LANDED && v.mainBody.bodyName == "Kerbin")
return;
if (v.mainBody != FlightGlobals.GetHomeBody())
{
var c = v.GetVesselCrew().First();

//Check their status.
var k = LifeSupportManager.Instance.FetchKerbal(c);
//Only if they are unsupplied
Expand All @@ -91,7 +82,8 @@ private void CheckEVAKerbals()
ApplyEVAEffect(k, c, v,
LifeSupportManager.isVet(k.KerbalName)
? LifeSupportSetup.Instance.LSConfig.EVAEffectVets
: LifeSupportSetup.Instance.LSConfig.EVAEffect);
: LifeSupportSetup.Instance.LSConfig.EVAEffect);
}
}
}

Expand Down
4 changes: 1 addition & 3 deletions Source/USILifeSupport/ModuleLifeSupport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ protected override void PostProcess(ConverterResults result, double deltaTime)
//Fetch them from the queue
var k = LifeSupportManager.Instance.FetchKerbal(c);
//Update our stuff
var onKerbin = (part.vessel.mainBody.name == "Kerbin" && part.vessel.altitude < LifeSupportSetup.Instance.LSConfig.HomeWorldAltitude);

var onKerbin = (part.vessel.mainBody == FlightGlobals.GetHomeBody() && part.vessel.altitude < LifeSupportSetup.Instance.LSConfig.HomeWorldAltitude);
if (!onKerbin && (deltaTime - result.TimeFactor > tolerance))
{
CheckSupplySideEffects(k, c);
Expand All @@ -100,7 +99,6 @@ protected override void PostProcess(ConverterResults result, double deltaTime)
}
k.LastUpdate = Planetarium.GetUniversalTime();
LifeSupportManager.Instance.TrackKerbal(k);

var supAmpunt = _resBroker.AmountAvailable(part, "Supplies", deltaTime, "ALL_VESSEL");
v.SuppliesLeft = supAmpunt/0.00005f/part.vessel.GetCrewCount();
LifeSupportManager.Instance.TrackVessel(v);
Expand Down
4 changes: 2 additions & 2 deletions Source/USILifeSupport/USILifeSupport.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>false</DebugSymbols>
<DebugType>none</DebugType>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\..\KSP_DEV\GameData\UmbraSpaceIndustries\LifeSupport\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
Expand Down

0 comments on commit be6d17d

Please sign in to comment.