Skip to content

Commit

Permalink
Prep for v2.4.4 release
Browse files Browse the repository at this point in the history
  • Loading branch information
ferram4 committed Oct 7, 2014
1 parent 19e0c14 commit ffc8feb
Show file tree
Hide file tree
Showing 14 changed files with 124 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"VERSION": {
"MAJOR": 2,
"MINOR": 4,
"PATCH": 3
"PATCH": 4
},
"KSP_VERSION": {
"MAJOR": 0,
"MINOR": 24,
"PATCH": 2
"MINOR": 25,
"PATCH": 0
}
}

Binary file not shown.
Binary file modified KerbalJointReinforcement/KerbalJointReinforcement.v12.suo
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
/**
* 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.
*/

Expand All @@ -38,12 +38,12 @@ namespace KerbalJointReinforcement
/**
* 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
*/

[KSPAddon(KSPAddon.Startup.MainMenu, true)]
[KSPAddon(KSPAddon.Startup.Instantly, true)]
internal class CompatibilityChecker : MonoBehaviour
{
public static bool IsCompatible()
Expand All @@ -61,24 +61,33 @@ public static bool IsCompatible()
// ...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_minor == 24 || Versioning.version_minor == 25);

bool compatible = false;
if (Versioning.version_minor == 24
|| (Versioning.version_minor == 23 && Versioning.Revision == 5))
compatible = true;
/*-----------------------------------------------*\
| IMPLEMENTERS SHOULD NOT EDIT BEYOND THIS POINT! |
\*-----------------------------------------------*/
}

public static bool IsUnityCompatible()
{
/*-----------------------------------------------*\
| BEGIN IMPLEMENTATION-SPECIFIC EDITS HERE. |
\*-----------------------------------------------*/

return compatible;
// TODO: Implement your own Unity compatibility check.
//
return true;

/*-----------------------------------------------*\
| IMPLEMENTERS SHOULD NOT EDIT BEYOND THIS POINT! |
\*-----------------------------------------------*/
}

// Version of the compatibility checker itself.
private static int _version = 2;
private static int _version = 4;

public void Start()
{
Expand Down Expand Up @@ -122,13 +131,72 @@ public void Start()
.Select(m => m.DeclaringType.Assembly.GetName().Name)
.ToArray();

// A mod is incompatible with Unity if its compatibility checker has an IsUnityCompatible method which returns false.
String[] incompatibleUnity =
fields
.Select(f => f.DeclaringType.GetMethod("IsUnityCompatible", Type.EmptyTypes))
.Where(m => m != null) // Mods without IsUnityCompatible() are assumed to be compatible.
.Where(m => m.IsStatic)
.Where(m => m.ReturnType == typeof(bool))
.Where(m =>
{
try
{
return !(bool)m.Invoke(null, new object[0]);
}
catch (Exception e)
{
// If a mod throws an exception from IsUnityCompatible, it's not compatible.
Debug.LogWarning(String.Format("[CompatibilityChecker] Exception while invoking IsUnityCompatible() from '{0}':\n\n{1}", m.DeclaringType.Assembly.GetName().Name, e));
return true;
}
})
.Select(m => m.DeclaringType.Assembly.GetName().Name)
.ToArray();

Array.Sort(incompatible);
Array.Sort(incompatibleUnity);

String message = String.Empty;

if (incompatible.Length > 0)
if (IsWin64())
{
Debug.LogWarning("[CompatibilityChecker] Incompatible mods detected: " + String.Join(", ", incompatible));
PopupDialog.SpawnPopupDialog("Incompatible Mods Detected", "Some installed mods are incompatible with this version of Kerbal Space Program. Some features may be broken or disabled. Please check for updates to the following mods:\n\n" + String.Join("\n", incompatible), "OK", false, HighLogic.Skin);
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 ((incompatible.Length > 0) || (incompatibleUnity.Length > 0))
{
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) || 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<Type> getAllTypes()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Kerbal Joint Reinforcement, v2.4.3
Kerbal Joint Reinforcement, v2.4.4
Copyright 2014, Michael Ferrara, aka Ferram4
This file is part of Kerbal Joint Reinforcement.
Expand Down Expand Up @@ -43,6 +43,9 @@ public void Awake()

public void Start()
{
if (!CompatibilityChecker.IsAllCompatible())
return;

GameEvents.onVesselWasModified.Add(OnVesselWasModified);
GameEvents.onVesselGoOffRails.Add(OnVesselOffRails);
GameEvents.onVesselGoOnRails.Add(OnVesselOnRails);
Expand All @@ -54,6 +57,9 @@ public void Start()

public void OnDestroy()
{
if (!CompatibilityChecker.IsAllCompatible())
return;

GameEvents.onVesselWasModified.Remove(OnVesselWasModified);
GameEvents.onVesselGoOffRails.Remove(OnVesselOffRails);
GameEvents.onVesselGoOnRails.Remove(OnVesselOnRails);
Expand Down Expand Up @@ -483,6 +489,8 @@ private void UpdatePartJoint(Part p)
if (Mathf.Abs(Vector3.Dot(up, ndir)) > 0.9f)
{
radius = Mathf.Min(JointUtils.CalculateRadius(main, ndir), JointUtils.CalculateRadius(connectedPart, ndir));
if (radius <= 0.001)
radius = node.size * 1.25f;
area = Mathf.PI * radius * radius; //Area of cylinder
momentOfInertia = area * radius * radius / 4; //Moment of Inertia of cylinder
}
Expand All @@ -508,6 +516,8 @@ private void UpdatePartJoint(Part p)
else
{
radius = Mathf.Min(JointUtils.CalculateRadius(p, dir), JointUtils.CalculateRadius(connectedPart, dir));
if (radius <= 0.001)
radius = node.size * 1.25f;
area = Mathf.PI * radius * radius; //Area of cylinder
momentOfInertia = area * radius * radius / 4; //Moment of Inertia of cylinder
}
Expand All @@ -517,6 +527,8 @@ private void UpdatePartJoint(Part p)
{

radius = Mathf.Min(JointUtils.CalculateRadius(p, Vector3.up), JointUtils.CalculateRadius(connectedPart, Vector3.up));
if (radius <= 0.001)
radius = node.size * 1.25f;
area = Mathf.PI * radius * radius; //Area of cylinder
momentOfInertia = area * radius * radius / 4; //Moment of Inertia of cylinder
}
Expand Down Expand Up @@ -564,7 +576,6 @@ private void UpdatePartJoint(Part p)

p.attachMethod = AttachNodeMethod.LOCKED_JOINT;


p.attachJoint.SetBreakingForces(breakForce, breakTorque);

if (JointUtils.debug)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@
<Compile Include="KerbalJointReinforcement.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Service References\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// 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("2.4.3.0")]
[assembly: AssemblyFileVersion("2.4.3.0")]
[assembly: AssemblyVersion("2.4.4.0")]
[assembly: AssemblyFileVersion("2.4.4.0")]
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Kerbal Joint Reinforcement, v2.4.3
Kerbal Joint Reinforcement, v2.4.4
==========================

Physics stabilizer plugin for Kerbal Space Program
Expand Down Expand Up @@ -115,6 +115,12 @@ These types are currently not used, but removing the a in front of them will cau
***********************
****** CHANGELOG ******
***********************
v2.4.4
Features
--KSP 0.25 compatibility
--Update CompatibilityChecker
--Shutdown functionality if CompatibilityChecker returns warnings

v2.4.3
Features
--KSP 0.24.2 compatibility
Expand Down

0 comments on commit ffc8feb

Please sign in to comment.