API: Standardize "nextCompletion" promise in tasks (#2687)

This commit is contained in:
catloversg
2026-04-28 13:49:53 +07:00
committed by GitHub
parent ee3014b029
commit 36e1adf2d2
72 changed files with 1750 additions and 364 deletions
+5 -3
View File
@@ -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,
};
}