Merge pull request #1448 from danielyxie/dev

Fix sleeve consuming too much time, fix blade join
This commit is contained in:
hydroflame 2021-10-09 14:31:42 -04:00 committed by GitHub
commit 45f266afa4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 26 deletions

24
dist/vendor.bundle.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -4178,7 +4178,6 @@ function NetscriptFunctions(workerScript: WorkerScript): NS {
}, },
joinBladeburnerDivision: function (): any { joinBladeburnerDivision: function (): any {
updateDynamicRam("joinBladeburnerDivision", getRamCost("bladeburner", "joinBladeburnerDivision")); updateDynamicRam("joinBladeburnerDivision", getRamCost("bladeburner", "joinBladeburnerDivision"));
checkBladeburnerAccess("joinBladeburnerDivision", true);
const bladeburner = Player.bladeburner; const bladeburner = Player.bladeburner;
if (bladeburner === null) throw new Error("Should not be called without Bladeburner"); if (bladeburner === null) throw new Error("Should not be called without Bladeburner");
if (Player.bitNodeN === 7 || SourceFileFlags[7] > 0) { if (Player.bitNodeN === 7 || SourceFileFlags[7] > 0) {
@ -4196,12 +4195,6 @@ function NetscriptFunctions(workerScript: WorkerScript): NS {
Player.bladeburner = new Bladeburner(Player); Player.bladeburner = new Bladeburner(Player);
workerScript.log("joinBladeburnerDivision", "You have been accepted into the Bladeburner division"); workerScript.log("joinBladeburnerDivision", "You have been accepted into the Bladeburner division");
const worldHeader = document.getElementById("world-menu-header");
if (worldHeader instanceof HTMLElement) {
worldHeader.click();
worldHeader.click();
}
return true; return true;
} else { } else {
workerScript.log( workerScript.log(

@ -189,7 +189,8 @@ function startNetscript1Script(workerScript: WorkerScript): Promise<WorkerScript
cb(res); cb(res);
}) })
.catch(function (err: any) { .catch(function (err: any) {
console.error(err); // workerscript is when you cancel a delay
if (!(err instanceof WorkerScript)) console.error(err);
}); });
}; };
int.setProperty(scope, name, int.createAsyncFunction(tempWrapper)); int.setProperty(scope, name, int.createAsyncFunction(tempWrapper));

@ -476,9 +476,9 @@ export class Sleeve extends Person {
return null; return null;
} }
let time = this.storedCycles * CONSTANTS.MilliPerCycle;
let cyclesUsed = this.storedCycles; let cyclesUsed = this.storedCycles;
cyclesUsed = Math.min(cyclesUsed, 15); cyclesUsed = Math.min(cyclesUsed, 15);
let time = cyclesUsed * CONSTANTS.MilliPerCycle;
if (this.currentTaskMaxTime !== 0 && this.currentTaskTime + time > this.currentTaskMaxTime) { if (this.currentTaskMaxTime !== 0 && this.currentTaskTime + time > this.currentTaskMaxTime) {
time = this.currentTaskMaxTime - this.currentTaskTime; time = this.currentTaskMaxTime - this.currentTaskTime;
cyclesUsed = Math.floor(time / CONSTANTS.MilliPerCycle); cyclesUsed = Math.floor(time / CONSTANTS.MilliPerCycle);
@ -489,6 +489,7 @@ export class Sleeve extends Person {
cyclesUsed = 0; cyclesUsed = 0;
} }
} }
console.log(cyclesUsed);
this.currentTaskTime += time; this.currentTaskTime += time;
// Shock gradually goes towards 100 // Shock gradually goes towards 100
@ -562,6 +563,7 @@ export class Sleeve extends Person {
* Resets all parameters used to keep information about the current task * Resets all parameters used to keep information about the current task
*/ */
resetTaskStatus(): void { resetTaskStatus(): void {
console.error("");
this.earningsForTask = createTaskTracker(); this.earningsForTask = createTaskTracker();
this.gainRatesForTask = createTaskTracker(); this.gainRatesForTask = createTaskTracker();
this.currentTask = SleeveTaskType.Idle; this.currentTask = SleeveTaskType.Idle;
@ -846,7 +848,6 @@ export class Sleeve extends Person {
this.currentTaskLocation = companyName; this.currentTaskLocation = companyName;
this.currentTask = SleeveTaskType.Company; this.currentTask = SleeveTaskType.Company;
this.currentTaskMaxTime = CONSTANTS.MillisecondsPer8Hours;
return true; return true;
} }
@ -906,7 +907,6 @@ export class Sleeve extends Person {
this.currentTaskLocation = factionName; this.currentTaskLocation = factionName;
this.currentTask = SleeveTaskType.Faction; this.currentTask = SleeveTaskType.Faction;
this.currentTaskMaxTime = CONSTANTS.MillisecondsPer20Hours;
return true; return true;
} }