Skip to content

Commit 78485dc

Browse files
committed
Merge 3.8.4.0 to master
2 parents a4fe856 + 2e28124 commit 78485dc

File tree

5 files changed

+75
-60
lines changed

5 files changed

+75
-60
lines changed

KerbalAlarmClock/KerbalAlarmClock.cs

Lines changed: 43 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,17 @@ internal override void Awake()
180180
GameEvents.onGameSceneLoadRequested.Add(OnGameSceneLoadRequestedForAppLauncher);
181181
GameEvents.Contract.onContractsLoaded.Add(ContractsReady);
182182

183-
// Need this one to handle the hideUI cancelling via pause menu
184-
GameEvents.onGameUnpause.Add(OnUnpause);
183+
GameEvents.onGUIAdministrationFacilitySpawn.Add(EnterKSCFacility);
184+
GameEvents.onGUIAstronautComplexSpawn.Add(EnterKSCFacility);
185+
GameEvents.onGUIMissionControlSpawn.Add(EnterKSCFacility);
186+
GameEvents.onGUIRnDComplexSpawn.Add(EnterKSCFacility);
187+
GameEvents.onGUIAdministrationFacilityDespawn.Add(LeaveKSCFacility);
188+
GameEvents.onGUIAstronautComplexDespawn.Add(LeaveKSCFacility);
189+
GameEvents.onGUIMissionControlDespawn.Add(LeaveKSCFacility);
190+
GameEvents.onGUIRnDComplexDespawn.Add(LeaveKSCFacility);
191+
192+
// Need this one to handle the hideUI cancelling via pause menu
193+
GameEvents.onGameUnpause.Add(OnUnpause);
185194

186195
blnFilterToVessel = false;
187196
if (HighLogic.LoadedScene == GameScenes.TRACKSTATION ||
@@ -212,7 +221,7 @@ internal override void Awake()
212221
APIAwake();
213222
}
214223

215-
private void InitAudio()
224+
private void InitAudio()
216225
{
217226
audioController = AddComponent<AudioController>();
218227
audioController.mbKAC = this;
@@ -275,8 +284,17 @@ internal override void OnDestroy()
275284
GameEvents.onGameSceneLoadRequested.Remove(OnGameSceneLoadRequestedForAppLauncher);
276285
GameEvents.Contract.onContractsLoaded.Remove(ContractsReady);
277286

278-
// Need this one to handle the hideUI cancelling via pause menu
279-
GameEvents.onGameUnpause.Remove(OnUnpause);
287+
GameEvents.onGUIAdministrationFacilitySpawn.Remove(EnterKSCFacility);
288+
GameEvents.onGUIAstronautComplexSpawn.Remove(EnterKSCFacility);
289+
GameEvents.onGUIMissionControlSpawn.Remove(EnterKSCFacility);
290+
GameEvents.onGUIRnDComplexSpawn.Remove(EnterKSCFacility);
291+
GameEvents.onGUIAdministrationFacilityDespawn.Remove(LeaveKSCFacility);
292+
GameEvents.onGUIAstronautComplexDespawn.Remove(LeaveKSCFacility);
293+
GameEvents.onGUIMissionControlDespawn.Remove(LeaveKSCFacility);
294+
GameEvents.onGUIRnDComplexDespawn.Remove(LeaveKSCFacility);
295+
296+
// Need this one to handle the hideUI cancelling via pause menu
297+
GameEvents.onGameUnpause.Remove(OnUnpause);
280298

281299

282300
Destroy(PhaseAngle);
@@ -302,9 +320,13 @@ void ContractsReady()
302320
blnContractsSystemReady = true;
303321
}
304322

305-
#region "Update Code"
306-
//Update Function - Happens on every frame - this is where behavioural stuff is typically done
307-
internal override void Update()
323+
//Hide the KAC when in SC overlay scenes
324+
private void EnterKSCFacility() { inAdminFacility = true; }
325+
private void LeaveKSCFacility() { inAdminFacility = false; }
326+
327+
#region "Update Code"
328+
//Update Function - Happens on every frame - this is where behavioural stuff is typically done
329+
internal override void Update()
308330
{
309331
KACWorkerGameState.SetCurrentGUIStates();
310332
//if scene has changed
@@ -429,7 +451,7 @@ private void OnUnpause()
429451
}
430452

431453
private Boolean GUIVisible = true;
432-
454+
private Boolean inAdminFacility = false;
433455

434456
//public void OnGUI()
435457
internal override void OnGUIEvery()
@@ -464,7 +486,7 @@ internal override void OnGUIEvery()
464486
isPauseMenuOpen = PauseMenu.isOpen;
465487
} catch{}
466488

467-
if (GUIVisible && blnFlightUIVisible && !(HighLogic.LoadedScene == GameScenes.FLIGHT && isPauseMenuOpen))
489+
if (GUIVisible && blnFlightUIVisible && !inAdminFacility && !(HighLogic.LoadedScene == GameScenes.FLIGHT && isPauseMenuOpen && settings.HideOnPause))
468490
{
469491
DrawGUI();
470492
}
@@ -539,40 +561,22 @@ public void DrawGUI()
539561
//Draw the icon that should be there all the time
540562
DrawIcons();
541563

542-
Boolean blnShowInterface = true;
543-
Boolean isPauseMenuOpen = false;
544-
try
545-
{
546-
isPauseMenuOpen = PauseMenu.isOpen;
547-
}
548-
catch { }
564+
// look for passed alarms to display stuff
565+
if (IconShowByActiveScene)
566+
TriggeredAlarms();
549567

