Closed okradonkey closed 5 years ago
This is absolutely excellent, thank you very much! The failsafe is perfectly acceptable, especially since there might be more edge cases around creating a site or extending it.
I'll merge it as soon as I get a few minutes, and probably cut a release not long thereafter.
Heh, I was sure there'd be edge cases:
^ While trying to create a new site. Don't worry, I've got this.
Important: Existing saved games with YARM sites try to access etd_minutes before it's set (null ref), so I added a failsafe in time_to_deplete (line 874: "or -1"). With the failsafe, there are no errors, but some sites display "ETD: never" for a few seconds until initialization. This may be better handled in the migration function.
Changes in this pull request: Added sort option for ore count Added sort option for ETD Added custom ETD message: "now" Moved ETD calculation to finish_deposit_count ETD is now accessible as site.etd_minutes etd_minutes value of -1 indicates ETD: Never (no miners depleting ore patch) etd_minutes value of 0 indicates ETD: Now (already completely depleted) ETD comparator sorts the list in proper order: Now .. X minutes .. Never (see comments in comparator function)
Note: I did not write any special code for infinite resources, but I am looking into a more accurate calculation for ETD (really, estimated time to minimum yield). I'll continue work on that in a separate branch soon.