Skip to content

Commit

Permalink
complete update for release 1.7.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
GER-Space committed Aug 22, 2019
1 parent cc89196 commit 91c2a6a
Show file tree
Hide file tree
Showing 26 changed files with 1,456 additions and 162 deletions.
Binary file not shown.
24 changes: 24 additions & 0 deletions GameData/CustomPreLaunchChecks/CustomPreLaunchChecks.version
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"NAME":"AdvancedTextures",
"URL":"https://raw.githubusercontent.com/GER-Space/AdvancedTextures/master/GameData/CustomPreLaunchChecks/CustomPreLaunchChecks.version",
"DOWNLOAD":"https://github.com/GER-Space/CustomPreLaunchChecks/releases",
"VERSION":
{
"MAJOR":1,
"MINOR":7,
"PATCH":3,
"BUILD":0
},
"KSP_VERSION":
{
"MAJOR":1,
"MINOR":7,
"PATCH":3
},
"KSP_VERSION_MIN":
{
"MAJOR":1,
"MINOR":7,
"PATCH":3
}
}
Binary file modified GameData/KerbalKonstructs/KerbalKonstructs.dll
Binary file not shown.
93 changes: 0 additions & 93 deletions GameData/KerbalKonstructs/KerbalKonstructs.dll.CodeAnalysisLog.xml

This file was deleted.

Empty file.
14 changes: 7 additions & 7 deletions GameData/KerbalKonstructs/KerbalKonstructs.version
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
"VERSION":
{
"MAJOR":1,
"MINOR":4,
"PATCH":5,
"BUILD":64
"MINOR":7,
"PATCH":3,
"BUILD":0
},
"KSP_VERSION":
{
"MAJOR":1,
"MINOR":4,
"PATCH":5
"MINOR":7,
"PATCH":3
},
"KSP_VERSION_MIN":
{
"MAJOR":1,
"MINOR":4,
"PATCH":5
"MINOR":7,
"PATCH":3
}
}
1 change: 1 addition & 0 deletions create_zip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ sed -i "s/MINOR\":./MINOR\":$MINOR/" GameData/KerbalKonstructs/KerbalKonstructs.
sed -i "s/PATCH\":./PATCH\":$PATCH/" GameData/KerbalKonstructs/KerbalKonstructs.version
sed -i "s/BUILD\":.*/BUILD\":$BUILD/" GameData/KerbalKonstructs/KerbalKonstructs.version

cp -r /c/Git/CustomPreLaunchChecks/GameData/CustomPreLaunchChecks/ GameData

/c/Program\ Files/7-Zip/7z.exe a -r $FILENAME GameData

Expand Down
63 changes: 17 additions & 46 deletions src/Core/LaunchSites/LaunchSiteChecks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,19 @@
using System.Linq;
using System.Reflection;
using UnityEngine;
using CustomPreLaunchChecks;