550-
if (KACWorkerGameState.CurrentGUIScene == GameScenes.FLIGHT)
568+
//If the mainwindow is visible And no pause menu then draw it
569+
if (WindowVisibleByActiveScene)
551570
{
552-
if (settings.HideOnPause && isPauseMenuOpen)
553-
blnShowInterface = false;
571+
DrawWindowsPre();
572+
DrawWindows();
573+
DrawWindowsPost();
574+
554575
}
555576

556-
//If game has pause menu up see whether to display the interface
557-
if (blnShowInterface)
577+
if (settings.WarpToEnabled)
558578
{
559-
// look for passed alarms to display stuff
560-
if (IconShowByActiveScene)
561-
TriggeredAlarms();
562-
563-
//If the mainwindow is visible And no pause menu then draw it
564-
if (WindowVisibleByActiveScene)
565-
{
566-
DrawWindowsPre();
567-
DrawWindows();
568-
DrawWindowsPost();
569-
570-
}
571-
572-
if (settings.WarpToEnabled)
573-
{
574-
DrawNodeButtons();
575-
}
579+
DrawNodeButtons();
576580
}
577581

578582
//Do the stuff to lock inputs of people have that turned on

KerbalAlarmClock/KerbalAlarmClock.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"VERSION": {
66
"MAJOR": 3,
77
"MINOR": 8,
8-
"PATCH": 3,
8+
"PATCH": 4,
99
"BUILD": 0
1010
},
1111
"KSP_VERSION": {

KerbalAlarmClock/KerbalAlarmClock_WindowAlarm.cs

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,8 @@ private int DrawAlarmActionButtons(KACAlarm tmpAlarm, out int NoOfDoubleLineButt
500500
if ((tmpAlarm.ManNodes != null) && tmpAlarm.ManNodes.Count > 0)
501501
//if ((tmpAlarm.ManNodes != null) && ((tmpAlarm.Remaining.UT + tmpAlarm.AlarmMarginSecs) > 0))
502502
{
503+
bool blnDontShowManNode = false;
504+
503505
//Check if theres a Maneuver node and if so put a label saying that it already exists
504506
//only display this node button if its the active ship
505507
//Add this sae functionality to the alarm triggered window
@@ -509,25 +511,28 @@ private int DrawAlarmActionButtons(KACAlarm tmpAlarm, out int NoOfDoubleLineButt
509511
if (KACWorkerGameState.CurrentVessel.patchedConicSolver.maneuverNodes.Count > 0)
510512
{
511513
strRestoretext = "Replace Maneuver Node(s)";
512-
//if the count and UT's are the same then go from there
513-
if (!KACAlarm.CompareManNodeListSimple(KACWorkerGameState.CurrentVessel.patchedConicSolver.maneuverNodes, tmpAlarm.ManNodes))
514-
strRestoretext += "\r\nNOTE: There is already a Node on the flight path";
515-
else
516-
strRestoretext += "\r\nNOTE: These nodes appear to be already set on the flight path";
517-
NoOfDoubleLineButtons++;
518-
}
519-
if ((tmpAlarm.Remaining.UT + tmpAlarm.AlarmMarginSecs) < 0)
520-
{
521-
strRestoretext += "\r\nWARNING: The stored Nodes are in the past";
522-
NoOfDoubleLineButtons++;
523-
}
524-
intReturnNoOfButtons++;
525-
if (GUILayout.Button(strRestoretext, KACResources.styleButton))
526-
{
527-
LogFormatted("Attempting to add Node");
528-
KACWorkerGameState.CurrentVessel.patchedConicSolver.maneuverNodes.Clear();
529-
RestoreManeuverNodeList(tmpAlarm.ManNodes);
514+
//if the count and UT's are the same then go from there
515+
if(!KACAlarm.CompareManNodeListSimple(KACWorkerGameState.CurrentVessel.patchedConicSolver.maneuverNodes, tmpAlarm.ManNodes)) {
516+
strRestoretext += "\r\nNOTE: There is already a Node on the flight path";
517+
NoOfDoubleLineButtons++;
518+
} else {
519+
//Dont show the button
520+
blnDontShowManNode = true;
521+
}
530522
}
523+
524+
if(!blnDontShowManNode) {
525+
if((tmpAlarm.Remaining.UT + tmpAlarm.AlarmMarginSecs) < 0) {
526+
strRestoretext += "\r\nWARNING: The stored Nodes are in the past";
527+
NoOfDoubleLineButtons++;
528+
}
529+
intReturnNoOfButtons++;
530+
if(GUILayout.Button(strRestoretext, KACResources.styleButton)) {
531+
LogFormatted("Attempting to add Node");
532+
KACWorkerGameState.CurrentVessel.patchedConicSolver.maneuverNodes.Clear();
533+
RestoreManeuverNodeList(tmpAlarm.ManNodes);
534+
}
535+
}
531536
}
532537
//There is a stored Target, that hasnt passed
533538
//if ((tmpAlarm.TargetObject != null) && ((tmpAlarm.Remaining.UT + tmpAlarm.AlarmMarginSecs) > 0))

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.8.3.0")]
36-
[assembly: AssemblyFileVersion("3.8.3.0")]
35+
[assembly: AssemblyVersion("3.8.4.0")]
36+
[assembly: AssemblyFileVersion("3.8.4.0")]

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 (http://www.freesfx.co.uk). EULA can be found here: http://www.freesfx.co.uk/info/eula/
3333

3434
VERSION HISTORY
35+
Version 3.8.4.0 - KSP Version: 1.2.2
36+
- Fixed bug in HideWhenPaused logic - (Issue #184)
37+
- Hide the KAC when in the SpaceCenter overlay scenes Issue #186)
38+
39+
- No longer create duplicate mannodes from alarm windows
40+
3541
Version 3.8.3.0 - KSP Version: 1.2.2
3642
- Fixed stupd typo with scrollview and add transfer (Issue #183)
3743

0 commit comments

Comments
 (0)