From 431e8a05f9313ffdbc78428ca323b9220e836380 Mon Sep 17 00:00:00 2001 From: Frank Date: Wed, 8 Jan 2020 18:45:57 +0100 Subject: [PATCH] ZCC - Fixed unit counting in status report. --- Moose Development/Moose/Core/Zone.lua | 3 +-- .../Moose/Functional/ZoneCaptureCoalition.lua | 23 ++++++++++++------- Moose Development/Moose/Ops/ATIS.lua | 4 ++++ .../Moose/Wrapper/Controllable.lua | 1 + 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/Moose Development/Moose/Core/Zone.lua b/Moose Development/Moose/Core/Zone.lua index 802656890..1b55b5ba3 100644 --- a/Moose Development/Moose/Core/Zone.lua +++ b/Moose Development/Moose/Core/Zone.lua @@ -750,7 +750,7 @@ function ZONE_RADIUS:GetScannedUnits() end ---- Count the number of different coalitions inside the zone. +--- Get a set of scanned units. -- @param #ZONE_RADIUS self -- @return Core.Set#SET_UNIT Set of units and statics inside the zone. function ZONE_RADIUS:GetScannedSetUnit() @@ -949,7 +949,6 @@ function ZONE_RADIUS:SearchZone( EvaluateFunction, ObjectCategories ) local function EvaluateZone( ZoneDCSUnit ) - --env.info( ZoneDCSUnit:getName() ) local ZoneUnit = UNIT:Find( ZoneDCSUnit ) diff --git a/Moose Development/Moose/Functional/ZoneCaptureCoalition.lua b/Moose Development/Moose/Functional/ZoneCaptureCoalition.lua index 7371ef1bc..e6a07e323 100644 --- a/Moose Development/Moose/Functional/ZoneCaptureCoalition.lua +++ b/Moose Development/Moose/Functional/ZoneCaptureCoalition.lua @@ -874,16 +874,23 @@ do -- ZONE_CAPTURE_COALITION self:Capture() end - -- Get red and blue unit sets. - local unitsetRed=self:GetScannedSetUnit():FilterCoalitions("red"):FilterActive(true):FilterOnce() - local unitsetBlu=self:GetScannedSetUnit():FilterCoalitions("blue"):FilterActive(true):FilterOnce() - - -- Count number of units. - local nRed=unitsetRed:Count() - local nBlu=unitsetBlu:Count() + -- Count stuff in zone. + local unitset=self:GetScannedSetUnit() + local nRed=0 + local nBlue=0 + for _,object in pairs(unitset:GetSet()) do + local coal=object:GetCoalition() + 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. - 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() if NewState~=State then text=text..string.format(" --> %s", NewState) diff --git a/Moose Development/Moose/Ops/ATIS.lua b/Moose Development/Moose/Ops/ATIS.lua index 2894f8949..8c51087d4 100644 --- a/Moose Development/Moose/Ops/ATIS.lua +++ b/Moose Development/Moose/Ops/ATIS.lua @@ -243,6 +243,10 @@ -- ![Banner Image](..\Presentations\ATIS\ATIS_SoundFolder.png) -- -- **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 -- diff --git a/Moose Development/Moose/Wrapper/Controllable.lua b/Moose Development/Moose/Wrapper/Controllable.lua index 86a62afb7..939345713 100644 --- a/Moose Development/Moose/Wrapper/Controllable.lua +++ b/Moose Development/Moose/Wrapper/Controllable.lua @@ -2380,6 +2380,7 @@ do -- Route methods local FromCoordinate = self:GetCoordinate() + --local FromWP = FromCoordinate:WaypointGround() local FromWP = FromCoordinate:WaypointGround(Speed, Formation) local ToWP = ToCoordinate:WaypointGround( Speed, Formation )