Remove stopFlag checks made redundant by the netscriptDelay change

This commit is contained in:
Heikki Aitakangas 2022-01-08 22:04:01 +02:00
parent 59da79a427
commit c6ff982b1d
4 changed files with 0 additions and 22 deletions

@ -342,9 +342,6 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
);
return netscriptDelay(hackingTime * 1000, workerScript).then(function () {
if (workerScript.env.stopFlag) {
return Promise.reject(workerScript);
}
const hackChance = calculateHackingChance(server, Player);
const rand = Math.random();
let expGainedOnSuccess = calculateHackingExpGain(server, Player) * threads;
@ -614,9 +611,6 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
)} (t=${numeralWrapper.formatThreads(threads)}).`,
);
return netscriptDelay(growTime * 1000, workerScript).then(function () {
if (workerScript.env.stopFlag) {
return Promise.reject(workerScript);
}
const moneyBefore = server.moneyAvailable <= 0 ? 1 : server.moneyAvailable;
processSingleServerGrowth(server, threads, Player, host.cpuCores);
const moneyAfter = server.moneyAvailable;
@ -685,7 +679,6 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
)} (t=${numeralWrapper.formatThreads(threads)})`,
);
return netscriptDelay(weakenTime * 1000, workerScript).then(function () {
if (workerScript.env.stopFlag) return Promise.reject(workerScript);
const host = GetServer(workerScript.hostname);
if (host === null) {
workerScript.log("weaken", () => "Server is null, did it die?");

@ -311,9 +311,6 @@ export function NetscriptCorporation(
const job = helper.string("assignJob", "job", ajob);
const employee = getEmployee(divisionName, cityName, employeeName);
return netscriptDelay(1000, workerScript).then(function () {
if (workerScript.env.stopFlag) {
return Promise.reject(workerScript);
}
return Promise.resolve(AssignJob(employee, job));
});
},
@ -344,9 +341,6 @@ export function NetscriptCorporation(
(60 * 1000) / (player.hacking_speed_mult * calculateIntelligenceBonus(player.intelligence, 1)),
workerScript,
).then(function () {
if (workerScript.env.stopFlag) {
return Promise.reject(workerScript);
}
return Promise.resolve(ThrowParty(corporation, office, costPerEmployee));
});
},
@ -359,9 +353,6 @@ export function NetscriptCorporation(
(60 * 1000) / (player.hacking_speed_mult * calculateIntelligenceBonus(player.intelligence, 1)),
workerScript,
).then(function () {
if (workerScript.env.stopFlag) {
return Promise.reject(workerScript);
}
return Promise.resolve(BuyCoffee(corporation, getDivision(divisionName), getOffice(divisionName, cityName)));
});
},

@ -611,9 +611,6 @@ export function NetscriptSingularity(
);
return netscriptDelay(installTime, workerScript).then(function () {
if (workerScript.env.stopFlag) {
return Promise.reject(workerScript);
}
workerScript.log("installBackdoor", () => `Successfully installed backdoor on '${server.hostname}'`);
server.backdoorInstalled = true;

@ -38,9 +38,6 @@ export function NetscriptStanek(player: IPlayer, workerScript: WorkerScript, hel
if (!fragment) throw helper.makeRuntimeErrorMsg("stanek.charge", `No fragment with root (${rootX}, ${rootY}).`);
const time = staneksGift.inBonus() ? 200 : 1000;
return netscriptDelay(time, workerScript).then(function () {
if (workerScript.env.stopFlag) {
return Promise.reject(workerScript);
}
const charge = staneksGift.charge(player, fragment, workerScript.scriptRef.threads);
workerScript.log("stanek.charge", () => `Charged fragment for ${charge} charge.`);
return Promise.resolve();