From 1f08724fea5413d4166b144c7cd0621f1f6fc675 Mon Sep 17 00:00:00 2001 From: gmcew <97335456+gmcew@users.noreply.github.com> Date: Mon, 3 Jun 2024 02:01:03 +0100 Subject: [PATCH] CORP: Products sell all at price of 0 (#1330) Match material behaviour - price of 0 discards stored products --- src/Corporation/Division.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Corporation/Division.ts b/src/Corporation/Division.ts index ccc6e6d45..ebf00a409 100644 --- a/src/Corporation/Division.ts +++ b/src/Corporation/Division.ts @@ -925,6 +925,8 @@ export class Division { if (sCost - product.cityData[city].productionCost > markupLimit) { markup = markupLimit / (sCost - product.cityData[city].productionCost); } + } else if (sCost <= 0) { + markup = 1e12; //Sell everything, essentially discard - as materials } product.maxSellAmount = @@ -939,7 +941,7 @@ export class Division { sellAmt = Math.min(product.maxSellAmount, sellAmt); sellAmt = sellAmt * corpConstants.secondsPerMarketCycle * marketCycles; sellAmt = Math.min(product.cityData[city].stored, sellAmt); //data[0] is qty - if (sellAmt && sCost) { + if (sellAmt && sCost >= 0) { product.cityData[city].stored -= sellAmt; //data[0] is qty totalProfit += sellAmt * sCost; product.cityData[city].actualSellAmount = sellAmt / (corpConstants.secondsPerMarketCycle * marketCycles); //data[2] is sell property