diff --git a/DeepFreeze.zip b/DeepFreeze.zip deleted file mode 100644 index 96a3f54..0000000 Binary files a/DeepFreeze.zip and /dev/null differ diff --git a/GameData/REPOSoftTech/DeepFreeze/DeepFreezeContinued.version b/GameData/REPOSoftTech/DeepFreeze/DeepFreezeContinued.version index 1b35a44..f8efc16 100644 --- a/GameData/REPOSoftTech/DeepFreeze/DeepFreezeContinued.version +++ b/GameData/REPOSoftTech/DeepFreeze/DeepFreezeContinued.version @@ -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":20,"PATCH":2,"BUILD":0}, +"VERSION":{"MAJOR":0,"MINOR":20,"PATCH":3,"BUILD":0}, "KSP_VERSION":{"MAJOR":1,"MINOR":0,"PATCH":5}, "KSP_VERSION_MIN":{"MAJOR":1,"MINOR":0,"PATCH":3}, "KSP_VERSION_MAX":{"MAJOR":1,"MINOR":0,"PATCH":5} diff --git a/GameData/REPOSoftTech/DeepFreeze/Plugins/DeepFreeze.dll b/GameData/REPOSoftTech/DeepFreeze/Plugins/DeepFreeze.dll index de7ced9..19fd7b0 100644 Binary files a/GameData/REPOSoftTech/DeepFreeze/Plugins/DeepFreeze.dll and b/GameData/REPOSoftTech/DeepFreeze/Plugins/DeepFreeze.dll differ diff --git a/Source/Changelog.txt b/Source/Changelog.txt index d919767..dcf82dd 100644 --- a/Source/Changelog.txt +++ b/Source/Changelog.txt @@ -1,4 +1,7 @@ -V0.20.2.0 "Bug fixes" +V0.20.3.0 "bug Fixes" +Fixed bug when thawing some kerbals vessel where vessel reference transform was not set in some cases. +Modified debugging and error messages during thawing to assist easier bug hunting in the future. +V0.20.2.0 "Bug fixes" Fixed null ref bug when vessels are destroyed. Fixed null ref bug when KSP vessel list cannot be accessed. Fixed null ref/NAN bug when revert to editor (from vessel with DeepFreeze part) and launch another vessel. diff --git a/Source/DeepFreezerPart.cs b/Source/DeepFreezerPart.cs index 8d6dd67..c202717 100644 --- a/Source/DeepFreezerPart.cs +++ b/Source/DeepFreezerPart.cs @@ -368,8 +368,8 @@ public void DeActivateAction(KSPActionParam param) private Guid CrntVslID; private uint CrntPartID; private string CrntVslName; - private bool vesselisinIVA; - private bool vesselisinInternal; + private bool vesselisinIVA = false; + private bool vesselisinInternal = false; private bool setGameSettings = false; @@ -767,13 +767,19 @@ private void checkRPMPodTransparencySetting() private void onceoffSetup() { - Utilities.Log_Debug("DeepFreezer", "OnUpdate SetGameSettings"); + Utilities.Log_Debug("DeepFreezer", "OnUpdate onceoffSetup"); _StoredCrewList.Clear(); CrntVslID = this.vessel.id; CrntVslName = this.vessel.vesselName; CrntPartID = this.part.flightID; lastUpdate = Time.time; lastRemove = Time.time; + if (DeepFreeze.Instance == null) + { + Utilities.Log("DeepFreezer", "Onceoffsetup - waiting for DeepFreeze settings instance"); + setGameSettings = false; + return; + } // Master settings values override the part values for EC required and Glykerol required if (DeepFreeze.Instance.DFsettings.ECReqdToFreezeThaw != ChargeRequired) { @@ -2166,8 +2172,9 @@ private void ThawKerbalStep0(string frozenkerbal) // we check the internal seat has our Crewmember in it. Not some other kerbal. if (crew.name == frozenkerbal) { + int codestep = 0; try - { + { //seat is taken and it is by themselves. Expected condition. //Check the KerbalRef isn't null. If it is we need to respawn them. (this shouldn't occur). if (kerbal.KerbalRef == null) @@ -2178,6 +2185,7 @@ private void ThawKerbalStep0(string frozenkerbal) kerbal.Spawn(); this.Log_Debug("Kerbal kerbalref = " + kerbal.KerbalRef.GetInstanceID()); } + codestep = 1; if (kerbal.KerbalRef != null) { Utilities.subdueIVAKerbalAnimations(kerbal.KerbalRef); @@ -2185,6 +2193,7 @@ private void ThawKerbalStep0(string frozenkerbal) Utilities.setFrznKerbalLayer(kerbal, true, false); //Set the Kerbal renderer layers on so they are visible again. kerbal.KerbalRef.InPart = this.part; //Put their kerbalref back in the part. kerbal.KerbalRef.rosterStatus = ProtoCrewMember.RosterStatus.Assigned; + codestep = 2; try { if (DFInstalledMods.IsTexReplacerInstalled) @@ -2198,6 +2207,7 @@ private void ThawKerbalStep0(string frozenkerbal) Debug.Log("Err: " + ex); } + codestep = 3; KerbalGUIManager.AddActiveCrew(kerbal.KerbalRef); //Add them to the portrait cams. this.Log_Debug("Just thawing crew and added to GUIManager"); KerbalGUIManager.PrintActiveCrew(); @@ -2207,6 +2217,7 @@ private void ThawKerbalStep0(string frozenkerbal) if (vesselisinIVA || vesselisinInternal) setIVAFrzrCam(tmpcrew.SeatIdx); + codestep = 4; if (hasExternalDoor) { //now set the helmet state depending on the external door state. @@ -2219,11 +2230,13 @@ private void ThawKerbalStep0(string frozenkerbal) Utilities.setHelmetshaders(kerbal.KerbalRef, true); } } - this.Log_Debug("Reference part after add=" + this.vessel.GetReferenceTransformPart().name + ",flightid=" + this.vessel.GetReferenceTransformPart().flightID); + this.Log_Debug("Finishing ThawKerbalStep0"); + //this.Log_Debug("Reference part after add=" + this.vessel.GetReferenceTransformPart().name + ",flightid=" + this.vessel.GetReferenceTransformPart().flightID); } catch (Exception ex) { Debug.Log("Exception attempting to add to seat for " + frozenkerbal); + Debug.Log("Part has Internals, and Frozen Kerbal was found codestep = " + codestep); Debug.Log("Err: " + ex); ScreenMessages.PostScreenMessage("Code Error: Cannot thaw kerbal at this time, Check Log", 5.0f, ScreenMessageStyle.UPPER_CENTER); ThawKerbalAbort(frozenkerbal); @@ -2245,6 +2258,7 @@ private void ThawKerbalStep0(string frozenkerbal) { this.Log_Debug("Seat Crew KerbalRef is NULL re-add them at seatidx=" + tmpcrew.SeatIdx); //this.part.internalModel.seats[tmpcrew.SeatIdx].taken = false; // Set their seat to NotTaken before we assign them back to their seat, not sure we really need this. + int codestep = 0; try { this.part.internalModel.SitKerbalAt(kerbal, this.part.internalModel.seats[tmpcrew.SeatIdx]); @@ -2253,6 +2267,7 @@ private void ThawKerbalStep0(string frozenkerbal) //set the seat to allow helmet, this will cause the helmet to appear kerbal.seat.allowCrewHelmet = true; } + codestep = 1; kerbal.seat.SpawnCrew(); setseatstaticoverlay(this.part.internalModel.seats[tmpcrew.SeatIdx]); // Think this will get rid of the static that appears on the portrait camera @@ -2263,6 +2278,7 @@ private void ThawKerbalStep0(string frozenkerbal) Utilities.setFrznKerbalLayer(kerbal, true, false); //Set the Kerbal renderer layers on so they are visible again. kerbal.KerbalRef.InPart = this.part; //Put their kerbalref back in the part. kerbal.KerbalRef.rosterStatus = ProtoCrewMember.RosterStatus.Assigned; + codestep = 2; try { if (DFInstalledMods.IsTexReplacerInstalled) @@ -2276,11 +2292,14 @@ private void ThawKerbalStep0(string frozenkerbal) Debug.Log("Err: " + ex); } + codestep = 3; KerbalGUIManager.AddActiveCrew(kerbal.KerbalRef); //Add them to the portrait cams. this.Log_Debug("Just thawing crew and added to GUIManager"); KerbalGUIManager.PrintActiveCrew(); + codestep = 4; if (vesselisinIVA || vesselisinInternal) setIVAFrzrCam(tmpcrew.SeatIdx); + codestep = 5; if (hasExternalDoor) { //now set the helmet state depending on the external door state. @@ -2293,10 +2312,12 @@ private void ThawKerbalStep0(string frozenkerbal) Utilities.setHelmetshaders(kerbal.KerbalRef, true); } } + this.Log_Debug("Finishing ThawKerbalStep0"); } catch (Exception ex) { Debug.Log("Exception attempting to add to seat for " + frozenkerbal); + Debug.Log("Seat Crew KerbalRef is NULL re-add them at seatidx=" + tmpcrew.SeatIdx + " codestep = " + codestep); Debug.Log("Err: " + ex); ScreenMessages.PostScreenMessage("Code Error: Cannot thaw kerbal at this time, Check Log", 5.0f, ScreenMessageStyle.UPPER_CENTER); ThawKerbalAbort(frozenkerbal); @@ -2316,6 +2337,7 @@ private void ThawKerbalStep0(string frozenkerbal) catch (Exception ex) { Debug.Log("Exception attempting to add to seat for " + frozenkerbal); + Debug.Log("Where DeepFreezer Module is attached to internal-LESS part"); Debug.Log("Err: " + ex); ScreenMessages.PostScreenMessage("Code Error: Cannot thaw kerbal at this time, Check Log", 5.0f, ScreenMessageStyle.UPPER_CENTER); ThawKerbalAbort(frozenkerbal); @@ -2505,7 +2527,7 @@ private bool RemoveKerbal(ProtoCrewMember kerbal, int SeatIndx) } else { - this.Log("Found Kerbal in the stored frozen crew list for this part, critical error. Report this on the forum."); + this.Log("Found Kerbal in the stored frozen crew list for this part."); this.Log("Crewmember:" + tmpcrew.CrewName + " Seat:" + tmpcrew.SeatIdx); } // Update the saved frozen kerbals dictionary @@ -3892,8 +3914,7 @@ private void stopStripLightFlash(int seatIndx) //This method sets the internal camera to the Freezer view prior to thawing or freezing a kerbal so we can see the nice animations. private void setIVAFrzrCam(int seatIndx) { - string camname = "FrzCam" + (seatIndx + 1).ToString(); - //this.Log_Debug("Setting FrzrCam " + camname); + string camname = "FrzCam" + (seatIndx + 1).ToString(); Camera cam = this.part.internalModel.FindModelComponent(camname); if (cam != null) //Found Freezer Camera so switch to it. { @@ -3908,6 +3929,7 @@ private void setIVAFrzrCam(int seatIndx) { CameraManager.Instance.SetCameraMode(CameraManager.CameraMode.Flight); } + this.Log_Debug("Finished Setting FrzrCam " + camname); } private void setseatstaticoverlay(InternalSeat seat) diff --git a/Source/Properties/AssemblyInfo.cs b/Source/Properties/AssemblyInfo.cs index 1559f77..1978feb 100644 --- a/Source/Properties/AssemblyInfo.cs +++ b/Source/Properties/AssemblyInfo.cs @@ -31,7 +31,7 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.20.2.0")] -[assembly: AssemblyFileVersion("0.20.2.0")] +[assembly: AssemblyVersion("0.20.3.0")] +[assembly: AssemblyFileVersion("0.20.3.0")] [assembly: KSPAssembly("DeepFreeze", 0, 20)] [assembly: KSPAssemblyDependency("DFInterface", 0, 4)] \ No newline at end of file