From 433a66d530579515bf557ac022e90debdf3bc1ff Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 11 May 2024 09:49:59 +0200 Subject: [PATCH] Airboss - Get magnetic variation from DCS if require is available - Added default magvar for Kola map --- Moose Development/Moose/Ops/Airboss.lua | 6 ++++++ Moose Development/Moose/Utilities/Utils.lua | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Moose Development/Moose/Ops/Airboss.lua b/Moose Development/Moose/Ops/Airboss.lua index 1105fa26f..13ec474c9 100644 --- a/Moose Development/Moose/Ops/Airboss.lua +++ b/Moose Development/Moose/Ops/Airboss.lua @@ -3654,6 +3654,12 @@ function AIRBOSS:onafterStatus( From, Event, To ) local pos = self:GetCoordinate() local speed = self.carrier:GetVelocityKNOTS() + -- Update magnetic variation if we can get it from DCS. + if require then + self.magvar=pos:GetMagneticDeclination() + --env.info(string.format("FF magvar=%.1f", self.magvar)) + end + -- Check water is ahead. local collision = false -- self:_CheckCollisionCoord(pos:Translate(self.collisiondist, hdg)) diff --git a/Moose Development/Moose/Utilities/Utils.lua b/Moose Development/Moose/Utilities/Utils.lua index 9d5f40b94..5d53100e9 100644 --- a/Moose Development/Moose/Utilities/Utils.lua +++ b/Moose Development/Moose/Utilities/Utils.lua @@ -55,6 +55,7 @@ BIGSMOKEPRESET = { -- @field #string MarianaIslands Mariana Islands map. -- @field #string Falklands South Atlantic map. -- @field #string Sinai Sinai map. +-- @field #string Kola Kola map. DCSMAP = { Caucasus="Caucasus", NTTR="Nevada", @@ -64,7 +65,8 @@ DCSMAP = { Syria="Syria", MarianaIslands="MarianaIslands", Falklands="Falklands", - Sinai="SinaiMap" + Sinai="SinaiMap", + Kola="Kola" } @@ -1703,6 +1705,7 @@ end -- * Mariana Islands +2 (East) -- * Falklands +12 (East) - note there's a LOT of deviation across the map, as we're closer to the South Pole -- * Sinai +4.8 (East) +-- * Kola +15 (East) - not there is a lot of deviation across the map (-1° to +24°), as we are close to the North pole -- @param #string map (Optional) Map for which the declination is returned. Default is from env.mission.theatre -- @return #number Declination in degrees. function UTILS.GetMagneticDeclination(map) @@ -1729,6 +1732,8 @@ function UTILS.GetMagneticDeclination(map) declination=12 elseif map==DCSMAP.Sinai then declination=4.8 + elseif map==DCSMAP.Kola then + declination=15 else declination=0 end