Skip to content

Commit

Permalink
Allow overriding career prompt. Close #2917
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanKell committed Oct 1, 2023
1 parent 98edaf1 commit fe213a0
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Source/Harmony/MainMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ internal class PatchMainMenu
{
private static bool _needCheckRP1 = true;
private static bool _hasRP1;
private static bool _needCheckDB = false;
private static bool _overrideCareer = false;

[HarmonyPrefix]
[HarmonyPatch("ConfirmNewGame")]
Expand All @@ -22,8 +24,19 @@ internal static bool Prefix_ConfirmNewGame(MainMenu __instance, Game.Modes ___ne
_hasRP1 = AssemblyLoader.loadedAssemblies.FirstOrDefault(a => a.name == "RP-0") != null;
_needCheckRP1 = false;
}

if (_needCheckDB)
{
foreach (ConfigNode node in GameDatabase.Instance.GetConfigNodes("REALISMOVERHAULSETTINGS"))
{
bool btmp = false;
node.TryGetValue("allowCareer", ref btmp);
_overrideCareer |= btmp;
}
_needCheckDB = false;
}

if (_hasRP1)
if (_hasRP1 || _overrideCareer)
return true;

if (___newGameMode != Game.Modes.SCIENCE_SANDBOX && ___newGameMode != Game.Modes.CAREER)
Expand Down

0 comments on commit fe213a0

Please sign in to comment.