duck-dynasty / duckbot

A Discord bot for personal friend group
GNU General Public License v3.0
9 stars 10 forks source link

🐛 fix double counting of raw resources in factory summary #1007

Closed twentylemon closed 6 days ago

twentylemon commented 6 days ago
Summary

Currently the factory output "double counts" raw resources when they are also produced by non-raw-resource-recipes, most notably water, but also with conversion recipes since they produce raw resources.

Tested with a factory producing 10 aluminium ingots using All recipe bank. Solution includes,

Bauxite#Copper
0.0833 Converter
0.8333 ReanimatedSam + 15.0 CopperOre -> 10.0 Bauxite
CopperOre
0.25 Miner
-> 15.0 CopperOre
CrudeOil
0.0083 OilExtractor
-> 1.0 CrudeOil
ElectrodeAluminumScrap
0.0667 Refinery
12.0 AluminaSolution + 4.0 PetroleumCoke -> 20.0 AluminumScrap + 7.0 Water
Sam
0.0556 Miner
-> 3.3333 Sam
Water
0.025 WaterExtractor
-> 3.0 Water

old, note only 3 water is actually produced, and bauxite is created by combining copper+sam

10.0 Bauxite + 15.0 CopperOre + 1.0 CrudeOil + 3.3333 Sam + 10.0 Water -> 10.0 AluminumIngot + 0.6667 PolymerResin

new:

15.0 CopperOre + 1.0 CrudeOil + 3.3333 Sam + 3.0 Water -> 10.0 AluminumIngot + 0.6667 PolymerResin

There's no tests for things in pretty, just manual testing.

Checklist
codecov[bot] commented 6 days ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 96.53%. Comparing base (b6e4d4c) to head (14315d3). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1007 +/- ## ======================================= Coverage 96.53% 96.53% ======================================= Files 95 95 Lines 2251 2251 Branches 168 168 ======================================= Hits 2173 2173 Misses 67 67 Partials 11 11 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.


🚨 Try these New Features:

twentylemon commented 6 days ago

Good catch. How did you do to discover this?

Water is usually the last recipe in the factory. Just noticed at some point that it didn't match the summary for aluminium.