Merge pull request #2809 from pd/corp-api-leftovers

Corp API: Add setSmartSupplyUseLeftovers
This commit is contained in:
hydroflame 2022-01-26 00:31:58 -05:00 committed by GitHub
commit 13453e678f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 0 deletions

@ -49,6 +49,7 @@ import {
SetMaterialMarketTA2, SetMaterialMarketTA2,
SetProductMarketTA1, SetProductMarketTA1,
SetProductMarketTA2, SetProductMarketTA2,
SetSmartSupplyUseLeftovers,
} from "../Corporation/Actions"; } from "../Corporation/Actions";
import { CorporationUnlockUpgrades } from "../Corporation/data/CorporationUnlockUpgrades"; import { CorporationUnlockUpgrades } from "../Corporation/data/CorporationUnlockUpgrades";
import { CorporationUpgrades } from "../Corporation/data/CorporationUpgrades"; import { CorporationUpgrades } from "../Corporation/data/CorporationUpgrades";
@ -410,6 +411,16 @@ export function NetscriptCorporation(
const warehouse = getWarehouse(divisionName, cityName); const warehouse = getWarehouse(divisionName, cityName);
SetSmartSupply(warehouse, enabled); SetSmartSupply(warehouse, enabled);
}, },
setSmartSupplyUseLeftovers: function (adivisionName: any, acityName: any, amaterialName: any, aenabled: any): void {
checkAccess("setSmartSupplyUseLeftovers", 7);
const divisionName = helper.string("setSmartSupply", "divisionName", adivisionName);
const cityName = helper.string("sellProduct", "cityName", acityName);
const materialName = helper.string("sellProduct", "materialName", amaterialName);
const enabled = helper.boolean(aenabled);
const warehouse = getWarehouse(divisionName, cityName);
const material = getMaterial(divisionName, cityName, materialName);
SetSmartSupplyUseLeftovers(warehouse, material, enabled);
},
buyMaterial: function (adivisionName: any, acityName: any, amaterialName: any, aamt: any): void { buyMaterial: function (adivisionName: any, acityName: any, amaterialName: any, aamt: any): void {
checkAccess("buyMaterial", 7); checkAccess("buyMaterial", 7);
const divisionName = helper.string("buyMaterial", "divisionName", adivisionName); const divisionName = helper.string("buyMaterial", "divisionName", adivisionName);

@ -6255,6 +6255,14 @@ export interface WarehouseAPI {
* @param enabled - smart supply enabled * @param enabled - smart supply enabled
*/ */
setSmartSupply(divisionName: string, cityName: string, enabled: boolean): void; setSmartSupply(divisionName: string, cityName: string, enabled: boolean): void;
/**
* Set whether smart supply uses leftovers before buying
* @param divisionName - Name of the division
* @param cityName - Name of the city
* @param materialName - Name of the material
* @param enabled - smart supply use leftovers enabled
*/
setSmartSupplyUseLeftovers(divisionName: string, cityName: string, materialName: string, enabled: boolean): void;
/** /**
* Set material buy data * Set material buy data
* @param divisionName - Name of the division * @param divisionName - Name of the division