diff --git a/src/SaveObject.tsx b/src/SaveObject.tsx index 6a15fbb11..8e9cd4737 100755 --- a/src/SaveObject.tsx +++ b/src/SaveObject.tsx @@ -67,7 +67,11 @@ class BitburnerSaveObject { const saveString = this.getSaveString(); save(saveString) - .then(() => SnackbarEvents.emit("Game Saved!", "info")) + .then(() => { + if (!Settings.SuppressSavedGameToast) { + SnackbarEvents.emit("Game Saved!", "info") + } + }) .catch((err) => console.error(err)); } diff --git a/src/Settings/Settings.ts b/src/Settings/Settings.ts index 09bd06031..8a4cbdd31 100644 --- a/src/Settings/Settings.ts +++ b/src/Settings/Settings.ts @@ -103,6 +103,11 @@ interface IDefaultSettings { */ SuppressTIXPopup: boolean; + /** + * Whether the user should be displayed a toast alert when the game is saved. + */ + SuppressSavedGameToast: boolean; + /* * Theme colors */ @@ -186,6 +191,7 @@ export const defaultSettings: IDefaultSettings = { SuppressTravelConfirmation: false, SuppressBladeburnerPopup: false, SuppressTIXPopup: false, + SuppressSavedGameToast: false, theme: { primarylight: "#0f0", @@ -251,6 +257,7 @@ export const Settings: ISettings & ISelfInitializer & ISelfLoading = { SuppressTravelConfirmation: defaultSettings.SuppressTravelConfirmation, SuppressBladeburnerPopup: defaultSettings.SuppressBladeburnerPopup, SuppressTIXPopup: defaultSettings.SuppressTIXPopup, + SuppressSavedGameToast: defaultSettings.SuppressSavedGameToast, MonacoTheme: "monokai", MonacoInsertSpaces: false, MonacoFontSize: 20, diff --git a/src/ui/React/GameOptionsRoot.tsx b/src/ui/React/GameOptionsRoot.tsx index 9d6ce9e10..9400eb872 100644 --- a/src/ui/React/GameOptionsRoot.tsx +++ b/src/ui/React/GameOptionsRoot.tsx @@ -70,6 +70,7 @@ export function GameOptionsRoot(props: IProps): React.ReactElement { ); const [suppressTIXPopup, setSuppressTIXPopup] = useState(Settings.SuppressTIXPopup); const [suppressBladeburnerPopup, setSuppressBladeburnerPopup] = useState(Settings.SuppressBladeburnerPopup); + const [suppressSavedGameToast, setSuppresSavedGameToast] = useState(Settings.SuppressSavedGameToast); const [disableHotkeys, setDisableHotkeys] = useState(Settings.DisableHotkeys); const [disableASCIIArt, setDisableASCIIArt] = useState(Settings.DisableASCIIArt); @@ -138,6 +139,11 @@ export function GameOptionsRoot(props: IProps): React.ReactElement { Settings.SuppressBladeburnerPopup = event.target.checked; } + function handleSuppressSavedGameToastChange(event: React.ChangeEvent): void { + setSuppresSavedGameToast(event.target.checked); + Settings.SuppressSavedGameToast = event.target.checked; + } + function handleDisableHotkeysChange(event: React.ChangeEvent): void { setDisableHotkeys(event.target.checked); Settings.DisableHotkeys = event.target.checked; @@ -420,6 +426,24 @@ export function GameOptionsRoot(props: IProps): React.ReactElement { /> )} + + + } + label={ + + If this is set, there will be no "Saved Game" toast appearing after save. + + } + > + Suppress Saved Game Toast + + } + /> + }