Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Patch: Fix Planetarium.GetUniversalTime() in editor #155

Closed
NathanKell opened this issue Jul 3, 2023 · 2 comments
Closed

New Patch: Fix Planetarium.GetUniversalTime() in editor #155

NathanKell opened this issue Jul 3, 2023 · 2 comments

Comments

@NathanKell
Copy link
Contributor

GetUniversalTime is supposed to detect when it's invalid and return HighLogic.CurrentGame.UniversalTime but at some point Planetarium started running in the editor which means its check for fetch == null returns false, so it still tries to get UT from its instance. But the instance has the UT from before the last revert, rather than from the current game.

Fix: Make the check fetch == null || HighLogic.LoadedSceneIsEditor. RP-1 has used this check for a long time (with its own wrapper for GetUniversalTime) and it's been fine, but there's plenty of code--including stock code--that assumes GetUniversalTime is correct.

Brought to my attention by KSP-RO/RP-1#2067 (because StrategySystem's Update runs in the editor, because of course it does).

@NathanKell
Copy link
Contributor Author

NathanKell commented Jul 3, 2023

Update: Gonna ship this patch in RP-1 and let it bake for a week or two before making it in KSPCF. @gotmachine can do it as a transpiler when he has time, I'm just gonna prefix.

KSP-RO/RP-1@b8ef7ba

@NathanKell
Copy link
Contributor Author

Fixed in e756eb2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant