Skip to content

Commit

Permalink
Merge 1.1.3.0 to master
Browse files Browse the repository at this point in the history
  • Loading branch information
TriggerAu committed Dec 20, 2014
2 parents 731f382 + 7b65978 commit 978a868
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 33 deletions.
29 changes: 26 additions & 3 deletions PluginBuilder/PublishKSPTWP.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
$GitHubName="TransferWindowPlanner"
$PluginName="TransferWindowPlanner"
$CurseID="224116"
$CurseName="224116-transfer-window-planner"
$KerbalStuffModID = 268

$UploadDir = "$($PSScriptRoot)\..\..\_Uploads\$($PluginName)"
$KerbalStuffWrapper = "D:\Programming\KSP\_Scripts\KerbalStuffWrapper\KerbalStuffWrapper.exe"

Expand Down Expand Up @@ -112,7 +112,7 @@ function UpdateVersionCheckGHPagesAndPublish() {
git --git-dir="$($GHPagesPath)\.git" --work-tree="$($GHPagesPath)" checkout gh-pages_develop
#update the version file

"|LATESTVERSION|$($Version)|LATESTVERSION|" | Out-File "$($GHPagesPath)\versioncheck.txt"
"|LATESTVERSION|$($Version)|LATESTVERSION|" | Out-File "$($GHPagesPath)\versioncheck.txt" -Encoding ascii

#Commit these changes
git --git-dir="$($GHPagesPath)\.git" --work-tree="$($GHPagesPath)" add "$($GHPagesPath)\versioncheck.txt"
Expand Down Expand Up @@ -225,6 +225,8 @@ if($ChoiceRtn -eq 0)
$reldescr = $reldescr.Replace("`r`n","\r\n")
$reldescr = $reldescr.Replace("`"","\`"")

$ForumHeader = "[B][SIZE=4][COLOR=`"#FF0000`"]v$($Version) Now Available [/COLOR][/SIZE][/B]- [SIZE=3][B][URL=`"https://github.com/TriggerAu/$($GitHubName)/releases/tag/v$($Version)`"]Download from GitHub[/URL][/B] [/SIZE] or [SIZE=3][B][URL=`"http://kerbal.curseforge.com/ksp-mods/$($CurseName)/files`"]Download from Curse*[/URL][/B][/SIZE] or [SIZE=3][B][URL=`"https://kerbalstuff.com/mod/$($KerbalStuffModID)`"]Download from Kerbal Stuff[/URL][/B] [/SIZE] [COLOR=`"#A9A9A9`"]* Once it's approved[/COLOR]"

$ForumList = "[LIST]`r`n" + $reldescr + "`r`n[/LIST]"
$ForumList = $ForumList.Replace("\r\n","`r`n").Replace("`r`n* ","`r`n[*]")

Expand All @@ -233,6 +235,24 @@ if($ChoiceRtn -eq 0)
$relKStuff = $reldescr.Replace("\r\n","`r`n")


"GitHub Description:"
"-------------------"
"$($reldescr)`r`n"

"KStuff Description:"
"-------------------"
"$($relKStuff)`r`n"

"Forum Info:"
"-------------------"
"$($ForumHeader)`r`n"
"$($ForumList)`r`n"

$Choices= [System.Management.Automation.Host.ChoiceDescription[]] @("&Yes","&No")
$ChoiceRtn = $host.ui.PromptForChoice("Do you wish to Continue?","Confirm Readme Notes",$Choices,0)

if($ChoiceRtn -eq 0) {

MergeDevToMaster

CreateGitHubRelease
Expand All @@ -257,10 +277,13 @@ if($ChoiceRtn -eq 0)
"-------------------"
"$($relKStuff)`r`n"

"Forum List text:"
"Forum Info:"
"-------------------"
"$($ForumHeader)`r`n"
"$($ForumList)`r`n"

}

}
else
{
Expand Down
5 changes: 5 additions & 0 deletions PluginFiles/ReadMe-TransferWindowPlanner.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ LICENSE
This work is licensed under an MIT license as outlined at the OSI site. Visit the documentation site for more details and Attribution

VERSION HISTORY
Version 1.1.3.0 - KSP Version: 0.90
- Recompiled for 0.90 and checked code stuff
- Fixed some issues with KAC Integration (Issue #23)
- Fixed Flyby Transfer adding Insertion Burn value (Issue #22)

Version 1.1.2.0 - KSP Version: 0.25.0
- Added extra logging and null checks re AppLauncher
- Updated KACWrapper to handle Alarmtime properly and add repeat properties
Expand Down
4 changes: 2 additions & 2 deletions TransferWindowPlanner/Properties/AssemblyInfo.cs
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("1.1.2.0")]
[assembly: AssemblyFileVersion("1.1.2.0")]
[assembly: AssemblyVersion("1.1.3.0")]
[assembly: AssemblyFileVersion("1.1.3.0")]
11 changes: 6 additions & 5 deletions TransferWindowPlanner/SharedStuff/KACWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,12 @@ internal KACAPI(Object KAC)
//DrawTimeEntryMethod = KACType.GetMethod("DrawTimeEntryAPI", BindingFlags.Public | BindingFlags.Instance);
//LogFormatted_DebugOnly("Success: " + (DrawTimeEntryMethod != null).ToString());

// MethodInfo[] mis = KACType.GetMethods(BindingFlags.Public | BindingFlags.Instance);
// foreach (MethodInfo mi in mis)
// {
// LogFormatted("M:{0}-{1}", mi.Name, mi.DeclaringType);
// }
//Commenting out rubbish lines
//MethodInfo[] mis = KACType.GetMethods(BindingFlags.Public | BindingFlags.Instance);
//foreach (MethodInfo mi in mis)
//{
// LogFormatted("M:{0}-{1}", mi.Name, mi.DeclaringType);
//}
}

private Object actualKAC;
Expand Down
23 changes: 17 additions & 6 deletions TransferWindowPlanner/SharedStuff/LambertSolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,25 @@ public static double TransferDeltaV(CelestialBody origin, CelestialBody destinat
double finalOrbitVelocity = Math.Sqrt(destination.gravParameter / (finalOrbitAltitude.Value + destination.Radius));
vesselDestinationOrbitalSpeed = finalOrbitVelocity; //Store this for later
insertionDeltaV = Math.Sqrt(insertionDeltaV * insertionDeltaV + 2 * finalOrbitVelocity * finalOrbitVelocity - 2 * destination.gravParameter / destination.sphereOfInfluence) - finalOrbitVelocity;

//Store away the extra details about the Destination/Injection
oTransfer.DestinationVesselOrbitalSpeed = vesselDestinationOrbitalSpeed;
oTransfer.DestinationVelocity = destinationVelocity;
//oTransfer.InjectionDeltaVector = (velocityBeforeInsertion - destinationVelocity);
oTransfer.InjectionDeltaVector = oTransfer.EjectionDeltaVector.normalized * insertionDeltaV;
oTransfer.InsertionInclination = insertionInclination;
}
else
{
//This is a flyby so there is no injection burn
//Store away the extra details about the Destination/Injection
oTransfer.DestinationVesselOrbitalSpeed = velocityBeforeInsertion.magnitude;
oTransfer.DestinationVelocity = destinationVelocity;
oTransfer.InjectionDeltaVector = new Vector3d();
oTransfer.InsertionInclination = 0;
}

//Store away the extra details about the Destination/Injection
oTransfer.DestinationVesselOrbitalSpeed = vesselDestinationOrbitalSpeed;
oTransfer.DestinationVelocity = destinationVelocity;
oTransfer.InjectionDeltaVector = (velocityBeforeInsertion - destinationVelocity);
oTransfer.InjectionDeltaVector = oTransfer.EjectionDeltaVector.normalized * insertionDeltaV;
oTransfer.InsertionInclination = insertionInclination;

}

return ejectionDeltaV + insertionDeltaV;
Expand Down
16 changes: 5 additions & 11 deletions TransferWindowPlanner/TWP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,9 @@ void DrawGUI()
if (MouseOverAnyWindow && !InputLockExists) {
Boolean AddLock = false;
switch (HighLogic.LoadedScene) {
case GameScenes.SPACECENTER: AddLock = settings.ClickThroughProtect_KSC && !(InputLockManager.GetControlLock("TWPControlLock") == ControlTypes.KSC_FACILITIES); break;
case GameScenes.EDITOR:
case GameScenes.SPH: AddLock = settings.ClickThroughProtect_Editor && !(InputLockManager.GetControlLock("TWPControlLock") == ControlTypes.EDITOR_LOCK); break;
case GameScenes.FLIGHT: AddLock = settings.ClickThroughProtect_Flight && !(InputLockManager.GetControlLock("TWPControlLock") == ControlTypes.All); break;
case GameScenes.SPACECENTER: AddLock = settings.ClickThroughProtect_KSC && !(InputLockManager.GetControlLock("TWPControlLock") != ControlTypes.None); break;
case GameScenes.EDITOR:AddLock = settings.ClickThroughProtect_Editor && !(InputLockManager.GetControlLock("TWPControlLock") != ControlTypes.None); break;
case GameScenes.FLIGHT: AddLock = settings.ClickThroughProtect_Flight && !(InputLockManager.GetControlLock("TWPControlLock") != ControlTypes.None); break;
case GameScenes.TRACKSTATION:
break;
default:
Expand All @@ -274,13 +273,8 @@ void DrawGUI()

switch (HighLogic.LoadedScene) {
case GameScenes.SPACECENTER: InputLockManager.SetControlLock(ControlTypes.KSC_FACILITIES, "TWPControlLock"); break;
case GameScenes.EDITOR:
case GameScenes.SPH:
InputLockManager.SetControlLock(ControlTypes.EDITOR_LOCK, "TWPControlLock");
break;
case GameScenes.FLIGHT:
InputLockManager.SetControlLock(ControlTypes.All, "TWPControlLock");
break;
case GameScenes.EDITOR: InputLockManager.SetControlLock(ControlTypes.EDITOR_LOCK, "TWPControlLock"); break;
case GameScenes.FLIGHT: InputLockManager.SetControlLock(ControlTypes.ALL_SHIP_CONTROLS, "TWPControlLock"); break;
case GameScenes.TRACKSTATION:
break;
default:
Expand Down
21 changes: 17 additions & 4 deletions TransferWindowPlanner/TWPWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,11 @@ private void DrawTransferDetails()
if (ShowEjectionDetails) {
GUILayout.Label("Ejection Normal Δv:", Styles.styleTextDetailsLabel);
}
GUILayout.Label("Insertion Inclination:", Styles.styleTextDetailsLabel);
if (TransferSpecs.FinalOrbitAltitude > 0) {
GUILayout.Label("Insertion Inclination:", Styles.styleTextDetailsLabel);
}else {
GUILayout.Label("", Styles.styleTextDetailsLabel); //empty label to maintain window height
}
GUILayout.EndVertical();
GUILayout.BeginVertical();
GUILayout.Label(String.Format("{0:0}", KSPTime.PrintDate(new KSPTime(TransferSelected.DepartureTime + TransferSelected.TravelTime), KSPTime.PrintTimeFormat.DateTimeString)), Styles.styleTextYellow);
Expand All @@ -415,7 +419,9 @@ private void DrawTransferDetails()
if (ShowEjectionDetails) {
GUILayout.Label(String.Format("{0:0.0} m/s", TransferSelected.EjectionDVNormal), Styles.styleTextYellow);
}
GUILayout.Label(String.Format("{0:0.00}°", TransferSelected.InsertionInclination * LambertSolver.Rad2Deg), Styles.styleTextYellow);
if (TransferSpecs.FinalOrbitAltitude > 0) {
GUILayout.Label(String.Format("{0:0.00}°", TransferSelected.InsertionInclination * LambertSolver.Rad2Deg), Styles.styleTextYellow);
}
GUILayout.EndVertical();

GUILayout.BeginVertical();
Expand All @@ -425,8 +431,13 @@ private void DrawTransferDetails()
if (ShowEjectionDetails) {
GUILayout.Label("Ejection Prograde Δv:", Styles.styleTextDetailsLabel);
}
GUILayout.Label("Insertion Δv:", Styles.styleTextDetailsLabel);

if (TransferSpecs.FinalOrbitAltitude > 0) {
GUILayout.Label("Insertion Δv:", Styles.styleTextDetailsLabel);
}
GUILayout.EndVertical();


GUILayout.BeginVertical();
GUILayout.Label(String.Format("{0:0}", new KSPTime(TransferSelected.TravelTime).IntervalStringLongTrimYears()), Styles.styleTextYellow);
GUILayout.Label(String.Format("{0:0} m/s", TransferSelected.DVTotal), Styles.styleTextYellow);
Expand All @@ -447,7 +458,9 @@ private void DrawTransferDetails()
if (ShowEjectionDetails) {
GUILayout.Label(String.Format("{0:0.0} m/s", TransferSelected.EjectionDVPrograde), Styles.styleTextYellow);
}
GUILayout.Label(String.Format("{0:0} m/s", TransferSelected.DVInjection), Styles.styleTextYellow);
if (TransferSpecs.FinalOrbitAltitude > 0) {
GUILayout.Label(String.Format("{0:0} m/s", TransferSelected.DVInjection), Styles.styleTextYellow);
}
GUILayout.EndVertical();
GUILayout.EndHorizontal();
}
Expand Down
14 changes: 12 additions & 2 deletions TransferWindowPlanner/TWPWindowSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ private void DrawWindow_General()
settings.Save();
}
if (DrawToggle(ref settings.ClickThroughProtect_Editor, "Prevent in Editors", Styles.styleToggle)) {
if (!settings.ClickThroughProtect_KSC && (HighLogic.LoadedScene == GameScenes.EDITOR ||HighLogic.LoadedScene == GameScenes.SPH))
if (!settings.ClickThroughProtect_KSC && (HighLogic.LoadedScene == GameScenes.EDITOR))
mbTWP.RemoveInputLock();
settings.Save();
}
Expand All @@ -225,7 +225,17 @@ private void DrawWindow_Alarm()
{
if (GUILayout.Button(new GUIContent("You need a newer version of KAC", "Click to open your browser and download a newer Kerbal Alarm Clock"), Styles.styleTextCenterGreen))
Application.OpenURL("http://forum.kerbalspaceprogram.com/threads/24786");


}
else if (!TWP_KACWrapper.KACWrapper.InstanceExists)
{
GUILayout.Label("KAC is not loaded in this scene, so we can't configure", Styles.styleTextGreen);
GUILayout.Label("the integration options", Styles.styleTextGreen);
GUILayout.Space(10);
GUILayout.Label("You can access these in scenes where KAC is visible", Styles.styleTextGreen);
GUILayout.Space(10);
GUILayout.Label("Go on... Move along... Nothing to see...", Styles.styleTextGreen);

}
else
{
Expand Down

0 comments on commit 978a868

Please sign in to comment.