From ed51e59c263737087cc22ed49c6d254a8b794a2e Mon Sep 17 00:00:00 2001 From: siimav <1120038+siimav@users.noreply.github.com> Date: Sun, 20 Oct 2024 01:38:14 +0300 Subject: [PATCH] Give idle researchers lower salary (#2440) --- GameData/RP-1/SpaceCenterSettings.cfg | 3 ++- Source/RP0/Maintenance/MaintenanceHandler.cs | 10 ++++++---- Source/RP0/Settings/SpaceCenterSettings.cs | 4 +++- Source/RP0/SpaceCenter/SpaceCenterManagement.cs | 6 +++--- Source/RP0/UI/KCT/GUI_Editor.cs | 2 +- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/GameData/RP-1/SpaceCenterSettings.cfg b/GameData/RP-1/SpaceCenterSettings.cfg index 4b40c695872..4e6fcfaae2f 100644 --- a/GameData/RP-1/SpaceCenterSettings.cfg +++ b/GameData/RP-1/SpaceCenterSettings.cfg @@ -68,7 +68,8 @@ SPACECENTERSETTINGS key = 16 600000 // 1967 and beyond } RushSalaryMult = 2 - IdleSalaryMult = 0.25 + EngineerIdleSalaryMult = 0.25 + ResearcherIdleSalaryMult = 0.5 HireCost = 300 AdditionalPadCostMult = 0.5 ConstructionRushCost diff --git a/Source/RP0/Maintenance/MaintenanceHandler.cs b/Source/RP0/Maintenance/MaintenanceHandler.cs index 9f425420b65..938c5703292 100644 --- a/Source/RP0/Maintenance/MaintenanceHandler.cs +++ b/Source/RP0/Maintenance/MaintenanceHandler.cs @@ -59,6 +59,7 @@ public class MaintenanceHandler : ScenarioModule }; public double LCsCostPerDay = 0d; + public double ResearchSalaryPerDay = 0d; public double TrainingUpkeepPerDay = 0d; public double NautBaseUpkeepPerDay = 0d; @@ -79,8 +80,6 @@ public double IntegrationSalaryPerDay } } - public double ResearchSalaryPerDay => Researchers * Database.SettingsSC.salaryResearchers / 365.25d; - public struct SubsidyDetails { public double minSubsidy, maxSubsidy, maxRep, subsidy; @@ -336,6 +335,11 @@ public void UpdateUpkeep() LCsCostPerDay += LCUpkeep(lc); } + if (SpaceCenterManagement.Instance.TechList.Count > 0) + ResearchSalaryPerDay = Researchers * Database.SettingsSC.salaryResearchers / 365.25d; + else + ResearchSalaryPerDay = Researchers * Database.SettingsSC.salaryResearchers * Database.SettingsSC.ResearcherIdleSalaryMult / 365.25d; + foreach (SpaceCenterFacility facility in FacilitiesForMaintenance) { if (Database.LockedFacilities.Contains(facility)) @@ -354,8 +358,6 @@ public void UpdateUpkeep() FacilityMaintenanceCosts[facility] = cost; } - - TrainingUpkeepPerDay = 0d; if (CrewHandler.Instance?.TrainingCourses != null) { diff --git a/Source/RP0/Settings/SpaceCenterSettings.cs b/Source/RP0/Settings/SpaceCenterSettings.cs index ad4767623ac..d2ab81e93c5 100644 --- a/Source/RP0/Settings/SpaceCenterSettings.cs +++ b/Source/RP0/Settings/SpaceCenterSettings.cs @@ -66,7 +66,9 @@ public class SpaceCenterSettings : ConfigNodePersistenceBase [Persistent] public int HireCost = 200; [Persistent] - public double AdditionalPadCostMult = 0.5d, RushRateMult = 1.5d, RushSalaryMult = 2d, IdleSalaryMult = 0.25, MergingTimePenalty = 0.05d, + public double ResearcherIdleSalaryMult = 0.5; + [Persistent] + public double AdditionalPadCostMult = 0.5d, RushRateMult = 1.5d, RushSalaryMult = 2d, EngineerIdleSalaryMult = 0.25, MergingTimePenalty = 0.05d, EffectiveCostPerLiterPerResourceMult = 0.1d; [Persistent] public FloatCurve EngineerSkillupRate = new FloatCurve(); diff --git a/Source/RP0/SpaceCenter/SpaceCenterManagement.cs b/Source/RP0/SpaceCenter/SpaceCenterManagement.cs index 044b96526c5..b2228813290 100644 --- a/Source/RP0/SpaceCenter/SpaceCenterManagement.cs +++ b/Source/RP0/SpaceCenter/SpaceCenterManagement.cs @@ -925,7 +925,7 @@ public double GetEffectiveIntegrationEngineersForSalary(LCSpaceCenter ksc) double engineers = 0d; foreach (var lc in ksc.LaunchComplexes) engineers += GetEffectiveEngineersForSalary(lc); - return engineers + ksc.UnassignedEngineers * Database.SettingsSC.IdleSalaryMult; + return engineers + ksc.UnassignedEngineers * Database.SettingsSC.EngineerIdleSalaryMult; } public double GetEffectiveEngineersForSalary(LCSpaceCenter ksc) => GetEffectiveIntegrationEngineersForSalary(ksc); @@ -935,12 +935,12 @@ public double GetEffectiveEngineersForSalary(LaunchComplex lc) if (lc.IsOperational && lc.Engineers > 0) { if (!lc.IsActive) - return lc.Engineers * Database.SettingsSC.IdleSalaryMult; + return lc.Engineers * Database.SettingsSC.EngineerIdleSalaryMult; if (lc.IsHumanRated && lc.BuildList.Count > 0 && !lc.BuildList[0].humanRated) { int num = Math.Min(lc.Engineers, lc.MaxEngineersFor(lc.BuildList[0])); - return num * lc.RushSalary + (lc.Engineers - num) * Database.SettingsSC.IdleSalaryMult; + return num * lc.RushSalary + (lc.Engineers - num) * Database.SettingsSC.EngineerIdleSalaryMult; } return lc.Engineers * lc.RushSalary; diff --git a/Source/RP0/UI/KCT/GUI_Editor.cs b/Source/RP0/UI/KCT/GUI_Editor.cs index 0a79ffb9721..f1505db25f4 100644 --- a/Source/RP0/UI/KCT/GUI_Editor.cs +++ b/Source/RP0/UI/KCT/GUI_Editor.cs @@ -97,7 +97,7 @@ private static void RenderBuildMode() if (bR > 0d && rateWithCurEngis > 0d) { double effectiveEngCount = bR / rateWithCurEngis * SpaceCenterManagement.Instance.ActiveSC.ActiveLC.Engineers; - double salaryPerDayAboveIdle = Database.SettingsSC.salaryEngineers * (1d / 365.25d) * (1d - Database.SettingsSC.IdleSalaryMult); + double salaryPerDayAboveIdle = Database.SettingsSC.salaryEngineers * (1d / 365.25d) * (1d - Database.SettingsSC.EngineerIdleSalaryMult); double cost = buildPoints / bR / 86400d * effectiveEngCount * salaryPerDayAboveIdle; GUILayout.Label(new GUIContent($"Net Salary: √{-CurrencyUtils.Funds(TransactionReasonsRP0.SalaryEngineers, -cost):N1}", "The extra salary paid above the idle rate for these engineers")); }