mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-21 08:42:53 +02:00
MISC: change all nextUpdates to use one Promise (#1069)
This commit is contained in:
@@ -4,7 +4,7 @@ import type { GangMember } from "../Gang/GangMember";
|
||||
import type { GangMemberTask } from "../Gang/GangMemberTask";
|
||||
import type { InternalAPI, NetscriptContext } from "../Netscript/APIWrapper";
|
||||
|
||||
import { GangNextUpdate } from "../Gang/Gang";
|
||||
import { GangPromise } from "../Gang/Gang";
|
||||
import { Player } from "@player";
|
||||
import { FactionName } from "@enums";
|
||||
import { GangConstants } from "../Gang/data/Constants";
|
||||
@@ -324,11 +324,10 @@ export function NetscriptGang(): InternalAPI<IGang> {
|
||||
const gang = getGang(ctx);
|
||||
return Math.round(gang.storedCycles / 5) * 1000;
|
||||
},
|
||||
nextUpdate: () => () => {
|
||||
if (!GangNextUpdate.promise) {
|
||||
GangNextUpdate.promise = new Promise<number>((res) => (GangNextUpdate.resolver = res));
|
||||
}
|
||||
return GangNextUpdate.promise;
|
||||
nextUpdate: (ctx) => () => {
|
||||
getGang(ctx);
|
||||
if (!GangPromise.promise) GangPromise.promise = new Promise<number>((res) => (GangPromise.resolve = res));
|
||||
return GangPromise.promise;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user