Skip to content

Commit 59afc83

Browse files
committed
Merge 3.13.0.0 to master
2 parents c5f813c + 3683968 commit 59afc83

File tree

8 files changed

+53
-34
lines changed

8 files changed

+53
-34
lines changed

KerbalAlarmClock/API/KACWrapper.cs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -386,9 +386,11 @@ internal KACAlarm(Object a)
386386
AlarmTypeField = KACAlarmType.GetField("TypeOfAlarm");
387387
AlarmTimeProperty = KACAlarmType.GetProperty("AlarmTimeUT");
388388
AlarmMarginField = KACAlarmType.GetField("AlarmMarginSecs");
389-
AlarmActionField = KACAlarmType.GetField("AlarmAction");
390389
RemainingField = KACAlarmType.GetField("Remaining");
391390

391+
AlarmActionField = KACAlarmType.GetField("AlarmAction");
392+
ActionActionProperty = KACAlarmType.GetProperty("AlarmActionConvert");
393+
392394
XferOriginBodyNameField = KACAlarmType.GetField("XferOriginBodyName");
393395
//LogFormatted("XFEROrigin:{0}", XferOriginBodyNameField == null);
394396
XferTargetBodyNameField = KACAlarmType.GetField("XferTargetBodyName");
@@ -498,11 +500,22 @@ public Double AlarmMargin
498500
/// <summary>
499501
/// What should the Alarm Clock do when the alarm fires
500502
/// </summary>
503+
//public AlarmActionEnum AlarmAction
504+
//{
505+
// get { return (AlarmActionEnum)AlarmActionField.GetValue(actualAlarm); }
506+
// set { AlarmActionField.SetValue(actualAlarm, (Int32)value); }
507+
//}
508+
/// <summary>
509+
/// What should the Alarm Clock do when the alarm fires
510+
/// </summary>
501511
public AlarmActionEnum AlarmAction
502512
{
503-
get { return (AlarmActionEnum)AlarmActionField.GetValue(actualAlarm); }
504-
set { AlarmActionField.SetValue(actualAlarm, (Int32)value); }
513+
get { return (AlarmActionEnum)ActionActionProperty.GetValue(actualAlarm); }
514+
set { ActionActionProperty.SetValue(actualAlarm, (Int32)value); }
505515
}
516+
private PropertyInfo ActionActionProperty;
517+
518+
506519

507520
private FieldInfo RemainingField;
508521
/// <summary>
@@ -573,7 +586,7 @@ public enum AlarmActionEnum
573586
[Description("Message Only-No Affect on warp")] MessageOnly,
574587
[Description("Kill Warp Only-No Message")] KillWarpOnly,
575588
[Description("Kill Warp and Message")] KillWarp,
576-
[Description("Pause Game and Message")] PauseGame,
589+
[Description("Pause Game and Message")] PauseGame
577590
}
578591

579592
public enum TimeEntryPrecisionEnum

KerbalAlarmClock/KerbalAlarmClock.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,12 @@ internal void RemoveInputLock()
10081008

10091009
private Boolean MouseOverWindow(Rect WindowRect, Boolean WindowVisible)
10101010
{
1011-
return WindowVisible && WindowRect.Contains(Event.current.mousePosition);
1011+
// Use Input instead of Event.current because Event.current.mousePosition
1012+
// gets inverted for key presses, but Input is stable (though always
1013+
// inverted).
1014+
Vector2 mousePos = Input.mousePosition;
1015+
mousePos.y = Screen.height - mousePos.y;
1016+
return WindowVisible && WindowRect.Contains(mousePos);
10121017
}
10131018

10141019
#if DEBUG

KerbalAlarmClock/KerbalAlarmClock.version

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@
44
"DOWNLOAD" : "https://github.com/TriggerAu/KerbalAlarmClock/releases",
55
"VERSION": {
66
"MAJOR": 3,
7-
"MINOR": 12,
7+
"MINOR": 13,
88
"PATCH": 0,
99
"BUILD": 0
1010
},
1111
"KSP_VERSION": {
1212
"MAJOR": 1,
13-
"MINOR": 8,
13+
"MINOR": 9,
1414
"PATCH": 1
1515
},
1616
"KSP_VERSION_MIN": {
1717
"MAJOR": 1,
18-
"MINOR": 8,
18+
"MINOR": 9,
1919
"PATCH": 0
2020
},
2121
"KSP_VERSION_MAX": {
2222
"MAJOR": 1,
23-
"MINOR": 8,
23+
"MINOR": 9,
2424
"PATCH": 99
2525
}
2626
}

KerbalAlarmClock/MuMech_OrbitExtensions.cs

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using System.Linq;
99
using System.Text;
1010

11+
using UnityEngine;
1112
using KSP;
1213

