fix: kæden respekterer spillerens valg af udgangsfordeling (v1.62.53)
This commit is contained in:
@@ -242,6 +242,11 @@ end
|
||||
|
||||
-- Slutprodukter: sælg straks (fabrikkens udgang -> "Sælg direkte"), medmindre kæden står på "Behold". Varer kæden
|
||||
-- selv satte til salg, sættes tilbage til "Behold", når spilleren vælger det.
|
||||
-- Har spilleren skiftet en udgang væk fra "Sælg direkte", som kæden selv satte? -> true = respektér det
|
||||
function ADChainRun.userOverrodeSale(setByChain, notSellingNow)
|
||||
return setByChain == true and notSellingNow == true
|
||||
end
|
||||
|
||||
local function outputMode(point, fillIndex)
|
||||
if point.getOutputDistributionMode == nil then return nil end
|
||||
local ok, mode = pcall(point.getOutputDistributionMode, point, fillIndex)
|
||||
@@ -257,8 +262,16 @@ function ADChainRun.applyFinalSales(data, chain, edges)
|
||||
local id = sale.key .. "|" .. sale.fillType
|
||||
wanted[id] = true
|
||||
local entry, fillIndex = (data.points or {})[sale.key], data.fillIndex[sale.fillType]
|
||||
if entry ~= nil and entry.point ~= nil and fillIndex ~= nil and entry.point.setOutputDistributionMode ~= nil
|
||||
and outputMode(entry.point, fillIndex) ~= ProductionPoint.OUTPUT_MODE.DIRECT_SELL then
|
||||
local current = entry ~= nil and entry.point ~= nil and fillIndex ~= nil and outputMode(entry.point, fillIndex) or nil
|
||||
if ADChainRun.userOverrodeSale(state.soldByChain[id] == true, current ~= nil and current ~= ProductionPoint.OUTPUT_MODE.DIRECT_SELL) then
|
||||
-- kæden satte den til salg, og spilleren har skiftet den væk igen: spillerens valg gælder (in-game 6/10:
|
||||
-- TMR-fabrikken blev sat tilbage til Sælg to gange, men TMR'en skal til køerne)
|
||||
state.finalKeep[sale.key] = true
|
||||
state.soldByChain[id] = nil
|
||||
wanted[id] = nil
|
||||
log("slutprodukt %s i %s: spilleren valgte ikke at sælge — beholdes fremover", tostring(sale.fillType), tostring(entry.buildingName or sale.key))
|
||||
elseif entry ~= nil and entry.point ~= nil and fillIndex ~= nil and entry.point.setOutputDistributionMode ~= nil
|
||||
and current ~= ProductionPoint.OUTPUT_MODE.DIRECT_SELL then
|
||||
entry.point:setOutputDistributionMode(fillIndex, ProductionPoint.OUTPUT_MODE.DIRECT_SELL)
|
||||
state.soldByChain[id] = true
|
||||
changed = changed + 1
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<modDesc descVersion="107">
|
||||
<author>masterdraco</author>
|
||||
<version>1.62.52.0</version>
|
||||
<version>1.62.53.0</version>
|
||||
<title>
|
||||
<en>AD Smart Pickup</en>
|
||||
</title>
|
||||
|
||||
Reference in New Issue
Block a user