Adjustment of time definitions to account for non-standard system scales.#5
Adjustment of time definitions to account for non-standard system scales.#5jmrd98 wants to merge 6 commits intoAngel-125:masterfrom
Conversation
| // return 360; | ||
| //else | ||
| // return 1440; | ||
| return KSPUtil.dateTimeFormatter.Day; |
There was a problem hiding this comment.
| return KSPUtil.dateTimeFormatter.Day; | |
| return KSPUtil.dateTimeFormatter.Day / 10; |
The previous numbers look to be a tenth of a Day, could use a var here
There was a problem hiding this comment.
This may need author input; the series of settings are in order of increasing duration in minutes, with the change intended to fill in for a whole day. I'm not sure what you mean about a tenth of a day?
There was a problem hiding this comment.
Sorry mate I got my maths wrong, its not a fraction of a day like I thought - too many thoughts, not enough brain cells
Snacks/Utilities/WindowUtils.cs
Outdated
| const double MINUTES_PER_HOUR = 60.0; | ||
| static double HOURS_PER_DAY = (GameSettings.KERBIN_TIME) ? 6.0 : 24.0; | ||
| static double HOURS_PER_DAY = KSPUtil.dateTimeFormatter.Day / 3600; // (GameSettings.KERBIN_TIME) ? 6.0 : 24.0; | ||
| public static double SECONDS_PER_DAY = SECONDS_PER_MINUTE*MINUTES_PER_HOUR*HOURS_PER_DAY; |
There was a problem hiding this comment.
You could property this one too to return KSPUtil.dateTimeFormatter.Day
|
@jmrd98 : Added some suggestions for you, see what you think |
|
@TriggerAu Thanks very much, I very much appreciate the hints. The individual comments covered it for the most part. I broadly agree with your suggestions, I just didn't know enough C# to make them comfortably. My basic goal was to make minimal adjustments (less things to break ;) ) but these all seem reasonable/minimal as well. I was about to say I wont' have a chance to look at this until the weekend, but apparently I can commit them from github... wonders never cease. It will still be until the weekend until I can give it a proper test, at least. |
Co-Authored-By: jmrd98 <komodo9000+github@gmail.com>
Co-Authored-By: jmrd98 <komodo9000+github@gmail.com>
Co-Authored-By: jmrd98 <komodo9000+github@gmail.com>
Co-Authored-By: jmrd98 <komodo9000+github@gmail.com>
Hi. When using either a non-stock system or a rescaled system, it is common to use the Kronometer mod in conjunction with Kopernicus. The rescaled systems typically result in a day/year length that differs from either the 24/365 or 6/426.08 scales.
This patch changes the encoded references for a day/year length from being hard coded to being picked up from the KSPUtil.dateTimeFormatter method. This returns either of the standard lengths in a stock game, and this method is overloaded by Kronometer to return the correct values for a rescaled system. Credit due to @Aelfhe1m and @TriggerAu for similar patches to KerbalAlarmClock and TransferWindowPlanner for leading me in the right direction.
The expected results are that both SnacksPerDay and the estimated remaining snacks display reflect the actual length of the day in the system being used.
I have tested the changes on my system and it appears to be working, but I am not very proficient in C#/Unity and would like your opinion on the changes. Thanks much, I really enjoy using your mods!