mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2025-02-17 02:22:23 +01:00
Fix for AI Cores in smart supply
This commit is contained in:
@ -233,9 +233,9 @@ export function SetSmartSupply(warehouse: Warehouse, smartSupply: boolean): void
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function SetSmartSupplyUseLeftovers(warehouse: Warehouse, material: Material, useLeftover: boolean): void {
|
export function SetSmartSupplyUseLeftovers(warehouse: Warehouse, material: Material, useLeftover: boolean): void {
|
||||||
if (!Object.keys(warehouse.smartSupplyUseLeftovers).includes(material.name))
|
if (!Object.keys(warehouse.smartSupplyUseLeftovers).includes(material.name.replace(/ /g, "")))
|
||||||
throw new Error(`Invalid material '${material.name}'`);
|
throw new Error(`Invalid material '${material.name}'`);
|
||||||
warehouse.smartSupplyUseLeftovers[material.name] = useLeftover;
|
warehouse.smartSupplyUseLeftovers[material.name.replace(/ /g, "")] = useLeftover;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function BuyMaterial(material: Material, amt: number): void {
|
export function BuyMaterial(material: Material, amt: number): void {
|
||||||
|
@ -16,7 +16,7 @@ interface ILeftoverProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Leftover(props: ILeftoverProps): React.ReactElement {
|
function Leftover(props: ILeftoverProps): React.ReactElement {
|
||||||
const [checked, setChecked] = useState(!!props.warehouse.smartSupplyUseLeftovers[props.matName]);
|
const [checked, setChecked] = useState(!!props.warehouse.smartSupplyUseLeftovers[props.matName.replace(/ /g, "")]);
|
||||||
|
|
||||||
function onChange(event: React.ChangeEvent<HTMLInputElement>): void {
|
function onChange(event: React.ChangeEvent<HTMLInputElement>): void {
|
||||||
try {
|
try {
|
||||||
@ -33,7 +33,7 @@ function Leftover(props: ILeftoverProps): React.ReactElement {
|
|||||||
<>
|
<>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={<Switch checked={checked} onChange={onChange} />}
|
control={<Switch checked={checked} onChange={onChange} />}
|
||||||
label={<Typography>{props.warehouse.materials[props.matName].name}</Typography>}
|
label={<Typography>{props.warehouse.materials[props.matName.replace(/ /g, "")].name}</Typography>}
|
||||||
/>
|
/>
|
||||||
<br />
|
<br />
|
||||||
</>
|
</>
|
||||||
|
Reference in New Issue
Block a user