fix bladeburner action cancel

This commit is contained in:
Olivier Gagnon 2021-11-12 16:54:34 -05:00
parent 0eec018faf
commit f5d6132dfc
6 changed files with 13 additions and 10 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -4,6 +4,7 @@ import { IBladeburner } from "../IBladeburner";
import { BlackOperation } from "../BlackOperation"; import { BlackOperation } from "../BlackOperation";
import { use } from "../../ui/Context"; import { use } from "../../ui/Context";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
interface IProps { interface IProps {
bladeburner: IBladeburner; bladeburner: IBladeburner;
@ -32,7 +33,7 @@ export function StartButton(props: IProps): React.ReactElement {
if (disabled) return; if (disabled) return;
props.bladeburner.action.type = props.type; props.bladeburner.action.type = props.type;
props.bladeburner.action.name = props.name; props.bladeburner.action.name = props.name;
player.singularityStopWork(); if (!player.hasAugmentation(AugmentationNames.BladesSimulacrum, true)) player.singularityStopWork();
props.bladeburner.startAction(player, props.bladeburner.action); props.bladeburner.startAction(player, props.bladeburner.action);
props.rerender(); props.rerender();
} }

@ -195,7 +195,7 @@ export interface IPlayer {
getUpgradeHomeRamCost(): number; getUpgradeHomeRamCost(): number;
getUpgradeHomeCoresCost(): number; getUpgradeHomeCoresCost(): number;
gotoLocation(to: LocationName): boolean; gotoLocation(to: LocationName): boolean;
hasAugmentation(aug: string | Augmentation): boolean; hasAugmentation(aug: string | Augmentation, installed?: boolean): boolean;
hasCorporation(): boolean; hasCorporation(): boolean;
hasGangWith(facName: string): boolean; hasGangWith(facName: string): boolean;
hasTorRouter(): boolean; hasTorRouter(): boolean;

@ -200,7 +200,7 @@ export class PlayerObject implements IPlayer {
getUpgradeHomeRamCost: () => number; getUpgradeHomeRamCost: () => number;
getUpgradeHomeCoresCost: () => number; getUpgradeHomeCoresCost: () => number;
gotoLocation: (to: LocationName) => boolean; gotoLocation: (to: LocationName) => boolean;
hasAugmentation: (aug: string | Augmentation) => boolean; hasAugmentation: (aug: string | Augmentation, installed?: boolean) => boolean;
hasCorporation: () => boolean; hasCorporation: () => boolean;
hasGangWith: (facName: string) => boolean; hasGangWith: (facName: string) => boolean;
hasTorRouter: () => boolean; hasTorRouter: () => boolean;

@ -5,7 +5,7 @@ import { IPlayer } from "../IPlayer";
import { Augmentation } from "../../Augmentation/Augmentation"; import { Augmentation } from "../../Augmentation/Augmentation";
export function hasAugmentation(this: IPlayer, aug: string | Augmentation): boolean { export function hasAugmentation(this: IPlayer, aug: string | Augmentation, installed = false): boolean {
const augName: string = aug instanceof Augmentation ? aug.name : aug; const augName: string = aug instanceof Augmentation ? aug.name : aug;
for (const owned of this.augmentations) { for (const owned of this.augmentations) {
@ -14,11 +14,13 @@ export function hasAugmentation(this: IPlayer, aug: string | Augmentation): bool
} }
} }
if (!installed) {
for (const owned of this.queuedAugmentations) { for (const owned of this.queuedAugmentations) {
if (owned.name === augName) { if (owned.name === augName) {
return true; return true;
} }
} }
}
return false; return false;
} }