mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-09 17:23:53 +01:00
MISC: Cancel spawned scripts in Bitverse (#1429)
This commit is contained in:
parent
bf8c15332e
commit
fd8eae5cf5
@ -108,6 +108,8 @@ import { getEnumHelper } from "./utils/EnumHelper";
|
|||||||
import { setDeprecatedProperties, deprecationWarning } from "./utils/DeprecationHelper";
|
import { setDeprecatedProperties, deprecationWarning } from "./utils/DeprecationHelper";
|
||||||
import { ServerConstants } from "./Server/data/Constants";
|
import { ServerConstants } from "./Server/data/Constants";
|
||||||
import { assertFunction } from "./Netscript/TypeAssertion";
|
import { assertFunction } from "./Netscript/TypeAssertion";
|
||||||
|
import { Router } from "./ui/GameRoot";
|
||||||
|
import { Page } from "./ui/Router";
|
||||||
|
|
||||||
export const enums: NSEnums = {
|
export const enums: NSEnums = {
|
||||||
CityName,
|
CityName,
|
||||||
@ -736,6 +738,10 @@ export const ns: InternalAPI<NSFull> = {
|
|||||||
const runOpts = helpers.spawnOptions(ctx, _thread_or_opt);
|
const runOpts = helpers.spawnOptions(ctx, _thread_or_opt);
|
||||||
const args = helpers.scriptArgs(ctx, _args);
|
const args = helpers.scriptArgs(ctx, _args);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
if (Router.page() === Page.BitVerse) {
|
||||||
|
helpers.log(ctx, () => `Script execution is canceled because you are in Bitverse.`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
const scriptServer = GetServer(ctx.workerScript.hostname);
|
const scriptServer = GetServer(ctx.workerScript.hostname);
|
||||||
if (scriptServer === null) {
|
if (scriptServer === null) {
|
||||||
throw helpers.errorMessage(ctx, `Cannot find server ${ctx.workerScript.hostname}`);
|
throw helpers.errorMessage(ctx, `Cannot find server ${ctx.workerScript.hostname}`);
|
||||||
|
Loading…
Reference in New Issue
Block a user