- Fixed unit counting in status report.
This commit is contained in:
Frank 2020-01-08 18:45:57 +01:00
parent b91a8cf4c8
commit 431e8a05f9
4 changed files with 21 additions and 10 deletions

View File

@ -750,7 +750,7 @@ function ZONE_RADIUS:GetScannedUnits()
end end
--- Count the number of different coalitions inside the zone. --- Get a set of scanned units.
-- @param #ZONE_RADIUS self -- @param #ZONE_RADIUS self
-- @return Core.Set#SET_UNIT Set of units and statics inside the zone. -- @return Core.Set#SET_UNIT Set of units and statics inside the zone.
function ZONE_RADIUS:GetScannedSetUnit() function ZONE_RADIUS:GetScannedSetUnit()
@ -949,7 +949,6 @@ function ZONE_RADIUS:SearchZone( EvaluateFunction, ObjectCategories )
local function EvaluateZone( ZoneDCSUnit ) local function EvaluateZone( ZoneDCSUnit )
--env.info( ZoneDCSUnit:getName() )
local ZoneUnit = UNIT:Find( ZoneDCSUnit ) local ZoneUnit = UNIT:Find( ZoneDCSUnit )

View File

@ -874,16 +874,23 @@ do -- ZONE_CAPTURE_COALITION
self:Capture() self:Capture()
end end
-- Get red and blue unit sets. -- Count stuff in zone.
local unitsetRed=self:GetScannedSetUnit():FilterCoalitions("red"):FilterActive(true):FilterOnce() local unitset=self:GetScannedSetUnit()
local unitsetBlu=self:GetScannedSetUnit():FilterCoalitions("blue"):FilterActive(true):FilterOnce() local nRed=0
local nBlue=0
-- Count number of units. for _,object in pairs(unitset:GetSet()) do
local nRed=unitsetRed:Count() local coal=object:GetCoalition()
local nBlu=unitsetBlu:Count() if object:IsAlive() then
if coal==coalition.side.RED then
nRed=nRed+1
elseif coal==coalition.side.BLUE then
nBlue=nBlue+1
end
end
end
-- Status text. -- Status text.
local text=string.format("CAPTURE ZONE %s: Owner=%s (Previous=%s): #blue=%d, #red=%d, Status %s", self:GetZoneName(), self:GetCoalitionName(), UTILS.GetCoalitionName(self:GetPreviousCoalition()), nBlu, nRed, State) local text=string.format("CAPTURE ZONE %s: Owner=%s (Previous=%s): #blue=%d, #red=%d, Status %s", self:GetZoneName(), self:GetCoalitionName(), UTILS.GetCoalitionName(self:GetPreviousCoalition()), nBlue, nRed, State)
local NewState = self:GetState() local NewState = self:GetState()
if NewState~=State then if NewState~=State then
text=text..string.format(" --> %s", NewState) text=text..string.format(" --> %s", NewState)

View File

@ -244,6 +244,10 @@
-- --
-- **Note** that the default folder name is *ATIS Soundfiles/*. If you want to change it, you can use the @{#ATIS.SetSoundfilesPath}(*path*), where *path* is the path of the directory. This must end with a slash "/"! -- **Note** that the default folder name is *ATIS Soundfiles/*. If you want to change it, you can use the @{#ATIS.SetSoundfilesPath}(*path*), where *path* is the path of the directory. This must end with a slash "/"!
-- --
-- # Marks on the F10 Map
--
-- You can place marks on the F10 map via the @{#ATIS.SetMapMarks}() function. These will contain info about the ATIS frequency, the currently active runway and some basic info about the weather (wind, pressure and temperature).
--
-- # Examples -- # Examples
-- --
-- ## Caucasus: Batumi -- ## Caucasus: Batumi

View File

@ -2380,6 +2380,7 @@ do -- Route methods
local FromCoordinate = self:GetCoordinate() local FromCoordinate = self:GetCoordinate()
--local FromWP = FromCoordinate:WaypointGround()
local FromWP = FromCoordinate:WaypointGround(Speed, Formation) local FromWP = FromCoordinate:WaypointGround(Speed, Formation)
local ToWP = ToCoordinate:WaypointGround( Speed, Formation ) local ToWP = ToCoordinate:WaypointGround( Speed, Formation )