mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-16 06:18:42 +02:00
UI: Improve dev menu for augmentations (#2315)
* UI: Improve dev menu for augmentations The button layout was confusing, there was no quick way to install augs, and uninstalled augs didn't properly lose their stat effects.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Player } from "@player";
|
||||
import React from "react";
|
||||
import { Clear, ExpandMore } from "@mui/icons-material";
|
||||
import { ExpandMore } from "@mui/icons-material";
|
||||
import {
|
||||
AccordionDetails,
|
||||
AccordionSummary,
|
||||
@@ -19,6 +19,7 @@ import { Factions } from "../../Faction/Factions";
|
||||
import { FactionChooser } from "./FactionChooser";
|
||||
import { getFactionAugmentationsFiltered } from "../../Faction/FactionHelpers";
|
||||
import { AutoExpandAccordion } from "../../ui/AutoExpand/AutoExpandAccordion";
|
||||
import { applyAugmentation } from "../../Augmentation/AugmentationHelpers";
|
||||
|
||||
export function AugmentationsDev(): React.ReactElement {
|
||||
const [augmentation, setAugmentation] = React.useState<AugmentationName | null>(null);
|
||||
@@ -63,12 +64,21 @@ export function AugmentationsDev(): React.ReactElement {
|
||||
|
||||
function clearAugs(): void {
|
||||
Player.augmentations = [];
|
||||
Player.reapplyAllAugmentations();
|
||||
Player.reapplyAllSourceFiles();
|
||||
}
|
||||
|
||||
function clearQueuedAugs(): void {
|
||||
Player.queuedAugmentations = [];
|
||||
}
|
||||
|
||||
function installAugs(): void {
|
||||
for (const aug of Player.queuedAugmentations) {
|
||||
applyAugmentation(aug);
|
||||
}
|
||||
Player.queuedAugmentations = [];
|
||||
}
|
||||
|
||||
const options = Object.values(AugmentationName).filter(
|
||||
(augmentationName) =>
|
||||
// NFG is always eligible.
|
||||
@@ -101,13 +111,14 @@ export function AugmentationsDev(): React.ReactElement {
|
||||
setAugmentation(augmentationName);
|
||||
}}
|
||||
></Autocomplete>
|
||||
<Tooltip title="Clear augmentations" style={{ marginLeft: "8px" }}>
|
||||
<Button onClick={clearAugs}>
|
||||
<Clear />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
</Box>
|
||||
<Button onClick={clearQueuedAugs}>Clear queued augmentations</Button>
|
||||
<Button onClick={installAugs} style={{ marginRight: "8px" }}>
|
||||
{`Quick-install ${Player.queuedAugmentations.length} queued augmentations`}
|
||||
</Button>
|
||||
<Button onClick={clearQueuedAugs} style={{ marginRight: "8px" }}>
|
||||
{`Clear ${Player.queuedAugmentations.length} queued augmentations`}
|
||||
</Button>
|
||||
<Button onClick={clearAugs}>{`Uninstall ${Player.augmentations.length} installed augmentations`}</Button>
|
||||
<Box display="flex" marginTop="8px">
|
||||
<Tooltip title="Queue all augmentations offered by faction, except NFG">
|
||||
<Button onClick={queueAllAugsOfFaction}>
|
||||
|
||||
Reference in New Issue
Block a user