namespace KerbalKonstructs.Core
{
class LaunchSiteChecks
{
internal static AsmUtils.Detour preFlightCheckDetour;
internal static AsmUtils.Detour findVesselDetour;
internal static AsmUtils.Detour findVesselDetour2;

internal static void PrepareSystem()
{

MethodBase oldCheckFunction = typeof(EditorLogic).GetMethod("GetStockPreFlightCheck", BindingFlags.Instance | BindingFlags.NonPublic);
MethodBase newCheckFunction = typeof(LaunchSiteChecks).GetMethod("NewPreflightCheck", BindingFlags.Instance | BindingFlags.Public);

preFlightCheckDetour = new AsmUtils.Detour(oldCheckFunction, newCheckFunction);
preFlightCheckDetour.Install();

MethodBase oldFindVesselFunction = typeof(ShipConstruction).GetMethods(BindingFlags.Static | BindingFlags.Public)
.Where(mi => mi.Name == "FindVesselsLandedAt" && mi.GetParameters().Length == 6).FirstOrDefault();
MethodBase newFindVesselFunction = typeof(LaunchSiteChecks).GetMethod("FindVesselsLandedAtKK", BindingFlags.Static | BindingFlags.Public);
Expand All @@ -38,33 +32,24 @@ internal static void PrepareSystem()
findVesselDetour2.Install();


}
CPLC.RegisterCheck(GetSizeCheck);
CPLC.RegisterCheck(GetMassCheck);
CPLC.RegisterCheck(GetPartCheck);

/// <summary>
/// Appends our custom checks to the prefilled checks
/// </summary>
/// <param name="launchSiteName"></param>
/// <returns></returns>
public PreFlightCheck NewPreflightCheck(string launchSiteName)
{
//Log.Normal("using injected call");
}

PreFlightCheck check = (PreFlightCheck)preFlightCheckDetour.CallOriginal(EditorLogic.fetch, new object[] { launchSiteName });
// Spawn the launchSite before we use it

KKLaunchSite launchSite = LaunchSiteManager.GetLaunchSiteByName(launchSiteName);
if (launchSite != null)
{
if (!launchSite.isSquad)
{
launchSite.staticInstance.TrySpawn();
Log.Normal("Spawned LaunchSite for launch: " + launchSite.LaunchSiteName);
}
check.AddTest(new KKPrelaunchSizeCheck(launchSiteName));
check.AddTest(new KKPrelaunchMassCheck(launchSiteName));
check.AddTest(new KKPrelaunchPartCheck(launchSiteName));
}
return check;
public static PreFlightTests.IPreFlightTest GetSizeCheck(string launchSiteName)
{
return new KKPrelaunchSizeCheck(launchSiteName);
}
public static PreFlightTests.IPreFlightTest GetMassCheck(string launchSiteName)
{
return new KKPrelaunchMassCheck(launchSiteName);
}
public static PreFlightTests.IPreFlightTest GetPartCheck(string launchSiteName)
{
return new KKPrelaunchPartCheck(launchSiteName);
}


Expand Down Expand Up @@ -140,8 +125,6 @@ public bool Test()
return retval;
}



public string GetWarningTitle()
{
return ("KK Launch Size Check");
Expand Down Expand Up @@ -277,20 +260,11 @@ public KKPrelaunchPartCheck(string launchSiteName)

public bool Test()
{
if (allowLaunch)
{
return true;
}

if (launchSite == null)
if (allowLaunch || launchSite == null || launchSite.isSquad)
{
return true;
}

if (launchSite.isSquad)
{
return true;
}
if (shipParts == 0)
{
return false;
Expand All @@ -307,14 +281,11 @@ public bool Test()

}



public string GetWarningTitle()
{
return ("KK Vessel Part Check");
}


public string GetWarningDescription()
{
return ("Max allowed parts are " + launchSite.MaxCraftParts + "\n"
Expand Down
1 change: 1 addition & 0 deletions src/Core/SpaceCenters/ScExtention.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using UnityEngine;
using KerbalKonstructs;
using System.Reflection;
using CustomPreLaunchChecks;

namespace KerbalKonstructs.Core
{
Expand Down
6 changes: 3 additions & 3 deletions src/Core/StaticGroup/GroupCenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ internal void Spawn()
gameObject = new GameObject();
GameObject.DontDestroyOnLoad(gameObject);

gameObject.name = Group + "_PQS";
gameObject.name = Group;

pqsCity = gameObject.AddComponent<PQSCity>();

Expand Down Expand Up @@ -439,13 +439,13 @@ internal float heading
Vector3 myForward = Vector3.ProjectOnPlane(gameObject.transform.forward, upVector);
float myHeading;

if (Vector3.Dot(myForward, eastVector) > 0)
if (Vector3.Dot(myForward, eastVector) >= 0)
{
myHeading = Vector3.Angle(myForward, northVector);
}
else
{
myHeading = 360 - Vector3.Angle(myForward, northVector);
myHeading = (360 - Vector3.Angle(myForward, northVector) %360);
}
return myHeading;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void Start()
}
}

foreach (Animation anim in staticInstance.gameObject.GetComponentsInChildren<Animation>(true))
foreach (Animation anim in staticInstance.mesh.GetComponentsInChildren<Animation>(true))
{
if (anim[animationName] != null)
{
Expand Down Expand Up @@ -218,7 +218,7 @@ private void SetGroup()
{
continue;
}
foreach (var module in sInstance.gameObject.GetComponentsInChildren<AnimateOnSunRise>())
foreach (var module in sInstance.mesh.GetComponents<AnimateOnSunRise>())
{
if (module.isMaster)
{
Expand Down
Loading

0 comments on commit 91c2a6a

Please sign in to comment.