fix ns1 scripts

This commit is contained in:
Olivier Gagnon
2022-05-25 16:01:28 -04:00
parent ca2e22506b
commit cb7f3b17be
2 changed files with 5 additions and 2 deletions
+4 -1
View File
@@ -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?)`,
);