bitburner-src/src/ui/React/RecoveryRoot.tsx

56 lines
1.9 KiB
TypeScript
Raw Normal View History

2021-11-02 22:28:19 +01:00
import React from "react";
import Typography from "@mui/material/Typography";
import Link from "@mui/material/Link";
import Button from "@mui/material/Button";
import { Settings } from "../../Settings/Settings";
2021-11-12 05:28:08 +01:00
import { load } from "../../db";
2021-11-02 22:28:19 +01:00
import { IRouter } from "../Router";
2021-11-12 05:28:08 +01:00
import { download } from "../../SaveObject";
2021-11-02 22:28:19 +01:00
export let RecoveryMode = false;
export function ActivateRecoveryMode(): void {
RecoveryMode = true;
}
interface IProps {
router: IRouter;
softReset: () => void;
2021-11-02 22:28:19 +01:00
}
export function RecoveryRoot({ router, softReset }: IProps): React.ReactElement {
2021-11-02 22:28:19 +01:00
function recover(): void {
RecoveryMode = false;
router.toTerminal();
}
Settings.AutosaveInterval = 0;
2021-11-12 05:28:08 +01:00
load().then((content) => {
download("RECOVERY.json", content);
});
2021-11-02 22:28:19 +01:00
return (
<>
<Typography variant="h3">RECOVERY MODE ACTIVATED</Typography>
<Typography>
There was an error loading your save file and the game went into recovery mode. In this mode saving is disabled
and the game will automatically export your save file (to prevent corruption).
</Typography>
<Typography>At this point it is recommended to alert a developer.</Typography>
<Link href="https://github.com/danielyxie/bitburner/issues/new" target="_blank">
<Typography>File an issue on github</Typography>
</Link>
<Link href="https://www.reddit.com/r/Bitburner/" target="_blank">
<Typography>Make a reddit post</Typography>
</Link>
<Link href="https://discord.gg/TFc3hKD" target="_blank">
<Typography>Post in the #bug-report channel on Discord.</Typography>
</Link>
<Typography>Please include your save file.</Typography>
<br />
<br />
<Typography>You can disable recovery mode now. But chances are the game will not work correctly.</Typography>
<Button onClick={recover}>DISABLE RECOVERY MODE</Button>
<Button onClick={softReset}>PERFORM SOFT RESET</Button>
2021-11-02 22:28:19 +01:00
</>
);
}