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
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

View File

@ -4178,7 +4178,6 @@ function NetscriptFunctions(workerScript: WorkerScript): NS {
},
joinBladeburnerDivision: function (): any {
updateDynamicRam("joinBladeburnerDivision", getRamCost("bladeburner", "joinBladeburnerDivision"));
checkBladeburnerAccess("joinBladeburnerDivision", true);
const bladeburner = Player.bladeburner;
if (bladeburner === null) throw new Error("Should not be called without Bladeburner");
if (Player.bitNodeN === 7 || SourceFileFlags[7] > 0) {
@ -4196,12 +4195,6 @@ function NetscriptFunctions(workerScript: WorkerScript): NS {
Player.bladeburner = new Bladeburner(Player);
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;
} else {
workerScript.log(

View File

@ -189,7 +189,8 @@ function startNetscript1Script(workerScript: WorkerScript): Promise<WorkerScript
cb(res);
})
.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));

View File

@ -476,9 +476,9 @@ export class Sleeve extends Person {
return null;
}
let time = this.storedCycles * CONSTANTS.MilliPerCycle;
let cyclesUsed = this.storedCycles;
cyclesUsed = Math.min(cyclesUsed, 15);
let time = cyclesUsed * CONSTANTS.MilliPerCycle;
if (this.currentTaskMaxTime !== 0 && this.currentTaskTime + time > this.currentTaskMaxTime) {
time = this.currentTaskMaxTime - this.currentTaskTime;
cyclesUsed = Math.floor(time / CONSTANTS.MilliPerCycle);
@ -489,6 +489,7 @@ export class Sleeve extends Person {
cyclesUsed = 0;
}
}
console.log(cyclesUsed);
this.currentTaskTime += time;
// 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
*/
resetTaskStatus(): void {
console.error("");
this.earningsForTask = createTaskTracker();
this.gainRatesForTask = createTaskTracker();
this.currentTask = SleeveTaskType.Idle;
@ -846,7 +848,6 @@ export class Sleeve extends Person {
this.currentTaskLocation = companyName;
this.currentTask = SleeveTaskType.Company;
this.currentTaskMaxTime = CONSTANTS.MillisecondsPer8Hours;
return true;
}
@ -906,7 +907,6 @@ export class Sleeve extends Person {
this.currentTaskLocation = factionName;
this.currentTask = SleeveTaskType.Faction;
this.currentTaskMaxTime = CONSTANTS.MillisecondsPer20Hours;
return true;
}