Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified DeepFreeze.zip
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"NAME":"DeepFreeze Continued...",
"URL":"http://ksp-avc.cybutek.net/version.php?id=183",
"DOWNLOAD":"https://kerbalstuff.com/mod/895/DeepFreeze%20Continued...",
"VERSION":{"MAJOR":0,"MINOR":19,"PATCH":0,"BUILD":0},
"VERSION":{"MAJOR":0,"MINOR":19,"PATCH":1,"BUILD":0},
"KSP_VERSION":{"MAJOR":1,"MINOR":0,"PATCH":4},
"KSP_VERSION_MIN":{"MAJOR":1,"MINOR":0,"PATCH":0},
"KSP_VERSION_MAX":{"MAJOR":1,"MINOR":0,"PATCH":4}
Expand Down
6 changes: 4 additions & 2 deletions GameData/REPOSoftTech/DeepFreeze/Plugins/Config.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ DFSettings
{
DFwindowPosX = 40
DFwindowPosY = 50
CFwindowPosX = 450
CFwindowPosY = 50
CFwindowPosX = 500
CFwindowPosY = 140
ECreqdForFreezer = False
fatalOption = True
comatoseTime = 300
UseAppLauncher = True
debugging = False
AutoRecoverFznKerbals = True
Expand Down
Binary file modified GameData/REPOSoftTech/DeepFreeze/Plugins/DeepFreeze.dll
Binary file not shown.
Binary file not shown.
6 changes: 5 additions & 1 deletion Source/Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
[B]V0.19.0.0 "Bug fixes & Enhancements"[/B]
[B]V0.19.1.0 "Bug fixes & Enhancements"[/B]
Added comatose function for when EC or Heat options are ON and Fatal option is OFF. Now when you run out of EC or overheat with these options set kerbals will be emergency thawed
and become comatose (tourists) for a period of 5 minutes (can be changed in the settings menu).
Fixed bug with new pop-up windows when EC is critical or overheat - this pop-up will now NOT appear if the active vessel is the vessel that has run out of EC or overheat.
[B]V0.19.0.0 "Bug fixes & Enhancements"[/B]
Added Fatal EC/Heat option. If this is ON kerbals will die if EC runs out or it gets too hot (if you are using the EC and Heat options). If this is OFF
the Kerbals will be emergency thawed and become available again, and start consuming LS resources again. (to-do - expand this to perhaps make them unusable for a period of time due to
emergency thaw effects, but not in this version) Default setting (for compatibility) is set to ON. - IE: running out of EC or over-heating will Kill kerbals.
Expand Down
53 changes: 46 additions & 7 deletions Source/DFIntMemory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private void Awake()
if (HighLogic.LoadedSceneIsFlight && FlightGlobals.ActiveVessel != null)
onVesselChange(FlightGlobals.ActiveVessel);
}
catch (Exception ex)
catch (Exception)
{
this.Log_Debug("Invalid Freezer Cam Code in settings. Settings value=" + DeepFreeze.Instance.DFsettings.internalFrzrCamCode);
keyFrzrCam = (KeyCode)100;
Expand Down Expand Up @@ -303,7 +303,7 @@ private void Update()
{
kerbalname = ActFrzrCams[lastFrzrCam].FrzrCamPart.part.internalModel.seats[lastFrzrCam].kerbalRef.name;
}
catch (Exception ex)
catch (Exception)
{
kerbalname = string.Empty;
}
Expand All @@ -317,10 +317,23 @@ private void FixedUpdate()
{
if (HighLogic.LoadedSceneIsEditor || Time.timeSinceLevelLoad < 5f) return; //Wait 5 seconds on level load before executing

//We check/update kerbal Dictionary for comatose kerbals in EVERY Game Scene.
try
{
if (DeepFreeze.Instance.DFgameSettings.KnownFrozenKerbals.Count() > 0)
CheckComaUpdate();
}
catch (Exception ex)
{
this.Log("FixedUpdate failed to update DeepFreeze Internal Comatose Kerbals Memory");
this.Log("Err: " + ex);
}

//We check/update Vessel and Part Dictionary in EVERY Game Scene.
try
{
CheckVslUpdate();
if (DeepFreeze.Instance.DFgameSettings.knownVessels.Count() > 0)
CheckVslUpdate();
}
catch (Exception ex)
{
Expand All @@ -343,6 +356,32 @@ private void FixedUpdate()
}
}

private void CheckComaUpdate()
{
// Check the knownfrozenkerbals for any tourists kerbals (IE: Comatose) if their time is up and reset them if it is.
var keysToDelete = new List<string>();
foreach (KeyValuePair<string, KerbalInfo> comaKerbals in DeepFreeze.Instance.DFgameSettings.KnownFrozenKerbals)
{
if (comaKerbals.Value.type == ProtoCrewMember.KerbalType.Tourist)
{
if (Planetarium.GetUniversalTime() - comaKerbals.Value.lastUpdate > (double)DeepFreeze.Instance.DFsettings.comatoseTime) // Is time up?
{
ProtoCrewMember crew = HighLogic.CurrentGame.CrewRoster.Tourist.FirstOrDefault(a => a.name == comaKerbals.Key);
if (crew != null)
{
Utilities.setComatoseKerbal(crew, ProtoCrewMember.KerbalType.Crew);
keysToDelete.Add(comaKerbals.Key);
}
else
{
this.Log("Unable to set comatose crew member " + comaKerbals.Key + " back to crew status.");
}
}
}
}
keysToDelete.ForEach(id => DeepFreeze.Instance.DFgameSettings.KnownFrozenKerbals.Remove(id));
}

private void ChkUnknownFrozenKerbals()
{
// Check the roster list for any unknown dead kerbals (IE: Frozen) that were not in the save file and add them.
Expand Down Expand Up @@ -612,7 +651,7 @@ private void resetFreezerCams()
}
}
}
catch (Exception ex)
catch (Exception)
{
this.Log("Failed to resetFreezerCams");
//this.Log("Err: " + ex);
Expand Down Expand Up @@ -724,13 +763,13 @@ private void UpdatePredictedVesselEC(VesselInfo vesselInfo, Vessel vessel, doubl
frznChargeRequired = (int)frzr.Value.frznChargeRequired;
ECreqdsincelastupdate += ((frznChargeRequired / 60.0f) * timeperiod * frzr.Value.numFrznCrew);
frzr.Value.deathCounter = currentTime;
this.Log_Debug("predicted EC part " + frzr.Value.vesselID + " " + frzr.Value.PartName + " FrznChargeRequired " + frznChargeRequired + " timeperiod " + timeperiod + " #frzncrew " + frzr.Value.numFrznCrew);
//this.Log_Debug("predicted EC part " + frzr.Value.vesselID + " " + frzr.Value.PartName + " FrznChargeRequired " + frznChargeRequired + " timeperiod " + timeperiod + " #frzncrew " + frzr.Value.numFrznCrew);
}
double ECafterlastupdate = vesselInfo.storedEC - ECreqdsincelastupdate;
double predictedMinutes = ECafterlastupdate / frznChargeRequired; // This probably should be per PART, but for simplicity we will do for the whole vessel
vesselInfo.predictedECOut = predictedMinutes * 60;
this.Log_Debug("UpdatePredictedVesselEC vessel " + vessel.id + " " + vessel.name + " StoredEC=" + vesselInfo.storedEC + " ECreqd=" + ECreqdsincelastupdate + " Prediction Secs=" + vesselInfo.predictedECOut);
this.Log_Debug("ECafterlastupdate " + ECafterlastupdate + " FrznChargeRequired " + frznChargeRequired + " predictedMinutes " + predictedMinutes);
//this.Log_Debug("UpdatePredictedVesselEC vessel " + vessel.id + " " + vessel.name + " StoredEC=" + vesselInfo.storedEC + " ECreqd=" + ECreqdsincelastupdate + " Prediction Secs=" + vesselInfo.predictedECOut);
//this.Log_Debug("ECafterlastupdate " + ECafterlastupdate + " FrznChargeRequired " + frznChargeRequired + " predictedMinutes " + predictedMinutes);
}

