From d0a44a60884236216b7bde020fe68e7fd0152d6f Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Tue, 18 Jan 2022 18:57:43 -0500 Subject: [PATCH] change asleep --- src/NetscriptFunctions.ts | 6 ++---- src/NetscriptWorker.ts | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index ec22166f6..e7bbb3696 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -577,9 +577,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { throw makeRuntimeErrorMsg("asleep", "Takes 1 argument."); } workerScript.log("asleep", () => `Sleeping for ${time} milliseconds`); - return netscriptDelay(time, workerScript).then(function () { - return Promise.resolve(true); - }); + return new Promise((resolve) => setTimeout(resolve, time)); }, grow: function (hostname: any, { threads: requestedThreads, stock }: any = {}): any { updateDynamicRam("grow", getRamCost(Player, "grow")); @@ -715,7 +713,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { end(); }); }, - getSharePower: function(): number { + getSharePower: function (): number { return CalculateShareMult(); }, print: function (...args: any[]): void { diff --git a/src/NetscriptWorker.ts b/src/NetscriptWorker.ts index 3819c5c20..a3935f76d 100644 --- a/src/NetscriptWorker.ts +++ b/src/NetscriptWorker.ts @@ -178,7 +178,7 @@ function startNetscript1Script(workerScript: WorkerScript): Promise