mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-26 11:10:58 +02:00
BLADEBURNER: FIX #3508 Add GetActionCurrentTime() to Bitburner API
Add GetActionCurrentTime() to Bitburner API. Slightly tweak BItburner.resetAction() to also reset time counters.
This commit is contained in:
@@ -137,6 +137,20 @@ export function NetscriptBladeburner(player: IPlayer, workerScript: WorkerScript
|
||||
throw ctx.makeRuntimeErrorMsg(e);
|
||||
}
|
||||
},
|
||||
getActionCurrentTime: (ctx: NetscriptContext) => (): number => {
|
||||
checkBladeburnerAccess(ctx);
|
||||
const bladeburner = player.bladeburner;
|
||||
if (bladeburner === null) throw new Error("Should not be called without Bladeburner");
|
||||
try {
|
||||
const timecomputed = Math.min(
|
||||
bladeburner.actionTimeCurrent + bladeburner.actionTimeOverflow,
|
||||
bladeburner.actionTimeToComplete,
|
||||
) * 1000 ;
|
||||
return timecomputed;
|
||||
} catch (e: any) {
|
||||
throw ctx.makeRuntimeErrorMsg(e);
|
||||
}
|
||||
},
|
||||
getActionEstimatedSuccessChance:
|
||||
(ctx: NetscriptContext) =>
|
||||
(_type: unknown, _name: unknown): [number, number] => {
|
||||
|
||||
Reference in New Issue
Block a user