mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-29 04:17:05 +02:00
API: Standardize "nextCompletion" promise in tasks (#2687)
This commit is contained in:
@@ -4,12 +4,12 @@ import { CompletedProgramName } from "@enums";
|
||||
import { CONSTANTS } from "../Constants";
|
||||
import { Player } from "@player";
|
||||
import { Programs } from "../Programs/Programs";
|
||||
import { Work, WorkType } from "./Work";
|
||||
import { PlayerBaseWork, WorkType } from "./Work";
|
||||
import { Program } from "../Programs/Program";
|
||||
import { calculateIntelligenceBonus } from "../PersonObjects/formulas/intelligence";
|
||||
import { asProgramFilePath } from "../Paths/ProgramFilePath";
|
||||
|
||||
export const isCreateProgramWork = (w: Work | null): w is CreateProgramWork =>
|
||||
export const isCreateProgramWork = (w: PlayerBaseWork | null): w is CreateProgramWork =>
|
||||
w !== null && w.type === WorkType.CREATE_PROGRAM;
|
||||
|
||||
interface CreateProgramWorkParams {
|
||||
@@ -17,7 +17,7 @@ interface CreateProgramWorkParams {
|
||||
singularity: boolean;
|
||||
}
|
||||
|
||||
export class CreateProgramWork extends Work {
|
||||
export class CreateProgramWork extends PlayerBaseWork {
|
||||
programName: CompletedProgramName;
|
||||
// amount of effective work completed on the program (time boosted by skills).
|
||||
unitCompleted: number;
|
||||
@@ -94,6 +94,7 @@ export class CreateProgramWork extends Work {
|
||||
const incompleteName = asProgramFilePath(programName + "-" + perc + "%-INC");
|
||||
Player.getHomeComputer().pushProgram(incompleteName);
|
||||
}
|
||||
this.resolveNextCompletion();
|
||||
}
|
||||
|
||||
APICopy() {
|
||||
@@ -101,6 +102,7 @@ export class CreateProgramWork extends Work {
|
||||
type: WorkType.CREATE_PROGRAM as const,
|
||||
cyclesWorked: this.cyclesWorked,
|
||||
programName: this.programName,
|
||||
nextCompletion: this.nextCompletion,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user