Merge pull request #3568 from nickofolas/fix/grafting-stop-work

GRAFTING: Fix Grafting not being handled in singularity stop work
This commit is contained in:
hydroflame 2022-05-04 12:02:29 -04:00 committed by GitHub
commit 5d4241b120
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

@ -291,6 +291,6 @@ export interface IPlayer {
sourceFileLvl(n: number): number;
startGraftAugmentationWork(augmentationName: string, time: number): void;
graftAugmentationWork(numCycles: number): boolean;
finishGraftAugmentationWork(cancelled: boolean): string;
finishGraftAugmentationWork(cancelled: boolean, singularity?: boolean): string;
applyEntropy(stacks?: number): void;
}

@ -302,7 +302,7 @@ export class PlayerObject implements IPlayer {
sourceFileLvl: (n: number) => number;
startGraftAugmentationWork: (augmentationName: string, time: number) => void;
graftAugmentationWork: (numCycles: number) => boolean;
finishGraftAugmentationWork: (cancelled: boolean) => string;
finishGraftAugmentationWork: (cancelled: boolean, singularity?: boolean) => string;
applyEntropy: (stacks?: number) => void;
constructor() {

@ -1364,7 +1364,7 @@ export function craftAugmentationWork(this: IPlayer, numCycles: number): boolean
return false;
}
export function finishGraftAugmentationWork(this: IPlayer, cancelled: boolean): string {
export function finishGraftAugmentationWork(this: IPlayer, cancelled: boolean, singularity = false): string {
const augName = this.graftAugmentationName;
if (cancelled === false) {
applyAugmentation(Augmentations[augName]);
@ -1378,7 +1378,7 @@ export function finishGraftAugmentationWork(this: IPlayer, cancelled: boolean):
`You've finished grafting ${augName}.<br>The augmentation has been applied to your body` +
(this.hasAugmentation(AugmentationNames.CongruityImplant) ? "." : ", but you feel a bit off."),
);
} else {
} else if (cancelled && singularity === false) {
dialogBoxCreate(`You cancelled the grafting of ${augName}.<br>Your money was not returned to you.`);
}
@ -1700,6 +1700,9 @@ export function singularityStopWork(this: IPlayer): string {
case CONSTANTS.WorkTypeCrime:
res = this.finishCrime(true);
break;
case CONSTANTS.WorkTypeGraftAugmentation:
res = this.finishGraftAugmentationWork(true, true);
break;
default:
console.error(`Unrecognized work type (${this.workType})`);
return "";