mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-30 21:07:04 +02:00
NETSCRIPT: Rework script ram updates (#408)
This commit is contained in:
@@ -20,6 +20,8 @@ import { Settings } from "../../Settings/Settings";
|
||||
import { ANSIITypography } from "./ANSIITypography";
|
||||
import { ScriptArg } from "../../Netscript/ScriptArg";
|
||||
import { useRerender } from "./hooks";
|
||||
import { areFilesEqual } from "../../Terminal/DirectoryHelpers";
|
||||
import { dialogBoxCreate } from "./DialogBox";
|
||||
|
||||
let layerCounter = 0;
|
||||
|
||||
@@ -220,7 +222,17 @@ function LogWindow(props: IProps): React.ReactElement {
|
||||
if (server === null) return;
|
||||
const s = findRunningScript(script.filename, script.args, server);
|
||||
if (s === null) {
|
||||
script.ramUsage = 0;
|
||||
const baseScript = server.scripts.find((serverScript) => areFilesEqual(serverScript.filename, script.filename));
|
||||
if (!baseScript) {
|
||||
return dialogBoxCreate(
|
||||
`Could not launch script. The script ${script.filename} no longer exists on the server ${server.hostname}.`,
|
||||
);
|
||||
}
|
||||
const ramUsage = baseScript.getRamUsage(server.scripts);
|
||||
if (!ramUsage) {
|
||||
return dialogBoxCreate(`Could not calculate ram usage for ${script.filename} on ${server.hostname}.`);
|
||||
}
|
||||
script.ramUsage = ramUsage;
|
||||
startWorkerScript(script, server);
|
||||
} else {
|
||||
setScript(s);
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as React from "react";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import { TableCell, Tooltip, Typography } from "@mui/material";
|
||||
import { characterOverviewStyles } from "./CharacterOverview";
|
||||
import { ISkillProgress } from "src/PersonObjects/formulas/skill";
|
||||
import { ISkillProgress } from "../../PersonObjects/formulas/skill";
|
||||
import { formatExp } from "../formatNumber";
|
||||
|
||||
interface IProgressProps {
|
||||
|
||||
Reference in New Issue
Block a user