Update FlightGroup.lua

- Added `GetSquadronName` and `GetAirwingName` functions
This commit is contained in:
Frank 2022-10-03 16:32:55 +02:00
parent 1e04aaa77d
commit 10eec8a47b

View File

@ -210,7 +210,7 @@ FLIGHTGROUP.Players={}
--- FLIGHTGROUP class version.
-- @field #string version
FLIGHTGROUP.version="0.8.0"
FLIGHTGROUP.version="0.8.1"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO list
@ -372,11 +372,34 @@ end
--- Get airwing the flight group belongs to.
-- @param #FLIGHTGROUP self
-- @return Ops.AirWing#AIRWING The AIRWING object.
function FLIGHTGROUP:GetAirWing()
-- @return Ops.AirWing#AIRWING The AIRWING object (if any).
function FLIGHTGROUP:GetAirwing()
return self.legion
end
--- Get name of airwing the flight group belongs to.
-- @param #FLIGHTGROUP self
-- @return #string Name of the airwing or "None" if the flightgroup does not belong to any airwing.
function FLIGHTGROUP:GetAirwing()
local name=self.legion and self.legion.alias or "None"
return name
end
--- Get squadron the flight group belongs to.
-- @param #FLIGHTGROUP self
-- @return Ops.Squadron#SQUADRON The SQUADRON of this flightgroup or #nil if the flightgroup does not belong to any squadron.
function FLIGHTGROUP:GetSquadron()
return self.cohort
end
--- Get squadron name the flight group belongs to.
-- @param #FLIGHTGROUP self
-- @return #string The squadron name or "None" if the flightgroup does not belon to any squadron.
function FLIGHTGROUP:GetSquadronName()
local name=self.cohort and self.cohort:GetName() or "None"
return name
end
--- Set if aircraft is VTOL capable. Unfortunately, there is no DCS way to determine this via scripting.
-- @param #FLIGHTGROUP self
-- @return #FLIGHTGROUP self
@ -836,6 +859,7 @@ end
function FLIGHTGROUP:GetKills()
return self.Nkills
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Status
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------