private void UpdateVesselInfo(VesselInfo vesselInfo, Vessel vessel, double currentTime)
Expand Down
8 changes: 6 additions & 2 deletions Source/DFSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ internal class DFSettings
internal bool debugging { get; set; }
internal bool ECreqdForFreezer { get; set; }
internal bool fatalOption { get; set; }
internal float comatoseTime { get; set; }
internal bool AutoRecoverFznKerbals { get; set; }
internal float KSCcostToThawKerbal { get; set; }
internal int ECReqdToFreezeThaw { get; set; }
Expand Down Expand Up @@ -59,14 +60,15 @@ internal DFSettings()
{
DFwindowPosX = 40;
DFwindowPosY = 50;
CFwindowPosX = 380;
CFwindowPosY = 50;
CFwindowPosX = 500;
CFwindowPosY = 140;
DFKACwindowPosX = 600;
DFKACwindowPosY = 50;
UseAppLauncher = true;
debugging = true;
ECreqdForFreezer = true;
fatalOption = true;
comatoseTime = 300;
AutoRecoverFznKerbals = true;
KSCcostToThawKerbal = 10000f;
ECReqdToFreezeThaw = 3000;
Expand Down Expand Up @@ -106,6 +108,7 @@ internal void Load(ConfigNode node)
DFKACwindowPosY = Utilities.GetNodeValue(DFsettingsNode, "DFKACwindowPosY", DFKACwindowPosY);
ECreqdForFreezer = Utilities.GetNodeValue(DFsettingsNode, "ECreqdForFreezer", ECreqdForFreezer);
fatalOption = Utilities.GetNodeValue(DFsettingsNode, "fatalOption", fatalOption);
comatoseTime = Utilities.GetNodeValue(DFsettingsNode, "comatoseTime", comatoseTime);
UseAppLauncher = Utilities.GetNodeValue(DFsettingsNode, "UseAppLauncher", UseAppLauncher);
debugging = Utilities.GetNodeValue(DFsettingsNode, "debugging", debugging);
AutoRecoverFznKerbals = Utilities.GetNodeValue(DFsettingsNode, "AutoRecoverFznKerbals", AutoRecoverFznKerbals);
Expand Down Expand Up @@ -154,6 +157,7 @@ internal void Save(ConfigNode node)
settingsNode.AddValue("DFKACwindowPosY", DFKACwindowPosY);
settingsNode.AddValue("ECreqdForFreezer", ECreqdForFreezer);
settingsNode.AddValue("fatalOption", fatalOption);
settingsNode.AddValue("comatoseTime", comatoseTime);
settingsNode.AddValue("UseAppLauncher", UseAppLauncher);
settingsNode.AddValue("debugging", debugging);
settingsNode.AddValue("AutoRecoverFznKerbals", AutoRecoverFznKerbals);
Expand Down
Loading