mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-10 09:43:54 +01:00
Handle grafting in singularity stop work
This commit is contained in:
parent
9c805dabb8
commit
a87bfb0de6
@ -291,6 +291,6 @@ export interface IPlayer {
|
|||||||
sourceFileLvl(n: number): number;
|
sourceFileLvl(n: number): number;
|
||||||
startGraftAugmentationWork(augmentationName: string, time: number): void;
|
startGraftAugmentationWork(augmentationName: string, time: number): void;
|
||||||
graftAugmentationWork(numCycles: number): boolean;
|
graftAugmentationWork(numCycles: number): boolean;
|
||||||
finishGraftAugmentationWork(cancelled: boolean): string;
|
finishGraftAugmentationWork(cancelled: boolean, singularity?: boolean): string;
|
||||||
applyEntropy(stacks?: number): void;
|
applyEntropy(stacks?: number): void;
|
||||||
}
|
}
|
||||||
|
@ -302,7 +302,7 @@ export class PlayerObject implements IPlayer {
|
|||||||
sourceFileLvl: (n: number) => number;
|
sourceFileLvl: (n: number) => number;
|
||||||
startGraftAugmentationWork: (augmentationName: string, time: number) => void;
|
startGraftAugmentationWork: (augmentationName: string, time: number) => void;
|
||||||
graftAugmentationWork: (numCycles: number) => boolean;
|
graftAugmentationWork: (numCycles: number) => boolean;
|
||||||
finishGraftAugmentationWork: (cancelled: boolean) => string;
|
finishGraftAugmentationWork: (cancelled: boolean, singularity?: boolean) => string;
|
||||||
applyEntropy: (stacks?: number) => void;
|
applyEntropy: (stacks?: number) => void;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -1364,7 +1364,7 @@ export function craftAugmentationWork(this: IPlayer, numCycles: number): boolean
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function finishGraftAugmentationWork(this: IPlayer, cancelled: boolean): string {
|
export function finishGraftAugmentationWork(this: IPlayer, cancelled: boolean, singularity = false): string {
|
||||||
const augName = this.graftAugmentationName;
|
const augName = this.graftAugmentationName;
|
||||||
if (cancelled === false) {
|
if (cancelled === false) {
|
||||||
applyAugmentation(Augmentations[augName]);
|
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` +
|
`You've finished grafting ${augName}.<br>The augmentation has been applied to your body` +
|
||||||
(this.hasAugmentation(AugmentationNames.CongruityImplant) ? "." : ", but you feel a bit off."),
|
(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.`);
|
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:
|
case CONSTANTS.WorkTypeCrime:
|
||||||
res = this.finishCrime(true);
|
res = this.finishCrime(true);
|
||||||
break;
|
break;
|
||||||
|
case CONSTANTS.WorkTypeGraftAugmentation:
|
||||||
|
res = this.finishGraftAugmentationWork(true, true);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
console.error(`Unrecognized work type (${this.workType})`);
|
console.error(`Unrecognized work type (${this.workType})`);
|
||||||
return "";
|
return "";
|
||||||
|
Loading…
Reference in New Issue
Block a user