createProgram: Return correct message

It doesn't return completion message upon cancellation anymore.
This commit is contained in:
ilkecan 2022-06-29 02:01:01 +00:00
parent 6f017bf4f6
commit adda3d68cd

@ -1326,10 +1326,16 @@ export function createProgramWork(this: IPlayer, numCycles: number): boolean {
export function finishCreateProgramWork(this: IPlayer, cancelled: boolean): string { export function finishCreateProgramWork(this: IPlayer, cancelled: boolean): string {
const programName = this.createProgramName; const programName = this.createProgramName;
let message = "";
if (!cancelled) { if (!cancelled) {
//Complete case //Complete case
this.gainIntelligenceExp((CONSTANTS.IntelligenceProgramBaseExpGain * this.timeWorked) / 1000); this.gainIntelligenceExp((CONSTANTS.IntelligenceProgramBaseExpGain * this.timeWorked) / 1000);
dialogBoxCreate(`You've finished creating ${programName}!<br>The new program can be found on your home computer.`); const lines = [
`You've finished creating ${programName}!`,
"The new program can be found on your home computer.",
];
dialogBoxCreate(lines.join("<br>"));
message = lines.join(" ");
if (!this.getHomeComputer().programs.includes(programName)) { if (!this.getHomeComputer().programs.includes(programName)) {
this.getHomeComputer().programs.push(programName); this.getHomeComputer().programs.push(programName);
@ -1339,12 +1345,12 @@ export function finishCreateProgramWork(this: IPlayer, cancelled: boolean): stri
const perc = (Math.floor((this.timeWorkedCreateProgram / this.timeNeededToCompleteWork) * 10000) / 100).toString(); const perc = (Math.floor((this.timeWorkedCreateProgram / this.timeNeededToCompleteWork) * 10000) / 100).toString();
const incompleteName = programName + "-" + perc + "%-INC"; const incompleteName = programName + "-" + perc + "%-INC";
this.getHomeComputer().programs.push(incompleteName); this.getHomeComputer().programs.push(incompleteName);
message = `Cancelled creating program: ${programName} (${perc}% complete)`;
} }
this.isWorking = false; this.isWorking = false;
this.resetWorkStatus(); this.resetWorkStatus();
return "You've finished creating " + programName + "! The new program can be found on your home computer."; return message;
} }
export function startGraftAugmentationWork(this: IPlayer, augmentationName: string, time: number): void { export function startGraftAugmentationWork(this: IPlayer, augmentationName: string, time: number): void {