diff --git a/CHANGES.md b/CHANGES.md index 4354edd08..297ed3446 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,29 @@ +Version 1.6.3 +======================================== +Released February 06, 2015 + +Bug Fixes: +-------------------- +- We've fixed an old issue where unloading a vessel can cause a log spamming with KeyNotFoundException +- We'll now log the current RemoteTech FileVersion to the ksp.log +- Stations will now properly re-registered as a station after unloading +- Stations will now properly registered as a station even if the first part is not the Remote Guidance Unit +- Fix for loading a saved RemoteTech EventCommand like 'activate antenna' + + +Version 1.6.2 +======================================== +Released January 24, 2015 + +Bug Fixes: +-------------------- +- Fixed an issue that can cause the KSP UI to be not clickable anymore after docking (thx DaveTSG for reporting) +- Fixed an issue that can cause the flight computer to crash into a small gray dot while loading a saved EventCommand (thx Synighte for reporting) +- Fix for saving/loading a ManeuverCommand +- Reverted a change of the AssemblyVersion from 1.6.1 to 1.6.0 to prevent issues with other mods that use our API (thx jrossignol) +- We fixed an old issue where KSP can freeze by zero cost links between two satellites + + Version 1.6.1 ======================================== Released January 19, 2015 diff --git a/GameData/RemoteTech/RemoteTech.version b/GameData/RemoteTech/RemoteTech.version index 16ef7a918..685cd2605 100644 --- a/GameData/RemoteTech/RemoteTech.version +++ b/GameData/RemoteTech/RemoteTech.version @@ -1,7 +1,8 @@ { "NAME": "RemoteTech", "URL": "https://raw.githubusercontent.com/RemoteTechnologiesGroup/RemoteTech/master/GameData/RemoteTech/RemoteTech.version", - "CHANGE_LOG_URL": "https://raw.githubusercontent.com/RemoteTechnologiesGroup/RemoteTech/master/CHANGES.md", + "CHANGE_LOG_URL": "https://raw.githubusercontent.com/RemoteTechnologiesGroup/RemoteTech/master/CHANGES.md", + "DOWNLOAD": "https://kerbalstuff.com/mod/134/RemoteTech", "GITHUB": { "USERNAME": "RemoteTechnologiesGroup", @@ -11,7 +12,7 @@ "VERSION":{ "MAJOR":1, "MINOR":6, - "PATCH":1, + "PATCH":3, "BUILD":0 }, "KSP_VERSION":{ diff --git a/src/RemoteTech/FlightComputer/EventCommand.cs b/src/RemoteTech/FlightComputer/EventCommand.cs index 3c3986dab..108951b6f 100644 --- a/src/RemoteTech/FlightComputer/EventCommand.cs +++ b/src/RemoteTech/FlightComputer/EventCommand.cs @@ -9,6 +9,8 @@ public class EventCommand : AbstractCommand { // Guiname of the BaseEvent [Persistent] public string GUIName; + // Name of the BaseEvent + [Persistent] public string Name; // flight id of the part by this BaseEvent [Persistent] public uint flightID; // PartModule of the part by this BaseEvent @@ -20,7 +22,7 @@ public override String Description { get { - return ((this.BaseEvent != null) ? this.BaseEvent.listParent.part.partInfo.title + ": " + this.BaseEvent.GUIName : "none") + + return ((this.BaseEvent != null) ? this.BaseEvent.listParent.part.partInfo.title + ": " + this.GUIName : "none") + Environment.NewLine + base.Description; } } @@ -45,6 +47,7 @@ public static EventCommand Event(BaseEvent ev) return new EventCommand() { BaseEvent = ev, + GUIName = ev.GUIName, TimeStamp = RTUtil.GameTime, }; } @@ -65,11 +68,13 @@ public override void Load(ConfigNode n, FlightComputer fc) if (n.HasValue("flightID")) this.flightID = uint.Parse(n.GetValue("flightID")); + + this.Module = n.GetValue("Module"); + this.GUIName = n.GetValue("GUIName"); + this.Name = n.GetValue("Name"); - Module = n.GetValue("Module"); - GUIName = n.GetValue("GUIName"); - - RTLog.Notify("Try to load an EventCommand from persistent with {0},{1},{2},{3}", PartId, flightID, Module, GUIName); + RTLog.Notify("Try to load an EventCommand from persistent with {0},{1},{2},{3},{4}", + PartId, this.flightID, this.Module, this.GUIName, this.Name); Part part = null; var partlist = FlightGlobals.ActiveVessel.parts; @@ -93,7 +98,7 @@ public override void Load(ConfigNode n, FlightComputer fc) BaseEventList eventlist = new BaseEventList(part, partmodule); if (eventlist.Count > 0) { - this.BaseEvent = eventlist.Where(ba => ba.GUIName == this.GUIName).FirstOrDefault(); + this.BaseEvent = eventlist.Where(ba => (ba.GUIName == this.GUIName || ba.name == this.Name)).FirstOrDefault(); } } } @@ -104,9 +109,10 @@ public override void Load(ConfigNode n, FlightComputer fc) /// public override void Save(ConfigNode n, FlightComputer fc) { - GUIName = this.BaseEvent.GUIName; - flightID = this.BaseEvent.listParent.module.part.flightID; - Module = this.BaseEvent.listParent.module.ClassName.ToString(); + this.GUIName = this.BaseEvent.GUIName; + this.flightID = this.BaseEvent.listParent.module.part.flightID; + this.Module = this.BaseEvent.listParent.module.ClassName.ToString(); + this.Name = this.BaseEvent.name; base.Save(n, fc); } diff --git a/src/RemoteTech/Modules/ProtoSignalProcessor.cs b/src/RemoteTech/Modules/ProtoSignalProcessor.cs index 369ceb731..ce3924488 100644 --- a/src/RemoteTech/Modules/ProtoSignalProcessor.cs +++ b/src/RemoteTech/Modules/ProtoSignalProcessor.cs @@ -25,15 +25,24 @@ public ProtoSignalProcessor(ProtoPartModuleSnapshot ppms, Vessel v) mVessel = v; Powered = ppms.GetBool("IsRTPowered"); + // get the crew count from the vessel + int crewcount = v.GetVesselCrew().Count; + // when the crewcount is eq 0 than look into the protoVessel + if (crewcount == 0 && v.protoVessel.GetVesselCrew() != null) + crewcount = v.protoVessel.GetVesselCrew().Count; + + RTLog.Notify("ProtoSignalProcessor crew count of {0} is {1}", v.vesselName, crewcount); + try { - IsCommandStation = Powered && v.HasCommandStation() && v.GetVesselCrew().Count >= ppms.GetInt("RTCommandMinCrew"); - RTLog.Notify("ProtoSignalProcessor(Powered: {0}, HasCommandStation: {1}, Crew: {2}/{3})", - Powered, v.HasCommandStation(), v.GetVesselCrew().Count, ppms.GetInt("RTCommandMinCrew")); - } catch (ArgumentException) { + IsCommandStation = Powered && v.HasCommandStation() && crewcount >= ppms.GetInt("RTCommandMinCrew"); + RTLog.Notify("ProtoSignalProcessor(Powered: {0}, HasCommandStation: {1}, Crew: {2}/{3})", + Powered, v.HasCommandStation(), crewcount, ppms.GetInt("RTCommandMinCrew")); + } catch (ArgumentException argexeception) { // I'm assuming this would get thrown by ppms.GetInt()... do the other functions have an exception spec? IsCommandStation = false; - RTLog.Notify("ProtoSignalProcessor(Powered: {0}, HasCommandStation: {1}, Crew: {2})", - Powered, v.HasCommandStation(), v.GetVesselCrew().Count); + RTLog.Notify("ProtoSignalProcessor(Powered: {0}, HasCommandStation: {1}, Crew: {2})", + Powered, v.HasCommandStation(), crewcount); + RTLog.Notify("ProtoSignalProcessor ", argexeception); } } diff --git a/src/RemoteTech/Properties/AssemblyInfo.cs b/src/RemoteTech/Properties/AssemblyInfo.cs index 86c96393f..6f017c082 100644 --- a/src/RemoteTech/Properties/AssemblyInfo.cs +++ b/src/RemoteTech/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("RemoteTech")] -[assembly: AssemblyCopyright("Copyright © 2013-2014")] +[assembly: AssemblyCopyright("Copyright © 2013-2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -37,7 +37,7 @@ // DLLs any time it changes. Breaking on a minor revision is probably acceptable - it's // unlikely that there wouldn't be other breaking changes on a minor version change. [assembly: AssemblyVersion("1.6")] -[assembly: AssemblyFileVersion("1.6.1")] +[assembly: AssemblyFileVersion("1.6.3")] // Use KSPAssembly to allow other DLLs to make this DLL a dependency in a // non-hacky way in KSP. Format is (AssemblyProduct, major, minor), and it diff --git a/src/RemoteTech/RTUtil.cs b/src/RemoteTech/RTUtil.cs index 12e69eb21..64dca6940 100644 --- a/src/RemoteTech/RTUtil.cs +++ b/src/RemoteTech/RTUtil.cs @@ -20,9 +20,16 @@ public static partial class RTUtil { public static double GameTime { get { return Planetarium.GetUniversalTime(); } } /// - /// Returns the current AssemplyVersion from AssemblyInfos.cs + /// Returns the current AssemplyFileVersion from AssemblyInfos.cs /// - public static string Version { get{ return "v"+Assembly.GetExecutingAssembly().GetName().Version.ToString(); } } + public static string Version + { + get + { + Assembly executableAssembly = Assembly.GetExecutingAssembly(); + return "v" + FileVersionInfo.GetVersionInfo(executableAssembly.Location).ProductVersion.ToString(); + } + } public static readonly String[] DistanceUnits = { "", "k", "M", "G", "T" }, diff --git a/src/RemoteTech/SatelliteManager.cs b/src/RemoteTech/SatelliteManager.cs index 10423b275..6d0e39b90 100644 --- a/src/RemoteTech/SatelliteManager.cs +++ b/src/RemoteTech/SatelliteManager.cs @@ -209,24 +209,41 @@ public static bool IsSignalProcessor(this PartModule pm) public static ISignalProcessor GetSignalProcessor(this Vessel v) { RTLog.Notify("GetSignalProcessor({0}): Check", v.vesselName); - if (v.loaded) + + ISignalProcessor result = null; + + if (v.loaded && v.parts.Count > 0) { - foreach (PartModule pm in v.Parts.SelectMany(p => p.Modules.Cast()).Where(pm => pm.IsSignalProcessor())) + var partModuleList = v.Parts.SelectMany(p => p.Modules.Cast()).Where(pm => pm.IsSignalProcessor()); + // try to look for a moduleSPU + result = partModuleList.Where(pm => pm.moduleName == "ModuleSPU").FirstOrDefault() as ISignalProcessor; + + if (result == null) { - RTLog.Notify("GetSignalProcessor({0}): Found", v.vesselName); - return pm as ISignalProcessor; + // otherwise get the first moduleSpuPassive + result = partModuleList.FirstOrDefault() as ISignalProcessor; } - } else { - foreach (ProtoPartModuleSnapshot ppms in v.protoVessel.protoPartSnapshots.SelectMany(x => x.modules).Where(ppms => ppms.IsSignalProcessor())) + var protoPartList = v.protoVessel.protoPartSnapshots.SelectMany(x => x.modules).Where(ppms => ppms.IsSignalProcessor()); + // try to look for a moduleSPU on a unloaded vessel + var protoPartProcessor = protoPartList.Where(ppms => ppms.moduleName == "ModuleSPU").FirstOrDefault(); + + if (protoPartProcessor == null) { - RTLog.Notify("GetSignalProcessor({0}): Found", v.vesselName); - return new ProtoSignalProcessor(ppms, v); + // otherwise get the first moduleSpuPassive + protoPartProcessor = protoPartList.FirstOrDefault(); + } + + // convert the found protoPartSnapshots to a ProtoSignalProcessor + if (protoPartProcessor != null) + { + result = new ProtoSignalProcessor(protoPartProcessor, v); } } - return null; + + return result; } public static bool IsCommandStation(this ProtoPartModuleSnapshot ppms) @@ -242,7 +259,7 @@ public static bool IsCommandStation(this PartModule pm) public static bool HasCommandStation(this Vessel v) { RTLog.Notify("HasCommandStation({0})", v.vesselName); - if (v.loaded) + if (v.loaded && v.parts.Count > 0) { return v.Parts.SelectMany(p => p.Modules.Cast()).Any(pm => pm.IsCommandStation()); }