mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-18 12:15:44 +01:00
BUGFIX: Game takes too long to process crime work with large number of cycles (#1821)
This commit is contained in:
parent
1c7230a799
commit
74ede7d947
@ -33,6 +33,12 @@ export class CrimeWork extends Work {
|
|||||||
}
|
}
|
||||||
|
|
||||||
process(cycles = 1): boolean {
|
process(cycles = 1): boolean {
|
||||||
|
/**
|
||||||
|
* Crime work is processed in a loop. If the number of cycles is too large, the loop blocks the game engine for too
|
||||||
|
* long. 12960000 is the number of cycles in 30 days (5 * 3600 * 24 * 30). On a very old machine, the loop takes
|
||||||
|
* ~800-1000 ms to process the "shoplift" crime which is the fastest crime (faster crime = more iteration).
|
||||||
|
*/
|
||||||
|
cycles = Math.min(cycles, 12960000);
|
||||||
this.cyclesWorked += cycles;
|
this.cyclesWorked += cycles;
|
||||||
const time = Object.values(Crimes).find((c) => c.type === this.crimeType)?.time ?? 0;
|
const time = Object.values(Crimes).find((c) => c.type === this.crimeType)?.time ?? 0;
|
||||||
this.unitCompleted += CONSTANTS.MilliPerCycle * cycles;
|
this.unitCompleted += CONSTANTS.MilliPerCycle * cycles;
|
||||||
|
Loading…
Reference in New Issue
Block a user