From 3657a196457d3512f5f2c57f9bbba2051abc2f50 Mon Sep 17 00:00:00 2001 From: FlightControl Date: Fri, 26 Apr 2019 18:42:42 +0200 Subject: [PATCH] Updates of working version. --- Moose Development/Moose/AI/AI_Escort.lua | 30 ++++++++++------ .../Moose/AI/AI_Escort_Request.lua | 36 ++++++------------- .../Moose/Functional/Detection.lua | 10 +++--- 3 files changed, 37 insertions(+), 39 deletions(-) diff --git a/Moose Development/Moose/AI/AI_Escort.lua b/Moose Development/Moose/AI/AI_Escort.lua index 59932b443..0ecd87ffe 100644 --- a/Moose Development/Moose/AI/AI_Escort.lua +++ b/Moose Development/Moose/AI/AI_Escort.lua @@ -332,22 +332,29 @@ end --- Defines the default menus -- @param #AI_ESCORT self +-- @param #number XStart The start position on the X-axis in meters for the first group. +-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group. +-- @param #nubmer YStart The start position on the Y-axis in meters for the first group. +-- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group. +-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group. +-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group. +-- @param #number ZLevels The amount of levels on the Z-axis. -- @return #AI_ESCORT -function AI_ESCORT:Menus() +function AI_ESCORT:Menus( XStart, XSpace, YStart, YSpace, ZStart, ZSpace, ZLevels ) self:F() -- self:MenuScanForTargets( 100, 60 ) self:MenuJoinUp() - self:MenuFormationTrail( 50, 100, 50 ) - self:MenuFormationStack( 50, 100, 50, 50 ) - self:MenuFormationLeftLine( 0, 0, 100, 100 ) - self:MenuFormationRightLine( 0, 0, 100, 100 ) - self:MenuFormationLeftWing( 0, 50, 0, 100, 100 ) - self:MenuFormationRightWing( 0, 50, 0, 100, 100 ) - self:MenuFormationCenterWing( 50, 50, 0, 50, 100, 100 ) - self:MenuFormationBox( 50, 100, 0, 50, 50, 100, 10 ) - + self:MenuFormationTrail(XStart,XSpace,YStart) + self:MenuFormationStack(XStart,XSpace,YStart,YSpace) + self:MenuFormationLeftLine(XStart,YStart,ZStart,ZSpace) + self:MenuFormationRightLine(XStart,YStart,ZStart,ZSpace) + self:MenuFormationLeftWing(XStart,XSpace,YStart,ZStart,ZSpace) + self:MenuFormationRightWing(XStart,XSpace,YStart,ZStart,ZSpace) + self:MenuFormationVic(XStart,XSpace,YStart,YSpace,ZStart,ZSpace) + self:MenuFormationBox(XStart,XSpace,YStart,YSpace,ZStart,ZSpace,ZLevels) + self:MenuHoldAtEscortPosition( 1000, 500 ) self:MenuHoldAtLeaderPosition( 1000, 500 ) @@ -1474,6 +1481,9 @@ function AI_ESCORT:_FlightReportTargetsScheduler() local ClientEscortTargets = self.Detection for DetectedItemIndex, DetectedItem in pairs( DetectedItems ) do + + self:F("FlightReportTargetScheduler Targets") + DetectedTargets = true -- There are detected targets, when the content of the for loop is executed. We use it to display a message. diff --git a/Moose Development/Moose/AI/AI_Escort_Request.lua b/Moose Development/Moose/AI/AI_Escort_Request.lua index e16499974..2c6b24e00 100644 --- a/Moose Development/Moose/AI/AI_Escort_Request.lua +++ b/Moose Development/Moose/AI/AI_Escort_Request.lua @@ -195,14 +195,15 @@ AI_ESCORT_REQUEST = { -- @param #string EscortBriefing A text showing the AI_ESCORT_REQUEST briefing to the player. Note that if no EscortBriefing is provided, the default briefing will be shown. -- @return #AI_ESCORT_REQUEST self -- @usage --- -- Declare a new EscortPlanes object as follows: --- --- -- First find the GROUP object and the CLIENT object. --- local EscortUnit = CLIENT:FindByName( "Unit Name" ) -- The Unit Name is the name of the unit flagged with the skill Client in the mission editor. --- local EscortGroup = GROUP:FindByName( "Group Name" ) -- The Group Name is the name of the group that will escort the Escort Client. --- --- -- Now use these 2 objects to construct the new EscortPlanes object. --- EscortPlanes = AI_ESCORT_REQUEST:New( EscortUnit, EscortGroup, "Desert", "Welcome to the mission. You are escorted by a plane with code name 'Desert', which can be instructed through the F10 radio menu." ) +-- EscortSpawn = SPAWN:NewWithAlias( "Red A2G Escort Template", "Red A2G Escort AI" ):InitLimit( 10, 10 ) +-- EscortSpawn:ParkAtAirbase( AIRBASE:FindByName( AIRBASE.Caucasus.Sochi_Adler ), AIRBASE.TerminalType.OpenBig ) +-- +-- local EscortUnit = UNIT:FindByName( "Red A2G Pilot" ) +-- +-- Escort = AI_ESCORT_REQUEST:New( EscortUnit, EscortSpawn, AIRBASE:FindByName(AIRBASE.Caucasus.Sochi_Adler), "A2G", "Briefing" ) +-- Escort:FormationTrail( 50, 100, 100 ) +-- Escort:Menus() +-- Escort:__Start( 5 ) function AI_ESCORT_REQUEST:New( EscortUnit, EscortSpawn, EscortAirbase, EscortName, EscortBriefing ) self.EscortGroupSet = SET_GROUP:New() @@ -210,7 +211,6 @@ function AI_ESCORT_REQUEST:New( EscortUnit, EscortSpawn, EscortAirbase, EscortNa self.EscortAirbase = EscortAirbase local self = BASE:Inherit( self, AI_ESCORT:New( EscortUnit, self.EscortGroupSet, EscortName, EscortBriefing ) ) -- #AI_ESCORT_REQUEST - self:F( { EscortUnit } ) self.LeaderGroup = self.EscortUnit:GetGroup() @@ -241,34 +241,20 @@ function AI_ESCORT_REQUEST:SpawnEscort() Report:Add( "Joining Up ..." ) LeaderEscort:MessageTypeToGroup( Report:Text(), MESSAGE.Type.Information, self.EscortUnit ) + self:FormationTrail( 50, 50, 50 ) + self:JoinFormation( EscortGroup ) end ) - self:__FormationTrail( 30, 50, 100, 100 ) - self:JoinFormation( EscortGroup ) end --- @param #AI_ESCORT_REQUEST self -- @param Core.Set#SET_GROUP EscortGroupSet function AI_ESCORT_REQUEST:onafterStart( EscortGroupSet ) - self:E("Start") - - EscortGroupSet:ForEachGroup( - --- @param Core.Group#GROUP EscortGroup - function( EscortGroup ) - --EscortGroup.EscortMenu = MENU_GROUP:New( self.EscortUnit:GetGroup(), EscortGroup:GetName() ) - EscortGroup:WayPointInitialize( 1 ) - - EscortGroup:OptionROTVertical() - EscortGroup:OptionROEOpenFire() - end - ) - if not self.MenuRequestEscort then self.MenuRequestEscort = MENU_GROUP_COMMAND:New( self.LeaderGroup, "Request A2G Escort", nil, function() - env.info("call") self:SpawnEscort() end ) diff --git a/Moose Development/Moose/Functional/Detection.lua b/Moose Development/Moose/Functional/Detection.lua index fe078643a..133706fb9 100644 --- a/Moose Development/Moose/Functional/Detection.lua +++ b/Moose Development/Moose/Functional/Detection.lua @@ -541,14 +541,17 @@ do -- DETECTION_BASE end - self.DetectionCount = self.DetectionSet:GetSomeIteratorLimit() + self.DetectionCount = self.DetectionSet:Count() - self.DetectionSet:ForSomeGroupAlive( + self.DetectionSet:ForEachGroupAlive( function( DetectionGroup ) self:__Detection( DetectDelay, DetectionGroup, DetectionTimeStamp ) -- Process each detection asynchronously. DetectDelay = DetectDelay + 1 end ) + + self:__Detect( -self.RefreshTimeInterval ) + end --- @param #DETECTION_BASE self @@ -803,10 +806,9 @@ do -- DETECTION_BASE self:__DetectedItem( 0.1, DetectedItem ) end end - - self:__Detect( self.RefreshTimeInterval ) end + end