Skip to content

Commit

Permalink
Prevent starting Science Sandbox games
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanKell committed Jul 24, 2023
1 parent 0f4e5f7 commit bd80e79
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 4 deletions.
7 changes: 5 additions & 2 deletions GameData/RP-1/Localization/en-us.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
#loadgame_Rep = Rep: <<1>>
#loadgame_Conf = Conf: <<1>>

#rp0_MainMenu_NoSciMode_Title = No Science Sandbox
#rp0_MainMenu_NoSciMode_Text = Science Sandbox mode is unsupported with RP-1. Please choose Career mode and then cheat funds as required.

// Administration
#rp0_Admin_ActivePrograms = Active Programs
#rp0_Admin_CompletedPrograms = Completed Programs
Expand All @@ -50,7 +53,7 @@
#rp0_Admin_CompleteProgramWithReward = Complete Program\nReward:
#rp0_Admin_CompleteProgram_Confirm = Are you sure you want to COMPLETE this Program?\n\nYou will no longer be offered any of its Contracts, and any of its Contracts which are active will be failed.<<1>>
#rp0_Admin_AcceptAdditional_Program_Title = Activate Another Program
#rp0_Admin_AcceptAdditional_Program = You've activated your first program! But you still have slots free. Activate another program now to increase funding. It's generally best to keep all your slots filled, unless you're saving them for a program that will unlock soon that you would rather take instead.
#rp0_Admin_AcceptAdditional_Program_Text = You've activated your first program! But you still have slots free. Activate another program now to increase funding. It's generally best to keep all your slots filled, unless you're saving them for a program that will unlock soon that you would rather take instead.
#rp0_Leaders_Title = Leaders
#rp0_Leaders_Appoint = Appoint
#rp0_Leaders_Remove = Remove
Expand Down Expand Up @@ -168,7 +171,7 @@
// Editor
#rp0_Editor_LC_BuildVesselFirst_Title = Create Vessel First
#rp0_Editor_LC_BuildVesselFirst = Create the vessel you wish this LC to support before clicking this button; that will set up the LC to serve this launch vehicle. LCs are customized to fit particular launch vehicles in RP-1.
#rp0_Editor_LC_BuildVesselFirst_Text = Create the vessel you wish this LC to support before clicking this button; that will set up the LC to serve this launch vehicle. LCs are customized to fit particular launch vehicles in RP-1.
// Loading screen tips - If you change the number of tips, change NumTips in LoadingScreenChanger.cs
#rp0_loading_tip_001 = Forgetting just about everything learned in stock KSP…
Expand Down
2 changes: 1 addition & 1 deletion Source/Harmony/Administration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ internal static void OnActivateProgramConfirm()
new Vector2(0.5f, 0.5f),
"ShowAcceptAdditionalProgramDialog",
"#rp0_Admin_AcceptAdditional_Program_Title",
"#rp0_Admin_AcceptAdditional_Program",
"#rp0_Admin_AcceptAdditional_Program_Text",
"#autoLOC_190905",
false,
HighLogic.UISkin);
Expand Down
31 changes: 31 additions & 0 deletions Source/Harmony/MainMenu.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using HarmonyLib;
using UnityEngine;
using KSP.Localization;
using UnityEngine.UI;

namespace RP0.Harmony
{
[HarmonyPatch(typeof(MainMenu))]
internal class PatchMainMenu
{
[HarmonyPrefix]
[HarmonyPatch("ConfirmNewGame")]
internal static bool Prefix_ConfirmNewGame(MainMenu __instance)
{
if (MainMenu.newGameMode != Game.Modes.SCIENCE_SANDBOX)
return true;

PopupDialog dlg = PopupDialog.SpawnPopupDialog(new Vector2(0.5f, 0.5f),
new Vector2(0.5f, 0.5f),
new MultiOptionDialog("NoScienceSandbox",
Localizer.Format("#rp0_MainMenu_NoSciMode_Text"),
Localizer.Format("#rp0_MainMenu_NoSciMode_Title"),
null,
new DialogGUIButton(Localizer.Format("#autoLOC_190905"),
__instance.CancelOverwriteNewGame, dismissOnSelect: true)), persistAcrossScenes: false, null);
dlg.OnDismiss = __instance.CancelOverwriteNewGame;
MenuNavigation.SpawnMenuNavigation(dlg.gameObject, Navigation.Mode.Vertical, limitCheck: true);
return false;
}
}
}
2 changes: 1 addition & 1 deletion Source/KerbalConstructionTime/GUI/GUI_Editor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ private static void ShowBuildVesselFirstDialog()
new Vector2(0.5f, 0.5f),
"ShowBuildLVFirstDialog",
"#rp0_Editor_LC_BuildVesselFirst_Title",
"#rp0_Editor_LC_BuildVesselFirst",
"#rp0_Editor_LC_BuildVesselFirst_Text",
"#autoLOC_190905",
false,
HighLogic.UISkin);
Expand Down
1 change: 1 addition & 0 deletions Source/RP0.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
<Compile Include="DataTypes\PersistentCompressedConfigNode.cs" />
<Compile Include="DataTypes\PersistentSortedList.cs" />
<Compile Include="DesignConcerns\UntooledParts.cs" />
<Compile Include="Harmony\MainMenu.cs" />
<Compile Include="Harmony\CrewListItem.cs" />
<Compile Include="Harmony\EditorDriver.cs" />
<Compile Include="Harmony\EditorPartIcon.cs" />
Expand Down

0 comments on commit bd80e79

Please sign in to comment.