mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-18 21:53:50 +01:00
Improve the robustness of the tutorial.
This commit is contained in:
parent
c6da513eea
commit
2fc17423ff
@ -13,10 +13,17 @@ import { GetServer } from "../Server/AllServers";
|
||||
import { dialogBoxCreate } from "../ui/React/DialogBox";
|
||||
import { AddRecentScript } from "./RecentScripts";
|
||||
import { Player } from "../Player";
|
||||
import { ITutorial } from "../InteractiveTutorial";
|
||||
import { AlertEvents } from "../ui/React/AlertManager";
|
||||
|
||||
export type killScriptParams = WorkerScript | number | { runningScript: RunningScript; hostname: string };
|
||||
|
||||
export function killWorkerScript(params: killScriptParams): boolean {
|
||||
console.log(ITutorial.isRunning);
|
||||
if (ITutorial.isRunning) {
|
||||
AlertEvents.emit("Processes cannot be killed during the tutorial.");
|
||||
return false;
|
||||
}
|
||||
if (params instanceof WorkerScript) {
|
||||
stopAndCleanUpWorkerScript(params);
|
||||
|
||||
|
@ -56,8 +56,7 @@ export function WorkerScriptAccordion(props: IProps): React.ReactElement {
|
||||
const killScript = killWorkerScript.bind(null, { runningScript: scriptRef, hostname: scriptRef.server });
|
||||
|
||||
function killScriptClickHandler(): void {
|
||||
killScript();
|
||||
dialogBoxCreate("Killing script");
|
||||
if (killScript()) dialogBoxCreate("Killing script");
|
||||
}
|
||||
|
||||
// Calculations for script stats
|
||||
|
@ -381,7 +381,7 @@ export function InteractiveTutorialRoot(): React.ReactElement {
|
||||
<Typography>
|
||||
Scripts must end with the {tutorialScriptExtension} extension. Let's make a script now by entering{" "}
|
||||
</Typography>
|
||||
<Typography classes={{ root: classes.textfield }}>{`[n00dles ~/]> nano ${tutorialScriptName}`}</Typography>
|
||||
<Typography classes={{ root: classes.textfield }}>{`[home ~/]> nano ${tutorialScriptName}`}</Typography>
|
||||
|
||||
<Typography>
|
||||
after the hack command finishes running (Sidenote: Pressing ctrl + c will end a command like hack early)
|
||||
@ -439,7 +439,7 @@ export function InteractiveTutorialRoot(): React.ReactElement {
|
||||
<br />
|
||||
To check how much RAM is available on this machine, enter
|
||||
</Typography>
|
||||
<Typography classes={{ root: classes.textfield }}>{"[n00dles ~/]> free"}</Typography>
|
||||
<Typography classes={{ root: classes.textfield }}>{"[home ~/]> free"}</Typography>
|
||||
</>
|
||||
),
|
||||
canNext: false,
|
||||
@ -450,7 +450,7 @@ export function InteractiveTutorialRoot(): React.ReactElement {
|
||||
<Typography>
|
||||
We have 4GB of free RAM on this machine, which is enough to run our script. Let's run our script using
|
||||
</Typography>
|
||||
<Typography classes={{ root: classes.textfield }}>{`[n00dles ~/]> run ${tutorialScriptName}`}</Typography>
|
||||
<Typography classes={{ root: classes.textfield }}>{`[home ~/]> run ${tutorialScriptName}`}</Typography>
|
||||
</>
|
||||
),
|
||||
canNext: false,
|
||||
@ -497,7 +497,7 @@ export function InteractiveTutorialRoot(): React.ReactElement {
|
||||
One last thing about scripts, each active script contains logs that detail what it's doing. We can check
|
||||
these logs using the tail command. Do that now for the script we just ran by typing{" "}
|
||||
</Typography>
|
||||
<Typography classes={{ root: classes.textfield }}>{`[n00dles ~/]> tail ${tutorialScriptName}`}</Typography>
|
||||
<Typography classes={{ root: classes.textfield }}>{`[home ~/]> tail ${tutorialScriptName}`}</Typography>
|
||||
</>
|
||||
),
|
||||
canNext: false,
|
||||
|
Loading…
Reference in New Issue
Block a user