1314
namespace KerbalAlarmClock
@@ -121,7 +122,7 @@ internal static double UTAtMeanAnomaly(this Orbit o, double meanAnomaly, double
121122
//The returned value is always between 0 and 360.
122123
internal static double AscendingNodeTrueAnomaly(this Orbit a, Orbit b)
123124
{
124-
Vector3d vectorToAN = Vector3d.Cross(a.SwappedOrbitNormal(), b.SwappedOrbitNormal());
125+
Vector3d vectorToAN = Vector3d.Cross(b.GetOrbitNormal(), a.GetOrbitNormal());
125126
return a.TrueAnomalyFromVector(vectorToAN);
126127
}
127128

@@ -130,7 +131,8 @@ internal static double AscendingNodeTrueAnomaly(this Orbit a, Orbit b)
130131
//The returned value is always between 0 and 360.
131132
internal static double DescendingNodeTrueAnomaly(this Orbit a, Orbit b)
132133
{
133-
return MuUtils.ClampDegrees360(a.AscendingNodeTrueAnomaly(b) + 180);
134+
Vector3d vectorToDN = Vector3d.Cross(a.GetOrbitNormal(), b.GetOrbitNormal());
135+
return a.TrueAnomalyFromVector(vectorToDN);
134136
}
135137

136138
//Gives the true anomaly at which o crosses the equator going northwards, if o is east-moving,
@@ -196,23 +198,7 @@ internal static bool DescendingNodeEquatorialExists(this Orbit o)
196198
//The returned value is always between 0 and 360.
197199
internal static double TrueAnomalyFromVector(this Orbit o, Vector3d vec)
198200
{
199-
Vector3d projected = Vector3d.Exclude(o.SwappedOrbitNormal(), vec);
200-
Vector3d vectorToPe = SwapYZ(o.eccVec);
201-
double angleFromPe = Math.Abs(Vector3d.Angle(vectorToPe, projected));
202-
203-
//If the vector points to the infalling part of the orbit then we need to do 360 minus the
204-
//angle from Pe to get the true anomaly. Test this by taking the the cross product of the
205-
//orbit normal and vector to the periapsis. This gives a vector that points to center of the
206-
//outgoing side of the orbit. If vectorToAN is more than 90 degrees from this vector, it occurs
207-
//during the infalling part of the orbit.
208-
if (Math.Abs(Vector3d.Angle(projected, Vector3d.Cross(o.SwappedOrbitNormal(), vectorToPe))) < 90)
209-
{
210-
return angleFromPe;
211-
}
212-
else
213-
{
214-
return 360 - angleFromPe;
215-
}
201+
return o.GetTrueAnomalyOfZupVector(vec) * Mathf.Rad2Deg;
216202
}
217203

218204
//Originally by Zool, revised by The_Duck

KerbalAlarmClock/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("3.12.0.0")]
36-
[assembly: AssemblyFileVersion("3.12.0.0")]
35+
[assembly: AssemblyVersion("3.13.0.0")]
36+
[assembly: AssemblyFileVersion("3.13.0.0")]

KerbalAlarmClock_APITester/KACAPITester.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,20 @@ internal override void DrawWindow(int id)
8383

8484
GUILayout.BeginHorizontal();
8585
UT = GUILayout.TextField(UT);
86-
if (GUILayout.Button("Create One"))
86+
if (GUILayout.Button("ChangeTime"))
8787
{
8888
KACWrapper.KAC.Alarms.First().AlarmTime = Convert.ToDouble(UT);
8989
}
9090
GUILayout.EndHorizontal();
91+
92+
if (GUILayout.Button("Create DoNothing"))
93+
{
94+
String aID = KACWrapper.KAC.CreateAlarm(KACWrapper.KACAPI.AlarmTypeEnum.TransferModelled, "Test", Planetarium.GetUniversalTime() + 900);
95+
96+
KACWrapper.KAC.Alarms.First(z => z.ID == aID).Notes = "FRED FLINTSTONE";
97+
KACWrapper.KAC.Alarms.First(z => z.ID == aID).AlarmMargin = 600;
98+
KACWrapper.KAC.Alarms.First(z => z.ID == aID).AlarmAction = KACWrapper.KACAPI.AlarmActionEnum.DoNothing;
99+
}
91100
}
92101
}
93102
String UT="";

KerbalAlarmClock_APITester/KerbalAlarmClock_APITester.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@
5959
<PropertyGroup>
6060
<PostBuildEvent>rem Set the Variables we need
6161
echo Finding KSP
62-
if exist "D:\~Games\KSP_Win_PlugInTest_Minimal\KSP.exe" (
63-
set GAMEPATH="D:\~Games\KSP_Win_PlugInTest_Minimal"
62+
if exist "C:\Data\Programming\KSP\_Versions\KSP_win_PluginTest\KSP_x64.exe" (
63+
set GAMEPATH="C:\Data\Programming\KSP\_Versions\KSP_win_PluginTest"
6464
) else if exist "C:\~Games\KSP_Win_PlugInTest_Minimal\KSP.exe" (
6565
set GAMEPATH="C:\~Games\KSP_Win_PlugInTest_Minimal
6666
) else if exist "D:\~Games\KSP_Win_PlugInTest\KSP.exe" (
@@ -75,7 +75,7 @@ if exist "D:\~Games\KSP_Win_PlugInTest_Minimal\KSP.exe" (
7575
echo Gamepath: %25GAMEPATH%25
7676
echo ConfigName: $(ConfigurationName)
7777
set DestPath="%25GAMEPATH%25\GameData\TriggerTech"
78-
set Binary="%25GAMEPATH%25\KSP.exe"
78+
set Binary="%25GAMEPATH%25\KSP_x64.exe"
7979

8080
if not $(ConfigurationName)==Debug goto DEBUGREBUILDCONFIG
8181
:DEBUGCONFIG

PlugInFiles/ReadMe-KerbalAlarmClock.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ ATTRIBUTION-SOUNDS
3232
Included Sounds are from freesfx.co.uk (https://www.freesfx.co.uk). EULA can be found here: https://www.freesfx.co.uk/info/eula/
3333

3434
VERSION HISTORY
35+
Version 3.13.0.0 - KSP Version: 1.9.1
36+
- Recompiled for 1.9.1
37+
- Fix for input locking chekcing issue on Linux - thanks Taniwha
38+
- Fix for AN/DN timing (Issue #239) - Thanks Doxen
39+
- Update API Wrapper for actions (Issue #233)
40+
3541
Version 3.12.0.0 - KSP Version: 1.8.1
3642
- Recompiled for 1.8.1 (Issue #234)
3743

0 commit comments

Comments
 (0)