Skip to content

Commit

Permalink
Merge pull request #30 from chump29/main
Browse files Browse the repository at this point in the history
Added Ka-50 and SA342 variants
  • Loading branch information
rkusa authored Sep 4, 2022
2 parents ca59e1f + 891a031 commit fb07b75
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions Scripts/Hooks/scratchpad-hook.lua
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,13 @@ local function loadScratchpad()
end

function formatCoord(format, isLat, d, opts)
local function showNegative(d, h)
if h == "S" or h == "W" then
d = -d
end
return d, ""
end

if type(opts) ~= "table" then
opts = {}
end
Expand Down Expand Up @@ -259,16 +266,19 @@ local function loadScratchpad()
if opts.precision ~= nil then
precision = opts.precision
end
if opts.showNegative ~= nil then
g, h = showNegative(g, h)
end
local degreesWidth = 2
if opts.lonDegreesWidth ~= nil and not isLat then
degreesWidth = opts.lonDegreesWidth
if opts.showNegative ~= nil and g < 0 then
degreesWidth = degreesWidth + 1
end
end
return string.format('%s %0'..degreesWidth..'d°%0'..(precision+3)..'.'..precision..'f\'', h, g, m)
else -- Decimal Degrees
if h == "S" or h == "W" then
d = -d
end
return string.format('%f',d)
return string.format('%f', showNegative(d, h))
end
end

Expand All @@ -290,6 +300,10 @@ local function loadScratchpad()
return {DDM = {lonDegreesWidth = 3}, MGRS = true}
elseif ac == "AH-64D_BLK_II" then
return {DDM = {precision = 2, lonDegreesWidth = 3}, MGRS = true}
elseif ac == "Ka-50" then
return {DDM = {precision = 1, lonDegreesWidth = 3, showNegative = true}}
elseif ac == "SA342M" or ac == "SA342L" or ac == "SA342Mistral" or ac == "SA342Minigun" then
return {DDM = {precision = 1}}
else
return {NS430 = true, DMS = true, DDM = true, MGRS = true}
end
Expand Down

0 comments on commit fb07b75

Please sign in to comment.