mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-29 11:03:48 +01:00
allbuild commit 8159dad5
This commit is contained in:
parent
8159dad5fa
commit
ce61f06319
2
dist/main.bundle.js
vendored
2
dist/main.bundle.js
vendored
File diff suppressed because one or more lines are too long
2
dist/main.bundle.js.map
vendored
2
dist/main.bundle.js.map
vendored
File diff suppressed because one or more lines are too long
@ -129,7 +129,7 @@
|
|||||||
"electron:packager-win": "electron-packager .package bitburner --platform win32 --arch x64 --out .build --overwrite --icon .package/icon.png",
|
"electron:packager-win": "electron-packager .package bitburner --platform win32 --arch x64 --out .build --overwrite --icon .package/icon.png",
|
||||||
"electron:packager-mac": "electron-packager .package bitburner --platform darwin --arch x64 --out .build --overwrite --icon .package/icon.png",
|
"electron:packager-mac": "electron-packager .package bitburner --platform darwin --arch x64 --out .build --overwrite --icon .package/icon.png",
|
||||||
"electron:packager-linux": "electron-packager .package bitburner --platform linux --arch x64 --out .build --overwrite --icon .package/icon.png",
|
"electron:packager-linux": "electron-packager .package bitburner --platform linux --arch x64 --out .build --overwrite --icon .package/icon.png",
|
||||||
"allbuild": "npm run build && npm run electron && git add --all && git commit -m \"allbuild commit $(git rev-parse --short HEAD)\" && git push -f -u origin dev",
|
"allbuild": "npm run build && npm run electron && git add --all && git commit -m \"allbuild commit $(git rev-parse --short HEAD)\" && git push -u origin dev",
|
||||||
"preversion": "npm install && npm run test",
|
"preversion": "npm install && npm run test",
|
||||||
"version": "sh ./tools/build-release.sh && git add --all",
|
"version": "sh ./tools/build-release.sh && git add --all",
|
||||||
"postversion": "git push -u origin dev && git push --tags",
|
"postversion": "git push -u origin dev && git push --tags",
|
||||||
|
@ -227,7 +227,7 @@ export const CONSTANTS: {
|
|||||||
// BitNode/Source-File related stuff
|
// BitNode/Source-File related stuff
|
||||||
TotalNumBitNodes: 24,
|
TotalNumBitNodes: 24,
|
||||||
|
|
||||||
InfiniteLoopLimit: 1000,
|
InfiniteLoopLimit: 2000,
|
||||||
|
|
||||||
Donations: 7,
|
Donations: 7,
|
||||||
|
|
||||||
|
@ -96,11 +96,15 @@ function wrapFunction(
|
|||||||
const safetyEnabled = Settings.InfinityLoopSafety;
|
const safetyEnabled = Settings.InfinityLoopSafety;
|
||||||
function wrappedFunction(...args: unknown[]): unknown {
|
function wrappedFunction(...args: unknown[]): unknown {
|
||||||
helpers.updateDynamicRam(ctx.function, getRamCost(Player, ...tree, ctx.function));
|
helpers.updateDynamicRam(ctx.function, getRamCost(Player, ...tree, ctx.function));
|
||||||
if (safetyEnabled) workerScript.infiniteLoopSafetyCounter++;
|
if (safetyEnabled) {
|
||||||
if (workerScript.infiniteLoopSafetyCounter > CONSTANTS.InfiniteLoopLimit)
|
const now = performance.now();
|
||||||
|
if (now - workerScript.infiniteLoopSafety > CONSTANTS.InfiniteLoopLimit) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Infinite loop without sleep detected. ${CONSTANTS.InfiniteLoopLimit} ns functions were called without 'sleep'. This will cause your UI to hang. Are you using 'asleep' by mistake?`,
|
`Potential infinite loop without sleep detected. The game spent ${CONSTANTS.InfiniteLoopLimit}ms stuck in this script. (Are you using 'asleep' by mistake?)`,
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return func(ctx)(...args);
|
return func(ctx)(...args);
|
||||||
}
|
}
|
||||||
const parent = getNestedProperty(wrappedAPI, ...tree);
|
const parent = getNestedProperty(wrappedAPI, ...tree);
|
||||||
|
@ -114,7 +114,7 @@ export class WorkerScript {
|
|||||||
/**
|
/**
|
||||||
* Once this counter reaches it's limit the script crashes. It is reset when a promise completes.
|
* Once this counter reaches it's limit the script crashes. It is reset when a promise completes.
|
||||||
*/
|
*/
|
||||||
infiniteLoopSafetyCounter = 0;
|
infiniteLoopSafety = performance.now();
|
||||||
|
|
||||||
constructor(runningScriptObj: RunningScript, pid: number, nsFuncsGenerator?: (ws: WorkerScript) => any) {
|
constructor(runningScriptObj: RunningScript, pid: number, nsFuncsGenerator?: (ws: WorkerScript) => any) {
|
||||||
this.name = runningScriptObj.filename;
|
this.name = runningScriptObj.filename;
|
||||||
|
@ -14,7 +14,7 @@ export function netscriptDelay(time: number, workerScript: WorkerScript): Promis
|
|||||||
workerScript.delay = null;
|
workerScript.delay = null;
|
||||||
workerScript.delayReject = undefined;
|
workerScript.delayReject = undefined;
|
||||||
|
|
||||||
workerScript.infiniteLoopSafetyCounter = 0;
|
workerScript.infiniteLoopSafety = performance.now();
|
||||||
if (workerScript.env.stopFlag) reject(new ScriptDeath(workerScript));
|
if (workerScript.env.stopFlag) reject(new ScriptDeath(workerScript));
|
||||||
else resolve();
|
else resolve();
|
||||||
}, time);
|
}, time);
|
||||||
|
Loading…
Reference in New Issue
Block a user