diff --git a/DeepFreeze.zip b/DeepFreeze.zip index 499aaff..1b8831a 100644 Binary files a/DeepFreeze.zip and b/DeepFreeze.zip differ diff --git a/GameData/REPOSoftTech/DeepFreeze/Plugins/DeepFreeze.dll b/GameData/REPOSoftTech/DeepFreeze/Plugins/DeepFreeze.dll index 933a741..43c7396 100644 Binary files a/GameData/REPOSoftTech/DeepFreeze/Plugins/DeepFreeze.dll and b/GameData/REPOSoftTech/DeepFreeze/Plugins/DeepFreeze.dll differ diff --git a/GameData/REPOSoftTech/DeepFreeze/Plugins/DeepFreeze.dll.mdb b/GameData/REPOSoftTech/DeepFreeze/Plugins/DeepFreeze.dll.mdb deleted file mode 100644 index 6c2c2c5..0000000 Binary files a/GameData/REPOSoftTech/DeepFreeze/Plugins/DeepFreeze.dll.mdb and /dev/null differ diff --git a/Source/Changelog.txt b/Source/Changelog.txt index 953f11a..cca8af9 100644 --- a/Source/Changelog.txt +++ b/Source/Changelog.txt @@ -1,4 +1,9 @@ -[B]V0.19.1.0 "Bug fixes & Enhancements"[/B] +[B]V0.19.2.0 "Bug fixes & Enhancements"[/B] +Fix distribution to include missing Editor group icon from V0.19.0.0 that somehow got left out of V0.19.1.0. +Fix bug that V0.19.2.0 introduced that was causing invalid seat placements and +Add more robust checking of Seat placements for frozen kerbals to avoid bugs that have been occurring for some users. +Fix seat placement when a freeze/thaw process is aborted. +[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. diff --git a/Source/DFIntMemory.cs b/Source/DFIntMemory.cs index 8544060..8d234c7 100644 --- a/Source/DFIntMemory.cs +++ b/Source/DFIntMemory.cs @@ -317,6 +317,14 @@ private void FixedUpdate() { if (HighLogic.LoadedSceneIsEditor || Time.timeSinceLevelLoad < 5f) return; //Wait 5 seconds on level load before executing + //Check if the active vessel has changed and if so, process. + if (HighLogic.LoadedSceneIsFlight) + { + if (FlightGlobals.ActiveVessel.id != ActVslID) + { + onVesselChange(FlightGlobals.ActiveVessel); + } + } //We check/update kerbal Dictionary for comatose kerbals in EVERY Game Scene. try { @@ -332,8 +340,7 @@ private void FixedUpdate() //We check/update Vessel and Part Dictionary in EVERY Game Scene. try { - if (DeepFreeze.Instance.DFgameSettings.knownVessels.Count() > 0) - CheckVslUpdate(); + CheckVslUpdate(); } catch (Exception ex) { @@ -360,22 +367,23 @@ 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(); - foreach (KeyValuePair comaKerbals in DeepFreeze.Instance.DFgameSettings.KnownFrozenKerbals) + List> comaKerbals = DeepFreeze.Instance.DFgameSettings.KnownFrozenKerbals.Where(e => e.Value.type == ProtoCrewMember.KerbalType.Tourist).ToList(); + foreach (KeyValuePair comaKerbal in comaKerbals) { - if (comaKerbals.Value.type == ProtoCrewMember.KerbalType.Tourist) + if (comaKerbal.Value.type == ProtoCrewMember.KerbalType.Tourist) { - if (Planetarium.GetUniversalTime() - comaKerbals.Value.lastUpdate > (double)DeepFreeze.Instance.DFsettings.comatoseTime) // Is time up? + if (Planetarium.GetUniversalTime() - comaKerbal.Value.lastUpdate > (double)DeepFreeze.Instance.DFsettings.comatoseTime) // Is time up? { - ProtoCrewMember crew = HighLogic.CurrentGame.CrewRoster.Tourist.FirstOrDefault(a => a.name == comaKerbals.Key); + ProtoCrewMember crew = HighLogic.CurrentGame.CrewRoster.Tourist.FirstOrDefault(a => a.name == comaKerbal.Key); if (crew != null) { Utilities.setComatoseKerbal(crew, ProtoCrewMember.KerbalType.Crew); - keysToDelete.Add(comaKerbals.Key); + keysToDelete.Add(comaKerbal.Key); } else { - this.Log("Unable to set comatose crew member " + comaKerbals.Key + " back to crew status."); - } + this.Log("Unable to set comatose crew member " + comaKerbal.Key + " back to crew status."); + } } } } @@ -517,6 +525,7 @@ internal void onVesselCreate(Vessel vessel) if (frznKerbals.Value.partID == frzr.part.flightID) { frznKerbals.Value.vesselID = vessel.id; + frznKerbals.Value.vesselName = vessel.vesselName; } } //Update the Frzr Parts internal frozenkerbals list GUID @@ -525,7 +534,7 @@ internal void onVesselCreate(Vessel vessel) storedCrew.VesselID = vessel.id; } } - } + } } internal void onPartCouple(GameEvents.FromToAction fromToAction) @@ -548,6 +557,7 @@ internal void onPartCouple(GameEvents.FromToAction fromToAction) if (frznKerbals.Value.partID == frzr.part.flightID) { frznKerbals.Value.vesselID = fromToAction.to.vessel.id; + frznKerbals.Value.vesselName = fromToAction.to.vessel.vesselName; } } //Update the Frzr Parts internal frozenkerbals list GUID @@ -567,7 +577,7 @@ internal void onPartCouple(GameEvents.FromToAction fromToAction) } internal void onVesselChange(Vessel vessel) - { + { if (HighLogic.LoadedSceneIsFlight) { this.Log_Debug("OnVesselChange activevessel " + FlightGlobals.ActiveVessel.name + "(" + FlightGlobals.ActiveVessel.id + ") parametervessel " + vessel.name + "(" + vessel.id + ")"); diff --git a/Source/DeepFreeze.cs b/Source/DeepFreeze.cs index 40dc747..e5c8f2f 100644 --- a/Source/DeepFreeze.cs +++ b/Source/DeepFreeze.cs @@ -172,25 +172,39 @@ protected void onVesselRecovered(ProtoVessel vessel) KerbalInfo kerbalinfo = DFgameSettings.KnownFrozenKerbals[key]; if (kerbalinfo.vesselID == vessel.vesselID) { - if (DeepFreeze.Instance.DFsettings.AutoRecoverFznKerbals) + if (kerbalinfo.type == ProtoCrewMember.KerbalType.Unowned) //Frozen crew { - this.Log_Debug("AutoRecover is ON"); - this.Log("Calling ThawFrozen Crew to thaw FrozenCrew " + key); - ThawFrozenCrew(key, vessel.vesselID); - } - else - { - this.Log("DeepFreeze AutoRecovery of frozen kerbals is set to off. Must be thawed manually."); - this.Log("DeepFreezeEvents frozenkerbal remains frozen =" + key); - ProtoCrewMember realkerbal = HighLogic.CurrentGame.CrewRoster.Unowned.FirstOrDefault(b => b.name == key); - if (realkerbal != null) + if (DeepFreeze.Instance.DFsettings.AutoRecoverFznKerbals) + { + this.Log_Debug("AutoRecover is ON"); + this.Log("Calling ThawFrozen Crew to thaw FrozenCrew " + key); + ThawFrozenCrew(key, vessel.vesselID); + } + else { - realkerbal.type = ProtoCrewMember.KerbalType.Unowned; - realkerbal.rosterStatus = ProtoCrewMember.RosterStatus.Dead; - this.Log_Debug("Kerbal " + realkerbal.name + " " + realkerbal.type + " " + realkerbal.rosterStatus); - ScreenMessages.PostScreenMessage(key + " was stored frozen at KSC", 5.0f, ScreenMessageStyle.UPPER_RIGHT); + this.Log("DeepFreeze AutoRecovery of frozen kerbals is set to off. Must be thawed manually."); + this.Log("DeepFreezeEvents frozenkerbal remains frozen =" + key); + ProtoCrewMember realkerbal = HighLogic.CurrentGame.CrewRoster.Unowned.FirstOrDefault(b => b.name == key); + if (realkerbal != null) + { + realkerbal.type = ProtoCrewMember.KerbalType.Unowned; + realkerbal.rosterStatus = ProtoCrewMember.RosterStatus.Dead; + this.Log_Debug("Kerbal " + realkerbal.name + " " + realkerbal.type + " " + realkerbal.rosterStatus); + ScreenMessages.PostScreenMessage(key + " was stored frozen at KSC", 5.0f, ScreenMessageStyle.UPPER_RIGHT); + } } } + else // Tourist/Comatose crew + { + this.Log_Debug("Comatose crew - reset to crew " + key); + ProtoCrewMember crew = HighLogic.CurrentGame.CrewRoster.Tourist.FirstOrDefault(c => c.name == key); + crew.type = ProtoCrewMember.KerbalType.Crew; + crew.rosterStatus = ProtoCrewMember.RosterStatus.Assigned; + this.Log_Debug("Kerbal " + crew.name + " " + crew.type + " " + crew.rosterStatus); + crew.ArchiveFlightLog(); + crew.rosterStatus = ProtoCrewMember.RosterStatus.Available; + DFgameSettings.KnownFrozenKerbals.Remove(crew.name); + } } } var alarmsToDelete = new List(); @@ -317,7 +331,23 @@ internal void KillFrozenCrew(string FrozenCrew) } } else - this.Log("DeepFreezeEvents " + kerbal.name + " couldn't find them to kill them."); + { + // check if comatose crew + ProtoCrewMember crew = HighLogic.CurrentGame.CrewRoster.Tourist.FirstOrDefault(a => a.name == FrozenCrew); + if (crew != null) + { + this.Log("DeepFreezeEvents " + kerbal.name + " killed"); + kerbal.type = ProtoCrewMember.KerbalType.Crew; + kerbal.rosterStatus = ProtoCrewMember.RosterStatus.Dead; + if (HighLogic.CurrentGame.Parameters.Difficulty.MissingCrewsRespawn == true) + { + kerbal.StartRespawnPeriod(); + this.Log("DeepFreezeEvents " + kerbal.name + " respawn started."); + } + } + else + this.Log("DeepFreezeEvents " + kerbal.name + " couldn't find them to kill them."); + } } #endregion Events diff --git a/Source/DeepFreeze.csproj b/Source/DeepFreeze.csproj index ab1c27a..abf2a79 100644 --- a/Source/DeepFreeze.csproj +++ b/Source/DeepFreeze.csproj @@ -69,6 +69,7 @@ + @@ -103,7 +104,7 @@ if %25ERRORLEVEL%25 == 1 ( if exist "$(SolutionDir)..\$(ProjectName).zip" del "$(SolutionDir)..\$(ProjectName).zip" c:\7za\7za a -tzip -r "$(SolutionDir)..\$(ProjectName).zip" "$(SolutionDir)..\GameData" -c:\7za\7za d -r -x!REPOSoftTech.png -x!Glykerol.png -x!DFtoolbar.png -x!DeepFreezeOff.png -x!DeepFreezeOn.png -x!alphaonly.png "$(SolutionDir)..\$(ProjectName).zip" "*.ddsified" "*.pdb" "*.mdb" "*.png" +c:\7za\7za d -r -x!REPOSoftTech.png -x!Glykerol.png -x!DFtoolbar.png -x!DeepFreezeOff.png -x!DeepFreezeOn.png -x!DeepFreezeEditor.png -x!alphaonly.png "$(SolutionDir)..\$(ProjectName).zip" "*.ddsified" "*.pdb" "*.mdb" "*.png" xcopy /E /Y "$(SolutionDir)..\GameData" "%25KSP_DIR%25\GameData"