braeven / FS22_A_ProductionRevamp

http://discord.gg/gHmnFZAypk
28 stars 3 forks source link

Autosold outputs of Productions bleed income when the game is loaded from savegame #18

Closed Shad0wlife closed 1 month ago

Shad0wlife commented 1 month ago

This is a basegame bug, but I think this is the right mod to fix it.

ProductionPoint:saveToXMLFile and ProductionPoint:loadFromXMLFile save and load productionCostsToClaim from the savegame XML, so running costs that will be paid at the end of the hour get saved when saving mid hour.

But the soldFillTypesToPayOut table that contains all "sold" products that are "force-sold" (cannot be stored, eg. the Electricity output of the Straw Harvest Pack's Heat Plant) just gets lost.

These soldFillTypesToPayOut only get paid out when ProductionPoint:updateBalaceDirectlySoldOutputs is called and that only happens on the full hour in ProductionChainManager:update when if self.hourChangeUpdating.

This means that (on that production building) if I save and quit and reload at 59minutes of an hour, and have 1 day months, I will lose 0.35 600 EconomyMultiplier = from 210 up to 630 Money. This should also apply to BGAs (at least from the base game, they "sellDirectly" Electricity and Methane), which pay out way more than the little heat plant.

braeven commented 1 month ago

need to test this, but looks good

braeven commented 1 month ago

merged with version 1.5.0.2