Closed Leif-The-Head closed 2 years ago
For rounding the displayed values, you can do so from here, but I'd suggest to only truncate to two decimals: https://github.com/brandon-ray/foxhole-facility-planner/blob/master/public/menu/components/buildMenu.js#L396
Hey thanks, feel free to make a PR
Feel free to keep a planner with wrong calculations, I already pointed out the exact spot where it goes wrong, you have the workspaces set up to literally delete a snippet and push a single button.
Actually I think your math is off because of how the game works: "Instead take a cracking unit, which has a cycle time of 160s, which would be 22.5 cycles per hour, and it calculates only 22 cycles ... I think you get the issue, the rounding shouldn't be there at all."
If there are 22.5 cycles per hour, the .5 is not completed yet so if we added that to the calculation its actual output will not be for another 80 seconds. The amount produced does not increase as the time does, all of the actual "resource creations" happens at the end of the 160s. If it was incremental and made that amount over time that would make sense, but with how the game handles production the math is correct as is.
I don't know why you came up with "let's round the value of production cycles per time unit down" (even at all), but it's a huge oversight as it just throws off the numbers completely. Let me put a brief example: A refinery making petrol from oil will show up as producing/consuming
0 per minute
because the production cycle is 150s, and if you try to divide 60 by 150 and round that down, that is simply 0. Same is for oil wells, where 60 by 50 would be 1.2, but it's rounded down to 1, so it shows as50 per minute
despite actually being 60. For both the value shows correctly for 1 hour, because 3600 is nicely divided by both 150 and 50 to clean values of 24 and 72 respectively, which do not need any rounding thus calculate correctly. Instead take a cracking unit, which has a cycle time of 160s, which would be 22.5 cycles per hour, and it calculates only 22 cycles ... I think you get the issue, the rounding shouldn't be there at all. https://github.com/brandon-ray/foxhole-facility-planner/blob/072f4d83644fde5cc574f2454a494d70cb5c7c3b/public/menu/components/buildMenu.js#L345