Merge remote-tracking branch 'origin/master' into develop

This commit is contained in:
Applevangelist 2022-09-12 17:29:47 +02:00
commit 76a8286c04

View File

@ -673,24 +673,7 @@ end
-- @param #GROUP self -- @param #GROUP self
-- @return #boolean If true, group is associated with a client or player slot. -- @return #boolean If true, group is associated with a client or player slot.
function GROUP:IsPlayer() function GROUP:IsPlayer()
return self:GetUnit(1):IsPlayer()
-- Get group.
-- local group=self:GetGroup()
-- Units of template group.
local units=self:GetTemplate().units
-- Get numbers.
for _,unit in pairs(units) do
-- Check if unit name matach and skill is Client or Player.
if unit.name==self:GetName() and (unit.skill=="Client" or unit.skill=="Player") then
return true
end
end
return false
end end
--- Returns the UNIT wrapper class with number UnitNumber. --- Returns the UNIT wrapper class with number UnitNumber.
@ -725,29 +708,6 @@ function GROUP:GetUnit( UnitNumber )
end end
--- Check if an (air) group is a client or player slot. Information is retrieved from the group template.
-- @param #GROUP self
-- @return #boolean If true, group is associated with a client or player slot.
function GROUP:IsPlayer()
-- Get group.
-- local group=self:GetGroup()
-- Units of template group.
local units=self:GetTemplate().units
-- Get numbers.
for _,unit in pairs(units) do
-- Check if unit name matach and skill is Client or Player.
if unit.name==self:GetName() and (unit.skill=="Client" or unit.skill=="Player") then
return true
end
end
return false
end
--- Returns the DCS Unit with number UnitNumber. --- Returns the DCS Unit with number UnitNumber.
-- If the underlying DCS Unit does not exist, the method will return nil. . -- If the underlying DCS Unit does not exist, the method will return nil. .
@ -2767,94 +2727,82 @@ function GROUP:GetHighestThreat()
return nil, nil return nil, nil
end end
--do -- Smoke --- Get TTS friendly, optionally customized callsign mainly for **player groups**. A customized callsign is taken from the #GROUP name, after an optional '#' sign, e.g. "Aerial 1-1#Ghostrider" resulting in "Ghostrider 9", or,
-- if that isn't available, from the playername, as set in the mission editor main screen under Logbook, after an optional '|' sign (actually, more of a personal call sign), e.g. "Apple|Moose" results in "Moose 9 1". Options see below.
-- @param #GROUP self
-- @param #boolean ShortCallsign Return a shortened customized callsign, i.e. "Ghostrider 9" and not "Ghostrider 9 1"
-- @param #boolean Keepnumber (Player only) Return customized callsign, incl optional numbers at the end, e.g. "Aerial 1-1#Ghostrider 109" results in "Ghostrider 109", if you want to e.g. use historical US Navy Callsigns
-- @param #table CallsignTranslations with DCS callsigns as keys and replacements as values
-- @return #string Callsign
-- @usage
-- -- Set Custom CAP Flight Callsigns for use with TTS
-- mygroup:GetCustomCallSign(true,false,{
-- Devil = 'Bengal',
-- Snake = 'Winder',
-- Colt = 'Camelot',
-- Enfield = 'Victory',
-- Uzi = 'Evil Eye'
-- })
-- --
----- Signal a flare at the position of the GROUP. -- results in this outcome if the group has Callsign "Enfield 9 1" on the 1st #UNIT of the group:
---- @param #GROUP self
---- @param Utilities.Utils#FLARECOLOR FlareColor
--function GROUP:Flare( FlareColor )
-- self:F2()
-- trigger.action.signalFlare( self:GetVec3(), FlareColor , 0 )
--end
-- --
----- Signal a white flare at the position of the GROUP. -- 'Victory 9'
---- @param #GROUP self
--function GROUP:FlareWhite()
-- self:F2()
-- trigger.action.signalFlare( self:GetVec3(), trigger.flareColor.White , 0 )
--end
-- --
----- Signal a yellow flare at the position of the GROUP. --
---- @param #GROUP self function GROUP:GetCustomCallSign(ShortCallsign,Keepnumber,CallsignTranslations)
--function GROUP:FlareYellow() --self:I("GetCustomCallSign")
-- self:F2()
-- trigger.action.signalFlare( self:GetVec3(), trigger.flareColor.Yellow , 0 ) local callsign = "Ghost 1"
--end if self:IsAlive() then
-- local IsPlayer = self:IsPlayer()
----- Signal a green flare at the position of the GROUP. local shortcallsign = self:GetCallsign() or "unknown91" -- e.g.Uzi91, but we want Uzi 9 1
---- @param #GROUP self local callsignroot = string.match(shortcallsign, '(%a+)') -- Uzi
--function GROUP:FlareGreen() --self:I("CallSign = " .. callsignroot)
-- self:F2() local groupname = self:GetName()
-- trigger.action.signalFlare( self:GetVec3(), trigger.flareColor.Green , 0 ) BASE:I({name=groupname,IsPlayer=IsPlayer})
--end local callnumber = string.match(shortcallsign, "(%d+)$" ) or "91" -- 91
-- local callnumbermajor = string.char(string.byte(callnumber,1)) -- 9
----- Signal a red flare at the position of the GROUP. local callnumberminor = string.char(string.byte(callnumber,2)) -- 1
---- @param #GROUP self local personalized = false
--function GROUP:FlareRed() if IsPlayer and string.find(groupname,"#") then
-- self:F2() -- personalized flight name in group naming
-- local Vec3 = self:GetVec3() if Keepnumber then
-- if Vec3 then shortcallsign = string.match(groupname,"#(.+)") -- Ghostrider 219
-- trigger.action.signalFlare( Vec3, trigger.flareColor.Red, 0 ) else
-- end shortcallsign = string.match(groupname,"#([%a]+)") -- Ghostrider
--end end
-- personalized = true
----- Smoke the GROUP. elseif IsPlayer and string.find(self:GetPlayerName(),"|") then
---- @param #GROUP self -- personalized flight name in group naming
--function GROUP:Smoke( SmokeColor, Range ) shortcallsign = string.match(self:GetPlayerName(),"|([%a]+)") -- Ghostrider
-- self:F2() personalized = true
-- if Range then end
-- trigger.action.smoke( self:GetRandomVec3( Range ), SmokeColor )
-- else if (not personalized) and CallsignTranslations and CallsignTranslations[callsignroot] then
-- trigger.action.smoke( self:GetVec3(), SmokeColor ) callsignroot = CallsignTranslations[callsignroot]
-- end end
--
--end if personalized then
-- -- player personalized callsign
----- Smoke the GROUP Green. if Keepnumber then
---- @param #GROUP self return shortcallsign -- Ghostrider 219
--function GROUP:SmokeGreen() elseif ShortCallsign then
-- self:F2() callsign = shortcallsign.." "..callnumbermajor -- Ghostrider 9
-- trigger.action.smoke( self:GetVec3(), trigger.smokeColor.Green ) else
--end callsign = shortcallsign.." "..callnumbermajor.." "..callnumberminor -- Ghostrider 9 1
-- end
----- Smoke the GROUP Red. return callsign
---- @param #GROUP self end
--function GROUP:SmokeRed()
-- self:F2() -- AI or not personalized
-- trigger.action.smoke( self:GetVec3(), trigger.smokeColor.Red ) if ShortCallsign then
--end callsign = callsignroot.." "..callnumbermajor -- Uzi/Victory 9
-- else
----- Smoke the GROUP White. callsign = callsignroot.." "..callnumbermajor.." "..callnumberminor -- Uzi/Victory 9 1
---- @param #GROUP self end
--function GROUP:SmokeWhite()
-- self:F2() --self:I("Generated Callsign = " .. callsign)
-- trigger.action.smoke( self:GetVec3(), trigger.smokeColor.White ) end
--end
-- return callsign
----- Smoke the GROUP Orange. end
---- @param #GROUP self
--function GROUP:SmokeOrange()
-- self:F2()
-- trigger.action.smoke( self:GetVec3(), trigger.smokeColor.Orange )
--end
--
----- Smoke the GROUP Blue.
---- @param #GROUP self
--function GROUP:SmokeBlue()
-- self:F2()
-- trigger.action.smoke( self:GetVec3(), trigger.smokeColor.Blue )
--end
--
--
--
--end