Updates escort before plane trip.

This commit is contained in:
FlightControl
2019-04-23 19:59:11 +03:00
parent d985d9a41d
commit b21ff707ba
5 changed files with 129 additions and 62 deletions

View File

@@ -924,7 +924,40 @@ do -- SET_GROUP
return AliveSet.Set or {}
end
--- Returns a report of of unit types.
-- @param #SET_GROUP self
-- @return Core.Report#REPORT A report of the unit types found. The key is the UnitTypeName and the value is the amount of unit types found.
function SET_GROUP:GetUnitTypeNames()
self:F2()
local MT = {} -- Message Text
local UnitTypes = {}
local ReportUnitTypes = REPORT:New()
for GroupID, GroupData in pairs( self:GetSet() ) do
local Units = GroupData:GetUnits()
for UnitID, UnitData in pairs( Units ) do
if UnitData:IsAlive() then
local UnitType = UnitData:GetTypeName()
if not UnitTypes[UnitType] then
UnitTypes[UnitType] = 1
else
UnitTypes[UnitType] = UnitTypes[UnitType] + 1
end
end
end
end
for UnitTypeID, UnitType in pairs( UnitTypes ) do
ReportUnitTypes:Add( UnitType .. " of " .. UnitTypeID )
end
return ReportUnitTypes
end
--- Add a GROUP to SET_GROUP.
-- Note that for each unit in the group that is set, a default cargo bay limit is initialized.
-- @param Core.Set#SET_GROUP self