From 024b4fd232ea857c1e697c9bf774ec0df9b1c708 Mon Sep 17 00:00:00 2001 From: NathanKell Date: Tue, 7 Oct 2014 23:15:18 -0400 Subject: [PATCH] Update to .25, radial decoupler feed off, v3.1 FINAL --- CrossFeedEnabler/AddToRadialTanks.cfg | 29 +++++---- CrossFeedEnabler/Readme_CFE.txt | 7 +++ Source/Checkers.cs | 88 ++++++++++++++++----------- Source/CrossFeedEnabler.cs | 27 +++++++- Source/CrossFeedEnabler.csproj | 4 +- Source/Properties/AssemblyInfo.cs | 2 +- 6 files changed, 108 insertions(+), 49 deletions(-) diff --git a/CrossFeedEnabler/AddToRadialTanks.cfg b/CrossFeedEnabler/AddToRadialTanks.cfg index b4e857a..afcc31e 100644 --- a/CrossFeedEnabler/AddToRadialTanks.cfg +++ b/CrossFeedEnabler/AddToRadialTanks.cfg @@ -1,6 +1,6 @@ //Powered by ialdabaoth's ModuleManager -@PART[radialRCSTank] +@PART[radialRCSTank]:FOR[CrossFeedEnabler] { %MODULE[ModuleCrossFeed] { @@ -8,7 +8,7 @@ } } -@PART[rcsTankRadialLong] +@PART[rcsTankRadialLong]:FOR[CrossFeedEnabler] { %MODULE[ModuleCrossFeed] { @@ -16,7 +16,7 @@ } } -@PART[MicroRCS] +@PART[MicroRCS]:FOR[CrossFeedEnabler] { %MODULE[ModuleCrossFeed] { @@ -24,7 +24,7 @@ } } -@PART[*]:HAS[@MODULE[StretchyTanks]] +@PART[*]:HAS[@MODULE[StretchyTanks]]:FOR[CrossFeedEnabler] { %MODULE[ModuleCrossFeed] { @@ -32,14 +32,14 @@ } } -@PART[*]:HAS[@MODULE[StretchyConicTank]] +@PART[*]:HAS[@MODULE[StretchyConicTank]]:FOR[CrossFeedEnabler] { %MODULE[ModuleCrossFeed] { %name = ModuleCrossFeed } } -@PART[proceduralTank*] +@PART[proceduralTank*]:FOR[CrossFeedEnabler] { %MODULE[ModuleCrossFeed] { @@ -47,7 +47,7 @@ } } -@PART[*]:HAS[@MODULE[WingManipulator]] +@PART[*]:HAS[@MODULE[WingManipulator]]:FOR[CrossFeedEnabler] { %MODULE[ModuleCrossFeed] { @@ -55,7 +55,7 @@ } } -@PART[cl_radial_cylTankOxy] +@PART[cl_radial_cylTankOxy]:FOR[CrossFeedEnabler] { %MODULE[ModuleCrossFeed] { @@ -63,7 +63,7 @@ } } -@PART[cl_radial_cylTankFuel] +@PART[cl_radial_cylTankFuel]:FOR[CrossFeedEnabler] { %MODULE[ModuleCrossFeed] { @@ -71,7 +71,7 @@ } } -@PART[cl_radial_sphereTankFuel] +@PART[cl_radial_sphereTankFuel]:FOR[CrossFeedEnabler] { %MODULE[ModuleCrossFeed] { @@ -79,10 +79,17 @@ } } -@PART[cl_radial_sphereTankOxy] +@PART[cl_radial_sphereTankOxy]:FOR[CrossFeedEnabler] { %MODULE[ModuleCrossFeed] { %name = ModuleCrossFeed } } + +// NOTE: Normally, radial decouplers have crossfeed (HUH!?) so that could be bad. +// I turn it off here, so you don't get weird effects. +@PART[radialDecoupler1-2|radialDecoupler|radialDecoupler2]:FOR[CrossFeedEnabler] +{ + %fuelCrossFeed = False +} \ No newline at end of file diff --git a/CrossFeedEnabler/Readme_CFE.txt b/CrossFeedEnabler/Readme_CFE.txt index 656b0d8..c273fc4 100644 --- a/CrossFeedEnabler/Readme_CFE.txt +++ b/CrossFeedEnabler/Readme_CFE.txt @@ -5,6 +5,8 @@ A partmodule: adds a fuel crossfeed between the part it's added to, and the part License CC-BY-SA +Includes Module Manager (by sarbian, swamp_ig, and ialdabaoth). See thread for details, license, and source: http://forum.kerbalspaceprogram.com/threads/55219 + Source on GitHub at https://github.com/NathanKell/CrossFeedEnabler/ Installation: Extract folder in zip to GameData. By default includes cfg to apply to radial RCS tanks, the mini radial RCS from Realism Overhaul, and all procedural wings and tanks. (NOTE: Requires ModuleManager, which by now you really should have.) @@ -29,6 +31,11 @@ For example, create a MM node and add it to some cfg. ================= Changelog: ================= +v3.1 +*Recompiled for KSP 0.25 +*Turns off crossfeed on Squad radial decouplers to prevent weird things from happening. The pylon, however, still has it, so you can still make droptanks (or just use a fuel line). +*Bundle Module Manager + v3.0.2 *Bugfix: No more NREs in editor *Removed unneeded update code diff --git a/Source/Checkers.cs b/Source/Checkers.cs index d4852a0..0406e0a 100644 --- a/Source/Checkers.cs +++ b/Source/Checkers.cs @@ -1,25 +1,26 @@ -/** + +/** * Copyright (c) 2014, Majiir * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted + * + * Redistribution and use in source and binary forms, with or without modification, are permitted * provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of + * + * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other materials provided + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other materials provided * with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ @@ -38,7 +39,7 @@ namespace CrossFeedEnabler /** * This utility displays a warning with a list of mods that determine themselves * to be incompatible with the current running version of Kerbal Space Program. - * + * * See this forum thread for details: * http://forum.kerbalspaceprogram.com/threads/65395-Voluntarily-Locking-Plugins-to-a-Particular-KSP-Version */ @@ -57,14 +58,14 @@ public static bool IsCompatible() // If you want to disable some behavior when incompatible, other parts of the plugin // should query this method: // - // if (!CompatibilityChecker.IsCompatible()) { + // if (!CompatibilityChecker.IsAllCompatible()) { // ...disable some features... // } // - // Even if you don't lock down functionality, you should return true if your users + // Even if you don't lock down functionality, you should return true if your users // can expect a future update to be available. // - return Versioning.version_major == 0 && Versioning.version_minor == 24 && Versioning.Revision == 2; + return Versioning.version_major == 0 && Versioning.version_minor == 25 && Versioning.Revision == 0; /*-----------------------------------------------*\ | IMPLEMENTERS SHOULD NOT EDIT BEYOND THIS POINT! | @@ -79,9 +80,8 @@ public static bool IsUnityCompatible() // TODO: Implement your own Unity compatibility check. // - if (Application.unityVersion.Equals("4.5.2f1")) - return true; - return false; + // not going to care about the fact that KSP .25 OSX uses a different Unity... + return true; /*-----------------------------------------------*\ | IMPLEMENTERS SHOULD NOT EDIT BEYOND THIS POINT! | @@ -89,7 +89,7 @@ public static bool IsUnityCompatible() } // Version of the compatibility checker itself. - private static int _version = 3; + private static int _version = 4; public void Start() { @@ -159,28 +159,48 @@ public void Start() Array.Sort(incompatible); Array.Sort(incompatibleUnity); - String message = "Some installed mods may be incompatible with this version of Kerbal Space Program. Features may be broken or disabled. Please check for updates to the listed mods."; + String message = String.Empty; - if (incompatible.Length > 0) + if (IsWin64()) { - Debug.LogWarning("[CompatibilityChecker] Incompatible mods detected: " + String.Join(", ", incompatible)); - message += String.Format("\n\nThese mods are incompatible with KSP {0}.{1}.{2}:\n\n", Versioning.version_major, Versioning.version_minor, Versioning.Revision); - message += String.Join("\n", incompatible); + message += "WARNING: You are using 64-bit KSP on Windows. This version of KSP is known to cause crashes. It's highly recommended that you use either 32-bit KSP on Windows or switch to Linux."; } - if (incompatibleUnity.Length > 0) + if ((incompatible.Length > 0) || (incompatibleUnity.Length > 0)) { - Debug.LogWarning("[CompatibilityChecker] Incompatible mods (Unity) detected: " + String.Join(", ", incompatibleUnity)); - message += String.Format("\n\nThese mods are incompatible with Unity {0}:\n\n", Application.unityVersion); - message += String.Join("\n", incompatibleUnity); + message += ((message == String.Empty) ? "Some" : "\n\nAdditionally, some") + " installed mods may be incompatible with this version of Kerbal Space Program. Features may be broken or disabled. Please check for updates to the listed mods."; + + if (incompatible.Length > 0) + { + Debug.LogWarning("[CompatibilityChecker] Incompatible mods detected: " + String.Join(", ", incompatible)); + message += String.Format("\n\nThese mods are incompatible with KSP {0}.{1}.{2}:\n\n", Versioning.version_major, Versioning.version_minor, Versioning.Revision); + message += String.Join("\n", incompatible); + } + + if (incompatibleUnity.Length > 0) + { + Debug.LogWarning("[CompatibilityChecker] Incompatible mods (Unity) detected: " + String.Join(", ", incompatibleUnity)); + message += String.Format("\n\nThese mods are incompatible with Unity {0}:\n\n", Application.unityVersion); + message += String.Join("\n", incompatibleUnity); + } } - if ((incompatible.Length > 0) || (incompatibleUnity.Length > 0)) + if ((incompatible.Length > 0) || (incompatibleUnity.Length > 0) || IsWin64()) { PopupDialog.SpawnPopupDialog("Incompatible Mods Detected", message, "OK", true, HighLogic.Skin); } } + public static bool IsWin64() + { + return (IntPtr.Size == 8) && (Environment.OSVersion.Platform == PlatformID.Win32NT); + } + + public static bool IsAllCompatible() + { + return IsCompatible() && IsUnityCompatible() && !IsWin64(); + } + private static IEnumerable getAllTypes() { foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) diff --git a/Source/CrossFeedEnabler.cs b/Source/CrossFeedEnabler.cs index b917b45..cae2a93 100644 --- a/Source/CrossFeedEnabler.cs +++ b/Source/CrossFeedEnabler.cs @@ -24,6 +24,8 @@ UIPartActionWindow myWindow } } + protected bool compatible = true; + public Part parentPart = null; [KSPField(isPersistant = true)] public bool crossFeedOverride = true; @@ -63,6 +65,13 @@ public void UpdateCrossFeed() // belt-and-suspenders: do this everywhere and everywhen. public override void OnLoad(ConfigNode node) { + if (!CompatibilityChecker.IsAllCompatible()) + { + Events["ToggleCrossFeed"].guiActive = false; + Events["ToggleCrossFeed"].guiActiveEditor = false; + compatible = false; + return; + } base.OnLoad(node); UpdateCrossFeed(); Events["ToggleCrossFeed"].guiActive = actionVisible; @@ -71,6 +80,13 @@ public override void OnLoad(ConfigNode node) public override void OnStart(PartModule.StartState state) { + if (!CompatibilityChecker.IsAllCompatible()) + { + Events["ToggleCrossFeed"].guiActive = false; + Events["ToggleCrossFeed"].guiActiveEditor = false; + compatible = false; + return; + } base.OnStart(state); UpdateCrossFeed(); Events["ToggleCrossFeed"].guiActive = actionVisible; @@ -79,6 +95,13 @@ public override void OnStart(PartModule.StartState state) public override void OnInitialize() { + if (!CompatibilityChecker.IsAllCompatible()) + { + Events["ToggleCrossFeed"].guiActive = false; + Events["ToggleCrossFeed"].guiActiveEditor = false; + compatible = false; + return; + } base.OnInitialize(); UpdateCrossFeed(); Events["ToggleCrossFeed"].guiActive = actionVisible; @@ -86,7 +109,7 @@ public override void OnInitialize() } public virtual void Update() { - if (HighLogic.LoadedSceneIsEditor) + if (compatible && HighLogic.LoadedSceneIsEditor) { if (parentPart != part.parent) { @@ -105,6 +128,8 @@ public virtual void Update() public void OnDestroy() { + if (!compatible) + return; if ((object)(part.parent) != null && part.parent.fuelLookupTargets != null) { part.parent.fuelLookupTargets.Remove(part); diff --git a/Source/CrossFeedEnabler.csproj b/Source/CrossFeedEnabler.csproj index 3c76448..7cdc6bc 100644 --- a/Source/CrossFeedEnabler.csproj +++ b/Source/CrossFeedEnabler.csproj @@ -41,11 +41,11 @@ - ..\..\..\..\..\..\Games\KSP_win64\KSP_x64_Data\Managed\Assembly-CSharp.dll + ..\..\..\..\..\..\Games\KSP_025clean\KSP_Data\Managed\Assembly-CSharp.dll False - ..\..\..\..\..\..\Games\KSP_win64\KSP_x64_Data\Managed\UnityEngine.dll + ..\..\..\..\..\..\Games\KSP_025clean\KSP_Data\Managed\UnityEngine.dll False diff --git a/Source/Properties/AssemblyInfo.cs b/Source/Properties/AssemblyInfo.cs index 117b5ad..05d1dee 100644 --- a/Source/Properties/AssemblyInfo.cs +++ b/Source/Properties/AssemblyInfo.cs @@ -33,4 +33,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.3.*")] -[assembly: AssemblyFileVersion("0.3.0.2")] +[assembly: AssemblyFileVersion("0.3.1.0")]