From cc0fd197c54bb88abd464d2e3d0df0828e15d6ba Mon Sep 17 00:00:00 2001 From: Rasmoh <34008313+Rasmoh@users.noreply.github.com> Date: Mon, 5 Sep 2022 17:25:32 -0700 Subject: [PATCH] Expose exports from Material --- src/NetscriptFunctions/Corporation.ts | 4 ++++ src/ScriptEditor/NetscriptDefinitions.d.ts | 17 ++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/NetscriptFunctions/Corporation.ts b/src/NetscriptFunctions/Corporation.ts index 54ceab96a..160eef5ee 100644 --- a/src/NetscriptFunctions/Corporation.ts +++ b/src/NetscriptFunctions/Corporation.ts @@ -360,6 +360,9 @@ export function NetscriptCorporation(): InternalAPI { const materialName = helpers.string(ctx, "materialName", _materialName); const material = getMaterial(divisionName, cityName, materialName); const corporation = getCorporation(); + const exports = material.exp.map((e) => { + return { div: e.ind, loc: e.city, amt: e.amt }; + }); return { cost: material.bCost, sCost: material.sCost, @@ -370,6 +373,7 @@ export function NetscriptCorporation(): InternalAPI { cmp: corporation.unlockUpgrades[3] ? material.cmp : undefined, prod: material.prd, sell: material.sll, + exp: exports, }; }, getProduct: diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index f94f89537..195300537 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -7211,10 +7211,25 @@ interface Material { prod: number; /** Amount of material sold */ sell: number; - /** cost to buy material */ + /** Cost to buy material */ cost: number; /** Sell cost, can be "MP+5" */ sCost: string | number; + /** Export orders */ + exp: Export[]; +} + +/** + * Export order for a material + * @public + */ +interface Export { + /** Division the material is being exported to */ + div: string; + /** City the material is being exported to */ + loc: string; + /** Amount of material exported */ + amt: string; } /**