fix sleeve consuming too much time at once.

This commit is contained in:
Olivier Gagnon
2021-10-09 14:31:06 -04:00
parent 752534bc4d
commit 2bf47c60df
5 changed files with 20 additions and 19 deletions
+3 -3
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;
}