diff --git a/DeepFreeze.zip b/DeepFreeze.zip index f4e12be..027877c 100644 Binary files a/DeepFreeze.zip and b/DeepFreeze.zip differ diff --git a/GameData/REPOSoftTech/DeepFreeze/DeepFreezeContinued.version b/GameData/REPOSoftTech/DeepFreeze/DeepFreezeContinued.version index fbb0231..265fee6 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":18,"PATCH":2,"BUILD":1}, +"VERSION":{"MAJOR":0,"MINOR":19,"PATCH":0,"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} diff --git a/GameData/REPOSoftTech/DeepFreeze/Icons/DeepFreezeEditor.png b/GameData/REPOSoftTech/DeepFreeze/Icons/DeepFreezeEditor.png new file mode 100644 index 0000000..4b11b0b Binary files /dev/null and b/GameData/REPOSoftTech/DeepFreeze/Icons/DeepFreezeEditor.png differ diff --git a/GameData/REPOSoftTech/DeepFreeze/Plugins/Config.cfg b/GameData/REPOSoftTech/DeepFreeze/Plugins/Config.cfg index 0cbeda3..30eb596 100644 --- a/GameData/REPOSoftTech/DeepFreeze/Plugins/Config.cfg +++ b/GameData/REPOSoftTech/DeepFreeze/Plugins/Config.cfg @@ -19,7 +19,7 @@ DFSettings TempinKelvin = True defaultTimeoutforCrewXfer = 30 cryopodResettimeDelay = 3 - DFWindowWidth = 420 + DFWindowWidth = 450 CFWindowWidth = 340 KACWindowWidth = 485 ECLowWarningTime = 3600 diff --git a/GameData/REPOSoftTech/DeepFreeze/Plugins/DeepFreeze.dll b/GameData/REPOSoftTech/DeepFreeze/Plugins/DeepFreeze.dll index 31c855f..f41db9e 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/Sounds/flatline.wav b/GameData/REPOSoftTech/DeepFreeze/Sounds/flatline.wav new file mode 100644 index 0000000..d9332bd Binary files /dev/null and b/GameData/REPOSoftTech/DeepFreeze/Sounds/flatline.wav differ diff --git a/Source/Changelog.txt b/Source/Changelog.txt index ae8998f..dc191f5 100644 --- a/Source/Changelog.txt +++ b/Source/Changelog.txt @@ -1,4 +1,25 @@ -[B]V0.18.2.0 "Bug Fixes & Enhancements"[/B] +[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. +Added pop-up window when EC is critical for vessels that are not the active vessel and you can automatically switch to that vessel. +Added flatline sound effect if kerbals die due to lack of EC or over temperature condition. +Support for Texture Replacer V2.4.10, you MUST have this version (or above) of Texture Replacer installed. Thawed kerbals will no longer lose their customised texture settings. +Support for RasterPropMonitor V0.23.0, you MUST have this version (or above) of RPM installed. +Changed the Editor Icon for DeepFreeze parts category to use Snowflake/Freeze icon instead of EVA Kerbal (stock) icon. +Added Engineer Info report check where there is a DeepFreeze Freezer attached that the vessel has 5 or more units of Glykerol available. + +Fixed Engineer report in editor so that DeepFreeze Freezers are now considered parts that use Glykerol and ElectricCharge. +Fixed bug where ships docking/un-docking with frozen kerbals results in unable to thaw frozen kerbals. +Fixed bug in new Internal Camera system when swapping to other DeepFreeze vessels that are in range the cameras do not move/update to the correct vessel. +Fixed bug if you have multiple vessels in loaded range on initially switching to flight mode on one vessel, if you swap to a DeepFreeze equipped vessel (with DeepFreeze part) and you attempt to thaw a previously frozen +kerbal, the thaw may not work or it will work but the kerbal is not visible on thawing. +Fixed issue where a freeze/thaw is in progress and the player switches vessels. DeepFreeze will now abort any in-progress thaw/freeze in this case. +Fixed NullReference bug in DFIntMemory with the internal cameras function. + +[B]V0.18.2.1 "Bug Fixes & Enhancements"[/B] +Fixed distribution file to include missing DFInterface.dll +[B]V0.18.2.0 "Bug Fixes & Enhancements"[/B] Fix Radial attachment points for CRY-0300 exclusion zones around the external doors. The CRY-0300 now correctly allows you to attach radial parts to the outside of it except for where the external doors are. There is a EVA Access point at the bottom of the external doors. If you block this with radial parts your EVA access will be blocked by KSP and you will get the "Hatch Obstructed" mesage. It is recommended you do not attach parts to the doors or the lower front section of the CRY-0300. diff --git a/Source/DFEditorFilter.cs b/Source/DFEditorFilter.cs index 4af52eb..bd7528f 100644 --- a/Source/DFEditorFilter.cs +++ b/Source/DFEditorFilter.cs @@ -17,6 +17,9 @@ using System.Collections.Generic; using UnityEngine; +using System.IO; +using KSP.IO; + namespace DF { @@ -31,7 +34,11 @@ public class DFEditorFilter : MonoBehaviour internal string category = "Filter by Function"; internal string subCategoryTitle = "DeepFreeze Items"; internal string defaultTitle = "DF"; - internal string iconName = "R&D_node_icon_evatech"; + //internal string iconName = "R&D_node_icon_evatech"; + //create and the icons + Texture2D icon_DeepFreeze_Editor = new Texture2D(32, 32); + + internal string iconName = "DeepFreezeEditor"; internal bool filter = true; private void Awake() @@ -40,6 +47,9 @@ private void Awake() GameEvents.onGUIEditorToolbarReady.Add(SubCategories); //ModuleManager.MMPatchLoader.addPostPatchCallback(DFMMCallBack); DFMMCallBack(); + //load the icons + icon_DeepFreeze_Editor.LoadImage(System.IO.File.ReadAllBytes("GameData/REPOSoftTech/DeepFreeze/Icons/DeepFreezeEditor.png")); + Debug.Log("DFEditorFilter Awake Complete"); } @@ -72,11 +82,10 @@ private bool EditorItemsFilter(AvailablePart avPart) } private void SubCategories() - { - RUI.Icons.Selectable.Icon icon = PartCategorizer.Instance.iconLoader.GetIcon(iconName); + { + RUI.Icons.Selectable.Icon filterDeepFreeze = new RUI.Icons.Selectable.Icon("DeepFreezeEditor", icon_DeepFreeze_Editor, icon_DeepFreeze_Editor, true); PartCategorizer.Category Filter = PartCategorizer.Instance.filters.Find(f => f.button.categoryName == category); - PartCategorizer.AddCustomSubcategoryFilter(Filter, subCategoryTitle, icon, p => EditorItemsFilter(p)); - + PartCategorizer.AddCustomSubcategoryFilter(Filter, subCategoryTitle, filterDeepFreeze, p => EditorItemsFilter(p)); RUIToggleButtonTyped button = Filter.button.activeButton; button.SetFalse(button, RUIToggleButtonTyped.ClickType.FORCED); button.SetTrue(button, RUIToggleButtonTyped.ClickType.FORCED); diff --git a/Source/DFGameSettings.cs b/Source/DFGameSettings.cs index 1629842..aa1362c 100644 --- a/Source/DFGameSettings.cs +++ b/Source/DFGameSettings.cs @@ -50,6 +50,7 @@ internal void Load(ConfigNode node) { KnownFrozenKerbals.Clear(); knownVessels.Clear(); + knownFreezerParts.Clear(); knownKACAlarms.Clear(); if (node.HasNode(configNodeName)) diff --git a/Source/DFInstalledMods.cs b/Source/DFInstalledMods.cs index 2b751e6..e951550 100644 --- a/Source/DFInstalledMods.cs +++ b/Source/DFInstalledMods.cs @@ -111,10 +111,19 @@ where a.FullName.Split(',')[0] == assemblyName internal static bool RTVesselConnected(Guid id) { bool RTVslConnected = false; - if (IsRTInstalled) + try + { + if (IsRTInstalled && RTWrapper.APIReady) + { + //RTVslConnected = (RemoteTech.API.API.HasLocalControl(id) || RemoteTech.API.API.HasAnyConnection(id)); + RTVslConnected = (RTWrapper.RTactualAPI.HasLocalControl(id) || RTWrapper.RTactualAPI.HasAnyConnection(id)); + //Utilities.Log_Debug("vessel " + id + "haslocal " + RemoteTech.API.API.HasLocalControl(id) + " has any " + RemoteTech.API.API.HasAnyConnection(id)); + } + } + catch (Exception ex) { - RTVslConnected = (RemoteTech.API.API.HasLocalControl(id) || RemoteTech.API.API.HasAnyConnection(id)); - //Utilities.Log_Debug("vessel " + id + "haslocal " + RemoteTech.API.API.HasLocalControl(id) + " has any " + RemoteTech.API.API.HasAnyConnection(id)); + Utilities.Log("DeepFreeze", "Exception attempting to check RemoteTech connections. Report this error on the Forum Thread."); + Utilities.Log("DeepFreeze", "Err: " + ex); } return RTVslConnected; } @@ -124,7 +133,16 @@ internal static double RTVesselDelay get { double RTVslDelay = 0f; - RTVslDelay = RemoteTech.API.API.GetShortestSignalDelay(FlightGlobals.ActiveVessel.id); + try + { + //RTVslDelay = RemoteTech.API.API.GetShortestSignalDelay(FlightGlobals.ActiveVessel.id); + RTVslDelay = RTWrapper.RTactualAPI.GetShortestSignalDelay(FlightGlobals.ActiveVessel.id); + } + catch (Exception ex) + { + Utilities.Log("DeepFreeze", "Exception attempting to check RemoteTech VesselDelay. Report this error on the Forum Thread."); + Utilities.Log("DeepFreeze", "Err: " + ex); + } return RTVslDelay; } } diff --git a/Source/DFIntMemory.cs b/Source/DFIntMemory.cs index 1fc9bf6..fa1646c 100644 --- a/Source/DFIntMemory.cs +++ b/Source/DFIntMemory.cs @@ -59,6 +59,8 @@ public VslFrzrCams(Transform frzrcamTransform, InternalModel frzrcamModel, int f private KeyCode keyNxtFrzrCam = (KeyCode)110; //Keycode for next frzrcam. Loaded from settings. Default is n private KeyCode keyPrvFrzrCam = (KeyCode)98; //Keycode for previous frzrcam. Loaded from settings. Default is b internal ScreenMessage IVAKerbalName, IVAkerbalPart, IVAkerbalPod; // used for the bottom right screen messages + private bool refreshPortraits = false; // set to true after a vessel coupling has occurred, a timer waits 3 secnds then refreshes the portraits cams. + private double refreshPortraitsTimer = 0d; // the timer for the previous var protected DFIntMemory() { @@ -75,15 +77,16 @@ private void Awake() BGPinstalled = DFInstalledMods.IsBGPInstalled; //Background Processing Mod GameEvents.onVesselRename.Add(onVesselRename); GameEvents.onVesselChange.Add(onVesselChange); - GameEvents.onVesselLoaded.Add(onVesselChange); + GameEvents.onVesselLoaded.Add(onVesselLoad); + GameEvents.onVesselCreate.Add(onVesselCreate); + GameEvents.onPartCouple.Add(onPartCouple); + GameEvents.onGUIEngineersReportReady.Add(AddTests); + try { keyFrzrCam = (KeyCode)DeepFreeze.Instance.DFsettings.internalFrzrCamCode; - this.Log_Debug("Freeze Cam Code set to " + keyFrzrCam.ToString()); keyNxtFrzrCam = (KeyCode)DeepFreeze.Instance.DFsettings.internalNxtFrzrCamCode; - this.Log_Debug("Next Freeze Cam Code set to " + keyNxtFrzrCam.ToString()); keyPrvFrzrCam = (KeyCode)DeepFreeze.Instance.DFsettings.internalPrvFrzrCamCode; - this.Log_Debug("Previous Freeze Cam Code set to " + keyPrvFrzrCam.ToString()); if (HighLogic.LoadedSceneIsFlight && FlightGlobals.ActiveVessel != null) onVesselChange(FlightGlobals.ActiveVessel); } @@ -101,18 +104,33 @@ private void Start() ChkUnknownFrozenKerbals(); ChkActiveFrozenKerbals(); DeepFreeze.Instance.DFgameSettings.DmpKnownFznKerbals(); - this.Log_Debug("DFIMemory startup dump all kerballs"); - Utilities.dmpAllKerbals(); + resetFreezerCams(); + if (DFInstalledMods.IsTexReplacerInstalled) + { + TRWrapper.InitTRWrapper(); + } + if (DFInstalledMods.IsUSILSInstalled) + { + USIWrapper.InitUSIWrapper(); + } + if (DFInstalledMods.IsRTInstalled) + { + RTWrapper.InitTRWrapper(); + } } private void OnDestroy() { this.Log_Debug("DFIntMemory OnDestroy"); //destroy the event hook for KAC - KACWrapper.KAC.onAlarmStateChanged -= KAC_onAlarmStateChanged; + if (KACWrapper.APIReady) + KACWrapper.KAC.onAlarmStateChanged -= KAC_onAlarmStateChanged; GameEvents.onVesselRename.Remove(onVesselRename); GameEvents.onVesselChange.Remove(onVesselChange); - GameEvents.onVesselLoaded.Remove(onVesselChange); + GameEvents.onVesselLoaded.Remove(onVesselLoad); + GameEvents.onVesselCreate.Remove(onVesselCreate); + GameEvents.onPartCouple.Remove(onPartCouple); + GameEvents.onGUIEngineersReportReady.Remove(AddTests); this.Log_Debug("DFIntMemory end OnDestroy"); } @@ -136,6 +154,16 @@ private void Update() if (HighLogic.LoadedSceneIsFlight && ActVslHasDpFrezr) { + //Check if Refresh Portraits Cam is required after two vessels are docked + if (refreshPortraits) + { + if (Planetarium.GetUniversalTime() - refreshPortraitsTimer > 3) + { + Utilities.CheckPortraitCams(FlightGlobals.ActiveVessel); + refreshPortraits = false; + } + } + //If user hits Modifier Key - D switch to freezer cams. if (GameSettings.MODIFIER_KEY.GetKey() && Input.GetKeyDown(keyFrzrCam) && ActFrzrCams.Count > 0) { @@ -187,6 +215,7 @@ private void Update() this.Log_Debug("lastFrzrCam is null"); } } + //If user hits n while we are in internal camera mode switch to the next freezer camera. if (Input.GetKeyDown(keyNxtFrzrCam) && Utilities.IsInInternal()) { @@ -222,6 +251,7 @@ private void Update() CameraManager.Instance.SetCameraFlight(); } } + //If user hits b while we are in internal camera mode switch to the previous freezer camera. if (Input.GetKeyDown(keyPrvFrzrCam) && Utilities.IsInInternal()) { @@ -285,7 +315,7 @@ private void Update() private void FixedUpdate() { - if (Time.timeSinceLevelLoad < 2f) return; //Wait 2 seconds on level load before executing + if (HighLogic.LoadedSceneIsEditor || Time.timeSinceLevelLoad < 5f) return; //Wait 5 seconds on level load before executing //We check/update Vessel and Part Dictionary in EVERY Game Scene. try @@ -418,11 +448,90 @@ internal void onVesselRename(GameEvents.HostedFromToAction fromT } } - internal void onVesselChange(Vessel vessel) + internal void onVesselLoad(Vessel vessel) + { + if (HighLogic.LoadedSceneIsFlight) + { + this.Log_Debug("OnVesselLoad activevessel " + FlightGlobals.ActiveVessel.id + " parametervesselid " + vessel.id); + resetFreezerCams(); + onVesselChange(vessel); + } + } + + internal void onVesselCreate(Vessel vessel) { - this.Log_Debug("OnVesselChange activevessel " + FlightGlobals.ActiveVessel.id + " parametervesselid " + vessel.id); if (HighLogic.LoadedSceneIsFlight) { + this.Log_Debug("OnVesselCreate activevessel " + FlightGlobals.ActiveVessel.id + " parametervesselid " + vessel.id); + List TmpDpFrzrActVsl = vessel.FindPartModulesImplementing(); + foreach (DeepFreezer frzr in TmpDpFrzrActVsl) + { + //Find the part in KnownFreezerParts and update the GUID + PartInfo partInfo; + if (DeepFreeze.Instance.DFgameSettings.knownFreezerParts.TryGetValue(frzr.part.flightID, out partInfo)) + { + partInfo.vesselID = vessel.id; + } + //Iterate frozen kerbals in KnownFrozenKerbals and update the GUID + foreach (KeyValuePair frznKerbals in DeepFreeze.Instance.DFgameSettings.KnownFrozenKerbals) + { + if (frznKerbals.Value.partID == frzr.part.flightID) + { + frznKerbals.Value.vesselID = vessel.id; + } + } + //Update the Frzr Parts internal frozenkerbals list GUID + foreach (FrznCrewMbr storedCrew in frzr.DFIStoredCrewList) + { + storedCrew.VesselID = vessel.id; + } + } + } + } + + internal void onPartCouple(GameEvents.FromToAction fromToAction) + { + if (HighLogic.LoadedSceneIsFlight) + { + this.Log_Debug("OnPartCouple activevessel " + FlightGlobals.ActiveVessel.id + " fromPart " + fromToAction.from.flightID + "(" + fromToAction.from.vessel.id + ") toPart " + fromToAction.to.flightID + "(" + fromToAction.to.vessel.id + ")"); + List TmpDpFrzrActVsl = fromToAction.from.vessel.FindPartModulesImplementing(); + foreach (DeepFreezer frzr in TmpDpFrzrActVsl) + { + //Find the part in KnownFreezerParts and update the GUID + PartInfo partInfo; + if (DeepFreeze.Instance.DFgameSettings.knownFreezerParts.TryGetValue(frzr.part.flightID, out partInfo)) + { + partInfo.vesselID = fromToAction.to.vessel.id; + } + //Iterate frozen kerbals in KnownFrozenKerbals and update the GUID + foreach (KeyValuePair frznKerbals in DeepFreeze.Instance.DFgameSettings.KnownFrozenKerbals) + { + if (frznKerbals.Value.partID == frzr.part.flightID) + { + frznKerbals.Value.vesselID = fromToAction.to.vessel.id; + } + } + //Update the Frzr Parts internal frozenkerbals list GUID + foreach (FrznCrewMbr storedCrew in frzr.DFIStoredCrewList) + { + storedCrew.VesselID = fromToAction.to.vessel.id; + } + } + //Now resetFrozenKerbals in the parts + foreach (DeepFreezer frzr in TmpDpFrzrActVsl) + { + frzr.resetFrozenKerbals(); + } + refreshPortraits = true; + refreshPortraitsTimer = Planetarium.GetUniversalTime(); + } + } + + internal void onVesselChange(Vessel vessel) + { + if (HighLogic.LoadedSceneIsFlight) + { + this.Log_Debug("OnVesselChange activevessel " + FlightGlobals.ActiveVessel.name + "(" + FlightGlobals.ActiveVessel.id + ") parametervessel " + vessel.name + "(" + vessel.id + ")"); //chk if current active vessel Has one or more DeepFreezer modules attached try { @@ -433,18 +542,16 @@ internal void onVesselChange(Vessel vessel) else { ActVslHasDpFrezr = true; - DpFrzrActVsl = FlightGlobals.ActiveVessel.FindPartModulesImplementing(); + DpFrzrActVsl = vessel.FindPartModulesImplementing(); //Check if vessel id has changed or last freezer cam transforms is now null, reset the freezer cams. - - this.Log_Debug("About to test actfrzrcams.count=" + ActFrzrCams.Count()); if (ActVslID != vessel.id || ActFrzrCams.Count() > 0) { - if (ActFrzrCams.Count() > 0) + foreach (DeepFreezer frzr in DpFrzrActVsl) { - if (ActFrzrCams[lastFrzrCam].FrzrCamTransform == null) + if (frzr.partHasInternals) { - this.Log_Debug("about to reset"); resetFreezerCams(); + break; } } } @@ -456,7 +563,7 @@ internal void onVesselChange(Vessel vessel) { this.Log("Failed to set active vessel and Check Freezers"); this.Log("Err: " + ex); - ActVslHasDpFrezr = false; + //ActVslHasDpFrezr = false; } } else @@ -465,36 +572,51 @@ internal void onVesselChange(Vessel vessel) } } + internal void AddTests() + { + this.Log_Debug("Adding DF Engineer Test"); + PreFlightTests.IDesignConcern DFtest = new DFEngReport(); + EngineersReport.Instance.AddTest(DFtest); + } + private void resetFreezerCams() { - ActFrzrCams.Clear(); - lastFrzrCam = 0; - this.Log_Debug("ActVslHasDpFrezer " + ActVslHasDpFrezr + " #ofFrzrs " + DpFrzrActVsl.Count()); - foreach (DeepFreezer Frzr in DpFrzrActVsl) + try { - if (Frzr.part.internalModel != null) + ActFrzrCams.Clear(); + lastFrzrCam = 0; + this.Log_Debug("ActVslHasDpFrezer " + ActVslHasDpFrezr + " #ofFrzrs " + DpFrzrActVsl.Count()); + foreach (DeepFreezer Frzr in DpFrzrActVsl) { - for (int i = 0; i < Frzr.FreezerSize; i++) + if (Frzr.part.internalModel != null) { - string frzrcamname = "FrzCam" + (i + 1).ToString(); - Transform frzrcam = Frzr.part.internalModel.FindModelComponent(frzrcamname); - if (frzrcam != null) + for (int i = 0; i < Frzr.FreezerSize; i++) { - VslFrzrCams vslfrzrcam = new VslFrzrCams(frzrcam, Frzr.part.internalModel, (i + 1), Frzr.part.name.Substring(0, 8), Frzr); - ActFrzrCams.Add(vslfrzrcam); - this.Log_Debug("Adding ActFrzrCams " + vslfrzrcam.FrzrCamModel.internalName + " " + vslfrzrcam.FrzrCamTransform.name); - } - else - { - this.Log_Debug("Unable to find FrzCam transform " + frzrcamname); + string frzrcamname = "FrzCam" + (i + 1).ToString(); + Transform frzrcam = Frzr.part.internalModel.FindModelComponent(frzrcamname); + if (frzrcam != null) + { + VslFrzrCams vslfrzrcam = new VslFrzrCams(frzrcam, Frzr.part.internalModel, (i + 1), Frzr.part.name.Substring(0, 8), Frzr); + ActFrzrCams.Add(vslfrzrcam); + this.Log_Debug("Adding ActFrzrCams " + vslfrzrcam.FrzrCamModel.internalName + " " + vslfrzrcam.FrzrCamTransform.name); + } + else + { + this.Log_Debug("Unable to find FrzCam transform " + frzrcamname); + } } } - } - else - { - this.Log_Debug("Frzr " + Frzr.name + " internalmodel is null"); + else + { + this.Log_Debug("Frzr " + Frzr.name + " internalmodel is null"); + } } } + catch (Exception ex) + { + this.Log("Failed to resetFreezerCams"); + //this.Log("Err: " + ex); + } } #region UpdateVesselDictionary @@ -528,10 +650,6 @@ private void CheckVslUpdate() { UpdateVesselInfo(vesselInfo, vessel, currentTime); int crewCapacity = UpdateVesselCounts(vesselInfo, vessel, currentTime); - //if (DeepFreeze.Instance.DFsettings.ECreqdForFreezer && vesselInfo.numFrznCrew > 0) - //{ - // UpdatePredictedVesselEC(vesselInfo, vessel, currentTime); - //} if (vessel.FindPartModulesImplementing().Count() == 0) { this.Log_Debug("Deleting vessel " + vesselInfo.vesselName + " - no freezer parts anymore"); @@ -566,10 +684,10 @@ private void CheckVslUpdate() } else //vessel not loaded { - if (!DFInstalledMods.IsBGPInstalled) - { - UpdatePredictedVesselEC(vesselInfo, vessel, currentTime); - } + //if (!DFInstalledMods.IsBGPInstalled || !Utilities.timewarpIsValid(5)) + //{ + UpdatePredictedVesselEC(vesselInfo, vessel, currentTime); + //} vesselInfo.hibernating = true; } } @@ -605,6 +723,7 @@ private void UpdatePredictedVesselEC(VesselInfo vesselInfo, Vessel vessel, doubl double timeperiod = Planetarium.GetUniversalTime() - (double)frzr.Value.timeLastElectricity; 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); } double ECafterlastupdate = vesselInfo.storedEC - ECreqdsincelastupdate; diff --git a/Source/DFSettings.cs b/Source/DFSettings.cs index 35a75e1..f1eb8e1 100644 --- a/Source/DFSettings.cs +++ b/Source/DFSettings.cs @@ -31,6 +31,7 @@ internal class DFSettings internal bool UseAppLauncher { get; set; } internal bool debugging { get; set; } internal bool ECreqdForFreezer { get; set; } + internal bool fatalOption { get; set; } internal bool AutoRecoverFznKerbals { get; set; } internal float KSCcostToThawKerbal { get; set; } internal int ECReqdToFreezeThaw { get; set; } @@ -65,6 +66,7 @@ internal DFSettings() UseAppLauncher = true; debugging = true; ECreqdForFreezer = true; + fatalOption = true; AutoRecoverFznKerbals = true; KSCcostToThawKerbal = 10000f; ECReqdToFreezeThaw = 3000; @@ -103,6 +105,7 @@ internal void Load(ConfigNode node) DFKACwindowPosX = Utilities.GetNodeValue(DFsettingsNode, "DFKACwindowPosX", DFKACwindowPosX); DFKACwindowPosY = Utilities.GetNodeValue(DFsettingsNode, "DFKACwindowPosY", DFKACwindowPosY); ECreqdForFreezer = Utilities.GetNodeValue(DFsettingsNode, "ECreqdForFreezer", ECreqdForFreezer); + fatalOption = Utilities.GetNodeValue(DFsettingsNode, "fatalOption", fatalOption); UseAppLauncher = Utilities.GetNodeValue(DFsettingsNode, "UseAppLauncher", UseAppLauncher); debugging = Utilities.GetNodeValue(DFsettingsNode, "debugging", debugging); AutoRecoverFznKerbals = Utilities.GetNodeValue(DFsettingsNode, "AutoRecoverFznKerbals", AutoRecoverFznKerbals); @@ -150,6 +153,7 @@ internal void Save(ConfigNode node) settingsNode.AddValue("DFKACwindowPosX", DFKACwindowPosX); settingsNode.AddValue("DFKACwindowPosY", DFKACwindowPosY); settingsNode.AddValue("ECreqdForFreezer", ECreqdForFreezer); + settingsNode.AddValue("fatalOption", fatalOption); settingsNode.AddValue("UseAppLauncher", UseAppLauncher); settingsNode.AddValue("debugging", debugging); settingsNode.AddValue("AutoRecoverFznKerbals", AutoRecoverFznKerbals); diff --git a/Source/DeepFreeze.cs b/Source/DeepFreeze.cs index ba9e8e4..40dc747 100644 --- a/Source/DeepFreeze.cs +++ b/Source/DeepFreeze.cs @@ -79,6 +79,7 @@ public override void OnAwake() this.Log("Adding EditorController"); var DFMem = gameObject.AddComponent(); children.Add(DFMem); + //var child = gameObject.AddComponent(); //children.Add(child); } diff --git a/Source/DeepFreeze.csproj b/Source/DeepFreeze.csproj index 3795d41..ab1c27a 100644 --- a/Source/DeepFreeze.csproj +++ b/Source/DeepFreeze.csproj @@ -39,9 +39,6 @@ ..\DFInterface\bin\Debug\DFInterface.dll - - .\RemoteTech.dll - False .\SMInterface.dll @@ -56,9 +53,6 @@ False ..\..\UnityEngine.dll - - .\USILifeSupport.dll - @@ -69,11 +63,15 @@ + + + + @@ -82,7 +80,7 @@ - + @@ -90,6 +88,12 @@ xcopy "$(TargetPath)" "$(SolutionDir)..\GameData\REPOSoftTech\$(ProjectName)\Plugins\" /Y +xcopy "$(TargetDir)$(ProjectName).pdb" "$(SolutionDir)..\GameData\REPOSoftTech\$(ProjectName)\Plugins\" /Y + +cd "$(TargetDir)" +"C:\Program Files (x86)\mono\bin\mono.exe" "C:\Program Files (x86)\mono\lib\mono\4.5\pdb2mdb.exe" "$(TargetFileName)" +xcopy "$(TargetDir)$(ProjectName).dll.mdb" "$(SolutionDir)..\GameData\REPOSoftTech\$(ProjectName)\Plugins\" /Y + where /q "C:\7za\:7za.exe" if %25ERRORLEVEL%25 == 1 ( echo Cannot find 7-zip to package build @@ -100,7 +104,6 @@ if exist "$(SolutionDir)..\$(ProjectName).zip" del "$(SolutionDir)..\$(ProjectNa 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 "$(SolutionDir)..\$(ProjectName).zip" "*\DFInterface*" *\DFInterface.zip" xcopy /E /Y "$(SolutionDir)..\GameData" "%25KSP_DIR%25\GameData"