mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-22 15:43:49 +01:00
Update exportMaterial amount to number | string (#583)
This commit is contained in:
parent
c67f32cdc1
commit
cc5247ac89
@ -15,7 +15,7 @@ exportMaterial(
|
|||||||
targetDivision: string,
|
targetDivision: string,
|
||||||
targetCity: CityName | `${CityName}`,
|
targetCity: CityName | `${CityName}`,
|
||||||
materialName: string,
|
materialName: string,
|
||||||
amt: number,
|
amt: number | string,
|
||||||
): void;
|
): void;
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ exportMaterial(
|
|||||||
| targetDivision | string | Target division |
|
| targetDivision | string | Target division |
|
||||||
| targetCity | [CityName](./bitburner.cityname.md) \| \`${[CityName](./bitburner.cityname.md)<!-- -->}\` | Target city |
|
| targetCity | [CityName](./bitburner.cityname.md) \| \`${[CityName](./bitburner.cityname.md)<!-- -->}\` | Target city |
|
||||||
| materialName | string | Name of the material |
|
| materialName | string | Name of the material |
|
||||||
| amt | number | Amount of material to export. |
|
| amt | number \| string | Amount of material to export. |
|
||||||
|
|
||||||
**Returns:**
|
**Returns:**
|
||||||
|
|
||||||
|
@ -478,7 +478,7 @@ Attempted export amount: ${amount}`);
|
|||||||
let sanitizedAmt = amount.replace(/\s+/g, "").toUpperCase();
|
let sanitizedAmt = amount.replace(/\s+/g, "").toUpperCase();
|
||||||
sanitizedAmt = sanitizedAmt.replace(/[^-()\d/*+.MAXEPRODINV]/g, "");
|
sanitizedAmt = sanitizedAmt.replace(/[^-()\d/*+.MAXEPRODINV]/g, "");
|
||||||
for (const testReplacement of ["(1.23)", "(-1.23)"]) {
|
for (const testReplacement of ["(1.23)", "(-1.23)"]) {
|
||||||
const replaced = sanitizedAmt.replace(/(IPROD|EPROD|IINV|EINV)/g, testReplacement);
|
const replaced = sanitizedAmt.replace(/(MAX|IPROD|EPROD|IINV|EINV)/g, testReplacement);
|
||||||
let evaluated, error;
|
let evaluated, error;
|
||||||
try {
|
try {
|
||||||
evaluated = eval(replaced);
|
evaluated = eval(replaced);
|
||||||
|
2
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
2
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -7084,7 +7084,7 @@ export interface WarehouseAPI {
|
|||||||
targetDivision: string,
|
targetDivision: string,
|
||||||
targetCity: CityName | `${CityName}`,
|
targetCity: CityName | `${CityName}`,
|
||||||
materialName: string,
|
materialName: string,
|
||||||
amt: number,
|
amt: number | string,
|
||||||
): void;
|
): void;
|
||||||
/**
|
/**
|
||||||
* Cancel material export
|
* Cancel material export
|
||||||
|
Loading…
Reference in New Issue
Block a user