From 7e12a48a8ad1ce3adebceadfdfb2a5e0d2512b77 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Tue, 18 Oct 2022 16:55:54 +0200 Subject: [PATCH] #Ops - various fixes --- Moose Development/Moose/Ops/CSAR.lua | 42 ++++++++++++++++------ Moose Development/Moose/Ops/PlayerTask.lua | 4 +-- 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/Moose Development/Moose/Ops/CSAR.lua b/Moose Development/Moose/Ops/CSAR.lua index d5abb33e8..511fc7929 100644 --- a/Moose Development/Moose/Ops/CSAR.lua +++ b/Moose Development/Moose/Ops/CSAR.lua @@ -1210,6 +1210,24 @@ function CSAR:_RemoveNameFromDownedPilots(name,force) return found end +--- [User] Set callsign options for TTS output. See @{Wrapper.Group#GROUP.GetCustomCallSign}() on how to set customized callsigns. +-- @param #CSAR self +-- @param #boolean ShortCallsign If true, only call out the major flight number +-- @param #boolean Keepnumber If true, keep the **customized callsign** in the #GROUP name for players as-is, no amendments or numbers. +-- @param #table CallsignTranslations (optional) Table to translate between DCS standard callsigns and bespoke ones. Does not apply if using customized +-- callsigns from playername or group name. +-- @return #CSAR self +function CSAR:SetCallSignOptions(ShortCallsign,Keepnumber,CallsignTranslations) + if not ShortCallsign or ShortCallsign == false then + self.ShortCallsign = false + else + self.ShortCallsign = true + end + self.Keepnumber = Keepnumber or false + self.CallsignTranslations = CallsignTranslations + return self +end + --- (Internal) Check if a name is in downed pilot table and remove it. -- @param #CSAR self -- @param #string UnitName @@ -1219,7 +1237,7 @@ function CSAR:_GetCustomCallSign(UnitName) local unit = UNIT:FindByName(UnitName) if unit and unit:IsAlive() then local group = unit:GetGroup() - callsign = group:GetCustomCallSign(true,true) + callsign = group:GetCustomCallSign(self.ShortCallsign,self.Keepnumber,self.CallsignTranslations) end return callsign end @@ -1791,7 +1809,7 @@ function CSAR:_SignalFlare(_unitName) else _distance = string.format("%.1fkm",_closest.distance) end - local _msg = string.format("%s - Popping signal flare at your %s o\'clock. Distance %s", _unitName, _clockDir, _distance) + local _msg = string.format("%s - Popping signal flare at your %s o\'clock. Distance %s", self:_GetCustomCallSign(_unitName), _clockDir, _distance) self:_DisplayMessageToSAR(_heli, _msg, self.messageTime, false, true, true) local _coord = _closest.pilot:GetCoordinate() @@ -1845,7 +1863,7 @@ function CSAR:_Reqsmoke( _unitName ) else _distance = string.format("%.1fkm",_closest.distance/1000) end - local _msg = string.format("%s - Popping smoke at your %s o\'clock. Distance %s", _unitName, _clockDir, _distance) + local _msg = string.format("%s - Popping smoke at your %s o\'clock. Distance %s", self:_GetCustomCallSign(_unitName), _clockDir, _distance) self:_DisplayMessageToSAR(_heli, _msg, self.messageTime, false, true, true) local _coord = _closest.pilot:GetCoordinate() local color = self.smokecolor @@ -2049,13 +2067,17 @@ function CSAR:_GetClockDirection(_heli, _group) local DirectionVec3 = _playerPosition:GetDirectionVec3( _targetpostions ) local Angle = _playerPosition:GetAngleDegrees( DirectionVec3 ) self:T(self.lid .. " _GetClockDirection"..tostring(Angle).." "..tostring(_heading)) - local clock = 12 - if _heading then - local Aspect = Angle - _heading - if Aspect == 0 then Aspect = 360 end - clock = math.abs(UTILS.Round((Aspect / 30),0)) - if clock == 0 then clock = 12 end - end + local hours = 0 + local clock = 12 + if _heading and Angle then + clock = 12 + --if angle == 0 then angle = 360 end + clock = _heading-Angle + hours = (clock/30)*-1 + clock = 12+hours + clock = UTILS.Round(clock,0) + if clock > 12 then clock = clock-12 end + end return clock end diff --git a/Moose Development/Moose/Ops/PlayerTask.lua b/Moose Development/Moose/Ops/PlayerTask.lua index 5f614fe9d..d5a63324e 100644 --- a/Moose Development/Moose/Ops/PlayerTask.lua +++ b/Moose Development/Moose/Ops/PlayerTask.lua @@ -1626,7 +1626,7 @@ end -- @param #string text Original text. -- @return #string Spoken text. function PLAYERTASKCONTROLLER:_GetTextForSpeech(text) - + self:T(self.lid.."_GetTextForSpeech") -- Space out numbers. text=string.gsub(text,"%d","%1 ") -- get rid of leading or trailing spaces @@ -2780,7 +2780,7 @@ function PLAYERTASKCONTROLLER:_ActiveTaskInfo(Group, Client, Task) -- Task Report text = text .. clienttxt - if task:HasFreetext() then + if task:HasFreetext() and not ( task.Type == AUFTRAG.Type.CTLD or task.Type == AUFTRAG.Type.CSAR) then local brieftxt = self.gettext:GetEntry("BRIEFING",self.locale) text = text .. string.format("\n%s: ",brieftxt)..task:GetFreetext() end