mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-26 19:14:32 +02:00
Vendored
+2
-2
File diff suppressed because one or more lines are too long
+2
-2
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
@@ -138,7 +138,8 @@ function startNetscript2Script(workerScript: WorkerScript): Promise<WorkerScript
|
|||||||
workerScript.errorMessage = e;
|
workerScript.errorMessage = e;
|
||||||
throw workerScript;
|
throw workerScript;
|
||||||
}
|
}
|
||||||
throw e; // Don't know what to do with it, let's rethrow.
|
workerScript.errorMessage = makeRuntimeRejectMsg(workerScript, "Unknown error: " + JSON.stringify(e));
|
||||||
|
throw workerScript;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,14 +168,7 @@ function startNetscript1Script(workerScript: WorkerScript): Promise<WorkerScript
|
|||||||
const entry = ns[name];
|
const entry = ns[name];
|
||||||
if (typeof entry === "function") {
|
if (typeof entry === "function") {
|
||||||
//Async functions need to be wrapped. See JS-Interpreter documentation
|
//Async functions need to be wrapped. See JS-Interpreter documentation
|
||||||
if (
|
if (["hack", "grow", "weaken", "sleep", "prompt", "manualHack", "scp", "write"].includes(name)) {
|
||||||
name === "hack" ||
|
|
||||||
name === "grow" ||
|
|
||||||
name === "weaken" ||
|
|
||||||
name === "sleep" ||
|
|
||||||
name === "prompt" ||
|
|
||||||
name === "manualHack"
|
|
||||||
) {
|
|
||||||
const tempWrapper = function (...args: any[]): void {
|
const tempWrapper = function (...args: any[]): void {
|
||||||
const fnArgs = [];
|
const fnArgs = [];
|
||||||
|
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ export async function determineAllPossibilitiesForTabCompletion(
|
|||||||
const script = currServ.scripts.find((script) => script.filename === filename);
|
const script = currServ.scripts.find((script) => script.filename === filename);
|
||||||
if (!script) return; // Doesn't exist.
|
if (!script) return; // Doesn't exist.
|
||||||
if (!script.module) {
|
if (!script.module) {
|
||||||
compile(script, currServ.scripts);
|
await compile(script, currServ.scripts);
|
||||||
}
|
}
|
||||||
const loadedModule = await script.module;
|
const loadedModule = await script.module;
|
||||||
if (!loadedModule.autocomplete) return; // Doesn't have an autocomplete function.
|
if (!loadedModule.autocomplete) return; // Doesn't have an autocomplete function.
|
||||||
|
|||||||
@@ -21,28 +21,30 @@ interface Log {
|
|||||||
script: RunningScript;
|
script: RunningScript;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let logs: Log[] = [];
|
||||||
|
|
||||||
export function LogBoxManager(): React.ReactElement {
|
export function LogBoxManager(): React.ReactElement {
|
||||||
const [logs, setLogs] = useState<Log[]>([]);
|
const setRerender = useState(true)[1];
|
||||||
|
function rerender(): void {
|
||||||
|
setRerender((o) => !o);
|
||||||
|
}
|
||||||
useEffect(
|
useEffect(
|
||||||
() =>
|
() =>
|
||||||
LogBoxEvents.subscribe((script: RunningScript) => {
|
LogBoxEvents.subscribe((script: RunningScript) => {
|
||||||
const id = script.server + "-" + script.filename + script.args.map((x: any): string => `${x}`).join("-");
|
const id = script.server + "-" + script.filename + script.args.map((x: any): string => `${x}`).join("-");
|
||||||
if (logs.find((l) => l.id === id)) return;
|
if (logs.find((l) => l.id === id)) return;
|
||||||
setLogs((old) => {
|
logs.push({
|
||||||
return [
|
id: id,
|
||||||
...old,
|
script: script,
|
||||||
{
|
|
||||||
id: id,
|
|
||||||
script: script,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
});
|
});
|
||||||
|
rerender();
|
||||||
}),
|
}),
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
function close(id: string): void {
|
function close(id: string): void {
|
||||||
setLogs((old) => old.filter((l) => l.id !== id));
|
logs = logs.filter((l) => l.id !== id);
|
||||||
|
rerender();
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user