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

Use DCS' built-in magnetic declination API #197

Open
rkusa opened this issue Nov 23, 2022 · 0 comments
Open

Use DCS' built-in magnetic declination API #197

rkusa opened this issue Nov 23, 2022 · 0 comments
Labels
good first issue Good for newcomers

Comments

@rkusa
Copy link
Collaborator

rkusa commented Nov 23, 2022

Before 2.8, DCS did not have an API to retrieve the magnetic variation at a coordinate. Since 2.8 (might have also been available before, just unknown), there is finally one.
Our current implementation calculates the magvar outside of DCS based on the International Geomagnetic Reference Field (IGRF). The result is very close to what DCS calculates, but can now be replaced by the new API provided with DCS 2.8:

local magvar = require('magvar')
magvar.get_mag_decl(lat, lon)

For some more details around the API, see:
https://discord.com/channels/696721363276267590/911042786122399824/1041889659174793256

Necessary changes:

  • Move the API out of the custom service into another more fitting one (hook maybe? 🤷‍♂️)
  • Replace the implementation with a call into Lua that executes the snippet mentioned above
  • Remove the igrf dependency
@rkusa rkusa added the good first issue Good for newcomers label Nov 23, 2022
@rkusa rkusa changed the title Use DCS' built-in magnetic declination Use DCS' built-in magnetic declination API Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant