From ad67103882c398bb07a5d19ed2f87c8795e58e5e Mon Sep 17 00:00:00 2001
From: R-T-B <21GunSoftware@comcast.net>
Date: Sun, 1 Dec 2024 00:56:12 -0800
Subject: [PATCH] version = 1.7.3 1.) Hotfix for a bug that could zero newgame
budgets. 2.) More UI improvements courtesy Github user AlexSkylark. 3.)
Numerous display text improvements to be less confusing for the end user. 4.)
Level 1 facilities are now 2/3rds of base maintanence cost to help with early
game. 5.) LaunchCosts are now displayed properly. 6.) UseItorLoseIt is now
default off.
---
Bureaucracy/Budget/BudgetEvent.cs | 6 +--
Bureaucracy/Budget/BudgetManager.cs | 2 +-
Bureaucracy/Budget/BudgetReport.cs | 9 +++-
Bureaucracy/Budget/Costs.cs | 5 +--
Bureaucracy/Bureaucracy.csproj | 41 ++++++-------------
Bureaucracy/Facilities/BureaucracyFacility.cs | 2 +-
Bureaucracy/Facilities/FacilityReport.cs | 20 ++++++++-
Bureaucracy/SettingsClass.cs | 6 +--
Bureaucracy/Utilities.cs | 13 +++---
GameData/Bureaucracy/Bureaucracy.version | 2 +-
GameData/Bureaucracy/Changelog.cfg | 10 +++++
11 files changed, 67 insertions(+), 49 deletions(-)
diff --git a/Bureaucracy/Budget/BudgetEvent.cs b/Bureaucracy/Budget/BudgetEvent.cs
index e05852b..8d0b0ce 100644
--- a/Bureaucracy/Budget/BudgetEvent.cs
+++ b/Bureaucracy/Budget/BudgetEvent.cs
@@ -39,9 +39,9 @@ public override void OnEventCompleted()
funding -= CrewManager.Instance.Bonuses(funding, true);
double facilityDebt = Costs.Instance.GetFacilityMaintenanceCosts();
double wageDebt = Math.Abs(funding + facilityDebt);
- if (funding < 0)
+ if (funding <= 0)
{
- Debug.Log("[Bureaucracy]: Funding < 0. Paying debts");
+ Debug.Log("[Bureaucracy]: Funding <= 0. Paying debts");
//pay wages first then facilities
Utilities.Instance.PayWageDebt(wageDebt);
Utilities.Instance.PayFacilityDebt(facilityDebt, wageDebt);
@@ -56,7 +56,6 @@ public override void OnEventCompleted()
if(!SettingsClass.Instance.UseItOrLoseIt || Funding.Instance.Funds <= 0.0d || funding <= 0.0d || Utilities.Instance.IsBootstrapBudgetCycle) Funding.Instance.AddFunds(funding, TransactionReasons.Contracts);
Debug.Log("[Bureaucracy]: OnBudgetAwarded. Awarding "+funding+" Costs: "+facilityDebt);
InternalListeners.OnBudgetAwarded.Fire(funding, facilityDebt);
- Costs.Instance.ResetLaunchCosts();
repDecay.ApplyRepDecay(Bureaucracy.Instance.settings.RepDecayPercent);
@@ -82,6 +81,7 @@ public override void OnEventCompleted()
}
InformParent();
+ Costs.Instance.ResetLaunchCosts();
}
}
diff --git a/Bureaucracy/Budget/BudgetManager.cs b/Bureaucracy/Budget/BudgetManager.cs
index b24a6d6..b4f62b6 100644
--- a/Bureaucracy/Budget/BudgetManager.cs
+++ b/Bureaucracy/Budget/BudgetManager.cs
@@ -55,7 +55,7 @@ public void OnLoad(ConfigNode cn)
CreateNewBudget(nextBudgetTime);
}
else Bureaucracy.Instance.YieldAndCreateBudgetOnNewGame();
- ConfigNode costsNode = cn.GetNode("COSTS");
+ ConfigNode costsNode = managerNode.GetNode("COSTS");
Costs.Instance.OnLoad(costsNode);
Debug.Log("[Bureaucracy]: Budget Manager: OnLoad Complete");
}
diff --git a/Bureaucracy/Budget/BudgetReport.cs b/Bureaucracy/Budget/BudgetReport.cs
index 08619b5..aaf3510 100644
--- a/Bureaucracy/Budget/BudgetReport.cs
+++ b/Bureaucracy/Budget/BudgetReport.cs
@@ -24,10 +24,15 @@ public override string ReportBody()
ReportBuilder.AppendLine($"Net Budget: {Utilities.Instance.FundsSymbol}{Math.Max(0, netBudget)}");
if (netBudget > 0 && netBudget < Funding.Instance.Funds) ReportBuilder.AppendLine("We can't justify extending your funding");
// ReSharper disable once InvertIf
- if (netBudget < 0)
+ if (netBudget + Utilities.Instance.fundsStored < 0)
{
ReportBuilder.AppendLine("The budget didn't fully cover your space programs costs.");
- ReportBuilder.Append($"A penalty of {Utilities.Instance.FundsSymbol}{Math.Round(netBudget, 0)} will be applied");
+ ReportBuilder.Append($"A budget shortfall of {Utilities.Instance.FundsSymbol}{Math.Round(netBudget + Utilities.Instance.fundsStored, 0)} was experienced.");
+ }
+ else if (netBudget < 0)
+ {
+ ReportBuilder.AppendLine("The budget didn't fully cover your space programs costs, so we used your remaining treasury to pay dues.");
+ ReportBuilder.Append($"This cost {Utilities.Instance.FundsSymbol}{Math.Round(Math.Abs(netBudget), 0)} from our treasury.");
}
return ReportBuilder.ToString();
}
diff --git a/Bureaucracy/Budget/Costs.cs b/Bureaucracy/Budget/Costs.cs
index 3a47fe4..c5f8511 100644
--- a/Bureaucracy/Budget/Costs.cs
+++ b/Bureaucracy/Budget/Costs.cs
@@ -46,9 +46,9 @@ public double GetTotalMaintenanceCosts()
costs += GetFacilityMaintenanceCosts();
costs += GetWageCosts();
costs += GetLaunchCosts();
- cachedCosts = costs;
+ cachedCosts = Math.Round(costs);
costsDirty = false;
- Debug.Log("[Bureaucracy]: Cached costs "+costs+". Setting Costs not dirty for next 5 seconds");
+ Debug.Log("[Bureaucracy]: Cached costs " + Math.Round(costs) + ". Setting Costs not dirty for next 5 seconds");
Bureaucracy.Instance.Invoke(nameof(Bureaucracy.Instance.SetCalcsDirty), 5.0f);
return Math.Round(costs);
}
@@ -90,7 +90,6 @@ public double GetFacilityMaintenanceCosts()
for (int i = 0; i < FacilityManager.Instance.Facilities.Count; i++)
{
BureaucracyFacility bf = FacilityManager.Instance.Facilities.ElementAt(i);
- if (bf.IsClosed) continue;
d += bf.MaintenanceCost * FacilityManager.Instance.CostMultiplier;
}
}
diff --git a/Bureaucracy/Bureaucracy.csproj b/Bureaucracy/Bureaucracy.csproj
index b09027c..7ad1b59 100644
--- a/Bureaucracy/Bureaucracy.csproj
+++ b/Bureaucracy/Bureaucracy.csproj
@@ -34,47 +34,47 @@
- D:\KSPDebug\KSP_x64_Data\Managed\Assembly-CSharp.dll
+ C:\Program Files\Kerbal Space Program\KSP_x64_Data\Managed\Assembly-CSharp.dll
- D:\KSPDebug\KSP_x64_Data\Managed\Assembly-CSharp-firstpass.dll
+ C:\Program Files\Kerbal Space Program\KSP_x64_Data\Managed\Assembly-CSharp-firstpass.dll
- ..\..\..\..\Desktop\UABE\FlightTracker.dll
+ ..\..\..\..\..\..\..\Program Files\Kerbal Space Program\GameData\FlightTracker\FlightTracker.dll
- H:\KSP1123\KSP_x64_Data\Managed\mscorlib.dll
+ C:\Program Files\Kerbal Space Program\KSP_x64_Data\Managed\mscorlib.dll
- H:\KSP1123\KSP_x64_Data\Managed\System.Configuration.dll
+ C:\Program Files\Kerbal Space Program\KSP_x64_Data\Managed\System.Configuration.dll
- H:\KSP1123\KSP_x64_Data\Managed\System.Security.dll
+ C:\Program Files\Kerbal Space Program\KSP_x64_Data\Managed\System.Security.dll
- D:\KSPDebug\KSP_x64_Data\Managed\UnityEngine.dll
+ C:\Program Files\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.dll
- D:\KSPDebug\KSP_x64_Data\Managed\UnityEngine.AnimationModule.dll
+ C:\Program Files\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.AnimationModule.dll
- D:\KSPDebug\KSP_x64_Data\Managed\UnityEngine.AssetBundleModule.dll
+ C:\Program Files\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.AssetBundleModule.dll
- D:\KSPDebug\KSP_x64_Data\Managed\UnityEngine.CoreModule.dll
+ C:\Program Files\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.CoreModule.dll
- D:\KSPDebug\KSP_x64_Data\Managed\UnityEngine.TextRenderingModule.dll
+ C:\Program Files\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.TextRenderingModule.dll
- D:\KSPDebug\KSP_x64_Data\Managed\UnityEngine.UI.dll
+ C:\Program Files\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.UI.dll
- D:\KSPDebug\KSP_x64_Data\Managed\UnityEngine.UIModule.dll
+ C:\Program Files\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.UIModule.dll
@@ -122,21 +122,6 @@
-
- echo Running debug post-build event...
-
-xcopy /Y "$(TargetDir)$(ProjectName).dll" "D:\KSPDebug\GameData\Bureaucracy\"
-
-if exist "$(TargetDir)$(ProjectName).pdb" (
- xcopy /Y "$(TargetDir)$(ProjectName).pdb" "D:\KSPDebug\GameData\Bureaucracy\"
-) else (
- echo Target file does not exist. Skipping copy.
-)
-
-if "$(ConfigurationName)" == "Release" (
- xcopy /Y "$(TargetDir)$(ProjectName).dll" "D:\SteamLibrary\steamapps\common\Kerbal Space Program\GameData"
-)
-