diff --git a/Source/RP0/SpaceCenter/Projects/LCConstructionProject.cs b/Source/RP0/SpaceCenter/Projects/LCConstructionProject.cs index 7ee97a49304..0f7445ce130 100644 --- a/Source/RP0/SpaceCenter/Projects/LCConstructionProject.cs +++ b/Source/RP0/SpaceCenter/Projects/LCConstructionProject.cs @@ -125,7 +125,6 @@ private void ReassignEngineers(LaunchComplex lc) if (engToAssign > 0) { KCTUtilities.ChangeEngineers(lc, engToAssign); - lc.RecalculateBuildRates(); } } } diff --git a/Source/RP0/UI/KCT/GUI_Personnel.cs b/Source/RP0/UI/KCT/GUI_Personnel.cs index a0222ce606b..33ad28fe63c 100644 --- a/Source/RP0/UI/KCT/GUI_Personnel.cs +++ b/Source/RP0/UI/KCT/GUI_Personnel.cs @@ -123,9 +123,10 @@ private static void RenderEngineersSection(bool isCostCacheInvalid) string assignStr = GetAssignText(true, currentLC, out int assignAmt); string unassignStr = GetAssignText(false, currentLC, out int unassignAmt); - bool recalc = false; ProjectType type = currentLC.LCType == LaunchComplexType.Pad ? ProjectType.VAB : ProjectType.SPH; - if (GUILayout.Button(unassignStr, GUILayout.ExpandWidth(false)) && unassignAmt > 0) { KCTUtilities.ChangeEngineers(currentLC, -unassignAmt); recalc = true; } + if (GUILayout.Button(unassignStr, GUILayout.ExpandWidth(false)) && unassignAmt > 0) + KCTUtilities.ChangeEngineers(currentLC, -unassignAmt); + if (Event.current.type == EventType.Repaint) { if (GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition)) @@ -136,7 +137,9 @@ private static void RenderEngineersSection(bool isCostCacheInvalid) GUILayout.Label($" {currentLC.Engineers:N0} ", GetLabelCenterAlignStyle(), GUILayout.ExpandWidth(false)); - if (GUILayout.Button(assignStr, GUILayout.ExpandWidth(false)) && assignAmt > 0) { KCTUtilities.ChangeEngineers(currentLC, assignAmt); recalc = true; } + if (GUILayout.Button(assignStr, GUILayout.ExpandWidth(false)) && assignAmt > 0) + KCTUtilities.ChangeEngineers(currentLC, assignAmt); + if (Event.current.type == EventType.Repaint) { if (GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition)) @@ -148,12 +151,6 @@ private static void RenderEngineersSection(bool isCostCacheInvalid) GUILayout.Label($"Max: {currentLC.MaxEngineers:N0}", GetLabelRightAlignStyle()); GUILayout.EndHorizontal(); - if (recalc) - { - currentLC.RecalculateBuildRates(); - currentLC.KSC.RecalculateBuildRates(false); - } - int assignDelta = 0; if (_currentPersonnelHover == PersonnelButtonHover.Assign) assignDelta = assignAmt; diff --git a/Source/RP0/Utilities/KCTUtilities.cs b/Source/RP0/Utilities/KCTUtilities.cs index e88d2d64f3c..1d60c6a7888 100644 --- a/Source/RP0/Utilities/KCTUtilities.cs +++ b/Source/RP0/Utilities/KCTUtilities.cs @@ -1345,7 +1345,6 @@ public static void HireStaff(bool isResearch, int workerAmount, LaunchComplex lc ChangeEngineers(ksc, workerAmount); if (lc != null) ChangeEngineers(lc, workerAmount); - ksc.RecalculateBuildRates(false); } SpaceCenterManagement.Instance.Applicants = Math.Max(0, SpaceCenterManagement.Instance.Applicants - workerAmount); if (SpaceCenterManagement.Instance.Applicants == 0) @@ -1357,6 +1356,7 @@ public static void ChangeEngineers(LaunchComplex currentLC, int delta) currentLC.Engineers += delta; SCMEvents.OnPersonnelChange.Fire(); MaintenanceHandler.Instance.ScheduleMaintenanceUpdate(); + currentLC.RecalculateBuildRates(); KCT_GUI.BuildRateForDisplay = null; }