Skip to content

Commit

Permalink
fix ns1 scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivier Gagnon committed May 25, 2022
1 parent ca2e225 commit cb7f3b1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
// "plugin:@typescript-eslint/recommended-requiring-type-checking",
],
parser: "@typescript-eslint/parser",
parserOptions: {
Expand Down
5 changes: 4 additions & 1 deletion src/Netscript/APIWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ function wrapFunction(
helpers.updateDynamicRam(ctx.function, getRamCost(Player, ...tree, ctx.function));
if (safetyEnabled) {
const now = performance.now();
if (now - workerScript.infiniteLoopSafety > CONSTANTS.InfiniteLoopLimit) {
if (
now - workerScript.infiniteLoopSafety > CONSTANTS.InfiniteLoopLimit &&
workerScript.scriptRef.filename.endsWith(".js")
) {
throw new Error(
`Potential infinite loop without sleep detected. The game spent ${CONSTANTS.InfiniteLoopLimit}ms stuck in this script. (Are you using 'asleep' by mistake?)`,
);
Expand Down

0 comments on commit cb7f3b1

Please sign in to comment.