mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-18 12:15:44 +01:00
allbuild commit b60f3da8
This commit is contained in:
parent
b60f3da80e
commit
216055b3e0
4
dist/main.bundle.js
vendored
4
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
2
dist/vendor.bundle.js
vendored
2
dist/vendor.bundle.js
vendored
File diff suppressed because one or more lines are too long
2
dist/vendor.bundle.js.map
vendored
2
dist/vendor.bundle.js.map
vendored
File diff suppressed because one or more lines are too long
@ -54,8 +54,8 @@ export const CurrentOptionsPage = (props: IProps): React.ReactElement => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleLocaleChange(event: SelectChangeEvent<string>): void {
|
function handleLocaleChange(event: SelectChangeEvent<string>): void {
|
||||||
setLocale(event.target.value );
|
setLocale(event.target.value);
|
||||||
Settings.Locale = event.target.value ;
|
Settings.Locale = event.target.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleTimestampFormatChange(event: React.ChangeEvent<HTMLInputElement>): void {
|
function handleTimestampFormatChange(event: React.ChangeEvent<HTMLInputElement>): void {
|
||||||
@ -179,12 +179,6 @@ export const CurrentOptionsPage = (props: IProps): React.ReactElement => {
|
|||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<OptionSwitch
|
|
||||||
checked={Settings.InfinityLoopSafety}
|
|
||||||
onChange={(newValue) => (Settings.InfinityLoopSafety = newValue)}
|
|
||||||
text="Script infinite loop safety net"
|
|
||||||
tooltip={<>If this is set the game will attempt to automatically kill scripts stuck in infinite loops.</>}
|
|
||||||
/>
|
|
||||||
</GameOptionsPage>
|
</GameOptionsPage>
|
||||||
),
|
),
|
||||||
[GameOptionsTab.INTERFACE]: (
|
[GameOptionsTab.INTERFACE]: (
|
||||||
|
@ -99,21 +99,8 @@ function wrapFunction(
|
|||||||
getValidPort: (port: any) => helpers.getValidPort(functionPath, port),
|
getValidPort: (port: any) => helpers.getValidPort(functionPath, port),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
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) {
|
|
||||||
const now = performance.now();
|
|
||||||
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?)`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return func(ctx)(...args);
|
return func(ctx)(...args);
|
||||||
}
|
}
|
||||||
const parent = getNestedProperty(wrappedAPI, ...tree);
|
const parent = getNestedProperty(wrappedAPI, ...tree);
|
||||||
|
@ -112,11 +112,6 @@ export class WorkerScript {
|
|||||||
*/
|
*/
|
||||||
atExit: any;
|
atExit: any;
|
||||||
|
|
||||||
/**
|
|
||||||
* Once this counter reaches it's limit the script crashes. It is reset when a promise completes.
|
|
||||||
*/
|
|
||||||
infiniteLoopSafety = performance.now();
|
|
||||||
|
|
||||||
constructor(runningScriptObj: RunningScript, pid: number, nsFuncsGenerator?: (ws: WorkerScript) => NS) {
|
constructor(runningScriptObj: RunningScript, pid: number, nsFuncsGenerator?: (ws: WorkerScript) => NS) {
|
||||||
this.name = runningScriptObj.filename;
|
this.name = runningScriptObj.filename;
|
||||||
this.hostname = runningScriptObj.server;
|
this.hostname = runningScriptObj.server;
|
||||||
|
@ -14,8 +14,6 @@ export function netscriptDelay(time: number, workerScript: WorkerScript): Promis
|
|||||||
workerScript.delay = window.setTimeout(() => {
|
workerScript.delay = window.setTimeout(() => {
|
||||||
workerScript.delay = null;
|
workerScript.delay = null;
|
||||||
workerScript.delayReject = undefined;
|
workerScript.delayReject = undefined;
|
||||||
|
|
||||||
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);
|
||||||
|
@ -54,11 +54,6 @@ interface IDefaultSettings {
|
|||||||
*/
|
*/
|
||||||
EnableBashHotkeys: boolean;
|
EnableBashHotkeys: boolean;
|
||||||
|
|
||||||
/**
|
|
||||||
* Infinite loop safety net
|
|
||||||
*/
|
|
||||||
InfinityLoopSafety: boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Timestamps format
|
* Timestamps format
|
||||||
*/
|
*/
|
||||||
@ -206,7 +201,6 @@ export const defaultSettings: IDefaultSettings = {
|
|||||||
DisableOverviewProgressBars: false,
|
DisableOverviewProgressBars: false,
|
||||||
EnableBashHotkeys: false,
|
EnableBashHotkeys: false,
|
||||||
TimestampsFormat: "",
|
TimestampsFormat: "",
|
||||||
InfinityLoopSafety: true,
|
|
||||||
Locale: "en",
|
Locale: "en",
|
||||||
MaxRecentScriptsCapacity: 50,
|
MaxRecentScriptsCapacity: 50,
|
||||||
MaxLogCapacity: 50,
|
MaxLogCapacity: 50,
|
||||||
@ -247,7 +241,6 @@ export const Settings: ISettings & ISelfInitializer & ISelfLoading = {
|
|||||||
DisableOverviewProgressBars: defaultSettings.DisableOverviewProgressBars,
|
DisableOverviewProgressBars: defaultSettings.DisableOverviewProgressBars,
|
||||||
EnableBashHotkeys: defaultSettings.EnableBashHotkeys,
|
EnableBashHotkeys: defaultSettings.EnableBashHotkeys,
|
||||||
TimestampsFormat: defaultSettings.TimestampsFormat,
|
TimestampsFormat: defaultSettings.TimestampsFormat,
|
||||||
InfinityLoopSafety: defaultSettings.InfinityLoopSafety,
|
|
||||||
Locale: "en",
|
Locale: "en",
|
||||||
MaxRecentScriptsCapacity: defaultSettings.MaxRecentScriptsCapacity,
|
MaxRecentScriptsCapacity: defaultSettings.MaxRecentScriptsCapacity,
|
||||||
MaxLogCapacity: defaultSettings.MaxLogCapacity,
|
MaxLogCapacity: defaultSettings.MaxLogCapacity,
|
||||||
|
Loading…
Reference in New Issue
Block a user