rust-server icon indicating copy to clipboard operation
rust-server copied to clipboard

Use DCS' built-in magnetic declination API

Open rkusa opened this issue 1 year ago • 0 comments

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 avatar Nov 23 '22 13:11 rkusa