mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-27 00:17:32 +01:00
Fix for AI Cores in smart supply
This commit is contained in:
parent
6ee291e0b3
commit
bd20f16a2d
@ -233,9 +233,9 @@ export function SetSmartSupply(warehouse: Warehouse, smartSupply: 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}'`);
|
||||
warehouse.smartSupplyUseLeftovers[material.name] = useLeftover;
|
||||
warehouse.smartSupplyUseLeftovers[material.name.replace(/ /g, "")] = useLeftover;
|
||||
}
|
||||
|
||||
export function BuyMaterial(material: Material, amt: number): void {
|
||||
|
@ -16,7 +16,7 @@ interface ILeftoverProps {
|
||||
}
|
||||
|
||||
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 {
|
||||
try {
|
||||
@ -33,7 +33,7 @@ function Leftover(props: ILeftoverProps): React.ReactElement {
|
||||
<>
|
||||
<FormControlLabel
|
||||
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 />
|
||||
</>
|
||||
|
Loading…
Reference in New Issue
Block a user