Skip to content

Commit

Permalink
Give idle researchers lower salary (#2440)
Browse files Browse the repository at this point in the history
  • Loading branch information
siimav authored Oct 19, 2024
1 parent e6dde09 commit ed51e59
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
3 changes: 2 additions & 1 deletion GameData/RP-1/SpaceCenterSettings.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions Source/RP0/Maintenance/MaintenanceHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public class MaintenanceHandler : ScenarioModule
};

public double LCsCostPerDay = 0d;
public double ResearchSalaryPerDay = 0d;

public double TrainingUpkeepPerDay = 0d;
public double NautBaseUpkeepPerDay = 0d;
Expand All @@ -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;
Expand Down Expand Up @@ -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))
Expand All @@ -354,8 +358,6 @@ public void UpdateUpkeep()
FacilityMaintenanceCosts[facility] = cost;
}



TrainingUpkeepPerDay = 0d;
if (CrewHandler.Instance?.TrainingCourses != null)
{
Expand Down
4 changes: 3 additions & 1 deletion Source/RP0/Settings/SpaceCenterSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions Source/RP0/SpaceCenter/SpaceCenterManagement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Source/RP0/UI/KCT/GUI_Editor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
Expand Down

0 comments on commit ed51e59

Please sign in to comment.