mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-18 20:25:45 +01:00
SINGULARITY: Allow being hospitalized while being busy (#1426)
This commit is contained in:
parent
48bebeea2b
commit
c0036b03d4
@ -611,11 +611,7 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
|||||||
},
|
},
|
||||||
hospitalize: (ctx) => () => {
|
hospitalize: (ctx) => () => {
|
||||||
helpers.checkSingularityAccess(ctx);
|
helpers.checkSingularityAccess(ctx);
|
||||||
if (Player.currentWork || Router.page() === Page.Infiltration || Router.page() === Page.BitVerse) {
|
Player.hospitalize(true);
|
||||||
helpers.log(ctx, () => "Cannot go to the hospital because the player is busy.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Player.hospitalize();
|
|
||||||
},
|
},
|
||||||
isBusy: (ctx) => () => {
|
isBusy: (ctx) => () => {
|
||||||
helpers.checkSingularityAccess(ctx);
|
helpers.checkSingularityAccess(ctx);
|
||||||
|
@ -256,19 +256,20 @@ export function takeDamage(this: PlayerObject, amt: number): boolean {
|
|||||||
|
|
||||||
this.hp.current -= amt;
|
this.hp.current -= amt;
|
||||||
if (this.hp.current <= 0) {
|
if (this.hp.current <= 0) {
|
||||||
this.hospitalize();
|
this.hospitalize(false);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function hospitalize(this: PlayerObject): number {
|
export function hospitalize(this: PlayerObject, suppressNotification: boolean): number {
|
||||||
const cost = getHospitalizationCost();
|
const cost = getHospitalizationCost();
|
||||||
SnackbarEvents.emit(`You've been Hospitalized for ${formatMoney(cost)}`, ToastVariant.SUCCESS, 2000);
|
|
||||||
|
|
||||||
this.loseMoney(cost, "hospitalization");
|
this.loseMoney(cost, "hospitalization");
|
||||||
this.hp.current = this.hp.max;
|
this.hp.current = this.hp.max;
|
||||||
|
if (!suppressNotification) {
|
||||||
|
SnackbarEvents.emit(`You've been Hospitalized for ${formatMoney(cost)}`, ToastVariant.SUCCESS, 2000);
|
||||||
|
}
|
||||||
return cost;
|
return cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user