From 8ed30da47308ef775b984701c1f31f89002d4315 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Tue, 8 Nov 2022 15:43:14 +0100 Subject: [PATCH] * POINT/PLAYERTASK * Added option to get BR/BRA with add'l magnetic heading --- Moose Development/Moose/Ops/PlayerTask.lua | 31 ++++++++++++++++++---- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/Moose Development/Moose/Ops/PlayerTask.lua b/Moose Development/Moose/Ops/PlayerTask.lua index 3bb7927f4..69327de47 100644 --- a/Moose Development/Moose/Ops/PlayerTask.lua +++ b/Moose Development/Moose/Ops/PlayerTask.lua @@ -922,6 +922,7 @@ do -- @field Ops.PlayerRecce#PLAYERRECCE PlayerRecce -- @field #number Coalition -- @field Core.Menu#MENU_MISSION MenuParent +-- @field #boolean ShowMagnetic Also show magnetic angles -- @extends Core.Fsm#FSM --- @@ -1234,6 +1235,7 @@ PLAYERTASKCONTROLLER = { PlayerRecce = nil, Coalition = nil, MenuParent = nil, + ShowMagnetic = true, } --- @@ -1400,7 +1402,7 @@ PLAYERTASKCONTROLLER.Messages = { --- PLAYERTASK class version. -- @field #string version -PLAYERTASKCONTROLLER.version="0.1.45" +PLAYERTASKCONTROLLER.version="0.1.46" --- Create and run a new TASKCONTROLLER instance. -- @param #PLAYERTASKCONTROLLER self @@ -1456,6 +1458,8 @@ function PLAYERTASKCONTROLLER:New(Name, Coalition, Type, ClientFilter) self.CallsignTranslations = nil self.noflaresmokemenu = false + + self.ShowMagnetic = true if ClientFilter then self.ClientSet = SET_CLIENT:New():FilterCoalitions(string.lower(self.CoalitionName)):FilterActive(true):FilterPrefixes(ClientFilter):FilterStart() @@ -2016,6 +2020,20 @@ function PLAYERTASKCONTROLLER:SwitchUseGroupNames(OnOff) return self end +--- [User] Switch showing additional magnetic angles +-- @param #PLAYERTASKCONTROLLER self +-- @param #boolean OnOff If true, set to on (default), if nil or false, set to off +-- @return #PLAYERTASKCONTROLLER self +function PLAYERTASKCONTROLLER:SwitchMagenticAngles(OnOff) + self:T(self.lid.."SwitchMagenticAngles") + if OnOff then + self.ShowMagnetic = true + else + self.ShowMagnetic = false + end + return self +end + --- [Internal] Get task types for the menu -- @param #PLAYERTASKCONTROLLER self -- @return #table TaskTypes @@ -2681,9 +2699,9 @@ function PLAYERTASKCONTROLLER:_FlashInfo() local Coordinate = task.Target:GetCoordinate() local CoordText = "" if self.Type ~= PLAYERTASKCONTROLLER.Type.A2A then - CoordText = Coordinate:ToStringA2G(_client) + CoordText = Coordinate:ToStringA2G(_client, nil, self.ShowMagnetic) else - CoordText = Coordinate:ToStringA2A(_client) + CoordText = Coordinate:ToStringA2A(_client, nil, self.ShowMagnetic) end local targettxt = self.gettext:GetEntry("TARGET",self.locale) local text = "Target: "..CoordText @@ -2716,9 +2734,9 @@ function PLAYERTASKCONTROLLER:_ActiveTaskInfo(Group, Client, Task) local Coordinate = task.Target:GetCoordinate() local CoordText = "" if self.Type ~= PLAYERTASKCONTROLLER.Type.A2A then - CoordText = Coordinate:ToStringA2G(Client) + CoordText = Coordinate:ToStringA2G(Client,nil,self.ShowMagnetic) else - CoordText = Coordinate:ToStringA2A(Client) + CoordText = Coordinate:ToStringA2A(Client,nil,self.ShowMagnetic) end -- Threat Level local ThreatLevel = task.Target:GetThreatLevelMax() @@ -2822,6 +2840,9 @@ function PLAYERTASKCONTROLLER:_ActiveTaskInfo(Group, Client, Task) if string.find(CoordText," BR, ") then CoordText = string.gsub(CoordText," BR, "," Bee, Arr, ") end + if self.ShowMagnetic then + text=string.gsub(text,"°M|","° magnetic, ") + end local ThreatLocaleTextTTS = self.gettext:GetEntry("THREATTEXTTTS",self.locale) local ttstext = string.format(ThreatLocaleTextTTS,self.MenuName or self.Name,ttsplayername,ttstaskname,ThreatLevelText, targets, CoordText) -- POINTERTARGETLASINGTTS = ". Pointer over target and lasing."