brandon-ray / foxhole-facility-planner

Create blueprints for a bunker, facility, and more using this fan-made tool for the video game Foxhole. Formerly known as Foxhole Facility Planner, this tool now features facilities, bunkers, trenches, and more!
https://foxholeplanner.com
MIT License
37 stars 12 forks source link

Rounding down error fix #11

Closed AlecWhite closed 2 years ago

AlecWhite commented 2 years ago

Hopefully fixes https://github.com/brandon-ray/foxhole-facility-planner/issues/10 and any other non-1-hour interval for accuracy's sake. Ideally it would need truncation of display value.

brandon-ray commented 2 years ago

Hey thanks so much for the PR! I realized though that the math for the calculations is correct as it is currently and they were mistaken. We do actually need to round down. I'll paste what I wrote there to the other person:

"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.