From 96fdf724008c8d76a9586be785a58496720049f7 Mon Sep 17 00:00:00 2001 From: FlightControl Date: Sat, 20 May 2017 13:32:21 +0200 Subject: [PATCH] Progress implementing teh SETTINGS class and coordinates per Controllable of the player --- Moose Development/Moose/Actions/Act_Route.lua | 21 +++++--- Moose Development/Moose/Core/Point.lua | 28 +++++----- Moose Development/Moose/Core/Zone.lua | 2 +- .../Moose/Functional/Designate.lua | 4 +- .../Moose/Functional/Detection.lua | 42 +++++++-------- Moose Development/Moose/Functional/Escort.lua | 2 +- Moose Development/Moose/Tasking/Task_A2A.lua | 23 ++++---- .../Moose/Tasking/Task_A2A_Dispatcher.lua | 12 +---- Moose Development/Moose/Tasking/Task_A2G.lua | 53 +++++++++++-------- Moose Development/Moose/Wrapper/Group.lua | 19 +++++++ 10 files changed, 119 insertions(+), 87 deletions(-) diff --git a/Moose Development/Moose/Actions/Act_Route.lua b/Moose Development/Moose/Actions/Act_Route.lua index 5e7f91381..91574be2d 100644 --- a/Moose Development/Moose/Actions/Act_Route.lua +++ b/Moose Development/Moose/Actions/Act_Route.lua @@ -154,19 +154,20 @@ do -- ACT_ROUTE --- Get the routing text to be displayed. -- The route mode determines the text displayed. -- @param #ACT_ROUTE self - -- @param Core.Point#COORDINATE FromCoordinate + -- @param Wrapper.Controllable#CONTROLLABLE Controllable -- @return #string - function ACT_ROUTE:GetRouteText( FromCoordinate ) + function ACT_ROUTE:GetRouteText( Controllable ) local RouteText = "" - if self.Coordinate then - RouteText = "Route to " .. self.Coordinate:ToString( FromCoordinate ) + RouteText = "Route to " .. self.Coordinate:ToString( Controllable ) end if self.Zone then - RouteText = "Route to " .. self.Zone:GetCoordinate():ToString( FromCoordinate ) + local Coordinate = self.Zone:GetPointVec3( self.Altitude ) + Coordinate:SetHeading( self.Heading ) + RouteText = "Route to zone " .. Coordinate:ToString( Controllable ) end return RouteText @@ -395,8 +396,12 @@ do -- ACT_ROUTE_ZONE --- Set Zone -- @param #ACT_ROUTE_ZONE self -- @param Core.Zone#ZONE_BASE Zone The Zone object where to route to. - function ACT_ROUTE_ZONE:SetZone( Zone ) + -- @param #number Altitude + -- @param #number Heading + function ACT_ROUTE_ZONE:SetZone( Zone, Altitude, Heading ) -- R2.2 Added altitude and heading self.Zone = Zone + self.Altitude = Altitude + self.Heading = Heading end --- Get Zone @@ -429,9 +434,9 @@ do -- ACT_ROUTE_ZONE -- @param #string From -- @param #string To function ACT_ROUTE_ZONE:onafterReport( ProcessUnit, From, Event, To ) + self:E( { ProcessUnit = ProcessUnit } ) - local TaskUnitCoordinate = ProcessUnit:GetCoordinate() - local RouteText = self:GetRouteText( TaskUnitCoordinate ) + local RouteText = self:GetRouteText( ProcessUnit ) self:Message( RouteText ) end diff --git a/Moose Development/Moose/Core/Point.lua b/Moose Development/Moose/Core/Point.lua index 75d44f6e1..d950c1bd7 100644 --- a/Moose Development/Moose/Core/Point.lua +++ b/Moose Development/Moose/Core/Point.lua @@ -241,6 +241,7 @@ POINT_VEC3 = { -- @extends Core.Point#COORDINATE + --- # POINT_VEC2 class, extends @{Point#COORDINATE} -- -- The @{Point#POINT_VEC2} class defines a 2D point in the simulator. The height coordinate (if needed) will be the land height + an optional added height specified. @@ -272,8 +273,6 @@ POINT_VEC2 = { } - - do -- COORDINATE --- COORDINATE constructor. @@ -449,6 +448,8 @@ do -- COORDINATE else return ' at ' .. UTILS.Round( UTILS.MetersToFeet( self.y ), -3 ) end + else + return "" end end @@ -720,7 +721,8 @@ do -- COORDINATE local AngleRadians = self:GetAngleRadians( DirectionVec3 ) local Distance = FromCoordinate:Get2DDistance( self ) local Altitude = self:GetAltitudeText() - return "BRAA: " .. self:GetBRText( AngleRadians, Distance, Settings ) + local AspectText = self:ToStringAspect( FromCoordinate ) + return "BRAA: " .. self:GetBRText( AngleRadians, Distance, Settings ) .. ( AspectText and ", " .. AspectText or "" ) end --- Return a BULLS string from a COORDINATE to the BULLS of the coalition. @@ -791,24 +793,26 @@ do -- COORDINATE -- * Uses default settings in COORDINATE. -- * Can be overridden if for a GROUP containing x clients, a menu was selected to override the default. -- @param #COORDINATE self - -- @param #COORDINATE FromCoordinate + -- @param Wrapper.Controllable#CONTROLLABLE Controllable -- @param Core.Settings#SETTINGS Settings -- @return #string The coordinate Text in the configured coordinate system. - function COORDINATE:ToString( FromCoordinate, Settings ) -- R2.2 + function COORDINATE:ToString( Controllable, Settings ) -- R2.2 local Settings = Settings or _SETTINGS + + local IsAir = Controllable and Controllable:IsAir() or false - if self:IsModeA2A() then + if IsAir then + local Coordinate = Controllable:GetCoordinate() + Coordinate:SetModeA2A() if Settings:IsA2A_BRA() then - return self:ToStringBRAA( FromCoordinate, Settings ) + return self:ToStringBRAA( Coordinate, Settings ) end if Settings:IsA2A_BULLS() then - return self:ToStringBULLS( FromCoordinate, Settings ) + return self:ToStringBULLS( Coordinate, Settings ) end - end - - if self:IsModeA2G() then + else if Settings:IsA2G_LL() then return self:ToStringLL( Settings ) end @@ -816,7 +820,7 @@ do -- COORDINATE return self:ToStringMGRS( Settings ) end end - + return nil end diff --git a/Moose Development/Moose/Core/Zone.lua b/Moose Development/Moose/Core/Zone.lua index 07d437913..7544c43bc 100644 --- a/Moose Development/Moose/Core/Zone.lua +++ b/Moose Development/Moose/Core/Zone.lua @@ -251,7 +251,7 @@ function ZONE_BASE:GetVec3( Height ) local Vec2 = self:GetVec2() - local Vec3 = { x = Vec2.x, y = land.getHeight( self:GetVec2() ) + Height, z = Vec2.y } + local Vec3 = { x = Vec2.x, y = Height and Height or land.getHeight( self:GetVec2() ), z = Vec2.y } self:T2( { Vec3 } ) diff --git a/Moose Development/Moose/Functional/Designate.lua b/Moose Development/Moose/Functional/Designate.lua index 9dd5914f7..4a2543100 100644 --- a/Moose Development/Moose/Functional/Designate.lua +++ b/Moose Development/Moose/Functional/Designate.lua @@ -538,7 +538,7 @@ do -- DESIGNATE for Index, DetectedItemData in pairs( DetectedItems ) do - local Report = self.Detection:DetectedItemReportSummary( Index ) + local Report = self.Detection:DetectedItemReportSummary( Index, AttackGroup ) DetectedReport:Add(" - " .. Report) end @@ -639,7 +639,7 @@ do -- DESIGNATE for Index, DetectedItemData in pairs( DetectedItems ) do - local Report = self.Detection:DetectedItemMenu( Index ) + local Report = self.Detection:DetectedItemMenu( Index, AttackGroup ) if not self.Designating[Index] then local DetectedMenu = MENU_GROUP:New( AttackGroup, Report, DesignateMenu ) diff --git a/Moose Development/Moose/Functional/Detection.lua b/Moose Development/Moose/Functional/Detection.lua index 6c92961e8..c9659b1af 100644 --- a/Moose Development/Moose/Functional/Detection.lua +++ b/Moose Development/Moose/Functional/Detection.lua @@ -1359,7 +1359,7 @@ do -- DETECTION_BASE -- @param #DETECTION_BASE self -- @param Index -- @return #string - function DETECTION_BASE:DetectedItemMenu( Index ) + function DETECTION_BASE:DetectedItemMenu( Index, AttackGroup ) self:F( Index ) return nil end @@ -1369,7 +1369,7 @@ do -- DETECTION_BASE -- @param #DETECTION_BASE self -- @param Index -- @return #string - function DETECTION_BASE:DetectedItemReportSummary( Index ) + function DETECTION_BASE:DetectedItemReportSummary( Index, AttackGroup ) self:F( Index ) return nil end @@ -1377,7 +1377,7 @@ do -- DETECTION_BASE --- Report detailed of a detectedion result. -- @param #DETECTION_BASE self -- @return #string - function DETECTION_BASE:DetectedReportDetailed() + function DETECTION_BASE:DetectedReportDetailed( AttackGroup ) self:F() return nil end @@ -1574,7 +1574,7 @@ do -- DETECTION_UNITS -- @param #DETECTION_UNITS self -- @param Index -- @return #string - function DETECTION_UNITS:DetectedItemMenu( Index ) + function DETECTION_UNITS:DetectedItemMenu( Index, AttackGroup ) self:F( Index ) local DetectedItem = self:GetDetectedItem( Index ) @@ -1593,7 +1593,7 @@ do -- DETECTION_UNITS self:T(DetectedItemUnit) local DetectedItemCoordinate = DetectedItemUnit:GetCoordinate() - local DetectedItemCoordText = DetectedItemCoordinate:ToString() + local DetectedItemCoordText = DetectedItemCoordinate:ToString( AttackGroup ) ReportSummary = string.format( "%s - %s", @@ -1612,7 +1612,7 @@ do -- DETECTION_UNITS -- @param #DETECTION_UNITS self -- @param Index -- @return #string - function DETECTION_UNITS:DetectedItemReportSummary( Index ) + function DETECTION_UNITS:DetectedItemReportSummary( Index, AttackGroup ) self:F( { Index, self.DetectedItems } ) local DetectedItem = self:GetDetectedItem( Index ) @@ -1654,7 +1654,7 @@ do -- DETECTION_UNITS end local DetectedItemCoordinate = DetectedItemUnit:GetCoordinate() - local DetectedItemCoordText = DetectedItemCoordinate:ToString() + local DetectedItemCoordText = DetectedItemCoordinate:ToString( AttackGroup ) local ThreatLevelA2G = DetectedItemUnit:GetThreatLevel( DetectedItem ) @@ -1679,13 +1679,13 @@ do -- DETECTION_UNITS --- Report detailed of a detection result. -- @param #DETECTION_UNITS self -- @return #string - function DETECTION_UNITS:DetectedReportDetailed() + function DETECTION_UNITS:DetectedReportDetailed( AttackGroup ) self:F() local Report = REPORT:New( "Detected units:" ) for DetectedItemID, DetectedItem in pairs( self.DetectedItems ) do local DetectedItem = DetectedItem -- #DETECTION_BASE.DetectedItem - local ReportSummary = self:DetectedItemReportSummary( DetectedItemID ) + local ReportSummary = self:DetectedItemReportSummary( DetectedItemID, AttackGroup ) Report:Add( ReportSummary ) end @@ -1844,7 +1844,7 @@ do -- DETECTION_TYPES -- @param #DETECTION_TYPES self -- @param Index -- @return #string - function DETECTION_TYPES:DetectedItemMenu( DetectedTypeName ) + function DETECTION_TYPES:DetectedItemMenu( DetectedTypeName, AttackGroup ) self:F( DetectedTypeName ) local DetectedItem = self:GetDetectedItem( DetectedTypeName ) @@ -1857,7 +1857,7 @@ do -- DETECTION_TYPES local DetectedItemUnit = DetectedSet:GetFirst() local DetectedItemCoordinate = DetectedItemUnit:GetCoordinate() - local DetectedItemCoordText = DetectedItemCoordinate:ToString() + local DetectedItemCoordText = DetectedItemCoordinate:ToString( AttackGroup ) self:E( { DetectedItemID, DetectedItemCoordText } ) @@ -1877,7 +1877,7 @@ do -- DETECTION_TYPES -- @param #DETECTION_TYPES self -- @param Index -- @return #string - function DETECTION_TYPES:DetectedItemReportSummary( DetectedTypeName ) + function DETECTION_TYPES:DetectedItemReportSummary( DetectedTypeName, AttackGroup ) self:F( DetectedTypeName ) local DetectedItem = self:GetDetectedItem( DetectedTypeName ) @@ -1894,7 +1894,7 @@ do -- DETECTION_TYPES local DetectedItemUnit = DetectedSet:GetFirst() local DetectedItemCoordinate = DetectedItemUnit:GetCoordinate() - local DetectedItemCoordText = DetectedItemCoordinate:ToString() + local DetectedItemCoordText = DetectedItemCoordinate:ToString( AttackGroup ) local ReportSummary = string.format( "%s - %s - Threat:[%s](%2d) - %2d of %s", @@ -1914,13 +1914,13 @@ do -- DETECTION_TYPES --- Report detailed of a detection result. -- @param #DETECTION_TYPES self -- @return #string - function DETECTION_TYPES:DetectedReportDetailed() + function DETECTION_TYPES:DetectedReportDetailed( AttackGroup ) self:F() local Report = REPORT:New( "Detected types:" ) for DetectedItemTypeName, DetectedItem in pairs( self.DetectedItems ) do local DetectedItem = DetectedItem -- #DETECTION_BASE.DetectedItem - local ReportSummary = self:DetectedItemReportSummary( DetectedItemTypeName ) + local ReportSummary = self:DetectedItemReportSummary( DetectedItemTypeName, AttackGroup ) Report:Add( ReportSummary ) end @@ -2001,7 +2001,7 @@ do -- DETECTION_AREAS -- @param #DETECTION_AREAS self -- @param Index -- @return #string - function DETECTION_AREAS:DetectedItemMenu( Index ) + function DETECTION_AREAS:DetectedItemMenu( Index, AttackGroup ) self:F( Index ) local DetectedItem = self:GetDetectedItem( Index ) @@ -2013,7 +2013,7 @@ do -- DETECTION_AREAS local DetectedZone = self:GetDetectedItemZone( Index ) local DetectedItemCoordinate = DetectedZone:GetCoordinate() - local DetectedItemCoordText = DetectedItemCoordinate:ToString() + local DetectedItemCoordText = DetectedItemCoordinate:ToString( AttackGroup ) local ReportSummary = string.format( "%s - %s", @@ -2031,7 +2031,7 @@ do -- DETECTION_AREAS -- @param #DETECTION_AREAS self -- @param Index -- @return #string - function DETECTION_AREAS:DetectedItemReportSummary( Index ) + function DETECTION_AREAS:DetectedItemReportSummary( Index, AttackGroup ) self:F( Index ) local DetectedItem = self:GetDetectedItem( Index ) @@ -2043,7 +2043,7 @@ do -- DETECTION_AREAS local DetectedZone = self:GetDetectedItemZone( Index ) local DetectedItemCoordinate = DetectedZone:GetCoordinate() - local DetectedItemCoordText = DetectedItemCoordinate:ToString() + local DetectedItemCoordText = DetectedItemCoordinate:ToString( AttackGroup ) local ThreatLevelA2G = self:GetTreatLevelA2G( DetectedItem ) local DetectedItemsCount = DetectedSet:Count() @@ -2068,13 +2068,13 @@ do -- DETECTION_AREAS --- Report detailed of a detection result. -- @param #DETECTION_AREAS self -- @return #string - function DETECTION_AREAS:DetectedReportDetailed() --R2.1 Fixed missing report + function DETECTION_AREAS:DetectedReportDetailed( AttackGroup) --R2.1 Fixed missing report self:F() local Report = REPORT:New( "Detected areas:" ) for DetectedItemIndex, DetectedItem in pairs( self.DetectedItems ) do local DetectedItem = DetectedItem -- #DETECTION_BASE.DetectedItem - local ReportSummary = self:DetectedItemReportSummary( DetectedItemIndex ) + local ReportSummary = self:DetectedItemReportSummary( DetectedItemIndex, AttackGroup ) Report:Add( ReportSummary ) end diff --git a/Moose Development/Moose/Functional/Escort.lua b/Moose Development/Moose/Functional/Escort.lua index dc2d62c44..449218f84 100644 --- a/Moose Development/Moose/Functional/Escort.lua +++ b/Moose Development/Moose/Functional/Escort.lua @@ -1164,7 +1164,7 @@ function ESCORT:_ReportTargetsScheduler() self:E( { DetectedItemID, DetectedItem } ) -- Remove the sub menus of the Attack menu of the Escort for the EscortGroup. - local DetectedItemReportSummary = self.Detection:DetectedItemReportSummary( DetectedItemID ) + local DetectedItemReportSummary = self.Detection:DetectedItemReportSummary( DetectedItemID, EscortGroupData ) if ClientEscortGroupName == EscortGroupName then diff --git a/Moose Development/Moose/Tasking/Task_A2A.lua b/Moose Development/Moose/Tasking/Task_A2A.lua index 070d62440..b69da792c 100644 --- a/Moose Development/Moose/Tasking/Task_A2A.lua +++ b/Moose Development/Moose/Tasking/Task_A2A.lua @@ -243,6 +243,8 @@ do -- TASK_A2A -- @param Wrapper.Unit#UNIT TaskUnit function TASK_A2A:SetTargetCoordinate( TargetCoordinate, TaskUnit ) + TargetCoordinate:SetModeA2A() + local ProcessUnit = self:GetUnitProcess( TaskUnit ) local ActRouteTarget = ProcessUnit:GetProcess( "Engaging", "RouteToTargetPoint" ) -- Actions.Act_Route#ACT_ROUTE_POINT @@ -265,12 +267,12 @@ do -- TASK_A2A --- @param #TASK_A2A self -- @param Core.Zone#ZONE_BASE TargetZone The Zone object where the Target is located on the map. -- @param Wrapper.Unit#UNIT TaskUnit - function TASK_A2A:SetTargetZone( TargetZone, TaskUnit ) + function TASK_A2A:SetTargetZone( TargetZone, Altitude, Heading, TaskUnit ) local ProcessUnit = self:GetUnitProcess( TaskUnit ) local ActRouteTarget = ProcessUnit:GetProcess( "Engaging", "RouteToTargetZone" ) -- Actions.Act_Route#ACT_ROUTE_ZONE - ActRouteTarget:SetZone( TargetZone ) + ActRouteTarget:SetZone( TargetZone, Altitude, Heading ) end @@ -363,17 +365,20 @@ do -- TASK_INTERCEPT --TODO: Add BR, Altitude, type of planes... - local TargetCoord = TargetSetUnit:GetFirst():GetCoordinate() - local TargetPositionText = TargetCoord:ToString() - local TargetThreatLevel = TargetSetUnit:CalculateThreatLevelA2G() - self:SetBriefing( TaskBriefing or - "Intercept incoming intruders.\n" .. - "Last Known Coordinates: " .. TargetPositionText .. "\n" .. - "Threat Level: [" .. string.rep( "■", TargetThreatLevel ) .. "]" + "Intercept incoming intruders.\n" ) + local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate() + TargetCoordinate:SetModeA2A() + self:SetInfo( "Coordinates", TargetCoordinate ) + + self:SetInfo( "ThreatLevel", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" ) + local DetectedItemsCount = TargetSetUnit:Count() + local DetectedItemsTypes = TargetSetUnit:GetTypeNames() + self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) ) + return self end diff --git a/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua b/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua index 6b1bba3eb..4cacccd39 100644 --- a/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua +++ b/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua @@ -184,18 +184,8 @@ do -- TASK_A2A_DISPATCHER if Task then self.Tasks[DetectedID] = Task - Task:SetTargetZone( DetectedZone ) + Task:SetTargetZone( DetectedZone, DetectedSet:GetFirst():GetAltitude(), DetectedSet:GetFirst():GetHeading() ) Task:SetDispatcher( self ) - Task:SetInfo( "ThreatLevel", "[" .. string.rep( "■", DetectedSet:CalculateThreatLevelA2G() ) .. "]" ) - local DetectedItemsCount = DetectedSet:Count() - local DetectedItemsTypes = DetectedSet:GetTypeNames() - Task:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) ) - - local Coordinate = Detection:GetDetectedItemCoordinate( DetectedIndex ) - Coordinate:SetModeA2A() - - Task:SetInfo( "Coordinates", Coordinate ) - Task:SetInfo( "Object", DetectedSet:GetFirst() ) Mission:AddTask( Task ) else self:E("This should not happen") diff --git a/Moose Development/Moose/Tasking/Task_A2G.lua b/Moose Development/Moose/Tasking/Task_A2G.lua index 004fb85de..501186ea7 100644 --- a/Moose Development/Moose/Tasking/Task_A2G.lua +++ b/Moose Development/Moose/Tasking/Task_A2G.lua @@ -375,17 +375,20 @@ do -- TASK_SEAD Mission:AddTask( self ) - local TargetCoord = TargetSetUnit:GetFirst():GetCoordinate() - local TargetPositionText = TargetCoord:ToString() - local TargetThreatLevel = TargetSetUnit:CalculateThreatLevelA2G() - self:SetBriefing( TaskBriefing or - "Execute a Suppression of Enemy Air Defenses.\n" .. - "Initial Coordinates: " .. TargetPositionText .. "\n" .. - "Threat Level: [" .. string.rep( "■", TargetThreatLevel ) .. "]" + "Execute a Suppression of Enemy Air Defenses.\n" ) + local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate() + TargetCoordinate:SetModeA2G() + self:SetInfo( "Coordinates", TargetCoordinate ) + + self:SetInfo( "ThreatLevel", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" ) + local DetectedItemsCount = TargetSetUnit:Count() + local DetectedItemsTypes = TargetSetUnit:GetTypeNames() + self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) ) + return self end @@ -415,17 +418,20 @@ do -- TASK_BAI Mission:AddTask( self ) - local TargetCoord = TargetSetUnit:GetFirst():GetCoordinate() - local TargetPositionText = TargetCoord:ToString() - local TargetThreatLevel = TargetSetUnit:CalculateThreatLevelA2G() - self:SetBriefing( TaskBriefing or - "Execute a Battlefield Air Interdiction of a group of enemy targets.\n" .. - "Initial Coordinates: " .. TargetPositionText .. "\n" .. - "Threat Level: [" .. string.rep( "■", TargetThreatLevel ) .. "]" + "Execute a Battlefield Air Interdiction of a group of enemy targets.\n" ) + local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate() + TargetCoordinate:SetModeA2G() + self:SetInfo( "Coordinates", TargetCoordinate ) + + self:SetInfo( "ThreatLevel", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" ) + local DetectedItemsCount = TargetSetUnit:Count() + local DetectedItemsTypes = TargetSetUnit:GetTypeNames() + self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) ) + return self end @@ -455,18 +461,21 @@ do -- TASK_CAS Mission:AddTask( self ) - local TargetCoord = TargetSetUnit:GetFirst():GetCoordinate() - local TargetPositionText = TargetCoord:ToString() - local TargetThreatLevel = TargetSetUnit:CalculateThreatLevelA2G() - self:SetBriefing( TaskBriefing or "Execute a Close Air Support for a group of enemy targets.\n" .. - "Beware of friendlies at the vicinity!\n" .. - "Initial Coordinates: " .. TargetPositionText .. "\n" .. - "Threat Level: [" .. string.rep( "■", TargetThreatLevel ) .. "]" + "Beware of friendlies at the vicinity!\n" ) - + + local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate() + TargetCoordinate:SetModeA2G() + self:SetInfo( "Coordinates", TargetCoordinate ) + + self:SetInfo( "ThreatLevel", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" ) + local DetectedItemsCount = TargetSetUnit:Count() + local DetectedItemsTypes = TargetSetUnit:GetTypeNames() + self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) ) + return self end diff --git a/Moose Development/Moose/Wrapper/Group.lua b/Moose Development/Moose/Wrapper/Group.lua index 3be9bc187..3f48805c4 100644 --- a/Moose Development/Moose/Wrapper/Group.lua +++ b/Moose Development/Moose/Wrapper/Group.lua @@ -485,6 +485,25 @@ function GROUP:GetPointVec2() return nil end +--- Returns a COORDINATE object indicating the point of the first UNIT of the GROUP within the mission. +-- @param Wrapper.Group#GROUP self +-- @return Core.Point#COORDINATE The COORDINATE of the GROUP. +-- @return #nil The POSITIONABLE is not existing or alive. +function GROUP:GetCoordinate() + self:F2( self.PositionableName ) + + local FirstUnit = self:GetUnit(1) + + if FirstUnit then + local FirstUnitCoordinate = FirstUnit:GetCoordinate() + self:T3(FirstUnitCoordinate) + return FirstUnitCoordinate + end + + return nil +end + + --- Returns a random @{DCSTypes#Vec3} vector (point in 3D of the UNIT within the mission) within a range around the first UNIT of the GROUP. -- @param #GROUP self -- @param #number Radius