diff --git a/DCS_Folder_Sync.bat b/DCS_Folder_Sync.bat new file mode 100644 index 000000000..d950efe12 --- /dev/null +++ b/DCS_Folder_Sync.bat @@ -0,0 +1,4 @@ +rem This script will pull the latest changes from the remote repository, and update the submodules accordingly. + +git pull +git submodule update --init diff --git a/Moose Development/Moose/AI/AI_Balancer.lua b/Moose Development/Moose/AI/AI_Balancer.lua index e8d91a3bc..52adb5978 100644 --- a/Moose Development/Moose/AI/AI_Balancer.lua +++ b/Moose Development/Moose/AI/AI_Balancer.lua @@ -1,10 +1,9 @@ ---- SP:N MP:Y AI:Y HU:N TYP:A -- This module contains the AI_BALANCER class. AI Balancing will replace in multi player missions +--- Single-Player:**No** / Mulit-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**All** -- **AI Balancing will replace in multi player missions -- non-occupied human slots with AI groups, in order to provide an engaging simulation environment, --- even when there are hardly any players in the mission. +-- even when there are hardly any players in the mission.** -- -- ![Banner Image](..\Presentations\AI_Balancer\Dia1.JPG) -- --- Examples can be found in the test missions. -- -- === -- @@ -73,6 +72,8 @@ -- -- Hereby the change log: -- +-- 2017-01-17: There is still a problem with AI being destroyed, but not respawned. Need to check further upon that. +-- -- 2017-01-08: AI_BALANCER:**InitSpawnInterval( Earliest, Latest )** added. -- -- === @@ -82,7 +83,6 @@ -- ### Contributions: -- -- * **[Dutch_Baron](https://forums.eagle.ru/member.php?u=112075)**: Working together with James has resulted in the creation of the AI_BALANCER class. James has shared his ideas on balancing AI with air units, and together we made a first design which you can use now :-) --- -- * **SNAFU**: Had a couple of mails with the guys to validate, if the same concept in the GCI/CAP script could be reworked within MOOSE. None of the script code has been used however within the new AI_BALANCER moose class. -- -- ### Authors: @@ -231,16 +231,15 @@ end --- @param #AI_BALANCER self function AI_BALANCER:onenterMonitoring( SetGroup ) - self:E( { self.SetClient:Count() } ) - self.SetClient:Flush() + self:T2( { self.SetClient:Count() } ) + --self.SetClient:Flush() self.SetClient:ForEachClient( --- @param Wrapper.Client#CLIENT Client function( Client ) - self:E(Client.ClientName) + self:T3(Client.ClientName) local AIGroup = self.Set:Get( Client.UnitName ) -- Wrapper.Group#GROUP - self:E({Client:IsAlive()}) if Client:IsAlive() then if AIGroup and AIGroup:IsAlive() == true then @@ -255,16 +254,16 @@ function AI_BALANCER:onenterMonitoring( SetGroup ) local PlayerInRange = { Value = false } local RangeZone = ZONE_RADIUS:New( 'RangeZone', AIGroup:GetVec2(), self.ReturnTresholdRange ) - self:E( RangeZone ) + self:T2( RangeZone ) _DATABASE:ForEachPlayer( --- @param Wrapper.Unit#UNIT RangeTestUnit function( RangeTestUnit, RangeZone, AIGroup, PlayerInRange ) - self:E( { PlayerInRange, RangeTestUnit.UnitName, RangeZone.ZoneName } ) + self:T2( { PlayerInRange, RangeTestUnit.UnitName, RangeZone.ZoneName } ) if RangeTestUnit:IsInZone( RangeZone ) == true then - self:E( "in zone" ) + self:T2( "in zone" ) if RangeTestUnit:GetCoalition() ~= AIGroup:GetCoalition() then - self:E( "in range" ) + self:T2( "in range" ) PlayerInRange.Value = true end end @@ -285,7 +284,7 @@ function AI_BALANCER:onenterMonitoring( SetGroup ) end else if not AIGroup or not AIGroup:IsAlive() == true then - self:E( "Client " .. Client.UnitName .. " not alive." ) + self:T( "Client " .. Client.UnitName .. " not alive." ) if not self.SpawnQueue[Client.UnitName] then -- Spawn a new AI taking into account the spawn interval Earliest, Latest self:__Spawn( math.random( self.Earliest, self.Latest ), Client.UnitName ) diff --git a/Moose Development/Moose/AI/AI_CAP.lua b/Moose Development/Moose/AI/AI_CAP.lua new file mode 100644 index 000000000..b055f8972 --- /dev/null +++ b/Moose Development/Moose/AI/AI_CAP.lua @@ -0,0 +1,528 @@ +--- Single-Player:**Yes** / Mulit-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**Air** -- **Execute Combat Air Patrol (CAP).** +-- +-- ![Banner Image](..\Presentations\AI_CAP\Dia1.JPG) +-- +-- +-- === +-- +-- # 1) @{#AI_CAP_ZONE} class, extends @{AI.AI_CAP#AI_PATROL_ZONE} +-- +-- The @{#AI_CAP_ZONE} class implements the core functions to patrol a @{Zone} by an AI @{Controllable} or @{Group} +-- and automatically engage any airborne enemies that are within a certain range or within a certain zone. +-- +-- ![Process](..\Presentations\AI_CAP\Dia3.JPG) +-- +-- The AI_CAP_ZONE is assigned a @{Group} and this must be done before the AI_CAP_ZONE process can be started using the **Start** event. +-- +-- ![Process](..\Presentations\AI_CAP\Dia4.JPG) +-- +-- The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits. +-- Upon arrival at the 3D point, a new random 3D point will be selected within the patrol zone using the given limits. +-- +-- ![Process](..\Presentations\AI_CAP\Dia5.JPG) +-- +-- This cycle will continue. +-- +-- ![Process](..\Presentations\AI_CAP\Dia6.JPG) +-- +-- During the patrol, the AI will detect enemy targets, which are reported through the **Detected** event. +-- +-- ![Process](..\Presentations\AI_CAP\Dia9.JPG) +-- +-- When enemies are detected, the AI will automatically engage the enemy. +-- +-- ![Process](..\Presentations\AI_CAP\Dia10.JPG) +-- +-- Until a fuel or damage treshold has been reached by the AI, or when the AI is commanded to RTB. +-- When the fuel treshold has been reached, the airplane will fly towards the nearest friendly airbase and will land. +-- +-- ![Process](..\Presentations\AI_CAP\Dia13.JPG) +-- +-- ## 1.1) AI_CAP_ZONE constructor +-- +-- * @{#AI_CAP_ZONE.New}(): Creates a new AI_CAP_ZONE object. +-- +-- ## 1.2) AI_CAP_ZONE is a FSM +-- +-- ![Process](..\Presentations\AI_CAP\Dia2.JPG) +-- +-- ### 1.2.1) AI_CAP_ZONE States +-- +-- * **None** ( Group ): The process is not started yet. +-- * **Patrolling** ( Group ): The AI is patrolling the Patrol Zone. +-- * **Engaging** ( Group ): The AI is engaging the bogeys. +-- * **Returning** ( Group ): The AI is returning to Base.. +-- +-- ### 1.2.2) AI_CAP_ZONE Events +-- +-- * **Start** ( Group ): Start the process. +-- * **Route** ( Group ): Route the AI to a new random 3D point within the Patrol Zone. +-- * **Engage** ( Group ): Let the AI engage the bogeys. +-- * **RTB** ( Group ): Route the AI to the home base. +-- * **Detect** ( Group ): The AI is detecting targets. +-- * **Detected** ( Group ): The AI has detected new targets. +-- * **Status** ( Group ): The AI is checking status (fuel and damage). When the tresholds have been reached, the AI will RTB. +-- +-- ## 1.3) Set the Range of Engagement +-- +-- ![Range](..\Presentations\AI_CAP\Dia11.JPG) +-- +-- An optional range can be set in meters, +-- that will define when the AI will engage with the detected airborne enemy targets. +-- The range can be beyond or smaller than the range of the Patrol Zone. +-- The range is applied at the position of the AI. +-- Use the method @{AI.AI_CAP#AI_CAP_ZONE.SetEngageRange}() to define that range. +-- +-- ## 1.4) Set the Zone of Engagement +-- +-- ![Zone](..\Presentations\AI_CAP\Dia12.JPG) +-- +-- An optional @{Zone} can be set, +-- that will define when the AI will engage with the detected airborne enemy targets. +-- Use the method @{AI.AI_Cap#AI_CAP_ZONE.SetEngageZone}() to define that Zone. +-- +-- ==== +-- +-- # **API CHANGE HISTORY** +-- +-- The underlying change log documents the API changes. Please read this carefully. The following notation is used: +-- +-- * **Added** parts are expressed in bold type face. +-- * _Removed_ parts are expressed in italic type face. +-- +-- Hereby the change log: +-- +-- 2017-01-15: Initial class and API. +-- +-- === +-- +-- # **AUTHORS and CONTRIBUTIONS** +-- +-- ### Contributions: +-- +-- * **[Quax](https://forums.eagle.ru/member.php?u=90530)**: Concept, Advice & Testing. +-- * **[Pikey](https://forums.eagle.ru/member.php?u=62835)**: Concept, Advice & Testing. +-- * **[Gunterlund](http://forums.eagle.ru:8080/member.php?u=75036)**: Test case revision. +-- * **[Whisper](http://forums.eagle.ru/member.php?u=3829): Testing. +-- * **[Delta99](https://forums.eagle.ru/member.php?u=125166): Testing. +-- +-- ### Authors: +-- +-- * **FlightControl**: Concept, Design & Programming. +-- +-- @module AI_Cap + + +--- AI_CAP_ZONE class +-- @type AI_CAP_ZONE +-- @field Wrapper.Controllable#CONTROLLABLE AIControllable The @{Controllable} patrolling. +-- @field Core.Zone#ZONE_BASE TargetZone The @{Zone} where the patrol needs to be executed. +-- @extends AI.AI_Patrol#AI_PATROL_ZONE +AI_CAP_ZONE = { + ClassName = "AI_CAP_ZONE", +} + + + +--- Creates a new AI_CAP_ZONE object +-- @param #AI_CAP_ZONE self +-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed. +-- @param Dcs.DCSTypes#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol. +-- @param Dcs.DCSTypes#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol. +-- @param Dcs.DCSTypes#Speed PatrolMinSpeed The minimum speed of the @{Controllable} in km/h. +-- @param Dcs.DCSTypes#Speed PatrolMaxSpeed The maximum speed of the @{Controllable} in km/h. +-- @return #AI_CAP_ZONE self +function AI_CAP_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed ) + + -- Inherits from BASE + local self = BASE:Inherit( self, AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed ) ) -- #AI_CAP_ZONE + + self.Accomplished = false + self.Engaging = false + + self:AddTransition( { "Patrolling", "Engaging" }, "Engage", "Engaging" ) -- FSM_CONTROLLABLE Transition for type #AI_CAP_ZONE. + + --- OnBefore Transition Handler for Event Engage. + -- @function [parent=#AI_CAP_ZONE] OnBeforeEngage + -- @param #AI_CAP_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + -- @return #boolean Return false to cancel Transition. + + --- OnAfter Transition Handler for Event Engage. + -- @function [parent=#AI_CAP_ZONE] OnAfterEngage + -- @param #AI_CAP_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + + --- Synchronous Event Trigger for Event Engage. + -- @function [parent=#AI_CAP_ZONE] Engage + -- @param #AI_CAP_ZONE self + + --- Asynchronous Event Trigger for Event Engage. + -- @function [parent=#AI_CAP_ZONE] __Engage + -- @param #AI_CAP_ZONE self + -- @param #number Delay The delay in seconds. + +--- OnLeave Transition Handler for State Engaging. +-- @function [parent=#AI_CAP_ZONE] OnLeaveEngaging +-- @param #AI_CAP_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @return #boolean Return false to cancel Transition. + +--- OnEnter Transition Handler for State Engaging. +-- @function [parent=#AI_CAP_ZONE] OnEnterEngaging +-- @param #AI_CAP_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. + + self:AddTransition( "Engaging", "Fired", "Engaging" ) -- FSM_CONTROLLABLE Transition for type #AI_CAP_ZONE. + + --- OnBefore Transition Handler for Event Fired. + -- @function [parent=#AI_CAP_ZONE] OnBeforeFired + -- @param #AI_CAP_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + -- @return #boolean Return false to cancel Transition. + + --- OnAfter Transition Handler for Event Fired. + -- @function [parent=#AI_CAP_ZONE] OnAfterFired + -- @param #AI_CAP_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + + --- Synchronous Event Trigger for Event Fired. + -- @function [parent=#AI_CAP_ZONE] Fired + -- @param #AI_CAP_ZONE self + + --- Asynchronous Event Trigger for Event Fired. + -- @function [parent=#AI_CAP_ZONE] __Fired + -- @param #AI_CAP_ZONE self + -- @param #number Delay The delay in seconds. + + self:AddTransition( "*", "Destroy", "*" ) -- FSM_CONTROLLABLE Transition for type #AI_CAP_ZONE. + + --- OnBefore Transition Handler for Event Destroy. + -- @function [parent=#AI_CAP_ZONE] OnBeforeDestroy + -- @param #AI_CAP_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + -- @return #boolean Return false to cancel Transition. + + --- OnAfter Transition Handler for Event Destroy. + -- @function [parent=#AI_CAP_ZONE] OnAfterDestroy + -- @param #AI_CAP_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + + --- Synchronous Event Trigger for Event Destroy. + -- @function [parent=#AI_CAP_ZONE] Destroy + -- @param #AI_CAP_ZONE self + + --- Asynchronous Event Trigger for Event Destroy. + -- @function [parent=#AI_CAP_ZONE] __Destroy + -- @param #AI_CAP_ZONE self + -- @param #number Delay The delay in seconds. + + + self:AddTransition( "Engaging", "Abort", "Patrolling" ) -- FSM_CONTROLLABLE Transition for type #AI_CAP_ZONE. + + --- OnBefore Transition Handler for Event Abort. + -- @function [parent=#AI_CAP_ZONE] OnBeforeAbort + -- @param #AI_CAP_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + -- @return #boolean Return false to cancel Transition. + + --- OnAfter Transition Handler for Event Abort. + -- @function [parent=#AI_CAP_ZONE] OnAfterAbort + -- @param #AI_CAP_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + + --- Synchronous Event Trigger for Event Abort. + -- @function [parent=#AI_CAP_ZONE] Abort + -- @param #AI_CAP_ZONE self + + --- Asynchronous Event Trigger for Event Abort. + -- @function [parent=#AI_CAP_ZONE] __Abort + -- @param #AI_CAP_ZONE self + -- @param #number Delay The delay in seconds. + + self:AddTransition( "Engaging", "Accomplish", "Patrolling" ) -- FSM_CONTROLLABLE Transition for type #AI_CAP_ZONE. + + --- OnBefore Transition Handler for Event Accomplish. + -- @function [parent=#AI_CAP_ZONE] OnBeforeAccomplish + -- @param #AI_CAP_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + -- @return #boolean Return false to cancel Transition. + + --- OnAfter Transition Handler for Event Accomplish. + -- @function [parent=#AI_CAP_ZONE] OnAfterAccomplish + -- @param #AI_CAP_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + + --- Synchronous Event Trigger for Event Accomplish. + -- @function [parent=#AI_CAP_ZONE] Accomplish + -- @param #AI_CAP_ZONE self + + --- Asynchronous Event Trigger for Event Accomplish. + -- @function [parent=#AI_CAP_ZONE] __Accomplish + -- @param #AI_CAP_ZONE self + -- @param #number Delay The delay in seconds. + + return self +end + + +--- Set the Engage Zone which defines where the AI will engage bogies. +-- @param #AI_CAP_ZONE self +-- @param Core.Zone#ZONE EngageZone The zone where the AI is performing CAP. +-- @return #AI_CAP_ZONE self +function AI_CAP_ZONE:SetEngageZone( EngageZone ) + self:F2() + + if EngageZone then + self.EngageZone = EngageZone + else + self.EngageZone = nil + end +end + +--- Set the Engage Range when the AI will engage with airborne enemies. +-- @param #AI_CAP_ZONE self +-- @param #number EngageRange The Engage Range. +-- @return #AI_CAP_ZONE self +function AI_CAP_ZONE:SetEngageRange( EngageRange ) + self:F2() + + if EngageRange then + self.EngageRange = EngageRange + else + self.EngageRange = nil + end +end + +--- onafter State Transition for Event Start. +-- @param #AI_CAP_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_CAP_ZONE:onafterStart( Controllable, From, Event, To ) + + -- Call the parent Start event handler + self:GetParent(self).onafterStart( self, Controllable, From, Event, To ) + +end + +--- @param Wrapper.Controllable#CONTROLLABLE AIControllable +function _NewEngageCapRoute( AIControllable ) + + AIControllable:T( "NewEngageRoute" ) + local EngageZone = AIControllable:GetState( AIControllable, "EngageZone" ) -- AI.AI_Cap#AI_CAP_ZONE + EngageZone:__Engage( 1 ) +end + +--- @param #AI_CAP_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_CAP_ZONE:onbeforeEngage( Controllable, From, Event, To ) + + if self.Accomplished == true then + return false + end +end + +--- @param #AI_CAP_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_CAP_ZONE:onafterDetected( Controllable, From, Event, To ) + + if From ~= "Engaging" then + + local Engage = false + + for DetectedUnitID, DetectedUnit in pairs( self.DetectedUnits ) do + + local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT + self:T( DetectedUnit ) + if DetectedUnit:IsAlive() and DetectedUnit:IsAir() then + Engage = true + break + end + end + + if Engage == true then + self:E( 'Detected -> Engaging' ) + self:__Engage( 1 ) + end + end +end + + + +--- @param #AI_CAP_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_CAP_ZONE:onafterEngage( Controllable, From, Event, To ) + + if Controllable:IsAlive() then + + local EngageRoute = {} + + --- Calculate the current route point. + local CurrentVec2 = self.Controllable:GetVec2() + + --TODO: Create GetAltitude function for GROUP, and delete GetUnit(1). + local CurrentAltitude = self.Controllable:GetUnit(1):GetAltitude() + local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y ) + local ToEngageZoneSpeed = self.PatrolMaxSpeed + local CurrentRoutePoint = CurrentPointVec3:RoutePointAir( + POINT_VEC3.RoutePointAltType.BARO, + POINT_VEC3.RoutePointType.TurningPoint, + POINT_VEC3.RoutePointAction.TurningPoint, + ToEngageZoneSpeed, + true + ) + + EngageRoute[#EngageRoute+1] = CurrentRoutePoint + + + --- Find a random 2D point in PatrolZone. + local ToTargetVec2 = self.PatrolZone:GetRandomVec2() + self:T2( ToTargetVec2 ) + + --- Define Speed and Altitude. + local ToTargetAltitude = math.random( self.EngageFloorAltitude, self.EngageCeilingAltitude ) + local ToTargetSpeed = math.random( self.PatrolMinSpeed, self.PatrolMaxSpeed ) + self:T2( { self.PatrolMinSpeed, self.PatrolMaxSpeed, ToTargetSpeed } ) + + --- Obtain a 3D @{Point} from the 2D point + altitude. + local ToTargetPointVec3 = POINT_VEC3:New( ToTargetVec2.x, ToTargetAltitude, ToTargetVec2.y ) + + --- Create a route point of type air. + local ToPatrolRoutePoint = ToTargetPointVec3:RoutePointAir( + POINT_VEC3.RoutePointAltType.BARO, + POINT_VEC3.RoutePointType.TurningPoint, + POINT_VEC3.RoutePointAction.TurningPoint, + ToTargetSpeed, + true + ) + + EngageRoute[#EngageRoute+1] = ToPatrolRoutePoint + + Controllable:OptionROEOpenFire() + Controllable:OptionROTPassiveDefense() + + local AttackTasks = {} + + for DetectedUnitID, DetectedUnit in pairs( self.DetectedUnits ) do + local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT + self:T( { DetectedUnit, DetectedUnit:IsAlive(), DetectedUnit:IsAir() } ) + if DetectedUnit:IsAlive() and DetectedUnit:IsAir() then + if self.EngageZone then + if DetectedUnit:IsInZone( self.EngageZone ) then + self:E( {"Within Zone and Engaging ", DetectedUnit } ) + AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit ) + end + else + if self.EngageRange then + if DetectedUnit:GetPointVec3():Get2DDistance(Controllable:GetPointVec3() ) <= self.EngageRange then + self:E( {"Within Range and Engaging", DetectedUnit } ) + AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit ) + end + else + AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit ) + end + end + else + self.DetectedUnits[DetectedUnit] = nil + end + end + + --- Now we're going to do something special, we're going to call a function from a waypoint action at the AIControllable... + self.Controllable:WayPointInitialize( EngageRoute ) + + + if #AttackTasks == 0 then + self:E("No targets found -> Going back to Patrolling") + self:__Accomplish( 1 ) + self:__Route( 1 ) + self:SetDetectionActivated() + else + EngageRoute[1].task = Controllable:TaskCombo( AttackTasks ) + + --- Do a trick, link the NewEngageRoute function of the object to the AIControllable in a temporary variable ... + self.Controllable:SetState( self.Controllable, "EngageZone", self ) + + self.Controllable:WayPointFunction( #EngageRoute, 1, "_NewEngageCapRoute" ) + + self:SetDetectionDeactivated() + end + + --- NOW ROUTE THE GROUP! + self.Controllable:WayPointExecute( 1, 2 ) + + end +end + +--- @param #AI_CAP_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @param Core.Event#EVENTDATA EventData +function AI_CAP_ZONE:onafterDestroy( Controllable, From, Event, To, EventData ) + + if EventData.IniUnit then + self.DetectedUnits[EventData.IniUnit] = nil + end + + Controllable:MessageToAll( "Destroyed a target", 15 , "Destroyed!" ) +end + +--- @param #AI_CAP_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_CAP_ZONE:onafterAccomplish( Controllable, From, Event, To ) + self.Accomplished = true + self:SetDetectionOff() +end + + diff --git a/Moose Development/Moose/AI/AI_CAS.lua b/Moose Development/Moose/AI/AI_CAS.lua new file mode 100644 index 000000000..bea247783 --- /dev/null +++ b/Moose Development/Moose/AI/AI_CAS.lua @@ -0,0 +1,516 @@ +--- Single-Player:**Yes** / Mulit-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**Air** -- **Provide Close Air Support to friendly ground troops.** +-- +-- ![Banner Image](..\Presentations\AI_CAS\Dia1.JPG) +-- +-- +-- === +-- +-- # 1) @{#AI_CAS_ZONE} class, extends @{AI.AI_Patrol#AI_PATROL_ZONE} +-- +-- @{#AI_CAS_ZONE} derives from the @{AI.AI_Patrol#AI_PATROL_ZONE}, inheriting its methods and behaviour. +-- +-- The @{#AI_CAS_ZONE} class implements the core functions to provide Close Air Support in an Engage @{Zone} by an AIR @{Controllable} or @{Group}. +-- The AI_CAS_ZONE runs a process. It holds an AI in a Patrol Zone and when the AI is commanded to engage, it will fly to an Engage Zone. +-- +-- ![HoldAndEngage](..\Presentations\AI_CAS\Dia3.JPG) +-- +-- The AI_CAS_ZONE is assigned a @{Group} and this must be done before the AI_CAS_ZONE process can be started through the **Start** event. +-- +-- ![Start Event](..\Presentations\AI_CAS\Dia4.JPG) +-- +-- Upon started, The AI will **Route** itself towards the random 3D point within a patrol zone, +-- using a random speed within the given altitude and speed limits. +-- Upon arrival at the 3D point, a new random 3D point will be selected within the patrol zone using the given limits. +-- This cycle will continue until a fuel or damage treshold has been reached by the AI, or when the AI is commanded to RTB. +-- +-- ![Route Event](..\Presentations\AI_CAS\Dia5.JPG) +-- +-- When the AI is commanded to provide Close Air Support (through the event **Engage**), the AI will fly towards the Engage Zone. +-- Any target that is detected in the Engage Zone will be reported and will be destroyed by the AI. +-- +-- ![Engage Event](..\Presentations\AI_CAS\Dia6.JPG) +-- +-- The AI will detect the targets and will only destroy the targets within the Engage Zone. +-- +-- ![Engage Event](..\Presentations\AI_CAS\Dia7.JPG) +-- +-- Every target that is destroyed, is reported< by the AI. +-- +-- ![Engage Event](..\Presentations\AI_CAS\Dia8.JPG) +-- +-- Note that the AI does not know when the Engage Zone is cleared, and therefore will keep circling in the zone. +-- +-- ![Engage Event](..\Presentations\AI_CAS\Dia9.JPG) +-- +-- Until it is notified through the event **Accomplish**, which is to be triggered by an observing party: +-- +-- * a FAC +-- * a timed event +-- * a menu option selected by a human +-- * a condition +-- * others ... +-- +-- ![Engage Event](..\Presentations\AI_CAS\Dia10.JPG) +-- +-- When the AI has accomplished the CAS, it will fly back to the Patrol Zone. +-- +-- ![Engage Event](..\Presentations\AI_CAS\Dia11.JPG) +-- +-- It will keep patrolling there, until it is notified to RTB or move to another CAS Zone. +-- It can be notified to go RTB through the **RTB** event. +-- +-- When the fuel treshold has been reached, the airplane will fly towards the nearest friendly airbase and will land. +-- +-- ![Engage Event](..\Presentations\AI_CAS\Dia12.JPG) +-- +-- # 1.1) AI_CAS_ZONE constructor +-- +-- * @{#AI_CAS_ZONE.New}(): Creates a new AI_CAS_ZONE object. +-- +-- ## 1.2) AI_CAS_ZONE is a FSM +-- +-- ![Process](..\Presentations\AI_CAS\Dia2.JPG) +-- +-- ### 1.2.1) AI_CAS_ZONE States +-- +-- * **None** ( Group ): The process is not started yet. +-- * **Patrolling** ( Group ): The AI is patrolling the Patrol Zone. +-- * **Engaging** ( Group ): The AI is engaging the targets in the Engage Zone, executing CAS. +-- * **Returning** ( Group ): The AI is returning to Base.. +-- +-- ### 1.2.2) AI_CAS_ZONE Events +-- +-- * **Start** ( Group ): Start the process. +-- * **Route** ( Group ): Route the AI to a new random 3D point within the Patrol Zone. +-- * **Engage** ( Group ): Engage the AI to provide CAS in the Engage Zone, destroying any target it finds. +-- * **RTB** ( Group ): Route the AI to the home base. +-- * **Detect** ( Group ): The AI is detecting targets. +-- * **Detected** ( Group ): The AI has detected new targets. +-- * **Status** ( Group ): The AI is checking status (fuel and damage). When the tresholds have been reached, the AI will RTB. +-- +-- ==== +-- +-- # **API CHANGE HISTORY** +-- +-- The underlying change log documents the API changes. Please read this carefully. The following notation is used: +-- +-- * **Added** parts are expressed in bold type face. +-- * _Removed_ parts are expressed in italic type face. +-- +-- Hereby the change log: +-- +-- 2017-01-15: Initial class and API. +-- +-- === +-- +-- # **AUTHORS and CONTRIBUTIONS** +-- +-- ### Contributions: +-- +-- * **[Quax](https://forums.eagle.ru/member.php?u=90530)**: Concept, Advice & Testing. +-- * **[Pikey](https://forums.eagle.ru/member.php?u=62835)**: Concept, Advice & Testing. +-- * **[Gunterlund](http://forums.eagle.ru:8080/member.php?u=75036)**: Test case revision. +-- +-- ### Authors: +-- +-- * **FlightControl**: Concept, Design & Programming. +-- +-- @module AI_Cas + + +--- AI_CAS_ZONE class +-- @type AI_CAS_ZONE +-- @field Wrapper.Controllable#CONTROLLABLE AIControllable The @{Controllable} patrolling. +-- @field Core.Zone#ZONE_BASE TargetZone The @{Zone} where the patrol needs to be executed. +-- @extends AI.AI_Patrol#AI_PATROL_ZONE +AI_CAS_ZONE = { + ClassName = "AI_CAS_ZONE", +} + + + +--- Creates a new AI_CAS_ZONE object +-- @param #AI_CAS_ZONE self +-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed. +-- @param Dcs.DCSTypes#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol. +-- @param Dcs.DCSTypes#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol. +-- @param Dcs.DCSTypes#Speed PatrolMinSpeed The minimum speed of the @{Controllable} in km/h. +-- @param Dcs.DCSTypes#Speed PatrolMaxSpeed The maximum speed of the @{Controllable} in km/h. +-- @param Core.Zone#ZONE EngageZone +-- @return #AI_CAS_ZONE self +function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, EngageZone ) + + -- Inherits from BASE + local self = BASE:Inherit( self, AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed ) ) -- #AI_CAS_ZONE + + self.EngageZone = EngageZone + self.Accomplished = false + + self:SetDetectionZone( self.EngageZone ) + + self:AddTransition( { "Patrolling", "Engaging" }, "Engage", "Engaging" ) -- FSM_CONTROLLABLE Transition for type #AI_CAS_ZONE. + + --- OnBefore Transition Handler for Event Engage. + -- @function [parent=#AI_CAS_ZONE] OnBeforeEngage + -- @param #AI_CAS_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + -- @return #boolean Return false to cancel Transition. + + --- OnAfter Transition Handler for Event Engage. + -- @function [parent=#AI_CAS_ZONE] OnAfterEngage + -- @param #AI_CAS_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + + --- Synchronous Event Trigger for Event Engage. + -- @function [parent=#AI_CAS_ZONE] Engage + -- @param #AI_CAS_ZONE self + + --- Asynchronous Event Trigger for Event Engage. + -- @function [parent=#AI_CAS_ZONE] __Engage + -- @param #AI_CAS_ZONE self + -- @param #number Delay The delay in seconds. + +--- OnLeave Transition Handler for State Engaging. +-- @function [parent=#AI_CAS_ZONE] OnLeaveEngaging +-- @param #AI_CAS_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @return #boolean Return false to cancel Transition. + +--- OnEnter Transition Handler for State Engaging. +-- @function [parent=#AI_CAS_ZONE] OnEnterEngaging +-- @param #AI_CAS_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. + + self:AddTransition( "Engaging", "Fired", "Engaging" ) -- FSM_CONTROLLABLE Transition for type #AI_CAS_ZONE. + + --- OnBefore Transition Handler for Event Fired. + -- @function [parent=#AI_CAS_ZONE] OnBeforeFired + -- @param #AI_CAS_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + -- @return #boolean Return false to cancel Transition. + + --- OnAfter Transition Handler for Event Fired. + -- @function [parent=#AI_CAS_ZONE] OnAfterFired + -- @param #AI_CAS_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + + --- Synchronous Event Trigger for Event Fired. + -- @function [parent=#AI_CAS_ZONE] Fired + -- @param #AI_CAS_ZONE self + + --- Asynchronous Event Trigger for Event Fired. + -- @function [parent=#AI_CAS_ZONE] __Fired + -- @param #AI_CAS_ZONE self + -- @param #number Delay The delay in seconds. + + self:AddTransition( "*", "Destroy", "*" ) -- FSM_CONTROLLABLE Transition for type #AI_CAS_ZONE. + + --- OnBefore Transition Handler for Event Destroy. + -- @function [parent=#AI_CAS_ZONE] OnBeforeDestroy + -- @param #AI_CAS_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + -- @return #boolean Return false to cancel Transition. + + --- OnAfter Transition Handler for Event Destroy. + -- @function [parent=#AI_CAS_ZONE] OnAfterDestroy + -- @param #AI_CAS_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + + --- Synchronous Event Trigger for Event Destroy. + -- @function [parent=#AI_CAS_ZONE] Destroy + -- @param #AI_CAS_ZONE self + + --- Asynchronous Event Trigger for Event Destroy. + -- @function [parent=#AI_CAS_ZONE] __Destroy + -- @param #AI_CAS_ZONE self + -- @param #number Delay The delay in seconds. + + + self:AddTransition( "Engaging", "Abort", "Patrolling" ) -- FSM_CONTROLLABLE Transition for type #AI_CAS_ZONE. + + --- OnBefore Transition Handler for Event Abort. + -- @function [parent=#AI_CAS_ZONE] OnBeforeAbort + -- @param #AI_CAS_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + -- @return #boolean Return false to cancel Transition. + + --- OnAfter Transition Handler for Event Abort. + -- @function [parent=#AI_CAS_ZONE] OnAfterAbort + -- @param #AI_CAS_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + + --- Synchronous Event Trigger for Event Abort. + -- @function [parent=#AI_CAS_ZONE] Abort + -- @param #AI_CAS_ZONE self + + --- Asynchronous Event Trigger for Event Abort. + -- @function [parent=#AI_CAS_ZONE] __Abort + -- @param #AI_CAS_ZONE self + -- @param #number Delay The delay in seconds. + + self:AddTransition( "Engaging", "Accomplish", "Patrolling" ) -- FSM_CONTROLLABLE Transition for type #AI_CAS_ZONE. + + --- OnBefore Transition Handler for Event Accomplish. + -- @function [parent=#AI_CAS_ZONE] OnBeforeAccomplish + -- @param #AI_CAS_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + -- @return #boolean Return false to cancel Transition. + + --- OnAfter Transition Handler for Event Accomplish. + -- @function [parent=#AI_CAS_ZONE] OnAfterAccomplish + -- @param #AI_CAS_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + + --- Synchronous Event Trigger for Event Accomplish. + -- @function [parent=#AI_CAS_ZONE] Accomplish + -- @param #AI_CAS_ZONE self + + --- Asynchronous Event Trigger for Event Accomplish. + -- @function [parent=#AI_CAS_ZONE] __Accomplish + -- @param #AI_CAS_ZONE self + -- @param #number Delay The delay in seconds. + + return self +end + + +--- Set the Engage Zone where the AI is performing CAS. Note that if the EngageZone is changed, the AI needs to re-detect targets. +-- @param #AI_CAS_ZONE self +-- @param Core.Zone#ZONE EngageZone The zone where the AI is performing CAS. +-- @return #AI_CAS_ZONE self +function AI_CAS_ZONE:SetEngageZone( EngageZone ) + self:F2() + + if EngageZone then + self.EngageZone = EngageZone + else + self.EngageZone = nil + end +end + + + +--- onafter State Transition for Event Start. +-- @param #AI_CAS_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_CAS_ZONE:onafterStart( Controllable, From, Event, To ) + + -- Call the parent Start event handler + self:GetParent(self).onafterStart( self, Controllable, From, Event, To ) + self:EventOnDead( self.OnDead ) + +end + +--- @param Wrapper.Controllable#CONTROLLABLE AIControllable +function _NewEngageRoute( AIControllable ) + + AIControllable:T( "NewEngageRoute" ) + local EngageZone = AIControllable:GetState( AIControllable, "EngageZone" ) -- AI.AI_Cas#AI_CAS_ZONE + EngageZone:__Engage( 1 ) +end + +--- @param #AI_CAS_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_CAS_ZONE:onbeforeEngage( Controllable, From, Event, To ) + + if self.Accomplished == true then + return false + end +end + + +--- @param #AI_CAS_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To ) + + if Controllable:IsAlive() then + + local EngageRoute = {} + + --- Calculate the current route point. + local CurrentVec2 = self.Controllable:GetVec2() + + --TODO: Create GetAltitude function for GROUP, and delete GetUnit(1). + local CurrentAltitude = self.Controllable:GetUnit(1):GetAltitude() + local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y ) + local ToEngageZoneSpeed = self.PatrolMaxSpeed + local CurrentRoutePoint = CurrentPointVec3:RoutePointAir( + POINT_VEC3.RoutePointAltType.BARO, + POINT_VEC3.RoutePointType.TurningPoint, + POINT_VEC3.RoutePointAction.TurningPoint, + ToEngageZoneSpeed, + true + ) + + EngageRoute[#EngageRoute+1] = CurrentRoutePoint + + + if self.Controllable:IsNotInZone( self.EngageZone ) then + + -- Find a random 2D point in EngageZone. + local ToEngageZoneVec2 = self.EngageZone:GetRandomVec2() + self:T2( ToEngageZoneVec2 ) + + -- Define Speed and Altitude. + local ToEngageZoneAltitude = math.random( self.EngageFloorAltitude, self.EngageCeilingAltitude ) + local ToEngageZoneSpeed = self.PatrolMaxSpeed + self:T2( ToEngageZoneSpeed ) + + -- Obtain a 3D @{Point} from the 2D point + altitude. + local ToEngageZonePointVec3 = POINT_VEC3:New( ToEngageZoneVec2.x, ToEngageZoneAltitude, ToEngageZoneVec2.y ) + + -- Create a route point of type air. + local ToEngageZoneRoutePoint = ToEngageZonePointVec3:RoutePointAir( + POINT_VEC3.RoutePointAltType.BARO, + POINT_VEC3.RoutePointType.TurningPoint, + POINT_VEC3.RoutePointAction.TurningPoint, + ToEngageZoneSpeed, + true + ) + + EngageRoute[#EngageRoute+1] = ToEngageZoneRoutePoint + + end + + --- Define a random point in the @{Zone}. The AI will fly to that point within the zone. + + --- Find a random 2D point in EngageZone. + local ToTargetVec2 = self.EngageZone:GetRandomVec2() + self:T2( ToTargetVec2 ) + + --- Define Speed and Altitude. + local ToTargetAltitude = math.random( self.EngageFloorAltitude, self.EngageCeilingAltitude ) + local ToTargetSpeed = math.random( self.PatrolMinSpeed, self.PatrolMaxSpeed ) + self:T2( { self.PatrolMinSpeed, self.PatrolMaxSpeed, ToTargetSpeed } ) + + --- Obtain a 3D @{Point} from the 2D point + altitude. + local ToTargetPointVec3 = POINT_VEC3:New( ToTargetVec2.x, ToTargetAltitude, ToTargetVec2.y ) + + --- Create a route point of type air. + local ToTargetRoutePoint = ToTargetPointVec3:RoutePointAir( + POINT_VEC3.RoutePointAltType.BARO, + POINT_VEC3.RoutePointType.TurningPoint, + POINT_VEC3.RoutePointAction.TurningPoint, + ToTargetSpeed, + true + ) + + ToTargetPointVec3:SmokeBlue() + + EngageRoute[#EngageRoute+1] = ToTargetRoutePoint + + + Controllable:OptionROEOpenFire() + Controllable:OptionROTPassiveDefense() + + local AttackTasks = {} + + for DetectedUnitID, DetectedUnit in pairs( self.DetectedUnits ) do + local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT + self:T( DetectedUnit ) + if DetectedUnit:IsAlive() then + if DetectedUnit:IsInZone( self.EngageZone ) then + self:E( {"Engaging ", DetectedUnit } ) + AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit ) + end + else + self.DetectedUnits[DetectedUnit] = nil + end + end + + EngageRoute[1].task = Controllable:TaskCombo( AttackTasks ) + + --- Now we're going to do something special, we're going to call a function from a waypoint action at the AIControllable... + self.Controllable:WayPointInitialize( EngageRoute ) + + --- Do a trick, link the NewEngageRoute function of the object to the AIControllable in a temporary variable ... + self.Controllable:SetState( self.Controllable, "EngageZone", self ) + + self.Controllable:WayPointFunction( #EngageRoute, 1, "_NewEngageRoute" ) + + --- NOW ROUTE THE GROUP! + self.Controllable:WayPointExecute( 1, 2 ) + end +end + +--- @param #AI_CAS_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @param Core.Event#EVENTDATA EventData +function AI_CAS_ZONE:onafterDestroy( Controllable, From, Event, To, EventData ) + + if EventData.IniUnit then + self.DetectedUnits[EventData.IniUnit] = nil + end + + Controllable:MessageToAll( "Destroyed a target", 15 , "Destroyed!" ) +end + +--- @param #AI_CAS_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_CAS_ZONE:onafterAccomplish( Controllable, From, Event, To ) + self.Accomplished = true + self:SetDetectionOff() +end + +--- @param #AI_CAS_ZONE self +-- @param Core.Event#EVENTDATA EventData +function AI_CAS_ZONE:OnDead( EventData ) + self:T( { "EventDead", EventData } ) + + if EventData.IniDCSUnit then + self:__Destroy( 1, EventData ) + end +end + + diff --git a/Moose Development/Moose/AI/AI_Cargo.lua b/Moose Development/Moose/AI/AI_Cargo.lua index e8963c927..903181661 100644 --- a/Moose Development/Moose/AI/AI_Cargo.lua +++ b/Moose Development/Moose/AI/AI_Cargo.lua @@ -1,4 +1,4 @@ ---- Management of logical cargo objects, that can be transported from and to transportation carriers. +--- Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Ground -- Management of logical cargo objects, that can be transported from and to transportation carriers. -- -- === -- diff --git a/Moose Development/Moose/AI/AI_Patrol.lua b/Moose Development/Moose/AI/AI_Patrol.lua index 6781fe964..8011f7482 100644 --- a/Moose Development/Moose/AI/AI_Patrol.lua +++ b/Moose Development/Moose/AI/AI_Patrol.lua @@ -1,110 +1,122 @@ ---- (AI) (FSM) Make AI patrol routes or zones. +--- Single-Player:**Yes** / Mulit-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**Air** -- **Air Patrolling or Staging.** +-- +-- ![Banner Image](..\Presentations\AI_PATROL\Dia1.JPG) +-- -- -- === -- --- 1) @{#AI_PATROLZONE} class, extends @{Core.Fsm#FSM_CONTROLLABLE} --- ================================================================ --- The @{#AI_PATROLZONE} class implements the core functions to patrol a @{Zone} by an AIR @{Controllable} @{Group}. --- The patrol algorithm works that for each airplane patrolling, upon arrival at the patrol zone, --- a random point is selected as the route point within the 3D space, within the given boundary limits. --- The airplane will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits. --- Upon arrival at the random 3D point, a new 3D random point will be selected within the patrol zone using the given limits. --- This cycle will continue until a fuel treshold has been reached by the airplane. +-- # 1) @{#AI_PATROL_ZONE} class, extends @{Core.Fsm#FSM_CONTROLLABLE} +-- +-- The @{#AI_PATROL_ZONE} class implements the core functions to patrol a @{Zone} by an AI @{Controllable} or @{Group}. +-- +-- ![Process](..\Presentations\AI_PATROL\Dia3.JPG) +-- +-- The AI_PATROL_ZONE is assigned a @{Group} and this must be done before the AI_PATROL_ZONE process can be started using the **Start** event. +-- +-- ![Process](..\Presentations\AI_PATROL\Dia4.JPG) +-- +-- The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits. +-- Upon arrival at the 3D point, a new random 3D point will be selected within the patrol zone using the given limits. +-- +-- ![Process](..\Presentations\AI_PATROL\Dia5.JPG) +-- +-- This cycle will continue. +-- +-- ![Process](..\Presentations\AI_PATROL\Dia6.JPG) +-- +-- During the patrol, the AI will detect enemy targets, which are reported through the **Detected** event. +-- +-- ![Process](..\Presentations\AI_PATROL\Dia9.JPG) +-- +---- Note that the enemy is not engaged! To model enemy engagement, either tailor the **Detected** event, or +-- use derived AI_ classes to model AI offensive or defensive behaviour. +-- +-- ![Process](..\Presentations\AI_PATROL\Dia10.JPG) +-- +-- Until a fuel or damage treshold has been reached by the AI, or when the AI is commanded to RTB. -- When the fuel treshold has been reached, the airplane will fly towards the nearest friendly airbase and will land. -- --- 1.1) AI_PATROLZONE constructor: --- ---------------------------- +-- ![Process](..\Presentations\AI_PATROL\Dia11.JPG) +-- +-- ## 1.1) AI_PATROL_ZONE constructor -- --- * @{#AI_PATROLZONE.New}(): Creates a new AI_PATROLZONE object. +-- * @{#AI_PATROL_ZONE.New}(): Creates a new AI_PATROL_ZONE object. -- --- 1.2) AI_PATROLZONE state machine: --- ---------------------------------- --- The AI_PATROLZONE is a state machine: it manages the different events and states of the AIControllable it is controlling. +-- ## 1.2) AI_PATROL_ZONE is a FSM -- --- ### 1.2.1) AI_PATROLZONE Events: +-- ![Process](..\Presentations\AI_PATROL\Dia2.JPG) -- --- * @{#AI_PATROLZONE.Route}( AIControllable ): A new 3D route point is selected and the AIControllable will fly towards that point with the given speed. --- * @{#AI_PATROLZONE.Patrol}( AIControllable ): The AIControllable reports it is patrolling. This event is called every 30 seconds. --- * @{#AI_PATROLZONE.RTB}( AIControllable ): The AIControllable will report return to base. --- * @{#AI_PATROLZONE.End}( AIControllable ): The end of the AI_PATROLZONE process. --- * @{#AI_PATROLZONE.Dead}( AIControllable ): The AIControllable is dead. The AI_PATROLZONE process will be ended. +-- ### 1.2.1) AI_PATROL_ZONE States -- --- ### 1.2.2) AI_PATROLZONE States: +-- * **None** ( Group ): The process is not started yet. +-- * **Patrolling** ( Group ): The AI is patrolling the Patrol Zone. +-- * **Returning** ( Group ): The AI is returning to Base.. -- --- * **Route**: A new 3D route point is selected and the AIControllable will fly towards that point with the given speed. --- * **Patrol**: The AIControllable is patrolling. This state is set every 30 seconds, so every 30 seconds, a state transition method can be used. --- * **RTB**: The AIControllable reports it wants to return to the base. --- * **Dead**: The AIControllable is dead ... --- * **End**: The process has come to an end. --- --- ### 1.2.3) AI_PATROLZONE state transition methods: +-- ### 1.2.2) AI_PATROL_ZONE Events -- --- State transition functions can be set **by the mission designer** customizing or improving the behaviour of the state. --- There are 2 moments when state transition methods will be called by the state machine: --- --- * **Before** the state transition. --- The state transition method needs to start with the name **OnBefore + the name of the state**. --- If the state transition method returns false, then the processing of the state transition will not be done! --- If you want to change the behaviour of the AIControllable at this event, return false, --- but then you'll need to specify your own logic using the AIControllable! --- --- * **After** the state transition. --- The state transition method needs to start with the name **OnAfter + the name of the state**. --- These state transition methods need to provide a return value, which is specified at the function description. --- --- An example how to manage a state transition for an AI_PATROLZONE object **Patrol** for the state **RTB**: --- --- local PatrolZoneGroup = GROUP:FindByName( "Patrol Zone" ) --- local PatrolZone = ZONE_POLYGON:New( "PatrolZone", PatrolZoneGroup ) --- --- local PatrolSpawn = SPAWN:New( "Patrol Group" ) --- local PatrolGroup = PatrolSpawn:Spawn() --- --- local Patrol = AI_PATROLZONE:New( PatrolZone, 3000, 6000, 300, 600 ) --- Patrol:SetControllable( PatrolGroup ) --- Patrol:ManageFuel( 0.2, 60 ) --- --- **OnBefore**RTB( AIGroup ) will be called by the AI_PATROLZONE object when the AIGroup reports RTB, but **before** the RTB default action is processed by the AI_PATROLZONE object. --- --- --- State transition function for the AI_PATROLZONE **Patrol** object --- -- @param #AI_PATROLZONE self --- -- @param Wrapper.Controllable#CONTROLLABLE AIGroup --- -- @return #boolean If false is returned, then the OnAfter state transition method will not be called. --- function Patrol:OnBeforeRTB( AIGroup ) --- AIGroup:MessageToRed( "Returning to base", 20 ) --- end --- --- **OnAfter**RTB( AIGroup ) will be called by the AI_PATROLZONE object when the AIGroup reports RTB, but **after** the RTB default action was processed by the AI_PATROLZONE object. --- --- --- State transition function for the AI_PATROLZONE **Patrol** object --- -- @param #AI_PATROLZONE self --- -- @param Wrapper.Controllable#CONTROLLABLE AIGroup --- -- @return #Wrapper.Controllable#CONTROLLABLE The new AIGroup object that is set to be patrolling the zone. --- function Patrol:OnAfterRTB( AIGroup ) --- return PatrolSpawn:Spawn() --- end +-- * **Start** ( Group ): Start the process. +-- * **Route** ( Group ): Route the AI to a new random 3D point within the Patrol Zone. +-- * **RTB** ( Group ): Route the AI to the home base. +-- * **Detect** ( Group ): The AI is detecting targets. +-- * **Detected** ( Group ): The AI has detected new targets. +-- * **Status** ( Group ): The AI is checking status (fuel and damage). When the tresholds have been reached, the AI will RTB. -- --- 1.3) Manage the AI_PATROLZONE parameters: --- ------------------------------------------ --- The following methods are available to modify the parameters of a AI_PATROLZONE object: +-- ## 1.3) Set or Get the AI controllable -- --- * @{#AI_PATROLZONE.SetControllable}(): Set the AIControllable. --- * @{#AI_PATROLZONE.GetControllable}(): Get the AIControllable. --- * @{#AI_PATROLZONE.SetSpeed}(): Set the patrol speed of the AI, for the next patrol. --- * @{#AI_PATROLZONE.SetAltitude}(): Set altitude of the AI, for the next patrol. +-- * @{#AI_PATROL_ZONE.SetControllable}(): Set the AIControllable. +-- * @{#AI_PATROL_ZONE.GetControllable}(): Get the AIControllable. +-- +-- ## 1.4) Set the Speed and Altitude boundaries of the AI controllable +-- +-- * @{#AI_PATROL_ZONE.SetSpeed}(): Set the patrol speed boundaries of the AI, for the next patrol. +-- * @{#AI_PATROL_ZONE.SetAltitude}(): Set altitude boundaries of the AI, for the next patrol. -- --- 1.3) Manage the out of fuel in the AI_PATROLZONE: --- ---------------------------------------------- --- When the AIControllable is out of fuel, it is required that a new AIControllable is started, before the old AIControllable can return to the home base. +-- ## 1.5) Manage the detection process of the AI controllable +-- +-- The detection process of the AI controllable can be manipulated. +-- Detection requires an amount of CPU power, which has an impact on your mission performance. +-- Only put detection on when absolutely necessary, and the frequency of the detection can also be set. +-- +-- * @{#AI_PATROL_ZONE.SetDetectionOn}(): Set the detection on. The AI will detect for targets. +-- * @{#AI_PATROL_ZONE.SetDetectionOff}(): Set the detection off, the AI will not detect for targets. The existing target list will NOT be erased. +-- +-- The detection frequency can be set with @{#AI_PATROL_ZONE.SetDetectionInterval}( seconds ), where the amount of seconds specify how much seconds will be waited before the next detection. +-- Use the method @{#AI_PATROL_ZONE.GetDetectedUnits}() to obtain a list of the @{Unit}s detected by the AI. +-- +-- The detection can be filtered to potential targets in a specific zone. +-- Use the method @{#AI_PATROL_ZONE.SetDetectionZone}() to set the zone where targets need to be detected. +-- Note that when the zone is too far away, or the AI is not heading towards the zone, or the AI is too high, no targets may be detected +-- according the weather conditions. +-- +-- ## 1.6) Manage the "out of fuel" in the AI_PATROL_ZONE +-- +-- When the AI is out of fuel, it is required that a new AI is started, before the old AI can return to the home base. -- Therefore, with a parameter and a calculation of the distance to the home base, the fuel treshold is calculated. --- When the fuel treshold is reached, the AIControllable will continue for a given time its patrol task in orbit, while a new AIControllable is targetted to the AI_PATROLZONE. --- Once the time is finished, the old AIControllable will return to the base. --- Use the method @{#AI_PATROLZONE.ManageFuel}() to have this proces in place. +-- When the fuel treshold is reached, the AI will continue for a given time its patrol task in orbit, +-- while a new AI is targetted to the AI_PATROL_ZONE. +-- Once the time is finished, the old AI will return to the base. +-- Use the method @{#AI_PATROL_ZONE.ManageFuel}() to have this proces in place. +-- +-- ## 1.7) Manage "damage" behaviour of the AI in the AI_PATROL_ZONE +-- +-- When the AI is damaged, it is required that a new AIControllable is started. However, damage cannon be foreseen early on. +-- Therefore, when the damage treshold is reached, the AI will return immediately to the home base (RTB). +-- Use the method @{#AI_PATROL_ZONE.ManageDamage}() to have this proces in place. -- -- ==== -- --- **API CHANGE HISTORY** --- ====================== +-- # **OPEN ISSUES** +-- +-- 2017-01-17: When Spawned AI is located at an airbase, it will be routed first back to the airbase after take-off. +-- +-- 2016-01-17: +-- -- Fixed problem with AI returning to base too early and unexpected. +-- -- ReSpawning of AI will reset the AI_PATROL and derived classes. +-- -- Checked the correct workings of SCHEDULER, and it DOES work correctly. +-- +-- ==== +-- +-- # **API CHANGE HISTORY** -- -- The underlying change log documents the API changes. Please read this carefully. The following notation is used: -- @@ -113,87 +125,287 @@ -- -- Hereby the change log: -- +-- 2017-01-17: Rename of class: **AI\_PATROL\_ZONE** is the new name for the old _AI\_PATROLZONE_. +-- +-- 2017-01-15: Complete revision. AI_PATROL_ZONE is the base class for other AI_PATROL like classes. +-- -- 2016-09-01: Initial class and API. -- -- === -- --- AUTHORS and CONTRIBUTIONS --- ========================= +-- # **AUTHORS and CONTRIBUTIONS** -- -- ### Contributions: -- --- * **DutchBaron**: Testing. --- * **Pikey**: Testing and API concept review. +-- * **[Dutch_Baron](https://forums.eagle.ru/member.php?u=112075)**: Working together with James has resulted in the creation of the AI_BALANCER class. James has shared his ideas on balancing AI with air units, and together we made a first design which you can use now :-) +-- * **[Pikey](https://forums.eagle.ru/member.php?u=62835)**: Testing and API concept review. -- -- ### Authors: -- -- * **FlightControl**: Design & Programming. -- --- --- @module Patrol +-- @module AI_Patrol --- State Transition Functions - ---- OnBefore State Transition Function --- @function [parent=#AI_PATROLZONE] OnBeforeRoute --- @param #AI_PATROLZONE self --- @param Wrapper.Controllable#CONTROLLABLE Controllable --- @return #boolean - ---- OnAfter State Transition Function --- @function [parent=#AI_PATROLZONE] OnAfterRoute --- @param #AI_PATROLZONE self --- @param Wrapper.Controllable#CONTROLLABLE Controllable - - - ---- AI_PATROLZONE class --- @type AI_PATROLZONE +--- AI_PATROL_ZONE class +-- @type AI_PATROL_ZONE -- @field Wrapper.Controllable#CONTROLLABLE AIControllable The @{Controllable} patrolling. -- @field Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed. -- @field Dcs.DCSTypes#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol. -- @field Dcs.DCSTypes#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol. -- @field Dcs.DCSTypes#Speed PatrolMinSpeed The minimum speed of the @{Controllable} in km/h. -- @field Dcs.DCSTypes#Speed PatrolMaxSpeed The maximum speed of the @{Controllable} in km/h. +-- @field Functional.Spawn#SPAWN CoordTest -- @extends Core.Fsm#FSM_CONTROLLABLE -AI_PATROLZONE = { - ClassName = "AI_PATROLZONE", +AI_PATROL_ZONE = { + ClassName = "AI_PATROL_ZONE", } - - ---- Creates a new AI_PATROLZONE object --- @param #AI_PATROLZONE self +--- Creates a new AI_PATROL_ZONE object +-- @param #AI_PATROL_ZONE self -- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed. -- @param Dcs.DCSTypes#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol. -- @param Dcs.DCSTypes#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol. -- @param Dcs.DCSTypes#Speed PatrolMinSpeed The minimum speed of the @{Controllable} in km/h. -- @param Dcs.DCSTypes#Speed PatrolMaxSpeed The maximum speed of the @{Controllable} in km/h. --- @return #AI_PATROLZONE self +-- @return #AI_PATROL_ZONE self -- @usage --- -- Define a new AI_PATROLZONE Object. This PatrolArea will patrol an AIControllable within PatrolZone between 3000 and 6000 meters, with a variying speed between 600 and 900 km/h. +-- -- Define a new AI_PATROL_ZONE Object. This PatrolArea will patrol an AIControllable within PatrolZone between 3000 and 6000 meters, with a variying speed between 600 and 900 km/h. -- PatrolZone = ZONE:New( 'PatrolZone' ) -- PatrolSpawn = SPAWN:New( 'Patrol Group' ) --- PatrolArea = AI_PATROLZONE:New( PatrolZone, 3000, 6000, 600, 900 ) -function AI_PATROLZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed ) +-- PatrolArea = AI_PATROL_ZONE:New( PatrolZone, 3000, 6000, 600, 900 ) +function AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed ) -- Inherits from BASE - local self = BASE:Inherit( self, FSM_CONTROLLABLE:New() ) -- Core.Fsm#FSM_CONTROLLABLE + local self = BASE:Inherit( self, FSM_CONTROLLABLE:New() ) -- #AI_PATROL_ZONE - self:SetStartState( "None" ) - self:AddTransition( "*", "Start", "Route" ) - self:AddTransition( "*", "Route", "Route" ) - self:AddTransition( { "Patrol", "Route" }, "Patrol", "Patrol" ) - self:AddTransition( "Patrol", "RTB", "RTB" ) - self:AddTransition( "*", "End", "End" ) - self:AddTransition( "*", "Dead", "End" ) self.PatrolZone = PatrolZone self.PatrolFloorAltitude = PatrolFloorAltitude self.PatrolCeilingAltitude = PatrolCeilingAltitude self.PatrolMinSpeed = PatrolMinSpeed self.PatrolMaxSpeed = PatrolMaxSpeed + + self:SetDetectionOn() + self.CheckStatus = true + + self:ManageFuel( .2, 60 ) + self:ManageDamage( 1 ) + + self:SetDetectionInterval( 30 ) + + self.DetectedUnits = {} -- This table contains the targets detected during patrol. + + self:SetStartState( "None" ) + + self:AddTransition( "None", "Start", "Patrolling" ) + +--- OnBefore Transition Handler for Event Start. +-- @function [parent=#AI_PATROL_ZONE] OnBeforeStart +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @return #boolean Return false to cancel Transition. + +--- OnAfter Transition Handler for Event Start. +-- @function [parent=#AI_PATROL_ZONE] OnAfterStart +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. + +--- Synchronous Event Trigger for Event Start. +-- @function [parent=#AI_PATROL_ZONE] Start +-- @param #AI_PATROL_ZONE self + +--- Asynchronous Event Trigger for Event Start. +-- @function [parent=#AI_PATROL_ZONE] __Start +-- @param #AI_PATROL_ZONE self +-- @param #number Delay The delay in seconds. + +--- OnLeave Transition Handler for State Patrolling. +-- @function [parent=#AI_PATROL_ZONE] OnLeavePatrolling +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @return #boolean Return false to cancel Transition. + +--- OnEnter Transition Handler for State Patrolling. +-- @function [parent=#AI_PATROL_ZONE] OnEnterPatrolling +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. + + self:AddTransition( "Patrolling", "Route", "Patrolling" ) -- FSM_CONTROLLABLE Transition for type #AI_PATROL_ZONE. + +--- OnBefore Transition Handler for Event Route. +-- @function [parent=#AI_PATROL_ZONE] OnBeforeRoute +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @return #boolean Return false to cancel Transition. + +--- OnAfter Transition Handler for Event Route. +-- @function [parent=#AI_PATROL_ZONE] OnAfterRoute +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. + +--- Synchronous Event Trigger for Event Route. +-- @function [parent=#AI_PATROL_ZONE] Route +-- @param #AI_PATROL_ZONE self + +--- Asynchronous Event Trigger for Event Route. +-- @function [parent=#AI_PATROL_ZONE] __Route +-- @param #AI_PATROL_ZONE self +-- @param #number Delay The delay in seconds. + + self:AddTransition( "*", "Status", "*" ) -- FSM_CONTROLLABLE Transition for type #AI_PATROL_ZONE. + +--- OnBefore Transition Handler for Event Status. +-- @function [parent=#AI_PATROL_ZONE] OnBeforeStatus +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @return #boolean Return false to cancel Transition. + +--- OnAfter Transition Handler for Event Status. +-- @function [parent=#AI_PATROL_ZONE] OnAfterStatus +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. + +--- Synchronous Event Trigger for Event Status. +-- @function [parent=#AI_PATROL_ZONE] Status +-- @param #AI_PATROL_ZONE self + +--- Asynchronous Event Trigger for Event Status. +-- @function [parent=#AI_PATROL_ZONE] __Status +-- @param #AI_PATROL_ZONE self +-- @param #number Delay The delay in seconds. + + self:AddTransition( "*", "Detect", "*" ) -- FSM_CONTROLLABLE Transition for type #AI_PATROL_ZONE. + +--- OnBefore Transition Handler for Event Detect. +-- @function [parent=#AI_PATROL_ZONE] OnBeforeDetect +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @return #boolean Return false to cancel Transition. + +--- OnAfter Transition Handler for Event Detect. +-- @function [parent=#AI_PATROL_ZONE] OnAfterDetect +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. + +--- Synchronous Event Trigger for Event Detect. +-- @function [parent=#AI_PATROL_ZONE] Detect +-- @param #AI_PATROL_ZONE self + +--- Asynchronous Event Trigger for Event Detect. +-- @function [parent=#AI_PATROL_ZONE] __Detect +-- @param #AI_PATROL_ZONE self +-- @param #number Delay The delay in seconds. + + self:AddTransition( "*", "Detected", "*" ) -- FSM_CONTROLLABLE Transition for type #AI_PATROL_ZONE. + +--- OnBefore Transition Handler for Event Detected. +-- @function [parent=#AI_PATROL_ZONE] OnBeforeDetected +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @return #boolean Return false to cancel Transition. + +--- OnAfter Transition Handler for Event Detected. +-- @function [parent=#AI_PATROL_ZONE] OnAfterDetected +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. + +--- Synchronous Event Trigger for Event Detected. +-- @function [parent=#AI_PATROL_ZONE] Detected +-- @param #AI_PATROL_ZONE self + +--- Asynchronous Event Trigger for Event Detected. +-- @function [parent=#AI_PATROL_ZONE] __Detected +-- @param #AI_PATROL_ZONE self +-- @param #number Delay The delay in seconds. + + self:AddTransition( "*", "RTB", "Returning" ) -- FSM_CONTROLLABLE Transition for type #AI_PATROL_ZONE. + +--- OnBefore Transition Handler for Event RTB. +-- @function [parent=#AI_PATROL_ZONE] OnBeforeRTB +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @return #boolean Return false to cancel Transition. + +--- OnAfter Transition Handler for Event RTB. +-- @function [parent=#AI_PATROL_ZONE] OnAfterRTB +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. + +--- Synchronous Event Trigger for Event RTB. +-- @function [parent=#AI_PATROL_ZONE] RTB +-- @param #AI_PATROL_ZONE self + +--- Asynchronous Event Trigger for Event RTB. +-- @function [parent=#AI_PATROL_ZONE] __RTB +-- @param #AI_PATROL_ZONE self +-- @param #number Delay The delay in seconds. + +--- OnLeave Transition Handler for State Returning. +-- @function [parent=#AI_PATROL_ZONE] OnLeaveReturning +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @return #boolean Return false to cancel Transition. + +--- OnEnter Transition Handler for State Returning. +-- @function [parent=#AI_PATROL_ZONE] OnEnterReturning +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. + + self:AddTransition( "*", "Reset", "Patrolling" ) -- FSM_CONTROLLABLE Transition for type #AI_PATROL_ZONE. + + self:AddTransition( "*", "Eject", "Ejected" ) + self:AddTransition( "*", "Crash", "Crashed" ) + self:AddTransition( "*", "PilotDead", "PilotDead" ) + return self end @@ -201,11 +413,11 @@ end --- Sets (modifies) the minimum and maximum speed of the patrol. --- @param #AI_PATROLZONE self +-- @param #AI_PATROL_ZONE self -- @param Dcs.DCSTypes#Speed PatrolMinSpeed The minimum speed of the @{Controllable} in km/h. -- @param Dcs.DCSTypes#Speed PatrolMaxSpeed The maximum speed of the @{Controllable} in km/h. --- @return #AI_PATROLZONE self -function AI_PATROLZONE:SetSpeed( PatrolMinSpeed, PatrolMaxSpeed ) +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:SetSpeed( PatrolMinSpeed, PatrolMaxSpeed ) self:F2( { PatrolMinSpeed, PatrolMaxSpeed } ) self.PatrolMinSpeed = PatrolMinSpeed @@ -215,39 +427,120 @@ end --- Sets the floor and ceiling altitude of the patrol. --- @param #AI_PATROLZONE self +-- @param #AI_PATROL_ZONE self -- @param Dcs.DCSTypes#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol. -- @param Dcs.DCSTypes#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol. --- @return #AI_PATROLZONE self -function AI_PATROLZONE:SetAltitude( PatrolFloorAltitude, PatrolCeilingAltitude ) +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:SetAltitude( PatrolFloorAltitude, PatrolCeilingAltitude ) self:F2( { PatrolFloorAltitude, PatrolCeilingAltitude } ) self.PatrolFloorAltitude = PatrolFloorAltitude self.PatrolCeilingAltitude = PatrolCeilingAltitude end +-- * @{#AI_PATROL_ZONE.SetDetectionOn}(): Set the detection on. The AI will detect for targets. +-- * @{#AI_PATROL_ZONE.SetDetectionOff}(): Set the detection off, the AI will not detect for targets. The existing target list will NOT be erased. +--- Set the detection on. The AI will detect for targets. +-- @param #AI_PATROL_ZONE self +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:SetDetectionOn() + self:F2() + + self.DetectOn = true +end ---- @param Wrapper.Controllable#CONTROLLABLE AIControllable -function _NewPatrolRoute( AIControllable ) +--- Set the detection off. The AI will NOT detect for targets. +-- However, the list of already detected targets will be kept and can be enquired! +-- @param #AI_PATROL_ZONE self +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:SetDetectionOff() + self:F2() + + self.DetectOn = false +end - AIControllable:T( "NewPatrolRoute" ) - local PatrolZone = AIControllable:GetState( AIControllable, "PatrolZone" ) -- PatrolCore.Zone#AI_PATROLZONE - PatrolZone:__Route( 1 ) +--- Set the status checking off. +-- @param #AI_PATROL_ZONE self +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:SetStatusOff() + self:F2() + + self.CheckStatus = false +end + +--- Activate the detection. The AI will detect for targets if the Detection is switched On. +-- @param #AI_PATROL_ZONE self +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:SetDetectionActivated() + self:F2() + + self.DetectActivated = true + self:__Detect( self.DetectInterval ) +end + +--- Deactivate the detection. The AI will NOT detect for targets. +-- @param #AI_PATROL_ZONE self +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:SetDetectionDeactivated() + self:F2() + + self.DetectActivated = false +end + +--- Set the interval in seconds between each detection executed by the AI. +-- The list of already detected targets will be kept and updated. +-- Newly detected targets will be added, but already detected targets that were +-- not detected in this cycle, will NOT be removed! +-- The default interval is 30 seconds. +-- @param #AI_PATROL_ZONE self +-- @param #number Seconds The interval in seconds. +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:SetDetectionInterval( Seconds ) + self:F2() + + if Seconds then + self.DetectInterval = Seconds + else + self.DetectInterval = 30 + end +end + +--- Set the detection zone where the AI is detecting targets. +-- @param #AI_PATROL_ZONE self +-- @param Core.Zone#ZONE DetectionZone The zone where to detect targets. +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:SetDetectionZone( DetectionZone ) + self:F2() + + if DetectionZone then + self.DetectZone = DetectionZone + else + self.DetectZone = nil + end +end + +--- Gets a list of @{Wrapper.Unit#UNIT}s that were detected by the AI. +-- No filtering is applied, so, ANY detected UNIT can be in this list. +-- It is up to the mission designer to use the @{Unit} class and methods to filter the targets. +-- @param #AI_PATROL_ZONE self +-- @return #table The list of @{Wrapper.Unit#UNIT}s +function AI_PATROL_ZONE:GetDetectedUnits() + self:F2() + + return self.DetectedUnits end - - ---- When the AIControllable is out of fuel, it is required that a new AIControllable is started, before the old AIControllable can return to the home base. +--- When the AI is out of fuel, it is required that a new AI is started, before the old AI can return to the home base. -- Therefore, with a parameter and a calculation of the distance to the home base, the fuel treshold is calculated. --- When the fuel treshold is reached, the AIControllable will continue for a given time its patrol task in orbit, while a new AIControllable is targetted to the AI_PATROLZONE. --- Once the time is finished, the old AIControllable will return to the base. --- @param #AI_PATROLZONE self +-- When the fuel treshold is reached, the AI will continue for a given time its patrol task in orbit, while a new AIControllable is targetted to the AI_PATROL_ZONE. +-- Once the time is finished, the old AI will return to the base. +-- @param #AI_PATROL_ZONE self -- @param #number PatrolFuelTresholdPercentage The treshold in percentage (between 0 and 1) when the AIControllable is considered to get out of fuel. -- @param #number PatrolOutOfFuelOrbitTime The amount of seconds the out of fuel AIControllable will orbit before returning to the base. --- @return #AI_PATROLZONE self -function AI_PATROLZONE:ManageFuel( PatrolFuelTresholdPercentage, PatrolOutOfFuelOrbitTime ) +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:ManageFuel( PatrolFuelTresholdPercentage, PatrolOutOfFuelOrbitTime ) self.PatrolManageFuel = true self.PatrolFuelTresholdPercentage = PatrolFuelTresholdPercentage @@ -256,60 +549,171 @@ function AI_PATROLZONE:ManageFuel( PatrolFuelTresholdPercentage, PatrolOutOfFuel return self end +--- When the AI is damaged beyond a certain treshold, it is required that the AI returns to the home base. +-- However, damage cannot be foreseen early on. +-- Therefore, when the damage treshold is reached, +-- the AI will return immediately to the home base (RTB). +-- Note that for groups, the average damage of the complete group will be calculated. +-- So, in a group of 4 airplanes, 2 lost and 2 with damage 0.2, the damage treshold will be 0.25. +-- @param #AI_PATROL_ZONE self +-- @param #number PatrolDamageTreshold The treshold in percentage (between 0 and 1) when the AI is considered to be damaged. +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:ManageDamage( PatrolDamageTreshold ) + + self.PatrolManageDamage = true + self.PatrolDamageTreshold = PatrolDamageTreshold + + return self +end + --- Defines a new patrol route using the @{Process_PatrolZone} parameters and settings. --- @param #AI_PATROLZONE self --- @return #AI_PATROLZONE self -function AI_PATROLZONE:onenterRoute() +-- @param #AI_PATROL_ZONE self +-- @return #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_PATROL_ZONE:onafterStart( Controllable, From, Event, To ) + self:F2() + + self:__Route( 1 ) -- Route to the patrol point. The asynchronous trigger is important, because a spawned group and units takes at least one second to come live. + self:__Status( 60 ) -- Check status status every 30 seconds. + self:SetDetectionActivated() + + self:EventOnPilotDead( self.OnPilotDead ) + self:EventOnCrash( self.OnCrash ) + self:EventOnEjection( self.OnEjection ) + + + Controllable:OptionROEHoldFire() + Controllable:OptionROTVertical() + + self.Controllable:OnReSpawn( + function( PatrolGroup ) + self:E( "ReSpawn" ) + self:__Reset() + self:__Route( 5 ) + end + ) + +end + + +--- @param #AI_PATROL_ZONE self +--- @param Wrapper.Controllable#CONTROLLABLE Controllable +function AI_PATROL_ZONE:onbeforeDetect( Controllable, From, Event, To ) + + return self.DetectOn and self.DetectActivated +end + +--- @param #AI_PATROL_ZONE self +--- @param Wrapper.Controllable#CONTROLLABLE Controllable +function AI_PATROL_ZONE:onafterDetect( Controllable, From, Event, To ) + + local Detected = false + + local DetectedTargets = Controllable:GetDetectedTargets() + for TargetID, Target in pairs( DetectedTargets or {} ) do + local TargetObject = Target.object + self:T( TargetObject ) + if TargetObject and TargetObject:isExist() and TargetObject.id_ < 50000000 then + + local TargetUnit = UNIT:Find( TargetObject ) + local TargetUnitName = TargetUnit:GetName() + + if self.DetectionZone then + if TargetUnit:IsInZone( self.DetectionZone ) then + self:T( {"Detected ", TargetUnit } ) + self.DetectedUnits[TargetUnit] = TargetUnit + Detected = true + end + else + self.DetectedUnits[TargetUnit] = TargetUnit + Detected = true + end + end + end + + self:__Detect( self.DetectInterval ) + + if Detected == true then + self:__Detected( 1.5 ) + end + +end + +--- @param Wrapper.Controllable#CONTROLLABLE AIControllable +-- This statis method is called from the route path within the last task at the last waaypoint of the Controllable. +-- Note that this method is required, as triggers the next route when patrolling for the Controllable. +function AI_PATROL_ZONE:_NewPatrolRoute( AIControllable ) + + local PatrolZone = AIControllable:GetState( AIControllable, "PatrolZone" ) -- PatrolCore.Zone#AI_PATROL_ZONE + PatrolZone:__Route( 1 ) +end + + +--- Defines a new patrol route using the @{Process_PatrolZone} parameters and settings. +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_PATROL_ZONE:onafterRoute( Controllable, From, Event, To ) self:F2() - local PatrolRoute = {} + -- When RTB, don't allow anymore the routing. + if From == "RTB" then + return + end + if self.Controllable:IsAlive() then - --- Determine if the AIControllable is within the PatrolZone. + -- Determine if the AIControllable is within the PatrolZone. -- If not, make a waypoint within the to that the AIControllable will fly at maximum speed to that point. --- --- Calculate the current route point. --- local CurrentVec2 = self.Controllable:GetVec2() --- local CurrentAltitude = self.Controllable:GetUnit(1):GetAltitude() --- local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y ) --- local CurrentRoutePoint = CurrentPointVec3:RoutePointAir( --- POINT_VEC3.RoutePointAltType.BARO, --- POINT_VEC3.RoutePointType.TurningPoint, --- POINT_VEC3.RoutePointAction.TurningPoint, --- ToPatrolZoneSpeed, --- true --- ) --- --- PatrolRoute[#PatrolRoute+1] = CurrentRoutePoint + local PatrolRoute = {} + + -- Calculate the current route point of the controllable as the start point of the route. + -- However, when the controllable is not in the air, + -- the controllable current waypoint is probably the airbase... + -- Thus, if we would take the current waypoint as the startpoint, upon take-off, the controllable flies + -- immediately back to the airbase, and this is not correct. + -- Therefore, when on a runway, get as the current route point a random point within the PatrolZone. + -- This will make the plane fly immediately to the patrol zone. - self:T2( PatrolRoute ) - - if self.Controllable:IsNotInZone( self.PatrolZone ) then - --- Find a random 2D point in PatrolZone. - local ToPatrolZoneVec2 = self.PatrolZone:GetRandomVec2() - self:T2( ToPatrolZoneVec2 ) - - --- Define Speed and Altitude. - local ToPatrolZoneAltitude = math.random( self.PatrolFloorAltitude, self.PatrolCeilingAltitude ) + if self.Controllable:InAir() == false then + self:E( "Not in the air, finding route path within PatrolZone" ) + local CurrentVec2 = self.Controllable:GetVec2() + --TODO: Create GetAltitude function for GROUP, and delete GetUnit(1). + local CurrentAltitude = self.Controllable:GetUnit(1):GetAltitude() + local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y ) local ToPatrolZoneSpeed = self.PatrolMaxSpeed - self:T2( ToPatrolZoneSpeed ) - - --- Obtain a 3D @{Point} from the 2D point + altitude. - local ToPatrolZonePointVec3 = POINT_VEC3:New( ToPatrolZoneVec2.x, ToPatrolZoneAltitude, ToPatrolZoneVec2.y ) - - --- Create a route point of type air. - local ToPatrolZoneRoutePoint = ToPatrolZonePointVec3:RoutePointAir( - POINT_VEC3.RoutePointAltType.BARO, - POINT_VEC3.RoutePointType.TurningPoint, - POINT_VEC3.RoutePointAction.TurningPoint, - ToPatrolZoneSpeed, - true - ) - - PatrolRoute[#PatrolRoute+1] = ToPatrolZoneRoutePoint - - end + local CurrentRoutePoint = CurrentPointVec3:RoutePointAir( + POINT_VEC3.RoutePointAltType.BARO, + POINT_VEC3.RoutePointType.TakeOffParking, + POINT_VEC3.RoutePointAction.FromParkingArea, + ToPatrolZoneSpeed, + true + ) + PatrolRoute[#PatrolRoute+1] = CurrentRoutePoint + else + self:E( "In the air, finding route path within PatrolZone" ) + local CurrentVec2 = self.Controllable:GetVec2() + --TODO: Create GetAltitude function for GROUP, and delete GetUnit(1). + local CurrentAltitude = self.Controllable:GetUnit(1):GetAltitude() + local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y ) + local ToPatrolZoneSpeed = self.PatrolMaxSpeed + local CurrentRoutePoint = CurrentPointVec3:RoutePointAir( + POINT_VEC3.RoutePointAltType.BARO, + POINT_VEC3.RoutePointType.TurningPoint, + POINT_VEC3.RoutePointAction.TurningPoint, + ToPatrolZoneSpeed, + true + ) + PatrolRoute[#PatrolRoute+1] = CurrentRoutePoint + end + --- Define a random point in the @{Zone}. The AI will fly to that point within the zone. @@ -334,6 +738,8 @@ function AI_PATROLZONE:onenterRoute() true ) + --self.CoordTest:SpawnFromVec3( ToTargetPointVec3:GetVec3() ) + --ToTargetPointVec3:SmokeRed() PatrolRoute[#PatrolRoute+1] = ToTargetRoutePoint @@ -343,25 +749,31 @@ function AI_PATROLZONE:onenterRoute() --- Do a trick, link the NewPatrolRoute function of the PATROLGROUP object to the AIControllable in a temporary variable ... self.Controllable:SetState( self.Controllable, "PatrolZone", self ) - self.Controllable:WayPointFunction( #PatrolRoute, 1, "_NewPatrolRoute" ) + self.Controllable:WayPointFunction( #PatrolRoute, 1, "AI_PATROL_ZONE:_NewPatrolRoute" ) - --- NOW ACT_ROUTE THE GROUP! - self.Controllable:WayPointExecute( 1 ) - - self:__Patrol( 30 ) + --- NOW ROUTE THE GROUP! + self.Controllable:WayPointExecute( 1, 2 ) end - + end +--- @param #AI_PATROL_ZONE self +function AI_PATROL_ZONE:onbeforeStatus() ---- @param #AI_PATROLZONE self -function AI_PATROLZONE:onenterPatrol() + return self.CheckStatus +end + +--- @param #AI_PATROL_ZONE self +function AI_PATROL_ZONE:onafterStatus() self:F2() if self.Controllable and self.Controllable:IsAlive() then + local RTB = false + local Fuel = self.Controllable:GetUnit(1):GetFuel() if Fuel < self.PatrolFuelTresholdPercentage then + self:E( self.Controllable:GetName() .. " is out of fuel:" .. Fuel .. ", RTB!" ) local OldAIControllable = self.Controllable local AIControllableTemplate = self.Controllable:GetTemplate() @@ -369,10 +781,93 @@ function AI_PATROLZONE:onenterPatrol() local TimedOrbitTask = OldAIControllable:TaskControlled( OrbitTask, OldAIControllable:TaskCondition(nil,nil,nil,nil,self.PatrolOutOfFuelOrbitTime,nil ) ) OldAIControllable:SetTask( TimedOrbitTask, 10 ) + RTB = true + else + end + + -- TODO: Check GROUP damage function. + local Damage = self.Controllable:GetLife() + if Damage <= self.PatrolDamageTreshold then + self:E( self.Controllable:GetName() .. " is damaged:" .. Damage .. ", RTB!" ) + RTB = true + end + + if RTB == true then self:RTB() else - self:__Patrol( 30 ) -- Execute the Patrol event after 30 seconds. + self:__Status( 60 ) -- Execute the Patrol event after 30 seconds. end end - end + +--- @param #AI_PATROL_ZONE self +function AI_PATROL_ZONE:onafterRTB() + self:F2() + + if self.Controllable and self.Controllable:IsAlive() then + + self:SetDetectionOff() + self.CheckStatus = false + + local PatrolRoute = {} + + --- Calculate the current route point. + local CurrentVec2 = self.Controllable:GetVec2() + + --TODO: Create GetAltitude function for GROUP, and delete GetUnit(1). + local CurrentAltitude = self.Controllable:GetUnit(1):GetAltitude() + local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y ) + local ToPatrolZoneSpeed = self.PatrolMaxSpeed + local CurrentRoutePoint = CurrentPointVec3:RoutePointAir( + POINT_VEC3.RoutePointAltType.BARO, + POINT_VEC3.RoutePointType.TurningPoint, + POINT_VEC3.RoutePointAction.TurningPoint, + ToPatrolZoneSpeed, + true + ) + + PatrolRoute[#PatrolRoute+1] = CurrentRoutePoint + + --- Now we're going to do something special, we're going to call a function from a waypoint action at the AIControllable... + self.Controllable:WayPointInitialize( PatrolRoute ) + + --- NOW ROUTE THE GROUP! + self.Controllable:WayPointExecute( 1, 1 ) + + end + +end + +--- @param #AI_PATROL_ZONE self +function AI_PATROL_ZONE:onafterDead() + self:SetDetectionOff() + self:SetStatusOff() +end + +--- @param #AI_PATROL_ZONE self +-- @param Core.Event#EVENTDATA EventData +function AI_PATROL_ZONE:OnCrash( EventData ) + + if self.Controllable:IsAlive() and EventData.IniDCSGroupName == self.Controllable:GetName() then + self:__Crash( 1, EventData ) + end +end + +--- @param #AI_PATROL_ZONE self +-- @param Core.Event#EVENTDATA EventData +function AI_PATROL_ZONE:OnEjection( EventData ) + + if self.Controllable:IsAlive() and EventData.IniDCSGroupName == self.Controllable:GetName() then + self:__Eject( 1, EventData ) + end +end + +--- @param #AI_PATROL_ZONE self +-- @param Core.Event#EVENTDATA EventData +function AI_PATROL_ZONE:OnPilotDead( EventData ) + + if self.Controllable:IsAlive() and EventData.IniDCSGroupName == self.Controllable:GetName() then + self:__PilotDead( 1, EventData ) + end +end + diff --git a/Moose Development/Moose/Core/Base.lua b/Moose Development/Moose/Core/Base.lua index 8e6a06e2b..6bb7aa043 100644 --- a/Moose Development/Moose/Core/Base.lua +++ b/Moose Development/Moose/Core/Base.lua @@ -115,6 +115,19 @@ -- * @{#BASE.GetClassName}(): Gets the name of the object, which is the name of the class the object was instantiated from. -- * @{#BASE.GetClassNameAndID}(): Gets the name and ID of the object. -- +-- ## 1.5) All objects derived from BASE can have "States" +-- +-- A mechanism is in place in MOOSE, that allows to let the objects administer **states**. +-- States are essentially properties of objects, which are identified by a **Key** and a **Value**. +-- The method @{#BASE.SetState}() can be used to set a Value with a reference Key to the object. +-- To **read or retrieve** a state Value based on a Key, use the @{#BASE.GetState} method. +-- These two methods provide a very handy way to keep state at long lasting processes. +-- Values can be stored within the objects, and later retrieved or changed when needed. +-- There is one other important thing to note, the @{#BASE.SetState}() and @{#BASE.GetState} methods +-- receive as the **first parameter the object for which the state needs to be set**. +-- Thus, if the state is to be set for the same object as the object for which the method is used, then provide the same +-- object name to the method. +-- -- ## 1.10) BASE Inheritance (tree) support -- -- The following methods are available to support inheritance: @@ -706,25 +719,41 @@ function BASE:onEvent(event) end end -function BASE:SetState( Object, StateName, State ) +--- Set a state or property of the Object given a Key and a Value. +-- Note that if the Object is destroyed, nillified or garbage collected, then the Values and Keys will also be gone. +-- @param #BASE self +-- @param Object The object that will hold the Value set by the Key. +-- @param Key The key that is used as a reference of the value. Note that the key can be a #string, but it can also be any other type! +-- @param Value The value to is stored in the object. +-- @return The Value set. +-- @return #nil The Key was not found and thus the Value could not be retrieved. +function BASE:SetState( Object, Key, Value ) local ClassNameAndID = Object:GetClassNameAndID() self.States[ClassNameAndID] = self.States[ClassNameAndID] or {} - self.States[ClassNameAndID][StateName] = State - self:T2( { ClassNameAndID, StateName, State } ) + self.States[ClassNameAndID][Key] = Value + self:T2( { ClassNameAndID, Key, Value } ) - return self.States[ClassNameAndID][StateName] + return self.States[ClassNameAndID][Key] end - -function BASE:GetState( Object, StateName ) + + +--- Get a Value given a Key from the Object. +-- Note that if the Object is destroyed, nillified or garbage collected, then the Values and Keys will also be gone. +-- @param #BASE self +-- @param Object The object that holds the Value set by the Key. +-- @param Key The key that is used to retrieve the value. Note that the key can be a #string, but it can also be any other type! +-- @param Value The value to is stored in the Object. +-- @return The Value retrieved. +function BASE:GetState( Object, Key ) local ClassNameAndID = Object:GetClassNameAndID() if self.States[ClassNameAndID] then - local State = self.States[ClassNameAndID][StateName] or false - self:T2( { ClassNameAndID, StateName, State } ) - return State + local Value = self.States[ClassNameAndID][Key] or false + self:T2( { ClassNameAndID, Key, Value } ) + return Value end return nil diff --git a/Moose Development/Moose/Core/Event.lua b/Moose Development/Moose/Core/Event.lua index e3f5301a2..cedee92e6 100644 --- a/Moose Development/Moose/Core/Event.lua +++ b/Moose Development/Moose/Core/Event.lua @@ -717,6 +717,16 @@ end -- @param #EVENTDATA Event function EVENT:onEvent( Event ) + local ErrorHandler = function( errmsg ) + + env.info( "Error in SCHEDULER function:" .. errmsg ) + if debug ~= nil then + env.info( debug.traceback() ) + end + + return errmsg + end + if self and self.Events and self.Events[Event.id] then if Event.initiator and Event.initiator:getCategory() == Object.Category.UNIT then Event.IniDCSUnit = Event.initiator @@ -758,14 +768,16 @@ function EVENT:onEvent( Event ) -- If the EventData is for a UNIT, the call directly the EventClass EventFunction for that UNIT. if Event.IniDCSUnitName and EventData.IniUnit and EventData.IniUnit[Event.IniDCSUnitName] then self:T( { "Calling EventFunction for Class ", EventClass:GetClassNameAndID(), ", Unit ", Event.IniUnitName } ) - EventData.IniUnit[Event.IniDCSUnitName].EventFunction( EventData.IniUnit[Event.IniDCSUnitName].EventClass, Event ) + local Result, Value = xpcall( function() return EventData.IniUnit[Event.IniDCSUnitName].EventFunction( EventData.IniUnit[Event.IniDCSUnitName].EventClass, Event ) end, ErrorHandler ) + --EventData.IniUnit[Event.IniDCSUnitName].EventFunction( EventData.IniUnit[Event.IniDCSUnitName].EventClass, Event ) else -- If the EventData is not bound to a specific unit, then call the EventClass EventFunction. -- Note that here the EventFunction will need to implement and determine the logic for the relevant source- or target unit, or weapon. if Event.IniDCSUnit and not EventData.IniUnit then if EventClass == EventData.EventClass then self:T( { "Calling EventFunction for Class ", EventClass:GetClassNameAndID() } ) - EventData.EventFunction( EventData.EventClass, Event ) + local Result, Value = xpcall( function() return EventData.EventFunction( EventData.EventClass, Event ) end, ErrorHandler ) + --EventData.EventFunction( EventData.EventClass, Event ) end end end diff --git a/Moose Development/Moose/Core/Fsm.lua b/Moose Development/Moose/Core/Fsm.lua index 2d1948aee..acf7a73ce 100644 --- a/Moose Development/Moose/Core/Fsm.lua +++ b/Moose Development/Moose/Core/Fsm.lua @@ -150,7 +150,7 @@ -- The following example provides a little demonstration on the difference between synchronous and asynchronous Event Triggering. -- -- function FSM:OnAfterEvent( From, Event, To, Amount ) --- self:E( { Amount = Amount } ) +-- self:T( { Amount = Amount } ) -- end -- -- local Amount = 1 @@ -198,7 +198,7 @@ -- ![Transition Flow](..\Presentations\FSM\Dia7.JPG) -- -- function FsmDemo:OnAfterSwitch( From, Event, To, FsmUnit ) --- self:E( { From, Event, To, FsmUnit } ) +-- self:T( { From, Event, To, FsmUnit } ) -- -- if From == "Green" then -- FsmUnit:Flare(FLARECOLOR.Green) @@ -221,7 +221,7 @@ -- -- For debugging reasons the received parameters are traced within the DCS.log. -- --- self:E( { From, Event, To, FsmUnit } ) +-- self:T( { From, Event, To, FsmUnit } ) -- -- The method will check if the From state received is either "Green" or "Red" and will flare the respective color from the FsmUnit. -- @@ -365,7 +365,7 @@ do -- FSM Transition.Event = Event Transition.To = To - self:E( Transition ) + self:T( Transition ) self._Transitions[Transition] = Transition self:_eventmap( self.Events, Transition ) @@ -387,7 +387,7 @@ do -- FSM -- @param #table ReturnEvents A table indicating for which returned events of the SubFSM which Event must be triggered in the FSM. -- @return Core.Fsm#FSM_PROCESS The SubFSM. function FSM:AddProcess( From, Event, Process, ReturnEvents ) - self:E( { From, Event, Process, ReturnEvents } ) + self:T( { From, Event, Process, ReturnEvents } ) local Sub = {} Sub.From = From @@ -417,7 +417,7 @@ do -- FSM for ProcessID, Process in pairs( self:GetProcesses() ) do if Process.From == From and Process.Event == Event then - self:E( Process ) + self:T( Process ) return Process.fsm end end @@ -468,7 +468,7 @@ do -- FSM local Process = self:GetProcess( From, Event ) - self:E( { Process = Process._Name, Scores = Process._Scores, State = State, ScoreText = ScoreText, Score = Score } ) + self:T( { Process = Process._Name, Scores = Process._Scores, State = State, ScoreText = ScoreText, Score = Score } ) Process._Scores[State] = Process._Scores[State] or {} Process._Scores[State].ScoreText = ScoreText Process._Scores[State].Score = Score @@ -528,26 +528,35 @@ do -- FSM function FSM:_call_handler(handler, params) if self[handler] then - self:E( "Calling " .. handler ) - return self[handler]( self, unpack(params) ) + self:T( "Calling " .. handler ) + local Value = self[handler]( self, unpack(params) ) + return Value end end function FSM._handler( self, EventName, ... ) - self:E( { EventName, ... } ) - local Can, to = self:can( EventName ) - self:E( { From = self.current, Event = EventName, To = to, Can = Can } ) + + if to == "*" then + to = self.current + end if Can then local from = self.current local params = { from, EventName, to, ... } + + if self.Controllable then + self:T( "FSM Transition for " .. self.Controllable.ControllableName .. " :" .. self.current .. " --> " .. EventName .. " --> " .. to ) + else + self:T( "FSM Transition:" .. self.current .. " --> " .. EventName .. " --> " .. to ) + end - if self:_call_handler("onbefore" .. EventName, params) == false - or self:_call_handler("OnBefore" .. EventName, params) == false - or self:_call_handler("onleave" .. from, params) == false - or self:_call_handler("OnLeave" .. from, params) == false then + if ( self:_call_handler("onbefore" .. EventName, params) == false ) + or ( self:_call_handler("OnBefore" .. EventName, params) == false ) + or ( self:_call_handler("onleave" .. from, params) == false ) + or ( self:_call_handler("OnLeave" .. from, params) == false ) then + self:T( "Cancel Transition" ) return false end @@ -561,7 +570,7 @@ do -- FSM -- self:F2( "nextevent = " .. sub.nextevent ) -- self[sub.nextevent]( self ) --end - self:E( "calling sub start event: " .. sub.StartEvent ) + self:T( "calling sub start event: " .. sub.StartEvent ) sub.fsm.fsmparent = self sub.fsm.ReturnEvents = sub.ReturnEvents sub.fsm[sub.StartEvent]( sub.fsm ) @@ -592,29 +601,30 @@ do -- FSM self:_call_handler("onstatechange", params) end + else + self:T( "Cannot execute transition." ) + self:T( { From = self.current, Event = EventName, To = to, Can = Can } ) end return nil end function FSM:_delayed_transition( EventName ) - self:E( { EventName = EventName } ) return function( self, DelaySeconds, ... ) - self:T( "Delayed Event: " .. EventName ) + self:T2( "Delayed Event: " .. EventName ) local CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 ) - self:T( { CallID = CallID } ) + self:T2( { CallID = CallID } ) end end function FSM:_create_transition( EventName ) - self:E( { Event = EventName } ) return function( self, ... ) return self._handler( self, EventName , ... ) end end function FSM:_gosub( ParentFrom, ParentEvent ) local fsmtable = {} if self.subs[ParentFrom] and self.subs[ParentFrom][ParentEvent] then - self:E( { ParentFrom, ParentEvent, self.subs[ParentFrom], self.subs[ParentFrom][ParentEvent] } ) + self:T( { ParentFrom, ParentEvent, self.subs[ParentFrom], self.subs[ParentFrom][ParentEvent] } ) return self.subs[ParentFrom][ParentEvent] else return {} @@ -624,17 +634,17 @@ do -- FSM function FSM:_isendstate( Current ) local FSMParent = self.fsmparent if FSMParent and self.endstates[Current] then - self:E( { state = Current, endstates = self.endstates, endstate = self.endstates[Current] } ) + self:T( { state = Current, endstates = self.endstates, endstate = self.endstates[Current] } ) FSMParent.current = Current local ParentFrom = FSMParent.current - self:E( ParentFrom ) - self:E( self.ReturnEvents ) + self:T( ParentFrom ) + self:T( self.ReturnEvents ) local Event = self.ReturnEvents[Current] - self:E( { ParentFrom, Event, self.ReturnEvents } ) + self:T( { ParentFrom, Event, self.ReturnEvents } ) if Event then return FSMParent, Event else - self:E( { "Could not find parent event name for state ", ParentFrom } ) + self:T( { "Could not find parent event name for state ", ParentFrom } ) end end @@ -667,7 +677,6 @@ do -- FSM end function FSM:can(e) - self:E( { e, self.Events, self.Events[e] } ) local Event = self.Events[e] self:F3( { self.current, Event } ) local To = Event and Event.map[self.current] or Event.map['*'] @@ -736,8 +745,9 @@ do -- FSM_CONTROLLABLE end if self[handler] then - self:E( "Calling " .. handler ) - return xpcall( function() return self[handler]( self, self.Controllable, unpack( params ) ) end, ErrorHandler ) + self:F3( "Calling " .. handler ) + local Result, Value = xpcall( function() return self[handler]( self, self.Controllable, unpack( params ) ) end, ErrorHandler ) + return Value --return self[handler]( self, self.Controllable, unpack( params ) ) end end @@ -769,14 +779,14 @@ do -- FSM_PROCESS end function FSM_PROCESS:Init( FsmProcess ) - self:E( "No Initialisation" ) + self:T( "No Initialisation" ) end --- Creates a new FSM_PROCESS object based on this FSM_PROCESS. -- @param #FSM_PROCESS self -- @return #FSM_PROCESS function FSM_PROCESS:Copy( Controllable, Task ) - self:E( { self:GetClassNameAndID() } ) + self:T( { self:GetClassNameAndID() } ) local NewFsm = self:New( Controllable, Task ) -- Core.Fsm#FSM_PROCESS @@ -795,19 +805,19 @@ do -- FSM_PROCESS -- Copy Processes for ProcessID, Process in pairs( self:GetProcesses() ) do - self:E( { Process} ) + self:T( { Process} ) local FsmProcess = NewFsm:AddProcess( Process.From, Process.Event, Process.fsm:Copy( Controllable, Task ), Process.ReturnEvents ) end -- Copy End States for EndStateID, EndState in pairs( self:GetEndStates() ) do - self:E( EndState ) + self:T( EndState ) NewFsm:AddEndState( EndState ) end -- Copy the score tables for ScoreID, Score in pairs( self:GetScores() ) do - self:E( Score ) + self:T( Score ) NewFsm:AddScore( ScoreID, Score.ScoreText, Score.Score ) end @@ -877,7 +887,7 @@ end -- @param Wrapper.Unit#UNIT ProcessUnit -- @return #FSM_PROCESS self function FSM_PROCESS:Assign( ProcessUnit, Task ) - self:E( { Task, ProcessUnit } ) + self:T( { Task, ProcessUnit } ) self:SetControllable( ProcessUnit ) self:SetTask( Task ) @@ -886,37 +896,21 @@ end return self end - - --- Adds a score for the FSM_PROCESS to be achieved. - -- @param #FSM_PROCESS self - -- @param #string State is the state of the process when the score needs to be given. (See the relevant state descriptions of the process). - -- @param #string ScoreText is a text describing the score that is given according the status. - -- @param #number Score is a number providing the score of the status. - -- @return #FSM_PROCESS self - function FSM_PROCESS:AddScore( State, ScoreText, Score ) - self:F2( { State, ScoreText, Score } ) - - self.Scores[State] = self.Scores[State] or {} - self.Scores[State].ScoreText = ScoreText - self.Scores[State].Score = Score - - return self - end - + function FSM_PROCESS:onenterAssigned( ProcessUnit ) - self:E( "Assign" ) + self:T( "Assign" ) self.Task:Assign() end function FSM_PROCESS:onenterFailed( ProcessUnit ) - self:E( "Failed" ) + self:T( "Failed" ) self.Task:Fail() end function FSM_PROCESS:onenterSuccess( ProcessUnit ) - self:E( "Success" ) + self:T( "Success" ) self.Task:Success() end @@ -928,20 +922,20 @@ end -- @param #string From -- @param #string To function FSM_PROCESS:onstatechange( ProcessUnit, From, Event, To, Dummy ) - self:E( { ProcessUnit, From, Event, To, Dummy, self:IsTrace() } ) + self:T( { ProcessUnit, From, Event, To, Dummy, self:IsTrace() } ) if self:IsTrace() then MESSAGE:New( "@ Process " .. self:GetClassNameAndID() .. " : " .. Event .. " changed to state " .. To, 2 ):ToAll() end - self:E( self.Scores[To] ) + self:T( self._Scores[To] ) -- TODO: This needs to be reworked with a callback functions allocated within Task, and set within the mission script from the Task Objects... - if self.Scores[To] then + if self._Scores[To] then local Task = self.Task local Scoring = Task:GetScoring() if Scoring then - Scoring:_AddMissionTaskScore( Task.Mission, ProcessUnit, self.Scores[To].ScoreText, self.Scores[To].Score ) + Scoring:_AddMissionTaskScore( Task.Mission, ProcessUnit, self._Scores[To].ScoreText, self._Scores[To].Score ) end end end @@ -975,7 +969,7 @@ do -- FSM_TASK function FSM_TASK:_call_handler( handler, params ) if self[handler] then - self:E( "Calling " .. handler ) + self:T( "Calling " .. handler ) return self[handler]( self, unpack( params ) ) end end @@ -1027,7 +1021,7 @@ do -- FSM_SET function FSM_SET:_call_handler( handler, params ) if self[handler] then - self:E( "Calling " .. handler ) + self:T( "Calling " .. handler ) return self[handler]( self, self.Set, unpack( params ) ) end end diff --git a/Moose Development/Moose/Core/Point.lua b/Moose Development/Moose/Core/Point.lua index 4269fb4cc..39801e785 100644 --- a/Moose Development/Moose/Core/Point.lua +++ b/Moose Development/Moose/Core/Point.lua @@ -74,9 +74,11 @@ POINT_VEC3 = { BARO = "BARO", }, RoutePointType = { + TakeOffParking = "TakeOffParking", TurningPoint = "Turning Point", }, RoutePointAction = { + FromParkingArea = "From Parking Area", TurningPoint = "Turning Point", }, } @@ -99,10 +101,12 @@ do -- POINT_VEC3 --- RoutePoint Types -- @type POINT_VEC3.RoutePointType +-- @field TakeOffParking "TakeOffParking" -- @field TurningPoint "Turning Point" --- RoutePoint Actions -- @type POINT_VEC3.RoutePointAction +-- @field FromParkingArea "From Parking Area" -- @field TurningPoint "Turning Point" -- Constructor. diff --git a/Moose Development/Moose/Core/ScheduleDispatcher.lua b/Moose Development/Moose/Core/ScheduleDispatcher.lua index 18ac50a5a..277fb7b8e 100644 --- a/Moose Development/Moose/Core/ScheduleDispatcher.lua +++ b/Moose Development/Moose/Core/ScheduleDispatcher.lua @@ -66,12 +66,12 @@ function SCHEDULEDISPATCHER:AddSchedule( Scheduler, ScheduleFunction, ScheduleAr -- If the object used as the key is nil, then the garbage collector will remove the item from the Functions array. self.ObjectSchedulers = self.ObjectSchedulers or setmetatable( {}, { __mode = "v" } ) - if Scheduler.SchedulerObject then + if Scheduler.MasterObject then self.ObjectSchedulers[self.CallID] = Scheduler - self:E( { CallID = self.CallID, ObjectScheduler = tostring(self.ObjectSchedulers[self.CallID]), SchedulerObject = tostring(Scheduler.SchedulerObject) } ) + self:F3( { CallID = self.CallID, ObjectScheduler = tostring(self.ObjectSchedulers[self.CallID]), MasterObject = tostring(Scheduler.MasterObject) } ) else self.PersistentSchedulers[self.CallID] = Scheduler - self:E( { CallID = self.CallID, PersistentScheduler = self.PersistentSchedulers[self.CallID] } ) + self:F3( { CallID = self.CallID, PersistentScheduler = self.PersistentSchedulers[self.CallID] } ) end self.Schedule = self.Schedule or setmetatable( {}, { __mode = "k" } ) @@ -80,7 +80,7 @@ function SCHEDULEDISPATCHER:AddSchedule( Scheduler, ScheduleFunction, ScheduleAr self.Schedule[Scheduler][self.CallID].Function = ScheduleFunction self.Schedule[Scheduler][self.CallID].Arguments = ScheduleArguments self.Schedule[Scheduler][self.CallID].StartTime = timer.getTime() + ( Start or 0 ) - self.Schedule[Scheduler][self.CallID].Start = Start + .001 + self.Schedule[Scheduler][self.CallID].Start = Start + .1 self.Schedule[Scheduler][self.CallID].Repeat = Repeat self.Schedule[Scheduler][self.CallID].Randomize = Randomize self.Schedule[Scheduler][self.CallID].Stop = Stop @@ -156,7 +156,7 @@ function SCHEDULEDISPATCHER:AddSchedule( Scheduler, ScheduleFunction, ScheduleAr self:Stop( Scheduler, CallID ) end else - --self:E( "Scheduled obscolete call for CallID: " .. CallID ) + self:E( "Scheduled obscolete call for CallID: " .. CallID ) end return nil diff --git a/Moose Development/Moose/Core/Scheduler.lua b/Moose Development/Moose/Core/Scheduler.lua index 14b596a5b..2b68e54bd 100644 --- a/Moose Development/Moose/Core/Scheduler.lua +++ b/Moose Development/Moose/Core/Scheduler.lua @@ -69,6 +69,8 @@ function SCHEDULER:New( SchedulerObject, SchedulerFunction, SchedulerArguments, local ScheduleID = nil + self.MasterObject = SchedulerObject + if SchedulerFunction then ScheduleID = self:Schedule( SchedulerObject, SchedulerFunction, SchedulerArguments, Start, Repeat, RandomizeFactor, Stop ) end @@ -100,7 +102,7 @@ function SCHEDULER:Schedule( SchedulerObject, SchedulerFunction, SchedulerArgume if SchedulerObject and SchedulerObject.ClassName and SchedulerObject.ClassID then ObjectName = SchedulerObject.ClassName .. SchedulerObject.ClassID end - self:E( { "Schedule :", ObjectName, tostring( SchedulerObject ), Start, Repeat, RandomizeFactor, Stop } ) + self:F3( { "Schedule :", ObjectName, tostring( SchedulerObject ), Start, Repeat, RandomizeFactor, Stop } ) self.SchedulerObject = SchedulerObject local ScheduleID = _SCHEDULEDISPATCHER:AddSchedule( diff --git a/Moose Development/Moose/Functional/Scoring.lua b/Moose Development/Moose/Functional/Scoring.lua index 3d1292c74..32e4a21f2 100644 --- a/Moose Development/Moose/Functional/Scoring.lua +++ b/Moose Development/Moose/Functional/Scoring.lua @@ -274,27 +274,30 @@ function SCORING:_AddMissionTaskScore( Mission, PlayerUnit, Text, Score ) local PlayerName = PlayerUnit:GetPlayerName() local MissionName = Mission:GetName() - self:F( { Mission:GetName(), PlayerUnit.UnitName, PlayerName, Text, Score } ) + self:E( { Mission:GetName(), PlayerUnit.UnitName, PlayerName, Text, Score } ) + + -- PlayerName can be nil, if the Unit with the player crashed or due to another reason. + if PlayerName then + local PlayerData = self.Players[PlayerName] - local PlayerData = self.Players[PlayerName] - - if not PlayerData.Mission[MissionName] then - PlayerData.Mission[MissionName] = {} - PlayerData.Mission[MissionName].ScoreTask = 0 - PlayerData.Mission[MissionName].ScoreMission = 0 + if not PlayerData.Mission[MissionName] then + PlayerData.Mission[MissionName] = {} + PlayerData.Mission[MissionName].ScoreTask = 0 + PlayerData.Mission[MissionName].ScoreMission = 0 + end + + self:T( PlayerName ) + self:T( PlayerData.Mission[MissionName] ) + + PlayerData.Score = self.Players[PlayerName].Score + Score + PlayerData.Mission[MissionName].ScoreTask = self.Players[PlayerName].Mission[MissionName].ScoreTask + Score + + MESSAGE:New( "Player '" .. PlayerName .. "' has " .. Text .. " in Mission '" .. MissionName .. "'. " .. + Score .. " task score!", + 30 ):ToAll() + + self:ScoreCSV( PlayerName, "TASK_" .. MissionName:gsub( ' ', '_' ), 1, Score, PlayerUnit:GetName() ) end - - self:T( PlayerName ) - self:T( PlayerData.Mission[MissionName] ) - - PlayerData.Score = self.Players[PlayerName].Score + Score - PlayerData.Mission[MissionName].ScoreTask = self.Players[PlayerName].Mission[MissionName].ScoreTask + Score - - MESSAGE:New( "Player '" .. PlayerName .. "' has " .. Text .. " in Mission '" .. MissionName .. "'. " .. - Score .. " task score!", - 30 ):ToAll() - - self:ScoreCSV( PlayerName, "TASK_" .. MissionName:gsub( ' ', '_' ), 1, Score, PlayerUnit:GetName() ) end @@ -436,7 +439,7 @@ function SCORING:_EventOnHit( Event ) ):ToAll() self:ScoreCSV( InitPlayerName, "HIT_PENALTY", 1, -25, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType ) else - self.Players[InitPlayerName].Score = self.Players[InitPlayerName].Score + 10 + self.Players[InitPlayerName].Score = self.Players[InitPlayerName].Score + 1 self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].Score = self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].Score + 1 self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].ScoreHit = self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].ScoreHit + 1 MESSAGE:New( "Player '" .. InitPlayerName .. "' hit a target " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. diff --git a/Moose Development/Moose/Functional/Spawn.lua b/Moose Development/Moose/Functional/Spawn.lua index 843b12f0e..4db8a032f 100644 --- a/Moose Development/Moose/Functional/Spawn.lua +++ b/Moose Development/Moose/Functional/Spawn.lua @@ -47,6 +47,9 @@ -- * @{#SPAWN.InitRepeat}(): Re-spawn groups when they land at the home base. Similar methods are @{#SPAWN.InitRepeatOnLanding} and @{#SPAWN.InitRepeatOnEngineShutDown}. -- * @{#SPAWN.InitRandomizeUnits}(): Randomizes the @{Unit}s in the @{Group} that is spawned within a **radius band**, given an Outer and Inner radius. -- * @{#SPAWN.InitRandomizeZones}(): Randomizes the spawning between a predefined list of @{Zone}s that are declared using this function. Each zone can be given a probability factor. +-- * @{#SPAWN.InitAIOn}(): Turns the AI On when spawning the new @{Group} object. +-- * @{#SPAWN.InitAIOff}(): Turns the AI Off when spawning the new @{Group} object. +-- * @{#SPAWN.InitAIOnOff}(): Turns the AI On or Off when spawning the new @{Group} object. -- -- ## 1.3) SPAWN spawning methods -- @@ -109,71 +112,40 @@ -- -- Hereby the change log: -- --- 2016-08-15: SPAWN:**InitCleanUp**( SpawnCleanUpInterval ) replaces SPAWN:_CleanUp_( SpawnCleanUpInterval ) +-- 2017-01-24: SPAWN:**InitAIOnOff( AIOnOff )** added. -- --- * Want to ensure that the methods starting with **Init** are the first called methods before any _Spawn_ method is called! --- * This notation makes it now more clear which methods are initialization methods and which methods are Spawn enablement methods. +-- 2017-01-24: SPAWN:**InitAIOn()** added. +-- +-- 2017-01-24: SPAWN:**InitAIOff()** added. +-- +-- 2016-08-15: SPAWN:**InitCleanUp**( SpawnCleanUpInterval ) replaces SPAWN:_CleanUp_( SpawnCleanUpInterval ). -- -- 2016-08-15: SPAWN:**InitRandomizeZones( SpawnZones )** added. -- --- * This method provides the functionality to randomize the spawning of the Groups at a given list of zones of different types. --- -- 2016-08-14: SPAWN:**OnSpawnGroup**( SpawnCallBackFunction, ... ) replaces SPAWN:_SpawnFunction_( SpawnCallBackFunction, ... ). -- -- 2016-08-14: SPAWN.SpawnInZone( Zone, __RandomizeGroup__, SpawnIndex ) replaces SpawnInZone( Zone, _RandomizeUnits, OuterRadius, InnerRadius,_ SpawnIndex ). -- --- * The RandomizeUnits, OuterRadius and InnerRadius have been replaced with a new method @{#SPAWN.InitRandomizeUnits}( RandomizeUnits, OuterRadius, InnerRadius ). --- * A new parameter RandomizeGroup to reflect the randomization of the starting position of the Spawned @{Group}. --- -- 2016-08-14: SPAWN.SpawnFromVec3( Vec3, SpawnIndex ) replaces SpawnFromVec3( Vec3, _RandomizeUnits, OuterRadius, InnerRadius,_ SpawnIndex ): -- --- * The RandomizeUnits, OuterRadius and InnerRadius have been replaced with a new method @{#SPAWN.InitRandomizeUnits}( RandomizeUnits, OuterRadius, InnerRadius ). --- * A new parameter RandomizeGroup to reflect the randomization of the starting position of the Spawned @{Group}. --- -- 2016-08-14: SPAWN.SpawnFromVec2( Vec2, SpawnIndex ) replaces SpawnFromVec2( Vec2, _RandomizeUnits, OuterRadius, InnerRadius,_ SpawnIndex ): -- --- * The RandomizeUnits, OuterRadius and InnerRadius have been replaced with a new method @{#SPAWN.InitRandomizeUnits}( RandomizeUnits, OuterRadius, InnerRadius ). --- * A new parameter RandomizeGroup to reflect the randomization of the starting position of the Spawned @{Group}. --- -- 2016-08-14: SPAWN.SpawnFromUnit( SpawnUnit, SpawnIndex ) replaces SpawnFromUnit( SpawnUnit, _RandomizeUnits, OuterRadius, InnerRadius,_ SpawnIndex ): -- --- * The RandomizeUnits, OuterRadius and InnerRadius have been replaced with a new method @{#SPAWN.InitRandomizeUnits}( RandomizeUnits, OuterRadius, InnerRadius ). --- * A new parameter RandomizeGroup to reflect the randomization of the starting position of the Spawned @{Group}. --- -- 2016-08-14: SPAWN.SpawnFromUnit( SpawnUnit, SpawnIndex ) replaces SpawnFromStatic( SpawnStatic, _RandomizeUnits, OuterRadius, InnerRadius,_ SpawnIndex ): -- --- * The RandomizeUnits, OuterRadius and InnerRadius have been replaced with a new method @{#SPAWN.InitRandomizeUnits}( RandomizeUnits, OuterRadius, InnerRadius ). --- * A new parameter RandomizeGroup to reflect the randomization of the starting position of the Spawned @{Group}. --- -- 2016-08-14: SPAWN.**InitRandomizeUnits( RandomizeUnits, OuterRadius, InnerRadius )** added: -- --- * This method enables the randomization of units at the first route point in a radius band at a spawn event. --- -- 2016-08-14: SPAWN.**Init**Limit( SpawnMaxUnitsAlive, SpawnMaxGroups ) replaces SPAWN._Limit_( SpawnMaxUnitsAlive, SpawnMaxGroups ): -- --- * Want to ensure that the methods starting with **Init** are the first called methods before any _Spawn_ method is called! --- * This notation makes it now more clear which methods are initialization methods and which methods are Spawn enablement methods. --- -- 2016-08-14: SPAWN.**Init**Array( SpawnAngle, SpawnWidth, SpawnDeltaX, SpawnDeltaY ) replaces SPAWN._Array_( SpawnAngle, SpawnWidth, SpawnDeltaX, SpawnDeltaY ). -- --- * Want to ensure that the methods starting with **Init** are the first called methods before any _Spawn_ method is called! --- * This notation makes it now more clear which methods are initialization methods and which methods are Spawn enablement methods. --- -- 2016-08-14: SPAWN.**Init**RandomizeRoute( SpawnStartPoint, SpawnEndPoint, SpawnRadius, SpawnHeight ) replaces SPAWN._RandomizeRoute_( SpawnStartPoint, SpawnEndPoint, SpawnRadius, SpawnHeight ). -- --- * Want to ensure that the methods starting with **Init** are the first called methods before any _Spawn_ method is called! --- * This notation makes it now more clear which methods are initialization methods and which methods are Spawn enablement methods. --- -- 2016-08-14: SPAWN.**Init**RandomizeTemplate( SpawnTemplatePrefixTable ) replaces SPAWN._RandomizeTemplate_( SpawnTemplatePrefixTable ). -- --- * Want to ensure that the methods starting with **Init** are the first called methods before any _Spawn_ method is called! --- * This notation makes it now more clear which methods are initialization methods and which methods are Spawn enablement methods. --- -- 2016-08-14: SPAWN.**Init**UnControlled() replaces SPAWN._UnControlled_(). -- --- * Want to ensure that the methods starting with **Init** are the first called methods before any _Spawn_ method is called! --- * This notation makes it now more clear which methods are initialization methods and which methods are Spawn enablement methods. --- -- === -- -- # **AUTHORS and CONTRIBUTIONS** @@ -181,6 +153,7 @@ -- ### Contributions: -- -- * **Aaron**: Posed the idea for Group position randomization at SpawnInZone and make the Unit randomization separate from the Group randomization. +-- * [**Entropy**](https://forums.eagle.ru/member.php?u=111471), **Afinegan**: Came up with the requirement for AIOnOff(). -- -- ### Authors: -- @@ -238,6 +211,7 @@ function SPAWN:New( SpawnTemplatePrefix ) self.SpawnMaxGroups = 0 -- The maximum amount of groups that can be spawned. self.SpawnRandomize = false -- Sets the randomization flag of new Spawned units to false. self.SpawnVisible = false -- Flag that indicates if all the Groups of the SpawnGroup need to be visible when Spawned. + self.AIOnOff = true -- The AI is on by default when spawning a group. self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned. else @@ -275,6 +249,7 @@ function SPAWN:NewWithAlias( SpawnTemplatePrefix, SpawnAliasPrefix ) self.SpawnMaxGroups = 0 -- The maximum amount of groups that can be spawned. self.SpawnRandomize = false -- Sets the randomization flag of new Spawned units to false. self.SpawnVisible = false -- Flag that indicates if all the Groups of the SpawnGroup need to be visible when Spawned. + self.AIOnOff = true -- The AI is on by default when spawning a group. self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned. else @@ -565,7 +540,34 @@ function SPAWN:InitArray( SpawnAngle, SpawnWidth, SpawnDeltaX, SpawnDeltaY ) return self end +do -- AI methods + --- Turns the AI On or Off for the @{Group} when spawning. + -- @param #SPAWN self + -- @param #boolean AIOnOff A value of true sets the AI On, a value of false sets the AI Off. + -- @return #SPAWN The SPAWN object + function SPAWN:InitAIOnOff( AIOnOff ) + + self.AIOnOff = AIOnOff + return self + end + + --- Turns the AI On for the @{Group} when spawning. + -- @param #SPAWN self + -- @return #SPAWN The SPAWN object + function SPAWN:InitAIOn() + + return self:InitAIOnOff( true ) + end + + --- Turns the AI Off for the @{Group} when spawning. + -- @param #SPAWN self + -- @return #SPAWN The SPAWN object + function SPAWN:InitAIOff() + + return self:InitAIOnOff( false ) + end +end -- AI methods --- Will spawn a group based on the internal index. -- Note: Uses @{DATABASE} module defined in MOOSE. @@ -591,6 +593,7 @@ function SPAWN:ReSpawn( SpawnIndex ) -- TODO: This logic makes DCS crash and i don't know why (yet). local SpawnGroup = self:GetGroupFromIndex( SpawnIndex ) + local WayPoints = SpawnGroup and SpawnGroup.WayPoints or nil if SpawnGroup then local SpawnDCSGroup = SpawnGroup:GetDCSObject() if SpawnDCSGroup then @@ -598,7 +601,18 @@ function SPAWN:ReSpawn( SpawnIndex ) end end - return self:SpawnWithIndex( SpawnIndex ) + local SpawnGroup = self:SpawnWithIndex( SpawnIndex ) + if SpawnGroup and WayPoints then + -- If there were WayPoints set, then Re-Execute those WayPoints! + SpawnGroup:WayPointInitialize( WayPoints ) + SpawnGroup:WayPointExecute( 1, 5 ) + end + + if SpawnGroup.ReSpawnFunction then + SpawnGroup:ReSpawnFunction() + end + + return SpawnGroup end --- Will spawn a group with a specified index number. @@ -649,6 +663,14 @@ function SPAWN:SpawnWithIndex( SpawnIndex ) self.SpawnGroups[self.SpawnIndex].Group = _DATABASE:Spawn( SpawnTemplate ) + local SpawnGroup = self.SpawnGroups[self.SpawnIndex].Group -- Wrapper.Group#GROUP + + --TODO: Need to check if this function doesn't need to be scheduled, as the group may not be immediately there! + if SpawnGroup then + + SpawnGroup:SetAIOnOff( self.AIOnOff ) + end + -- If there is a SpawnFunction hook defined, call it. if self.SpawnFunctionHook then self.SpawnFunctionHook( self.SpawnGroups[self.SpawnIndex].Group, unpack( self.SpawnFunctionArguments ) ) diff --git a/Moose Development/Moose/Moose.lua b/Moose Development/Moose/Moose.lua index 32b309b3b..ed13ffe2e 100644 --- a/Moose Development/Moose/Moose.lua +++ b/Moose Development/Moose/Moose.lua @@ -42,6 +42,8 @@ Include.File( "Functional/Detection" ) --- AI Classes Include.File( "AI/AI_Balancer" ) Include.File( "AI/AI_Patrol" ) +Include.File( "AI/AI_Cap" ) +Include.File( "AI/AI_Cas" ) Include.File( "AI/AI_Cargo" ) --- Actions diff --git a/Moose Development/Moose/Tasking/CommandCenter.lua b/Moose Development/Moose/Tasking/CommandCenter.lua index 10fce8124..1f1eb735d 100644 --- a/Moose Development/Moose/Tasking/CommandCenter.lua +++ b/Moose Development/Moose/Tasking/CommandCenter.lua @@ -239,7 +239,8 @@ end function COMMANDCENTER:MessageToCoalition( Message ) local CCCoalition = self:GetPositionable():GetCoalition() - self:GetPositionable():MessageToBlue( Message , 20, CCCoalition ) + --TODO: Fix coalition bug! + self:GetPositionable():MessageToCoalition( Message, 20, CCCoalition, self:GetName() ) end diff --git a/Moose Development/Moose/Tasking/DetectionManager.lua b/Moose Development/Moose/Tasking/DetectionManager.lua index a28a63ce0..0ecb7fc3a 100644 --- a/Moose Development/Moose/Tasking/DetectionManager.lua +++ b/Moose Development/Moose/Tasking/DetectionManager.lua @@ -1,4 +1,4 @@ --- This module contains the DETECTION_MANAGER class and derived classes. +--- This module contains the DETECTION_MANAGER class and derived classes. -- -- === -- diff --git a/Moose Development/Moose/Tasking/Task.lua b/Moose Development/Moose/Tasking/Task.lua index 75e1a1747..7b23f21b0 100644 --- a/Moose Development/Moose/Tasking/Task.lua +++ b/Moose Development/Moose/Tasking/Task.lua @@ -630,7 +630,7 @@ function TASK.MenuTaskAbort( MenuParam ) local self = MenuParam.self local TaskGroup = MenuParam.TaskGroup - --self:AssignToGroup( TaskGroup ) + self:Abort() end @@ -897,8 +897,8 @@ end --- FSM function for a TASK -- @param #TASK self --- @param #string Event -- @param #string From +-- @param #string Event -- @param #string To function TASK:onenterAborted( From, Event, To ) @@ -907,12 +907,29 @@ function TASK:onenterAborted( From, Event, To ) self:GetMission():GetCommandCenter():MessageToCoalition( "Task " .. self:GetName() .. " has been aborted! Task may be replanned." ) self:UnAssignFromGroups() + + self:__Replan( 5 ) end --- FSM function for a TASK -- @param #TASK self --- @param #string Event -- @param #string From +-- @param #string Event +-- @param #string To +function TASK:onafterReplan( From, Event, To ) + + self:E( "Task Replanned" ) + + self:GetMission():GetCommandCenter():MessageToCoalition( "Replanning Task " .. self:GetName() .. "." ) + + self:SetMenu() + +end + +--- FSM function for a TASK +-- @param #TASK self +-- @param #string From +-- @param #string Event -- @param #string To function TASK:onenterFailed( From, Event, To ) diff --git a/Moose Development/Moose/Wrapper/Controllable.lua b/Moose Development/Moose/Wrapper/Controllable.lua index af21429ba..bc5104782 100644 --- a/Moose Development/Moose/Wrapper/Controllable.lua +++ b/Moose Development/Moose/Wrapper/Controllable.lua @@ -39,7 +39,7 @@ -- * @{#CONTROLLABLE.TaskEmbarkToTransport}: (GROUND) Embark to a Transport landed at a location. -- * @{#CONTROLLABLE.TaskEscort}: (AIR) Escort another airborne controllable. -- * @{#CONTROLLABLE.TaskFAC_AttackControllable}: (AIR + GROUND) The task makes the controllable/unit a FAC and orders the FAC to control the target (enemy ground controllable) destruction. --- * @{#CONTROLLABLE.TaskFireAtPoint}: (GROUND) Fire at a VEC2 point until ammunition is finished. +-- * @{#CONTROLLABLE.TaskFireAtPoint}: (GROUND) Fire some or all ammunition at a VEC2 point. -- * @{#CONTROLLABLE.TaskFollow}: (AIR) Following another airborne controllable. -- * @{#CONTROLLABLE.TaskHold}: (GROUND) Hold ground controllable from moving. -- * @{#CONTROLLABLE.TaskHoldPosition}: (AIR) Hold position at the current position of the first unit of the controllable. @@ -123,7 +123,6 @@ -- === -- -- @module Controllable --- @author FlightControl --- The CONTROLLABLE class -- @type CONTROLLABLE @@ -144,6 +143,8 @@ function CONTROLLABLE:New( ControllableName ) local self = BASE:Inherit( self, POSITIONABLE:New( ControllableName ) ) self:F2( ControllableName ) self.ControllableName = ControllableName + + self.TaskScheduler = SCHEDULER:New( self ) return self end @@ -165,6 +166,58 @@ function CONTROLLABLE:_GetController() return nil end +-- Get methods + +--- Returns the UNITs wrappers of the DCS Units of the Controllable (default is a GROUP). +-- @param #CONTROLLABLE self +-- @return #list The UNITs wrappers. +function CONTROLLABLE:GetUnits() + self:F2( { self.ControllableName } ) + local DCSControllable = self:GetDCSObject() + + if DCSControllable then + local DCSUnits = DCSControllable:getUnits() + local Units = {} + for Index, UnitData in pairs( DCSUnits ) do + Units[#Units+1] = UNIT:Find( UnitData ) + end + self:T3( Units ) + return Units + end + + return nil +end + + +--- Returns the health. Dead controllables have health <= 1.0. +-- @param #CONTROLLABLE self +-- @return #number The controllable health value (unit or group average). +-- @return #nil The controllable is not existing or alive. +function CONTROLLABLE:GetLife() + self:F2( self.ControllableName ) + + local DCSControllable = self:GetDCSObject() + + if DCSControllable then + local UnitLife = 0 + local Units = self:GetUnits() + if #Units == 1 then + local Unit = Units[1] -- Wrapper.Unit#UNIT + UnitLife = Unit:GetLife() + else + local UnitLifeTotal = 0 + for UnitID, Unit in pairs( Units ) do + local Unit = Unit -- Wrapper.Unit#UNIT + UnitLifeTotal = UnitLifeTotal + Unit:GetLife() + end + UnitLife = UnitLifeTotal / #Units + end + return UnitLife + end + + return nil +end + -- Tasks @@ -202,7 +255,7 @@ function CONTROLLABLE:PushTask( DCSTask, WaitTime ) -- Controller:pushTask( DCSTask ) if WaitTime then - SCHEDULER:New( Controller, Controller.pushTask, { DCSTask }, WaitTime ) + self.TaskScheduler:Schedule( Controller, Controller.pushTask, { DCSTask }, WaitTime ) else Controller:pushTask( DCSTask ) end @@ -224,7 +277,7 @@ function CONTROLLABLE:SetTask( DCSTask, WaitTime ) if DCSControllable then local Controller = self:_GetController() - self:E(Controller) + self:T3( Controller ) -- When a controllable SPAWNs, it takes about a second to get the controllable in the simulator. Setting tasks to unspawned controllables provides unexpected results. -- Therefore we schedule the functions to set the mission and options for the Controllable. @@ -233,7 +286,7 @@ function CONTROLLABLE:SetTask( DCSTask, WaitTime ) if not WaitTime then Controller:setTask( DCSTask ) else - SCHEDULER:New( Controller, Controller.setTask, { DCSTask }, WaitTime ) + self.TaskScheduler:Schedule( Controller, Controller.setTask, { DCSTask }, WaitTime ) end return self @@ -304,6 +357,10 @@ function CONTROLLABLE:TaskCombo( DCSTasks ) tasks = DCSTasks } } + + for TaskID, Task in ipairs( DCSTasks ) do + self:E( Task ) + end self:T3( { DCSTaskCombo } ) return DCSTaskCombo @@ -489,19 +546,24 @@ function CONTROLLABLE:TaskAttackUnit( AttackUnit, WeaponType, WeaponExpend, Atta -- } local DCSTask - DCSTask = { id = 'AttackUnit', + DCSTask = { + id = 'AttackUnit', params = { + altitudeEnabled = true, unitId = AttackUnit:GetID(), - weaponType = WeaponType, - expend = WeaponExpend, - attackQty = AttackQty, - direction = Direction, - attackQtyLimit = AttackQtyLimit, - controllableAttack = ControllableAttack, - }, - }, + attackQtyLimit = AttackQtyLimit or false, + attackQty = AttackQty or 2, + expend = WeaponExpend or "Auto", + altitude = 2000, + directionEnabled = true, + groupAttack = true, + --weaponType = WeaponType or 1073741822, + direction = Direction or 0, + } + } - self:T3( { DCSTask } ) + self:E( DCSTask ) + return DCSTask end @@ -885,15 +947,18 @@ end -- @param #CONTROLLABLE self -- @param Dcs.DCSTypes#Vec2 Vec2 The point to fire at. -- @param Dcs.DCSTypes#Distance Radius The radius of the zone to deploy the fire at. +-- @param #number AmmoCount (optional) Quantity of ammunition to expand (omit to fire until ammunition is depleted). -- @return Dcs.DCSTasking.Task#Task The DCS task structure. -function CONTROLLABLE:TaskFireAtPoint( Vec2, Radius ) - self:F2( { self.ControllableName, Vec2, Radius } ) +function CONTROLLABLE:TaskFireAtPoint( Vec2, Radius, AmmoCount ) + self:F2( { self.ControllableName, Vec2, Radius, AmmoCount } ) -- FireAtPoint = { -- id = 'FireAtPoint', -- params = { -- point = Vec2, -- radius = Distance, + -- expendQty = number, + -- expendQtyEnabled = boolean, -- } -- } @@ -902,8 +967,15 @@ function CONTROLLABLE:TaskFireAtPoint( Vec2, Radius ) params = { point = Vec2, radius = Radius, + expendQty = 100, -- dummy value + expendQtyEnabled = false, } } + + if AmmoCount then + DCSTask.params.expendQty = AmmoCount + DCSTask.params.expendQtyEnabled = true + end self:T3( { DCSTask } ) return DCSTask @@ -1494,7 +1566,7 @@ function CONTROLLABLE:Route( GoPoints ) local MissionTask = { id = 'Mission', params = { route = { points = Points, }, }, } local Controller = self:_GetController() --Controller.setTask( Controller, MissionTask ) - SCHEDULER:New( Controller, Controller.setTask, { MissionTask }, 1 ) + self.TaskScheduler:Schedule( Controller, Controller.setTask, { MissionTask }, 1 ) return self end @@ -2122,7 +2194,7 @@ end -- @param #table WayPoints If WayPoints is given, then use the route. -- @return #CONTROLLABLE function CONTROLLABLE:WayPointInitialize( WayPoints ) - self:F( { WayPoint, WayPointIndex, WayPointFunction } ) + self:F( { WayPoints } ) if WayPoints then self.WayPoints = WayPoints @@ -2133,6 +2205,18 @@ function CONTROLLABLE:WayPointInitialize( WayPoints ) return self end +--- Get the current WayPoints set with the WayPoint functions( Note that the WayPoints can be nil, although there ARE waypoints). +-- @param #CONTROLLABLE self +-- @return #table WayPoints If WayPoints is given, then return the WayPoints structure. +function CONTROLLABLE:GetWayPoints() + self:F( ) + + if self.WayPoints then + return self.WayPoints + end + + return nil +end --- Registers a waypoint function that will be executed when the controllable moves over the WayPoint. -- @param #CONTROLLABLE self @@ -2201,6 +2285,4 @@ function CONTROLLABLE:WayPointExecute( WayPoint, WaitTime ) return self end --- Message APIs - - +-- Message APIs \ No newline at end of file diff --git a/Moose Development/Moose/Wrapper/Group.lua b/Moose Development/Moose/Wrapper/Group.lua index 1115e8869..84a9d2912 100644 --- a/Moose Development/Moose/Wrapper/Group.lua +++ b/Moose Development/Moose/Wrapper/Group.lua @@ -28,114 +28,26 @@ -- * @{#GROUP.Find}(): Find a GROUP instance from the _DATABASE object using a DCS Group object. -- * @{#GROUP.FindByName}(): Find a GROUP instance from the _DATABASE object using a DCS Group name. -- --- 1.2) GROUP task methods --- ----------------------- --- Several group task methods are available that help you to prepare tasks. --- These methods return a string consisting of the task description, which can then be given to either a --- @{Wrapper.Controllable#CONTROLLABLE.PushTask} or @{Wrapper.Controllable#CONTROLLABLE.SetTask} method to assign the task to the GROUP. --- Tasks are specific for the category of the GROUP, more specific, for AIR, GROUND or AIR and GROUND. --- Each task description where applicable indicates for which group category the task is valid. --- There are 2 main subdivisions of tasks: Assigned tasks and EnRoute tasks. --- --- ### 1.2.1) Assigned task methods --- --- Assigned task methods make the group execute the task where the location of the (possible) targets of the task are known before being detected. --- This is different from the EnRoute tasks, where the targets of the task need to be detected before the task can be executed. --- --- Find below a list of the **assigned task** methods: --- --- * @{Wrapper.Controllable#CONTROLLABLE.TaskAttackGroup}: (AIR) Attack a Group. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskAttackMapObject}: (AIR) Attacking the map object (building, structure, e.t.c). --- * @{Wrapper.Controllable#CONTROLLABLE.TaskAttackUnit}: (AIR) Attack the Unit. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskBombing}: (Wrapper.Controllable#CONTROLLABLEDelivering weapon at the point on the ground. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskBombingRunway}: (AIR) Delivering weapon on the runway. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskEmbarking}: (AIR) Move the group to a Vec2 Point, wait for a defined duration and embark a group. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskEmbarkToTransport}: (GROUND) Embark to a Transport landed at a location. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskEscort}: (AIR) Escort another airborne group. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskFAC_AttackGroup}: (AIR + GROUND) The task makes the group/unit a FAC and orders the FAC to control the target (enemy ground group) destruction. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskFireAtPoint}: (GROUND) Fire at a VEC2 point until ammunition is finished. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskFollow}: (AIR) Following another airborne group. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskHold}: (GROUND) Hold ground group from moving. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskHoldPosition}: (AIR) Hold position at the current position of the first unit of the group. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskLand}: (AIR HELICOPTER) Landing at the ground. For helicopters only. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskLandAtZone}: (AIR) Land the group at a @{Core.Zone#ZONE_RADIUS). --- * @{Wrapper.Controllable#CONTROLLABLE.TaskOrbitCircle}: (AIR) Orbit at the current position of the first unit of the group at a specified alititude. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskOrbitCircleAtVec2}: (AIR) Orbit at a specified position at a specified alititude during a specified duration with a specified speed. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskRefueling}: (AIR) Refueling from the nearest tanker. No parameters. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskRoute}: (AIR + GROUND) Return a Misson task to follow a given route defined by Points. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskRouteToVec2}: (AIR + GROUND) Make the Group move to a given point. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskRouteToVec3}: (AIR + GROUND) Make the Group move to a given point. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskRouteToZone}: (AIR + GROUND) Route the group to a given zone. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskReturnToBase}: (AIR) Route the group to an airbase. +-- ## 1.2) GROUP task methods -- --- ### 1.2.2) EnRoute task methods --- --- EnRoute tasks require the targets of the task need to be detected by the group (using its sensors) before the task can be executed: --- --- * @{Wrapper.Controllable#CONTROLLABLE.EnRouteTaskAWACS}: (AIR) Aircraft will act as an AWACS for friendly units (will provide them with information about contacts). No parameters. --- * @{Wrapper.Controllable#CONTROLLABLE.EnRouteTaskEngageGroup}: (AIR) Engaging a group. The task does not assign the target group to the unit/group to attack now; it just allows the unit/group to engage the target group as well as other assigned targets. --- * @{Wrapper.Controllable#CONTROLLABLE.EnRouteTaskEngageTargets}: (AIR) Engaging targets of defined types. --- * @{Wrapper.Controllable#CONTROLLABLE.EnRouteTaskEWR}: (AIR) Attack the Unit. --- * @{Wrapper.Controllable#CONTROLLABLE.EnRouteTaskFAC}: (AIR + GROUND) The task makes the group/unit a FAC and lets the FAC to choose a targets (enemy ground group) around as well as other assigned targets. --- * @{Wrapper.Controllable#CONTROLLABLE.EnRouteTaskFAC_EngageGroup}: (AIR + GROUND) The task makes the group/unit a FAC and lets the FAC to choose the target (enemy ground group) as well as other assigned targets. --- * @{Wrapper.Controllable#CONTROLLABLE.EnRouteTaskTanker}: (AIR) Aircraft will act as a tanker for friendly units. No parameters. --- --- ### 1.2.3) Preparation task methods --- --- There are certain task methods that allow to tailor the task behaviour: +-- A GROUP is a @{Controllable}. See the @{Controllable} task methods section for a description of the task methods. -- --- * @{Wrapper.Controllable#CONTROLLABLE.TaskWrappedAction}: Return a WrappedAction Task taking a Command. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskCombo}: Return a Combo Task taking an array of Tasks. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskCondition}: Return a condition section for a controlled task. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskControlled}: Return a Controlled Task taking a Task and a TaskCondition. --- -- ### 1.2.4) Obtain the mission from group templates -- -- Group templates contain complete mission descriptions. Sometimes you want to copy a complete mission from a group and assign it to another: -- -- * @{Wrapper.Controllable#CONTROLLABLE.TaskMission}: (AIR + GROUND) Return a mission task from a mission template. -- --- 1.3) GROUP Command methods --- -------------------------- --- Group **command methods** prepare the execution of commands using the @{Wrapper.Controllable#CONTROLLABLE.SetCommand} method: +-- ## 1.3) GROUP Command methods +-- +-- A GROUP is a @{Controllable}. See the @{Controllable} command methods section for a description of the command methods. -- --- * @{Wrapper.Controllable#CONTROLLABLE.CommandDoScript}: Do Script command. --- * @{Wrapper.Controllable#CONTROLLABLE.CommandSwitchWayPoint}: Perform a switch waypoint command. +-- ## 1.4) GROUP option methods +-- +-- A GROUP is a @{Controllable}. See the @{Controllable} option methods section for a description of the option methods. -- --- 1.4) GROUP Option methods --- ------------------------- --- Group **Option methods** change the behaviour of the Group while being alive. +-- ## 1.5) GROUP Zone validation methods -- --- ### 1.4.1) Rule of Engagement: --- --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROEWeaponFree} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROEOpenFire} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROEReturnFire} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROEEvadeFire} --- --- To check whether an ROE option is valid for a specific group, use: --- --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROEWeaponFreePossible} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROEOpenFirePossible} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROEReturnFirePossible} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROEEvadeFirePossible} --- --- ### 1.4.2) Rule on thread: --- --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROTNoReaction} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROTPassiveDefense} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROTEvadeFire} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROTVertical} --- --- To test whether an ROT option is valid for a specific group, use: --- --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROTNoReactionPossible} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROTPassiveDefensePossible} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROTEvadeFirePossible} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROTVerticalPossible} --- --- 1.5) GROUP Zone validation methods --- ---------------------------------- -- The group can be validated whether it is completely, partly or not within a @{Zone}. -- Use the following Zone validation methods on the group: -- @@ -145,6 +57,43 @@ -- -- The zone can be of any @{Zone} class derived from @{Core.Zone#ZONE_BASE}. So, these methods are polymorphic to the zones tested on. -- +-- ## 1.6) GROUP AI methods +-- +-- A GROUP has AI methods to control the AI activation. +-- +-- * @{#GROUP.SetAIOnOff}(): Turns the GROUP AI On or Off. +-- * @{#GROUP.SetAIOn}(): Turns the GROUP AI On. +-- * @{#GROUP.SetAIOff}(): Turns the GROUP AI Off. +-- +-- ==== +-- +-- # **API CHANGE HISTORY** +-- +-- The underlying change log documents the API changes. Please read this carefully. The following notation is used: +-- +-- * **Added** parts are expressed in bold type face. +-- * _Removed_ parts are expressed in italic type face. +-- +-- Hereby the change log: +-- +-- 2017-01-24: GROUP:**SetAIOnOff( AIOnOff )** added. +-- +-- 2017-01-24: GROUP:**SetAIOn()** added. +-- +-- 2017-01-24: GROUP:**SetAIOff()** added. +-- +-- === +-- +-- # **AUTHORS and CONTRIBUTIONS** +-- +-- ### Contributions: +-- +-- * [**Entropy**](https://forums.eagle.ru/member.php?u=111471), **Afinegan**: Came up with the requirement for AIOnOff(). +-- +-- ### Authors: +-- +-- * **FlightControl**: Design & Programming +-- -- @module Group -- @author FlightControl @@ -205,6 +154,23 @@ function GROUP:GetDCSObject() return nil end +--- Returns the @{Dcs.DCSTypes#Position3} position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission. +-- @param Wrapper.Positionable#POSITIONABLE self +-- @return Dcs.DCSTypes#Position The 3D position vectors of the POSITIONABLE. +-- @return #nil The POSITIONABLE is not existing or alive. +function GROUP:GetPositionVec3() -- Overridden from POSITIONABLE:GetPositionVec3() + self:F2( self.PositionableName ) + + local DCSPositionable = self:GetDCSObject() + + if DCSPositionable then + local PositionablePosition = DCSPositionable:getUnits()[1]:getPosition().p + self:T3( PositionablePosition ) + return PositionablePosition + end + + return nil +end --- Returns if the DCS Group is alive. -- When the group exists at run-time, this method will return true, otherwise false. @@ -391,26 +357,6 @@ function GROUP:GetInitialSize() return nil end ---- Returns the UNITs wrappers of the DCS Units of the DCS Group. --- @param #GROUP self --- @return #table The UNITs wrappers. -function GROUP:GetUnits() - self:F2( { self.GroupName } ) - local DCSGroup = self:GetDCSObject() - - if DCSGroup then - local DCSUnits = DCSGroup:getUnits() - local Units = {} - for Index, UnitData in pairs( DCSUnits ) do - Units[#Units+1] = UNIT:Find( UnitData ) - end - self:T3( Units ) - return Units - end - - return nil -end - --- Returns the DCS Units of the DCS Group. -- @param #GROUP self @@ -497,7 +443,7 @@ end --- Is Zone Functions +do -- Is Zone methods --- Returns true if all units of the group are within a @{Zone}. -- @param #GROUP self @@ -663,6 +609,49 @@ function GROUP:AllOnGround() return nil end +end + +do -- AI methods + + --- Turns the AI On or Off for the GROUP. + -- @param #GROUP self + -- @param #boolean AIOnOff The value true turns the AI On, the value false turns the AI Off. + -- @return #GROUP The GROUP. + function GROUP:SetAIOnOff( AIOnOff ) + + local DCSGroup = self:GetDCSObject() -- Dcs.DCSGroup#Group + + if DCSGroup then + local DCSController = DCSGroup:getController() -- Dcs.DCSController#Controller + if DCSController then + DCSController:setOnOff( AIOnOff ) + return self + end + end + + return nil + end + + --- Turns the AI On for the GROUP. + -- @param #GROUP self + -- @return #GROUP The GROUP. + function GROUP:SetAIOn() + + return self:SetAIOnOff( true ) + end + + --- Turns the AI Off for the GROUP. + -- @param #GROUP self + -- @return #GROUP The GROUP. + function GROUP:SetAIOff() + + return self:SetAIOnOff( false ) + end + +end + + + --- Returns the current maximum velocity of the group. -- Each unit within the group gets evaluated, and the maximum velocity (= the unit which is going the fastest) is returned. -- @param #GROUP self @@ -882,4 +871,30 @@ function GROUP:CalculateThreatLevelA2G() return MaxThreatLevelA2G end +--- Returns true if the first unit of the GROUP is in the air. +-- @param Wrapper.Group#GROUP self +-- @return #boolean true if in the first unit of the group is in the air. +-- @return #nil The GROUP is not existing or not alive. +function GROUP:InAir() + self:F2( self.GroupName ) + + local DCSGroup = self:GetDCSObject() + + if DCSGroup then + local DCSUnit = DCSGroup:getUnit(1) + if DCSUnit then + local GroupInAir = DCSGroup:getUnit(1):inAir() + self:T3( GroupInAir ) + return GroupInAir + end + end + + return nil +end + +function GROUP:OnReSpawn( ReSpawnFunction ) + + self.ReSpawnFunction = ReSpawnFunction +end + diff --git a/Moose Development/Moose/Wrapper/Identifiable.lua b/Moose Development/Moose/Wrapper/Identifiable.lua index 34f87b25a..c11b5cee7 100644 --- a/Moose Development/Moose/Wrapper/Identifiable.lua +++ b/Moose Development/Moose/Wrapper/Identifiable.lua @@ -29,7 +29,6 @@ -- === -- -- @module Identifiable --- @author FlightControl --- The IDENTIFIABLE class -- @type IDENTIFIABLE diff --git a/Moose Development/Moose/Wrapper/Object.lua b/Moose Development/Moose/Wrapper/Object.lua index ed00a0cfe..14650e584 100644 --- a/Moose Development/Moose/Wrapper/Object.lua +++ b/Moose Development/Moose/Wrapper/Object.lua @@ -23,7 +23,6 @@ -- === -- -- @module Object --- @author FlightControl --- The OBJECT class -- @type OBJECT diff --git a/Moose Development/Moose/Wrapper/Positionable.lua b/Moose Development/Moose/Wrapper/Positionable.lua index e011f6f8c..7ce5f0d04 100644 --- a/Moose Development/Moose/Wrapper/Positionable.lua +++ b/Moose Development/Moose/Wrapper/Positionable.lua @@ -24,7 +24,6 @@ -- === -- -- @module Positionable --- @author FlightControl --- The POSITIONABLE class -- @type POSITIONABLE @@ -46,6 +45,7 @@ POSITIONABLE = { function POSITIONABLE:New( PositionableName ) local self = BASE:Inherit( self, IDENTIFIABLE:New( PositionableName ) ) + self.PositionableName = PositionableName return self end @@ -54,12 +54,12 @@ end -- @return Dcs.DCSTypes#Position The 3D position vectors of the POSITIONABLE. -- @return #nil The POSITIONABLE is not existing or alive. function POSITIONABLE:GetPositionVec3() - self:F2( self.PositionableName ) + self:E( self.PositionableName ) local DCSPositionable = self:GetDCSObject() if DCSPositionable then - local PositionablePosition = DCSPositionable:getPosition() + local PositionablePosition = DCSPositionable:getPosition().p self:T3( PositionablePosition ) return PositionablePosition end @@ -111,6 +111,27 @@ function POSITIONABLE:GetPointVec2() return nil end +--- Returns a POINT_VEC3 object indicating the point in 3D of the POSITIONABLE within the mission. +-- @param Wrapper.Positionable#POSITIONABLE self +-- @return Core.Point#POINT_VEC3 The 3D point vector of the POSITIONABLE. +-- @return #nil The POSITIONABLE is not existing or alive. +function POSITIONABLE:GetPointVec3() + self:F2( self.PositionableName ) + + local DCSPositionable = self:GetDCSObject() + + if DCSPositionable then + local PositionableVec3 = self:GetPositionVec3() + + local PositionablePointVec3 = POINT_VEC3:NewFromVec3( PositionableVec3 ) + + self:T2( PositionablePointVec3 ) + return PositionablePointVec3 + end + + return nil +end + --- Returns a random @{Dcs.DCSTypes#Vec3} vector within a range, indicating the point in 3D of the POSITIONABLE within the mission. -- @param Wrapper.Positionable#POSITIONABLE self @@ -220,20 +241,13 @@ end --- Returns true if the POSITIONABLE is in the air. +-- Polymorphic, is overridden in GROUP and UNIT. -- @param Wrapper.Positionable#POSITIONABLE self -- @return #boolean true if in the air. -- @return #nil The POSITIONABLE is not existing or alive. function POSITIONABLE:InAir() self:F2( self.PositionableName ) - local DCSPositionable = self:GetDCSObject() - - if DCSPositionable then - local PositionableInAir = DCSPositionable:inAir() - self:T3( PositionableInAir ) - return PositionableInAir - end - return nil end @@ -315,6 +329,7 @@ end -- @param #POSITIONABLE self -- @param #string Message The message text -- @param Dcs.DCSTYpes#Duration Duration The duration of the message. +-- @param Dcs.DCScoalition#coalition MessageCoalition The Coalition receiving the message. -- @param #string Name (optional) The Name of the sender. If not provided, the Name is the type of the Positionable. function POSITIONABLE:MessageToCoalition( Message, Duration, MessageCoalition, Name ) self:F2( { Message, Duration } ) diff --git a/Moose Development/Moose/Wrapper/Unit.lua b/Moose Development/Moose/Wrapper/Unit.lua index 65657e3c5..2b9d30b89 100644 --- a/Moose Development/Moose/Wrapper/Unit.lua +++ b/Moose Development/Moose/Wrapper/Unit.lua @@ -467,6 +467,25 @@ function UNIT:GetFuel() return nil end +--- Returns the UNIT in a UNIT list of one element. +-- @param #UNIT self +-- @return #list The UNITs wrappers. +function UNIT:GetUnits() + self:F2( { self.UnitName } ) + local DCSUnit = self:GetDCSObject() + + if DCSUnit then + local DCSUnits = DCSUnit:getUnits() + local Units = {} + Units[1] = UNIT:Find( DCSUnit ) + self:T3( Units ) + return Units + end + + return nil +end + + --- Returns the unit's health. Dead units has health <= 1.0. -- @param #UNIT self -- @return #number The Unit's health value. @@ -799,3 +818,21 @@ function UNIT:IsShip() return nil end +--- Returns true if the UNIT is in the air. +-- @param Wrapper.Positionable#UNIT self +-- @return #boolean true if in the air. +-- @return #nil The UNIT is not existing or alive. +function UNIT:InAir() + self:F2( self.UnitName ) + + local DCSUnit = self:GetDCSObject() + + if DCSUnit then + local UnitInAir = DCSUnit:inAir() + self:T3( UnitInAir ) + return UnitInAir + end + + return nil +end + diff --git a/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua b/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua index 1d9b665ac..31a028f31 100644 --- a/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua +++ b/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua @@ -1,5 +1,5 @@ env.info( '*** MOOSE STATIC INCLUDE START *** ' ) -env.info( 'Moose Generation Timestamp: 20170110_1254' ) +env.info( 'Moose Generation Timestamp: 20170124_1109' ) local base = _G Include = {} @@ -2907,6 +2907,19 @@ end -- * @{#BASE.GetClassName}(): Gets the name of the object, which is the name of the class the object was instantiated from. -- * @{#BASE.GetClassNameAndID}(): Gets the name and ID of the object. -- +-- ## 1.5) All objects derived from BASE can have "States" +-- +-- A mechanism is in place in MOOSE, that allows to let the objects administer **states**. +-- States are essentially properties of objects, which are identified by a **Key** and a **Value**. +-- The method @{#BASE.SetState}() can be used to set a Value with a reference Key to the object. +-- To **read or retrieve** a state Value based on a Key, use the @{#BASE.GetState} method. +-- These two methods provide a very handy way to keep state at long lasting processes. +-- Values can be stored within the objects, and later retrieved or changed when needed. +-- There is one other important thing to note, the @{#BASE.SetState}() and @{#BASE.GetState} methods +-- receive as the **first parameter the object for which the state needs to be set**. +-- Thus, if the state is to be set for the same object as the object for which the method is used, then provide the same +-- object name to the method. +-- -- ## 1.10) BASE Inheritance (tree) support -- -- The following methods are available to support inheritance: @@ -3498,25 +3511,41 @@ function BASE:onEvent(event) end end -function BASE:SetState( Object, StateName, State ) +--- Set a state or property of the Object given a Key and a Value. +-- Note that if the Object is destroyed, nillified or garbage collected, then the Values and Keys will also be gone. +-- @param #BASE self +-- @param Object The object that will hold the Value set by the Key. +-- @param Key The key that is used as a reference of the value. Note that the key can be a #string, but it can also be any other type! +-- @param Value The value to is stored in the object. +-- @return The Value set. +-- @return #nil The Key was not found and thus the Value could not be retrieved. +function BASE:SetState( Object, Key, Value ) local ClassNameAndID = Object:GetClassNameAndID() self.States[ClassNameAndID] = self.States[ClassNameAndID] or {} - self.States[ClassNameAndID][StateName] = State - self:T2( { ClassNameAndID, StateName, State } ) + self.States[ClassNameAndID][Key] = Value + self:T2( { ClassNameAndID, Key, Value } ) - return self.States[ClassNameAndID][StateName] + return self.States[ClassNameAndID][Key] end - -function BASE:GetState( Object, StateName ) + + +--- Get a Value given a Key from the Object. +-- Note that if the Object is destroyed, nillified or garbage collected, then the Values and Keys will also be gone. +-- @param #BASE self +-- @param Object The object that holds the Value set by the Key. +-- @param Key The key that is used to retrieve the value. Note that the key can be a #string, but it can also be any other type! +-- @param Value The value to is stored in the Object. +-- @return The Value retrieved. +function BASE:GetState( Object, Key ) local ClassNameAndID = Object:GetClassNameAndID() if self.States[ClassNameAndID] then - local State = self.States[ClassNameAndID][StateName] or false - self:T2( { ClassNameAndID, StateName, State } ) - return State + local Value = self.States[ClassNameAndID][Key] or false + self:T2( { ClassNameAndID, Key, Value } ) + return Value end return nil @@ -3857,6 +3886,8 @@ function SCHEDULER:New( SchedulerObject, SchedulerFunction, SchedulerArguments, local ScheduleID = nil + self.MasterObject = SchedulerObject + if SchedulerFunction then ScheduleID = self:Schedule( SchedulerObject, SchedulerFunction, SchedulerArguments, Start, Repeat, RandomizeFactor, Stop ) end @@ -3888,7 +3919,7 @@ function SCHEDULER:Schedule( SchedulerObject, SchedulerFunction, SchedulerArgume if SchedulerObject and SchedulerObject.ClassName and SchedulerObject.ClassID then ObjectName = SchedulerObject.ClassName .. SchedulerObject.ClassID end - self:E( { "Schedule :", ObjectName, tostring( SchedulerObject ), Start, Repeat, RandomizeFactor, Stop } ) + self:F3( { "Schedule :", ObjectName, tostring( SchedulerObject ), Start, Repeat, RandomizeFactor, Stop } ) self.SchedulerObject = SchedulerObject local ScheduleID = _SCHEDULEDISPATCHER:AddSchedule( @@ -4015,12 +4046,12 @@ function SCHEDULEDISPATCHER:AddSchedule( Scheduler, ScheduleFunction, ScheduleAr -- If the object used as the key is nil, then the garbage collector will remove the item from the Functions array. self.ObjectSchedulers = self.ObjectSchedulers or setmetatable( {}, { __mode = "v" } ) - if Scheduler.SchedulerObject then + if Scheduler.MasterObject then self.ObjectSchedulers[self.CallID] = Scheduler - self:E( { CallID = self.CallID, ObjectScheduler = tostring(self.ObjectSchedulers[self.CallID]), SchedulerObject = tostring(Scheduler.SchedulerObject) } ) + self:F3( { CallID = self.CallID, ObjectScheduler = tostring(self.ObjectSchedulers[self.CallID]), MasterObject = tostring(Scheduler.MasterObject) } ) else self.PersistentSchedulers[self.CallID] = Scheduler - self:E( { CallID = self.CallID, PersistentScheduler = self.PersistentSchedulers[self.CallID] } ) + self:F3( { CallID = self.CallID, PersistentScheduler = self.PersistentSchedulers[self.CallID] } ) end self.Schedule = self.Schedule or setmetatable( {}, { __mode = "k" } ) @@ -4029,7 +4060,7 @@ function SCHEDULEDISPATCHER:AddSchedule( Scheduler, ScheduleFunction, ScheduleAr self.Schedule[Scheduler][self.CallID].Function = ScheduleFunction self.Schedule[Scheduler][self.CallID].Arguments = ScheduleArguments self.Schedule[Scheduler][self.CallID].StartTime = timer.getTime() + ( Start or 0 ) - self.Schedule[Scheduler][self.CallID].Start = Start + .001 + self.Schedule[Scheduler][self.CallID].Start = Start + .1 self.Schedule[Scheduler][self.CallID].Repeat = Repeat self.Schedule[Scheduler][self.CallID].Randomize = Randomize self.Schedule[Scheduler][self.CallID].Stop = Stop @@ -4105,7 +4136,7 @@ function SCHEDULEDISPATCHER:AddSchedule( Scheduler, ScheduleFunction, ScheduleAr self:Stop( Scheduler, CallID ) end else - --self:E( "Scheduled obscolete call for CallID: " .. CallID ) + self:E( "Scheduled obscolete call for CallID: " .. CallID ) end return nil @@ -4876,6 +4907,16 @@ end -- @param #EVENTDATA Event function EVENT:onEvent( Event ) + local ErrorHandler = function( errmsg ) + + env.info( "Error in SCHEDULER function:" .. errmsg ) + if debug ~= nil then + env.info( debug.traceback() ) + end + + return errmsg + end + if self and self.Events and self.Events[Event.id] then if Event.initiator and Event.initiator:getCategory() == Object.Category.UNIT then Event.IniDCSUnit = Event.initiator @@ -4917,14 +4958,16 @@ function EVENT:onEvent( Event ) -- If the EventData is for a UNIT, the call directly the EventClass EventFunction for that UNIT. if Event.IniDCSUnitName and EventData.IniUnit and EventData.IniUnit[Event.IniDCSUnitName] then self:T( { "Calling EventFunction for Class ", EventClass:GetClassNameAndID(), ", Unit ", Event.IniUnitName } ) - EventData.IniUnit[Event.IniDCSUnitName].EventFunction( EventData.IniUnit[Event.IniDCSUnitName].EventClass, Event ) + local Result, Value = xpcall( function() return EventData.IniUnit[Event.IniDCSUnitName].EventFunction( EventData.IniUnit[Event.IniDCSUnitName].EventClass, Event ) end, ErrorHandler ) + --EventData.IniUnit[Event.IniDCSUnitName].EventFunction( EventData.IniUnit[Event.IniDCSUnitName].EventClass, Event ) else -- If the EventData is not bound to a specific unit, then call the EventClass EventFunction. -- Note that here the EventFunction will need to implement and determine the logic for the relevant source- or target unit, or weapon. if Event.IniDCSUnit and not EventData.IniUnit then if EventClass == EventData.EventClass then self:T( { "Calling EventFunction for Class ", EventClass:GetClassNameAndID() } ) - EventData.EventFunction( EventData.EventClass, Event ) + local Result, Value = xpcall( function() return EventData.EventFunction( EventData.EventClass, Event ) end, ErrorHandler ) + --EventData.EventFunction( EventData.EventClass, Event ) end end end @@ -9793,9 +9836,11 @@ POINT_VEC3 = { BARO = "BARO", }, RoutePointType = { + TakeOffParking = "TakeOffParking", TurningPoint = "Turning Point", }, RoutePointAction = { + FromParkingArea = "From Parking Area", TurningPoint = "Turning Point", }, } @@ -9818,10 +9863,12 @@ do -- POINT_VEC3 --- RoutePoint Types -- @type POINT_VEC3.RoutePointType +-- @field TakeOffParking "TakeOffParking" -- @field TurningPoint "Turning Point" --- RoutePoint Actions -- @type POINT_VEC3.RoutePointAction +-- @field FromParkingArea "From Parking Area" -- @field TurningPoint "Turning Point" -- Constructor. @@ -10858,7 +10905,7 @@ end -- The following example provides a little demonstration on the difference between synchronous and asynchronous Event Triggering. -- -- function FSM:OnAfterEvent( From, Event, To, Amount ) --- self:E( { Amount = Amount } ) +-- self:T( { Amount = Amount } ) -- end -- -- local Amount = 1 @@ -10906,7 +10953,7 @@ end -- ![Transition Flow](..\Presentations\FSM\Dia7.JPG) -- -- function FsmDemo:OnAfterSwitch( From, Event, To, FsmUnit ) --- self:E( { From, Event, To, FsmUnit } ) +-- self:T( { From, Event, To, FsmUnit } ) -- -- if From == "Green" then -- FsmUnit:Flare(FLARECOLOR.Green) @@ -10929,7 +10976,7 @@ end -- -- For debugging reasons the received parameters are traced within the DCS.log. -- --- self:E( { From, Event, To, FsmUnit } ) +-- self:T( { From, Event, To, FsmUnit } ) -- -- The method will check if the From state received is either "Green" or "Red" and will flare the respective color from the FsmUnit. -- @@ -11073,7 +11120,7 @@ do -- FSM Transition.Event = Event Transition.To = To - self:E( Transition ) + self:T( Transition ) self._Transitions[Transition] = Transition self:_eventmap( self.Events, Transition ) @@ -11095,7 +11142,7 @@ do -- FSM -- @param #table ReturnEvents A table indicating for which returned events of the SubFSM which Event must be triggered in the FSM. -- @return Core.Fsm#FSM_PROCESS The SubFSM. function FSM:AddProcess( From, Event, Process, ReturnEvents ) - self:E( { From, Event, Process, ReturnEvents } ) + self:T( { From, Event, Process, ReturnEvents } ) local Sub = {} Sub.From = From @@ -11125,7 +11172,7 @@ do -- FSM for ProcessID, Process in pairs( self:GetProcesses() ) do if Process.From == From and Process.Event == Event then - self:E( Process ) + self:T( Process ) return Process.fsm end end @@ -11176,7 +11223,7 @@ do -- FSM local Process = self:GetProcess( From, Event ) - self:E( { Process = Process._Name, Scores = Process._Scores, State = State, ScoreText = ScoreText, Score = Score } ) + self:T( { Process = Process._Name, Scores = Process._Scores, State = State, ScoreText = ScoreText, Score = Score } ) Process._Scores[State] = Process._Scores[State] or {} Process._Scores[State].ScoreText = ScoreText Process._Scores[State].Score = Score @@ -11236,26 +11283,35 @@ do -- FSM function FSM:_call_handler(handler, params) if self[handler] then - self:E( "Calling " .. handler ) - return self[handler]( self, unpack(params) ) + self:T( "Calling " .. handler ) + local Value = self[handler]( self, unpack(params) ) + return Value end end function FSM._handler( self, EventName, ... ) - self:E( { EventName, ... } ) - local Can, to = self:can( EventName ) - self:E( { From = self.current, Event = EventName, To = to, Can = Can } ) + + if to == "*" then + to = self.current + end if Can then local from = self.current local params = { from, EventName, to, ... } + + if self.Controllable then + self:T( "FSM Transition for " .. self.Controllable.ControllableName .. " :" .. self.current .. " --> " .. EventName .. " --> " .. to ) + else + self:T( "FSM Transition:" .. self.current .. " --> " .. EventName .. " --> " .. to ) + end - if self:_call_handler("onbefore" .. EventName, params) == false - or self:_call_handler("OnBefore" .. EventName, params) == false - or self:_call_handler("onleave" .. from, params) == false - or self:_call_handler("OnLeave" .. from, params) == false then + if ( self:_call_handler("onbefore" .. EventName, params) == false ) + or ( self:_call_handler("OnBefore" .. EventName, params) == false ) + or ( self:_call_handler("onleave" .. from, params) == false ) + or ( self:_call_handler("OnLeave" .. from, params) == false ) then + self:T( "Cancel Transition" ) return false end @@ -11269,7 +11325,7 @@ do -- FSM -- self:F2( "nextevent = " .. sub.nextevent ) -- self[sub.nextevent]( self ) --end - self:E( "calling sub start event: " .. sub.StartEvent ) + self:T( "calling sub start event: " .. sub.StartEvent ) sub.fsm.fsmparent = self sub.fsm.ReturnEvents = sub.ReturnEvents sub.fsm[sub.StartEvent]( sub.fsm ) @@ -11300,29 +11356,30 @@ do -- FSM self:_call_handler("onstatechange", params) end + else + self:T( "Cannot execute transition." ) + self:T( { From = self.current, Event = EventName, To = to, Can = Can } ) end return nil end function FSM:_delayed_transition( EventName ) - self:E( { EventName = EventName } ) return function( self, DelaySeconds, ... ) - self:T( "Delayed Event: " .. EventName ) + self:T2( "Delayed Event: " .. EventName ) local CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 ) - self:T( { CallID = CallID } ) + self:T2( { CallID = CallID } ) end end function FSM:_create_transition( EventName ) - self:E( { Event = EventName } ) return function( self, ... ) return self._handler( self, EventName , ... ) end end function FSM:_gosub( ParentFrom, ParentEvent ) local fsmtable = {} if self.subs[ParentFrom] and self.subs[ParentFrom][ParentEvent] then - self:E( { ParentFrom, ParentEvent, self.subs[ParentFrom], self.subs[ParentFrom][ParentEvent] } ) + self:T( { ParentFrom, ParentEvent, self.subs[ParentFrom], self.subs[ParentFrom][ParentEvent] } ) return self.subs[ParentFrom][ParentEvent] else return {} @@ -11332,17 +11389,17 @@ do -- FSM function FSM:_isendstate( Current ) local FSMParent = self.fsmparent if FSMParent and self.endstates[Current] then - self:E( { state = Current, endstates = self.endstates, endstate = self.endstates[Current] } ) + self:T( { state = Current, endstates = self.endstates, endstate = self.endstates[Current] } ) FSMParent.current = Current local ParentFrom = FSMParent.current - self:E( ParentFrom ) - self:E( self.ReturnEvents ) + self:T( ParentFrom ) + self:T( self.ReturnEvents ) local Event = self.ReturnEvents[Current] - self:E( { ParentFrom, Event, self.ReturnEvents } ) + self:T( { ParentFrom, Event, self.ReturnEvents } ) if Event then return FSMParent, Event else - self:E( { "Could not find parent event name for state ", ParentFrom } ) + self:T( { "Could not find parent event name for state ", ParentFrom } ) end end @@ -11375,7 +11432,6 @@ do -- FSM end function FSM:can(e) - self:E( { e, self.Events, self.Events[e] } ) local Event = self.Events[e] self:F3( { self.current, Event } ) local To = Event and Event.map[self.current] or Event.map['*'] @@ -11444,8 +11500,9 @@ do -- FSM_CONTROLLABLE end if self[handler] then - self:E( "Calling " .. handler ) - return xpcall( function() return self[handler]( self, self.Controllable, unpack( params ) ) end, ErrorHandler ) + self:F3( "Calling " .. handler ) + local Result, Value = xpcall( function() return self[handler]( self, self.Controllable, unpack( params ) ) end, ErrorHandler ) + return Value --return self[handler]( self, self.Controllable, unpack( params ) ) end end @@ -11477,14 +11534,14 @@ do -- FSM_PROCESS end function FSM_PROCESS:Init( FsmProcess ) - self:E( "No Initialisation" ) + self:T( "No Initialisation" ) end --- Creates a new FSM_PROCESS object based on this FSM_PROCESS. -- @param #FSM_PROCESS self -- @return #FSM_PROCESS function FSM_PROCESS:Copy( Controllable, Task ) - self:E( { self:GetClassNameAndID() } ) + self:T( { self:GetClassNameAndID() } ) local NewFsm = self:New( Controllable, Task ) -- Core.Fsm#FSM_PROCESS @@ -11503,19 +11560,19 @@ do -- FSM_PROCESS -- Copy Processes for ProcessID, Process in pairs( self:GetProcesses() ) do - self:E( { Process} ) + self:T( { Process} ) local FsmProcess = NewFsm:AddProcess( Process.From, Process.Event, Process.fsm:Copy( Controllable, Task ), Process.ReturnEvents ) end -- Copy End States for EndStateID, EndState in pairs( self:GetEndStates() ) do - self:E( EndState ) + self:T( EndState ) NewFsm:AddEndState( EndState ) end -- Copy the score tables for ScoreID, Score in pairs( self:GetScores() ) do - self:E( Score ) + self:T( Score ) NewFsm:AddScore( ScoreID, Score.ScoreText, Score.Score ) end @@ -11585,7 +11642,7 @@ end -- @param Wrapper.Unit#UNIT ProcessUnit -- @return #FSM_PROCESS self function FSM_PROCESS:Assign( ProcessUnit, Task ) - self:E( { Task, ProcessUnit } ) + self:T( { Task, ProcessUnit } ) self:SetControllable( ProcessUnit ) self:SetTask( Task ) @@ -11594,37 +11651,21 @@ end return self end - - --- Adds a score for the FSM_PROCESS to be achieved. - -- @param #FSM_PROCESS self - -- @param #string State is the state of the process when the score needs to be given. (See the relevant state descriptions of the process). - -- @param #string ScoreText is a text describing the score that is given according the status. - -- @param #number Score is a number providing the score of the status. - -- @return #FSM_PROCESS self - function FSM_PROCESS:AddScore( State, ScoreText, Score ) - self:F2( { State, ScoreText, Score } ) - - self.Scores[State] = self.Scores[State] or {} - self.Scores[State].ScoreText = ScoreText - self.Scores[State].Score = Score - - return self - end - + function FSM_PROCESS:onenterAssigned( ProcessUnit ) - self:E( "Assign" ) + self:T( "Assign" ) self.Task:Assign() end function FSM_PROCESS:onenterFailed( ProcessUnit ) - self:E( "Failed" ) + self:T( "Failed" ) self.Task:Fail() end function FSM_PROCESS:onenterSuccess( ProcessUnit ) - self:E( "Success" ) + self:T( "Success" ) self.Task:Success() end @@ -11636,20 +11677,20 @@ end -- @param #string From -- @param #string To function FSM_PROCESS:onstatechange( ProcessUnit, From, Event, To, Dummy ) - self:E( { ProcessUnit, From, Event, To, Dummy, self:IsTrace() } ) + self:T( { ProcessUnit, From, Event, To, Dummy, self:IsTrace() } ) if self:IsTrace() then MESSAGE:New( "@ Process " .. self:GetClassNameAndID() .. " : " .. Event .. " changed to state " .. To, 2 ):ToAll() end - self:E( self.Scores[To] ) + self:T( self._Scores[To] ) -- TODO: This needs to be reworked with a callback functions allocated within Task, and set within the mission script from the Task Objects... - if self.Scores[To] then + if self._Scores[To] then local Task = self.Task local Scoring = Task:GetScoring() if Scoring then - Scoring:_AddMissionTaskScore( Task.Mission, ProcessUnit, self.Scores[To].ScoreText, self.Scores[To].Score ) + Scoring:_AddMissionTaskScore( Task.Mission, ProcessUnit, self._Scores[To].ScoreText, self._Scores[To].Score ) end end end @@ -11683,7 +11724,7 @@ do -- FSM_TASK function FSM_TASK:_call_handler( handler, params ) if self[handler] then - self:E( "Calling " .. handler ) + self:T( "Calling " .. handler ) return self[handler]( self, unpack( params ) ) end end @@ -11735,7 +11776,7 @@ do -- FSM_SET function FSM_SET:_call_handler( handler, params ) if self[handler] then - self:E( "Calling " .. handler ) + self:T( "Calling " .. handler ) return self[handler]( self, self.Set, unpack( params ) ) end end @@ -11767,7 +11808,6 @@ end -- FSM_SET -- === -- -- @module Object --- @author FlightControl --- The OBJECT class -- @type OBJECT @@ -11862,7 +11902,6 @@ end -- === -- -- @module Identifiable --- @author FlightControl --- The IDENTIFIABLE class -- @type IDENTIFIABLE @@ -12084,7 +12123,6 @@ end -- === -- -- @module Positionable --- @author FlightControl --- The POSITIONABLE class -- @type POSITIONABLE @@ -12106,6 +12144,7 @@ POSITIONABLE = { function POSITIONABLE:New( PositionableName ) local self = BASE:Inherit( self, IDENTIFIABLE:New( PositionableName ) ) + self.PositionableName = PositionableName return self end @@ -12114,12 +12153,12 @@ end -- @return Dcs.DCSTypes#Position The 3D position vectors of the POSITIONABLE. -- @return #nil The POSITIONABLE is not existing or alive. function POSITIONABLE:GetPositionVec3() - self:F2( self.PositionableName ) + self:E( self.PositionableName ) local DCSPositionable = self:GetDCSObject() if DCSPositionable then - local PositionablePosition = DCSPositionable:getPosition() + local PositionablePosition = DCSPositionable:getPosition().p self:T3( PositionablePosition ) return PositionablePosition end @@ -12171,6 +12210,27 @@ function POSITIONABLE:GetPointVec2() return nil end +--- Returns a POINT_VEC3 object indicating the point in 3D of the POSITIONABLE within the mission. +-- @param Wrapper.Positionable#POSITIONABLE self +-- @return Core.Point#POINT_VEC3 The 3D point vector of the POSITIONABLE. +-- @return #nil The POSITIONABLE is not existing or alive. +function POSITIONABLE:GetPointVec3() + self:F2( self.PositionableName ) + + local DCSPositionable = self:GetDCSObject() + + if DCSPositionable then + local PositionableVec3 = self:GetPositionVec3() + + local PositionablePointVec3 = POINT_VEC3:NewFromVec3( PositionableVec3 ) + + self:T2( PositionablePointVec3 ) + return PositionablePointVec3 + end + + return nil +end + --- Returns a random @{Dcs.DCSTypes#Vec3} vector within a range, indicating the point in 3D of the POSITIONABLE within the mission. -- @param Wrapper.Positionable#POSITIONABLE self @@ -12280,20 +12340,13 @@ end --- Returns true if the POSITIONABLE is in the air. +-- Polymorphic, is overridden in GROUP and UNIT. -- @param Wrapper.Positionable#POSITIONABLE self -- @return #boolean true if in the air. -- @return #nil The POSITIONABLE is not existing or alive. function POSITIONABLE:InAir() self:F2( self.PositionableName ) - local DCSPositionable = self:GetDCSObject() - - if DCSPositionable then - local PositionableInAir = DCSPositionable:inAir() - self:T3( PositionableInAir ) - return PositionableInAir - end - return nil end @@ -12375,6 +12428,7 @@ end -- @param #POSITIONABLE self -- @param #string Message The message text -- @param Dcs.DCSTYpes#Duration Duration The duration of the message. +-- @param Dcs.DCScoalition#coalition MessageCoalition The Coalition receiving the message. -- @param #string Name (optional) The Name of the sender. If not provided, the Name is the type of the Positionable. function POSITIONABLE:MessageToCoalition( Message, Duration, MessageCoalition, Name ) self:F2( { Message, Duration } ) @@ -12522,7 +12576,7 @@ end -- * @{#CONTROLLABLE.TaskEmbarkToTransport}: (GROUND) Embark to a Transport landed at a location. -- * @{#CONTROLLABLE.TaskEscort}: (AIR) Escort another airborne controllable. -- * @{#CONTROLLABLE.TaskFAC_AttackControllable}: (AIR + GROUND) The task makes the controllable/unit a FAC and orders the FAC to control the target (enemy ground controllable) destruction. --- * @{#CONTROLLABLE.TaskFireAtPoint}: (GROUND) Fire at a VEC2 point until ammunition is finished. +-- * @{#CONTROLLABLE.TaskFireAtPoint}: (GROUND) Fire some or all ammunition at a VEC2 point. -- * @{#CONTROLLABLE.TaskFollow}: (AIR) Following another airborne controllable. -- * @{#CONTROLLABLE.TaskHold}: (GROUND) Hold ground controllable from moving. -- * @{#CONTROLLABLE.TaskHoldPosition}: (AIR) Hold position at the current position of the first unit of the controllable. @@ -12606,7 +12660,6 @@ end -- === -- -- @module Controllable --- @author FlightControl --- The CONTROLLABLE class -- @type CONTROLLABLE @@ -12627,6 +12680,8 @@ function CONTROLLABLE:New( ControllableName ) local self = BASE:Inherit( self, POSITIONABLE:New( ControllableName ) ) self:F2( ControllableName ) self.ControllableName = ControllableName + + self.TaskScheduler = SCHEDULER:New( self ) return self end @@ -12648,6 +12703,58 @@ function CONTROLLABLE:_GetController() return nil end +-- Get methods + +--- Returns the UNITs wrappers of the DCS Units of the Controllable (default is a GROUP). +-- @param #CONTROLLABLE self +-- @return #list The UNITs wrappers. +function CONTROLLABLE:GetUnits() + self:F2( { self.ControllableName } ) + local DCSControllable = self:GetDCSObject() + + if DCSControllable then + local DCSUnits = DCSControllable:getUnits() + local Units = {} + for Index, UnitData in pairs( DCSUnits ) do + Units[#Units+1] = UNIT:Find( UnitData ) + end + self:T3( Units ) + return Units + end + + return nil +end + + +--- Returns the health. Dead controllables have health <= 1.0. +-- @param #CONTROLLABLE self +-- @return #number The controllable health value (unit or group average). +-- @return #nil The controllable is not existing or alive. +function CONTROLLABLE:GetLife() + self:F2( self.ControllableName ) + + local DCSControllable = self:GetDCSObject() + + if DCSControllable then + local UnitLife = 0 + local Units = self:GetUnits() + if #Units == 1 then + local Unit = Units[1] -- Wrapper.Unit#UNIT + UnitLife = Unit:GetLife() + else + local UnitLifeTotal = 0 + for UnitID, Unit in pairs( Units ) do + local Unit = Unit -- Wrapper.Unit#UNIT + UnitLifeTotal = UnitLifeTotal + Unit:GetLife() + end + UnitLife = UnitLifeTotal / #Units + end + return UnitLife + end + + return nil +end + -- Tasks @@ -12685,7 +12792,7 @@ function CONTROLLABLE:PushTask( DCSTask, WaitTime ) -- Controller:pushTask( DCSTask ) if WaitTime then - SCHEDULER:New( Controller, Controller.pushTask, { DCSTask }, WaitTime ) + self.TaskScheduler:Schedule( Controller, Controller.pushTask, { DCSTask }, WaitTime ) else Controller:pushTask( DCSTask ) end @@ -12707,7 +12814,7 @@ function CONTROLLABLE:SetTask( DCSTask, WaitTime ) if DCSControllable then local Controller = self:_GetController() - self:E(Controller) + self:T3( Controller ) -- When a controllable SPAWNs, it takes about a second to get the controllable in the simulator. Setting tasks to unspawned controllables provides unexpected results. -- Therefore we schedule the functions to set the mission and options for the Controllable. @@ -12716,7 +12823,7 @@ function CONTROLLABLE:SetTask( DCSTask, WaitTime ) if not WaitTime then Controller:setTask( DCSTask ) else - SCHEDULER:New( Controller, Controller.setTask, { DCSTask }, WaitTime ) + self.TaskScheduler:Schedule( Controller, Controller.setTask, { DCSTask }, WaitTime ) end return self @@ -12787,6 +12894,10 @@ function CONTROLLABLE:TaskCombo( DCSTasks ) tasks = DCSTasks } } + + for TaskID, Task in ipairs( DCSTasks ) do + self:E( Task ) + end self:T3( { DCSTaskCombo } ) return DCSTaskCombo @@ -12972,19 +13083,24 @@ function CONTROLLABLE:TaskAttackUnit( AttackUnit, WeaponType, WeaponExpend, Atta -- } local DCSTask - DCSTask = { id = 'AttackUnit', + DCSTask = { + id = 'AttackUnit', params = { + altitudeEnabled = true, unitId = AttackUnit:GetID(), - weaponType = WeaponType, - expend = WeaponExpend, - attackQty = AttackQty, - direction = Direction, - attackQtyLimit = AttackQtyLimit, - controllableAttack = ControllableAttack, - }, - }, + attackQtyLimit = AttackQtyLimit or false, + attackQty = AttackQty or 2, + expend = WeaponExpend or "Auto", + altitude = 2000, + directionEnabled = true, + groupAttack = true, + --weaponType = WeaponType or 1073741822, + direction = Direction or 0, + } + } - self:T3( { DCSTask } ) + self:E( DCSTask ) + return DCSTask end @@ -13368,15 +13484,18 @@ end -- @param #CONTROLLABLE self -- @param Dcs.DCSTypes#Vec2 Vec2 The point to fire at. -- @param Dcs.DCSTypes#Distance Radius The radius of the zone to deploy the fire at. +-- @param #number AmmoCount (optional) Quantity of ammunition to expand (omit to fire until ammunition is depleted). -- @return Dcs.DCSTasking.Task#Task The DCS task structure. -function CONTROLLABLE:TaskFireAtPoint( Vec2, Radius ) - self:F2( { self.ControllableName, Vec2, Radius } ) +function CONTROLLABLE:TaskFireAtPoint( Vec2, Radius, AmmoCount ) + self:F2( { self.ControllableName, Vec2, Radius, AmmoCount } ) -- FireAtPoint = { -- id = 'FireAtPoint', -- params = { -- point = Vec2, -- radius = Distance, + -- expendQty = number, + -- expendQtyEnabled = boolean, -- } -- } @@ -13385,8 +13504,15 @@ function CONTROLLABLE:TaskFireAtPoint( Vec2, Radius ) params = { point = Vec2, radius = Radius, + expendQty = 100, -- dummy value + expendQtyEnabled = false, } } + + if AmmoCount then + DCSTask.params.expendQty = AmmoCount + DCSTask.params.expendQtyEnabled = true + end self:T3( { DCSTask } ) return DCSTask @@ -13977,7 +14103,7 @@ function CONTROLLABLE:Route( GoPoints ) local MissionTask = { id = 'Mission', params = { route = { points = Points, }, }, } local Controller = self:_GetController() --Controller.setTask( Controller, MissionTask ) - SCHEDULER:New( Controller, Controller.setTask, { MissionTask }, 1 ) + self.TaskScheduler:Schedule( Controller, Controller.setTask, { MissionTask }, 1 ) return self end @@ -14605,7 +14731,7 @@ end -- @param #table WayPoints If WayPoints is given, then use the route. -- @return #CONTROLLABLE function CONTROLLABLE:WayPointInitialize( WayPoints ) - self:F( { WayPoint, WayPointIndex, WayPointFunction } ) + self:F( { WayPoints } ) if WayPoints then self.WayPoints = WayPoints @@ -14616,6 +14742,18 @@ function CONTROLLABLE:WayPointInitialize( WayPoints ) return self end +--- Get the current WayPoints set with the WayPoint functions( Note that the WayPoints can be nil, although there ARE waypoints). +-- @param #CONTROLLABLE self +-- @return #table WayPoints If WayPoints is given, then return the WayPoints structure. +function CONTROLLABLE:GetWayPoints() + self:F( ) + + if self.WayPoints then + return self.WayPoints + end + + return nil +end --- Registers a waypoint function that will be executed when the controllable moves over the WayPoint. -- @param #CONTROLLABLE self @@ -14684,10 +14822,7 @@ function CONTROLLABLE:WayPointExecute( WayPoint, WaitTime ) return self end --- Message APIs - - ---- This module contains the GROUP class. +-- Message APIs--- This module contains the GROUP class. -- -- 1) @{Wrapper.Group#GROUP} class, extends @{Wrapper.Controllable#CONTROLLABLE} -- ============================================================= @@ -14717,114 +14852,26 @@ end -- * @{#GROUP.Find}(): Find a GROUP instance from the _DATABASE object using a DCS Group object. -- * @{#GROUP.FindByName}(): Find a GROUP instance from the _DATABASE object using a DCS Group name. -- --- 1.2) GROUP task methods --- ----------------------- --- Several group task methods are available that help you to prepare tasks. --- These methods return a string consisting of the task description, which can then be given to either a --- @{Wrapper.Controllable#CONTROLLABLE.PushTask} or @{Wrapper.Controllable#CONTROLLABLE.SetTask} method to assign the task to the GROUP. --- Tasks are specific for the category of the GROUP, more specific, for AIR, GROUND or AIR and GROUND. --- Each task description where applicable indicates for which group category the task is valid. --- There are 2 main subdivisions of tasks: Assigned tasks and EnRoute tasks. --- --- ### 1.2.1) Assigned task methods --- --- Assigned task methods make the group execute the task where the location of the (possible) targets of the task are known before being detected. --- This is different from the EnRoute tasks, where the targets of the task need to be detected before the task can be executed. --- --- Find below a list of the **assigned task** methods: --- --- * @{Wrapper.Controllable#CONTROLLABLE.TaskAttackGroup}: (AIR) Attack a Group. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskAttackMapObject}: (AIR) Attacking the map object (building, structure, e.t.c). --- * @{Wrapper.Controllable#CONTROLLABLE.TaskAttackUnit}: (AIR) Attack the Unit. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskBombing}: (Wrapper.Controllable#CONTROLLABLEDelivering weapon at the point on the ground. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskBombingRunway}: (AIR) Delivering weapon on the runway. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskEmbarking}: (AIR) Move the group to a Vec2 Point, wait for a defined duration and embark a group. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskEmbarkToTransport}: (GROUND) Embark to a Transport landed at a location. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskEscort}: (AIR) Escort another airborne group. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskFAC_AttackGroup}: (AIR + GROUND) The task makes the group/unit a FAC and orders the FAC to control the target (enemy ground group) destruction. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskFireAtPoint}: (GROUND) Fire at a VEC2 point until ammunition is finished. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskFollow}: (AIR) Following another airborne group. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskHold}: (GROUND) Hold ground group from moving. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskHoldPosition}: (AIR) Hold position at the current position of the first unit of the group. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskLand}: (AIR HELICOPTER) Landing at the ground. For helicopters only. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskLandAtZone}: (AIR) Land the group at a @{Core.Zone#ZONE_RADIUS). --- * @{Wrapper.Controllable#CONTROLLABLE.TaskOrbitCircle}: (AIR) Orbit at the current position of the first unit of the group at a specified alititude. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskOrbitCircleAtVec2}: (AIR) Orbit at a specified position at a specified alititude during a specified duration with a specified speed. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskRefueling}: (AIR) Refueling from the nearest tanker. No parameters. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskRoute}: (AIR + GROUND) Return a Misson task to follow a given route defined by Points. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskRouteToVec2}: (AIR + GROUND) Make the Group move to a given point. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskRouteToVec3}: (AIR + GROUND) Make the Group move to a given point. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskRouteToZone}: (AIR + GROUND) Route the group to a given zone. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskReturnToBase}: (AIR) Route the group to an airbase. +-- ## 1.2) GROUP task methods -- --- ### 1.2.2) EnRoute task methods --- --- EnRoute tasks require the targets of the task need to be detected by the group (using its sensors) before the task can be executed: --- --- * @{Wrapper.Controllable#CONTROLLABLE.EnRouteTaskAWACS}: (AIR) Aircraft will act as an AWACS for friendly units (will provide them with information about contacts). No parameters. --- * @{Wrapper.Controllable#CONTROLLABLE.EnRouteTaskEngageGroup}: (AIR) Engaging a group. The task does not assign the target group to the unit/group to attack now; it just allows the unit/group to engage the target group as well as other assigned targets. --- * @{Wrapper.Controllable#CONTROLLABLE.EnRouteTaskEngageTargets}: (AIR) Engaging targets of defined types. --- * @{Wrapper.Controllable#CONTROLLABLE.EnRouteTaskEWR}: (AIR) Attack the Unit. --- * @{Wrapper.Controllable#CONTROLLABLE.EnRouteTaskFAC}: (AIR + GROUND) The task makes the group/unit a FAC and lets the FAC to choose a targets (enemy ground group) around as well as other assigned targets. --- * @{Wrapper.Controllable#CONTROLLABLE.EnRouteTaskFAC_EngageGroup}: (AIR + GROUND) The task makes the group/unit a FAC and lets the FAC to choose the target (enemy ground group) as well as other assigned targets. --- * @{Wrapper.Controllable#CONTROLLABLE.EnRouteTaskTanker}: (AIR) Aircraft will act as a tanker for friendly units. No parameters. --- --- ### 1.2.3) Preparation task methods --- --- There are certain task methods that allow to tailor the task behaviour: +-- A GROUP is a @{Controllable}. See the @{Controllable} task methods section for a description of the task methods. -- --- * @{Wrapper.Controllable#CONTROLLABLE.TaskWrappedAction}: Return a WrappedAction Task taking a Command. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskCombo}: Return a Combo Task taking an array of Tasks. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskCondition}: Return a condition section for a controlled task. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskControlled}: Return a Controlled Task taking a Task and a TaskCondition. --- -- ### 1.2.4) Obtain the mission from group templates -- -- Group templates contain complete mission descriptions. Sometimes you want to copy a complete mission from a group and assign it to another: -- -- * @{Wrapper.Controllable#CONTROLLABLE.TaskMission}: (AIR + GROUND) Return a mission task from a mission template. -- --- 1.3) GROUP Command methods --- -------------------------- --- Group **command methods** prepare the execution of commands using the @{Wrapper.Controllable#CONTROLLABLE.SetCommand} method: +-- ## 1.3) GROUP Command methods +-- +-- A GROUP is a @{Controllable}. See the @{Controllable} command methods section for a description of the command methods. -- --- * @{Wrapper.Controllable#CONTROLLABLE.CommandDoScript}: Do Script command. --- * @{Wrapper.Controllable#CONTROLLABLE.CommandSwitchWayPoint}: Perform a switch waypoint command. +-- ## 1.4) GROUP option methods +-- +-- A GROUP is a @{Controllable}. See the @{Controllable} option methods section for a description of the option methods. -- --- 1.4) GROUP Option methods --- ------------------------- --- Group **Option methods** change the behaviour of the Group while being alive. +-- ## 1.5) GROUP Zone validation methods -- --- ### 1.4.1) Rule of Engagement: --- --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROEWeaponFree} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROEOpenFire} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROEReturnFire} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROEEvadeFire} --- --- To check whether an ROE option is valid for a specific group, use: --- --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROEWeaponFreePossible} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROEOpenFirePossible} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROEReturnFirePossible} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROEEvadeFirePossible} --- --- ### 1.4.2) Rule on thread: --- --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROTNoReaction} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROTPassiveDefense} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROTEvadeFire} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROTVertical} --- --- To test whether an ROT option is valid for a specific group, use: --- --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROTNoReactionPossible} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROTPassiveDefensePossible} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROTEvadeFirePossible} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROTVerticalPossible} --- --- 1.5) GROUP Zone validation methods --- ---------------------------------- -- The group can be validated whether it is completely, partly or not within a @{Zone}. -- Use the following Zone validation methods on the group: -- @@ -14834,6 +14881,43 @@ end -- -- The zone can be of any @{Zone} class derived from @{Core.Zone#ZONE_BASE}. So, these methods are polymorphic to the zones tested on. -- +-- ## 1.6) GROUP AI methods +-- +-- A GROUP has AI methods to control the AI activation. +-- +-- * @{#GROUP.SetAIOnOff}(): Turns the GROUP AI On or Off. +-- * @{#GROUP.SetAIOn}(): Turns the GROUP AI On. +-- * @{#GROUP.SetAIOff}(): Turns the GROUP AI Off. +-- +-- ==== +-- +-- # **API CHANGE HISTORY** +-- +-- The underlying change log documents the API changes. Please read this carefully. The following notation is used: +-- +-- * **Added** parts are expressed in bold type face. +-- * _Removed_ parts are expressed in italic type face. +-- +-- Hereby the change log: +-- +-- 2017-01-24: GROUP:**SetAIOnOff( AIOnOff )** added. +-- +-- 2017-01-24: GROUP:**SetAIOn()** added. +-- +-- 2017-01-24: GROUP:**SetAIOff()** added. +-- +-- === +-- +-- # **AUTHORS and CONTRIBUTIONS** +-- +-- ### Contributions: +-- +-- * [**Entropy**](https://forums.eagle.ru/member.php?u=111471), **Afinegan**: Came up with the requirement for AIOnOff(). +-- +-- ### Authors: +-- +-- * **FlightControl**: Design & Programming +-- -- @module Group -- @author FlightControl @@ -14894,6 +14978,23 @@ function GROUP:GetDCSObject() return nil end +--- Returns the @{Dcs.DCSTypes#Position3} position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission. +-- @param Wrapper.Positionable#POSITIONABLE self +-- @return Dcs.DCSTypes#Position The 3D position vectors of the POSITIONABLE. +-- @return #nil The POSITIONABLE is not existing or alive. +function GROUP:GetPositionVec3() -- Overridden from POSITIONABLE:GetPositionVec3() + self:F2( self.PositionableName ) + + local DCSPositionable = self:GetDCSObject() + + if DCSPositionable then + local PositionablePosition = DCSPositionable:getUnits()[1]:getPosition().p + self:T3( PositionablePosition ) + return PositionablePosition + end + + return nil +end --- Returns if the DCS Group is alive. -- When the group exists at run-time, this method will return true, otherwise false. @@ -15080,26 +15181,6 @@ function GROUP:GetInitialSize() return nil end ---- Returns the UNITs wrappers of the DCS Units of the DCS Group. --- @param #GROUP self --- @return #table The UNITs wrappers. -function GROUP:GetUnits() - self:F2( { self.GroupName } ) - local DCSGroup = self:GetDCSObject() - - if DCSGroup then - local DCSUnits = DCSGroup:getUnits() - local Units = {} - for Index, UnitData in pairs( DCSUnits ) do - Units[#Units+1] = UNIT:Find( UnitData ) - end - self:T3( Units ) - return Units - end - - return nil -end - --- Returns the DCS Units of the DCS Group. -- @param #GROUP self @@ -15186,7 +15267,7 @@ end --- Is Zone Functions +do -- Is Zone methods --- Returns true if all units of the group are within a @{Zone}. -- @param #GROUP self @@ -15352,6 +15433,49 @@ function GROUP:AllOnGround() return nil end +end + +do -- AI methods + + --- Turns the AI On or Off for the GROUP. + -- @param #GROUP self + -- @param #boolean AIOnOff The value true turns the AI On, the value false turns the AI Off. + -- @return #GROUP The GROUP. + function GROUP:SetAIOnOff( AIOnOff ) + + local DCSGroup = self:GetDCSObject() -- Dcs.DCSGroup#Group + + if DCSGroup then + local DCSController = DCSGroup:getController() -- Dcs.DCSController#Controller + if DCSController then + DCSController:setOnOff( AIOnOff ) + return self + end + end + + return nil + end + + --- Turns the AI On for the GROUP. + -- @param #GROUP self + -- @return #GROUP The GROUP. + function GROUP:SetAIOn() + + return self:SetAIOnOff( true ) + end + + --- Turns the AI Off for the GROUP. + -- @param #GROUP self + -- @return #GROUP The GROUP. + function GROUP:SetAIOff() + + return self:SetAIOnOff( false ) + end + +end + + + --- Returns the current maximum velocity of the group. -- Each unit within the group gets evaluated, and the maximum velocity (= the unit which is going the fastest) is returned. -- @param #GROUP self @@ -15571,6 +15695,32 @@ function GROUP:CalculateThreatLevelA2G() return MaxThreatLevelA2G end +--- Returns true if the first unit of the GROUP is in the air. +-- @param Wrapper.Group#GROUP self +-- @return #boolean true if in the first unit of the group is in the air. +-- @return #nil The GROUP is not existing or not alive. +function GROUP:InAir() + self:F2( self.GroupName ) + + local DCSGroup = self:GetDCSObject() + + if DCSGroup then + local DCSUnit = DCSGroup:getUnit(1) + if DCSUnit then + local GroupInAir = DCSGroup:getUnit(1):inAir() + self:T3( GroupInAir ) + return GroupInAir + end + end + + return nil +end + +function GROUP:OnReSpawn( ReSpawnFunction ) + + self.ReSpawnFunction = ReSpawnFunction +end + --- This module contains the UNIT class. -- @@ -16041,6 +16191,25 @@ function UNIT:GetFuel() return nil end +--- Returns the UNIT in a UNIT list of one element. +-- @param #UNIT self +-- @return #list The UNITs wrappers. +function UNIT:GetUnits() + self:F2( { self.UnitName } ) + local DCSUnit = self:GetDCSObject() + + if DCSUnit then + local DCSUnits = DCSUnit:getUnits() + local Units = {} + Units[1] = UNIT:Find( DCSUnit ) + self:T3( Units ) + return Units + end + + return nil +end + + --- Returns the unit's health. Dead units has health <= 1.0. -- @param #UNIT self -- @return #number The Unit's health value. @@ -16373,6 +16542,24 @@ function UNIT:IsShip() return nil end +--- Returns true if the UNIT is in the air. +-- @param Wrapper.Positionable#UNIT self +-- @return #boolean true if in the air. +-- @return #nil The UNIT is not existing or alive. +function UNIT:InAir() + self:F2( self.UnitName ) + + local DCSUnit = self:GetDCSObject() + + if DCSUnit then + local UnitInAir = DCSUnit:inAir() + self:T3( UnitInAir ) + return UnitInAir + end + + return nil +end + --- This module contains the CLIENT class. -- -- 1) @{Wrapper.Client#CLIENT} class, extends @{Wrapper.Unit#UNIT} @@ -17313,27 +17500,30 @@ function SCORING:_AddMissionTaskScore( Mission, PlayerUnit, Text, Score ) local PlayerName = PlayerUnit:GetPlayerName() local MissionName = Mission:GetName() - self:F( { Mission:GetName(), PlayerUnit.UnitName, PlayerName, Text, Score } ) + self:E( { Mission:GetName(), PlayerUnit.UnitName, PlayerName, Text, Score } ) + + -- PlayerName can be nil, if the Unit with the player crashed or due to another reason. + if PlayerName then + local PlayerData = self.Players[PlayerName] - local PlayerData = self.Players[PlayerName] - - if not PlayerData.Mission[MissionName] then - PlayerData.Mission[MissionName] = {} - PlayerData.Mission[MissionName].ScoreTask = 0 - PlayerData.Mission[MissionName].ScoreMission = 0 + if not PlayerData.Mission[MissionName] then + PlayerData.Mission[MissionName] = {} + PlayerData.Mission[MissionName].ScoreTask = 0 + PlayerData.Mission[MissionName].ScoreMission = 0 + end + + self:T( PlayerName ) + self:T( PlayerData.Mission[MissionName] ) + + PlayerData.Score = self.Players[PlayerName].Score + Score + PlayerData.Mission[MissionName].ScoreTask = self.Players[PlayerName].Mission[MissionName].ScoreTask + Score + + MESSAGE:New( "Player '" .. PlayerName .. "' has " .. Text .. " in Mission '" .. MissionName .. "'. " .. + Score .. " task score!", + 30 ):ToAll() + + self:ScoreCSV( PlayerName, "TASK_" .. MissionName:gsub( ' ', '_' ), 1, Score, PlayerUnit:GetName() ) end - - self:T( PlayerName ) - self:T( PlayerData.Mission[MissionName] ) - - PlayerData.Score = self.Players[PlayerName].Score + Score - PlayerData.Mission[MissionName].ScoreTask = self.Players[PlayerName].Mission[MissionName].ScoreTask + Score - - MESSAGE:New( "Player '" .. PlayerName .. "' has " .. Text .. " in Mission '" .. MissionName .. "'. " .. - Score .. " task score!", - 30 ):ToAll() - - self:ScoreCSV( PlayerName, "TASK_" .. MissionName:gsub( ' ', '_' ), 1, Score, PlayerUnit:GetName() ) end @@ -17475,7 +17665,7 @@ function SCORING:_EventOnHit( Event ) ):ToAll() self:ScoreCSV( InitPlayerName, "HIT_PENALTY", 1, -25, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType ) else - self.Players[InitPlayerName].Score = self.Players[InitPlayerName].Score + 10 + self.Players[InitPlayerName].Score = self.Players[InitPlayerName].Score + 1 self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].Score = self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].Score + 1 self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].ScoreHit = self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].ScoreHit + 1 MESSAGE:New( "Player '" .. InitPlayerName .. "' hit a target " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. @@ -18231,6 +18421,9 @@ end -- * @{#SPAWN.InitRepeat}(): Re-spawn groups when they land at the home base. Similar methods are @{#SPAWN.InitRepeatOnLanding} and @{#SPAWN.InitRepeatOnEngineShutDown}. -- * @{#SPAWN.InitRandomizeUnits}(): Randomizes the @{Unit}s in the @{Group} that is spawned within a **radius band**, given an Outer and Inner radius. -- * @{#SPAWN.InitRandomizeZones}(): Randomizes the spawning between a predefined list of @{Zone}s that are declared using this function. Each zone can be given a probability factor. +-- * @{#SPAWN.InitAIOn}(): Turns the AI On when spawning the new @{Group} object. +-- * @{#SPAWN.InitAIOff}(): Turns the AI Off when spawning the new @{Group} object. +-- * @{#SPAWN.InitAIOnOff}(): Turns the AI On or Off when spawning the new @{Group} object. -- -- ## 1.3) SPAWN spawning methods -- @@ -18293,71 +18486,40 @@ end -- -- Hereby the change log: -- --- 2016-08-15: SPAWN:**InitCleanUp**( SpawnCleanUpInterval ) replaces SPAWN:_CleanUp_( SpawnCleanUpInterval ) +-- 2017-01-24: SPAWN:**InitAIOnOff( AIOnOff )** added. -- --- * Want to ensure that the methods starting with **Init** are the first called methods before any _Spawn_ method is called! --- * This notation makes it now more clear which methods are initialization methods and which methods are Spawn enablement methods. +-- 2017-01-24: SPAWN:**InitAIOn()** added. +-- +-- 2017-01-24: SPAWN:**InitAIOff()** added. +-- +-- 2016-08-15: SPAWN:**InitCleanUp**( SpawnCleanUpInterval ) replaces SPAWN:_CleanUp_( SpawnCleanUpInterval ). -- -- 2016-08-15: SPAWN:**InitRandomizeZones( SpawnZones )** added. -- --- * This method provides the functionality to randomize the spawning of the Groups at a given list of zones of different types. --- -- 2016-08-14: SPAWN:**OnSpawnGroup**( SpawnCallBackFunction, ... ) replaces SPAWN:_SpawnFunction_( SpawnCallBackFunction, ... ). -- -- 2016-08-14: SPAWN.SpawnInZone( Zone, __RandomizeGroup__, SpawnIndex ) replaces SpawnInZone( Zone, _RandomizeUnits, OuterRadius, InnerRadius,_ SpawnIndex ). -- --- * The RandomizeUnits, OuterRadius and InnerRadius have been replaced with a new method @{#SPAWN.InitRandomizeUnits}( RandomizeUnits, OuterRadius, InnerRadius ). --- * A new parameter RandomizeGroup to reflect the randomization of the starting position of the Spawned @{Group}. --- -- 2016-08-14: SPAWN.SpawnFromVec3( Vec3, SpawnIndex ) replaces SpawnFromVec3( Vec3, _RandomizeUnits, OuterRadius, InnerRadius,_ SpawnIndex ): -- --- * The RandomizeUnits, OuterRadius and InnerRadius have been replaced with a new method @{#SPAWN.InitRandomizeUnits}( RandomizeUnits, OuterRadius, InnerRadius ). --- * A new parameter RandomizeGroup to reflect the randomization of the starting position of the Spawned @{Group}. --- -- 2016-08-14: SPAWN.SpawnFromVec2( Vec2, SpawnIndex ) replaces SpawnFromVec2( Vec2, _RandomizeUnits, OuterRadius, InnerRadius,_ SpawnIndex ): -- --- * The RandomizeUnits, OuterRadius and InnerRadius have been replaced with a new method @{#SPAWN.InitRandomizeUnits}( RandomizeUnits, OuterRadius, InnerRadius ). --- * A new parameter RandomizeGroup to reflect the randomization of the starting position of the Spawned @{Group}. --- -- 2016-08-14: SPAWN.SpawnFromUnit( SpawnUnit, SpawnIndex ) replaces SpawnFromUnit( SpawnUnit, _RandomizeUnits, OuterRadius, InnerRadius,_ SpawnIndex ): -- --- * The RandomizeUnits, OuterRadius and InnerRadius have been replaced with a new method @{#SPAWN.InitRandomizeUnits}( RandomizeUnits, OuterRadius, InnerRadius ). --- * A new parameter RandomizeGroup to reflect the randomization of the starting position of the Spawned @{Group}. --- -- 2016-08-14: SPAWN.SpawnFromUnit( SpawnUnit, SpawnIndex ) replaces SpawnFromStatic( SpawnStatic, _RandomizeUnits, OuterRadius, InnerRadius,_ SpawnIndex ): -- --- * The RandomizeUnits, OuterRadius and InnerRadius have been replaced with a new method @{#SPAWN.InitRandomizeUnits}( RandomizeUnits, OuterRadius, InnerRadius ). --- * A new parameter RandomizeGroup to reflect the randomization of the starting position of the Spawned @{Group}. --- -- 2016-08-14: SPAWN.**InitRandomizeUnits( RandomizeUnits, OuterRadius, InnerRadius )** added: -- --- * This method enables the randomization of units at the first route point in a radius band at a spawn event. --- -- 2016-08-14: SPAWN.**Init**Limit( SpawnMaxUnitsAlive, SpawnMaxGroups ) replaces SPAWN._Limit_( SpawnMaxUnitsAlive, SpawnMaxGroups ): -- --- * Want to ensure that the methods starting with **Init** are the first called methods before any _Spawn_ method is called! --- * This notation makes it now more clear which methods are initialization methods and which methods are Spawn enablement methods. --- -- 2016-08-14: SPAWN.**Init**Array( SpawnAngle, SpawnWidth, SpawnDeltaX, SpawnDeltaY ) replaces SPAWN._Array_( SpawnAngle, SpawnWidth, SpawnDeltaX, SpawnDeltaY ). -- --- * Want to ensure that the methods starting with **Init** are the first called methods before any _Spawn_ method is called! --- * This notation makes it now more clear which methods are initialization methods and which methods are Spawn enablement methods. --- -- 2016-08-14: SPAWN.**Init**RandomizeRoute( SpawnStartPoint, SpawnEndPoint, SpawnRadius, SpawnHeight ) replaces SPAWN._RandomizeRoute_( SpawnStartPoint, SpawnEndPoint, SpawnRadius, SpawnHeight ). -- --- * Want to ensure that the methods starting with **Init** are the first called methods before any _Spawn_ method is called! --- * This notation makes it now more clear which methods are initialization methods and which methods are Spawn enablement methods. --- -- 2016-08-14: SPAWN.**Init**RandomizeTemplate( SpawnTemplatePrefixTable ) replaces SPAWN._RandomizeTemplate_( SpawnTemplatePrefixTable ). -- --- * Want to ensure that the methods starting with **Init** are the first called methods before any _Spawn_ method is called! --- * This notation makes it now more clear which methods are initialization methods and which methods are Spawn enablement methods. --- -- 2016-08-14: SPAWN.**Init**UnControlled() replaces SPAWN._UnControlled_(). -- --- * Want to ensure that the methods starting with **Init** are the first called methods before any _Spawn_ method is called! --- * This notation makes it now more clear which methods are initialization methods and which methods are Spawn enablement methods. --- -- === -- -- # **AUTHORS and CONTRIBUTIONS** @@ -18365,6 +18527,7 @@ end -- ### Contributions: -- -- * **Aaron**: Posed the idea for Group position randomization at SpawnInZone and make the Unit randomization separate from the Group randomization. +-- * [**Entropy**](https://forums.eagle.ru/member.php?u=111471), **Afinegan**: Came up with the requirement for AIOnOff(). -- -- ### Authors: -- @@ -18422,6 +18585,7 @@ function SPAWN:New( SpawnTemplatePrefix ) self.SpawnMaxGroups = 0 -- The maximum amount of groups that can be spawned. self.SpawnRandomize = false -- Sets the randomization flag of new Spawned units to false. self.SpawnVisible = false -- Flag that indicates if all the Groups of the SpawnGroup need to be visible when Spawned. + self.AIOnOff = true -- The AI is on by default when spawning a group. self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned. else @@ -18459,6 +18623,7 @@ function SPAWN:NewWithAlias( SpawnTemplatePrefix, SpawnAliasPrefix ) self.SpawnMaxGroups = 0 -- The maximum amount of groups that can be spawned. self.SpawnRandomize = false -- Sets the randomization flag of new Spawned units to false. self.SpawnVisible = false -- Flag that indicates if all the Groups of the SpawnGroup need to be visible when Spawned. + self.AIOnOff = true -- The AI is on by default when spawning a group. self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned. else @@ -18749,7 +18914,34 @@ function SPAWN:InitArray( SpawnAngle, SpawnWidth, SpawnDeltaX, SpawnDeltaY ) return self end +do -- AI methods + --- Turns the AI On or Off for the @{Group} when spawning. + -- @param #SPAWN self + -- @param #boolean AIOnOff A value of true sets the AI On, a value of false sets the AI Off. + -- @return #SPAWN The SPAWN object + function SPAWN:InitAIOnOff( AIOnOff ) + + self.AIOnOff = AIOnOff + return self + end + + --- Turns the AI On for the @{Group} when spawning. + -- @param #SPAWN self + -- @return #SPAWN The SPAWN object + function SPAWN:InitAIOn() + + return self:InitAIOnOff( true ) + end + + --- Turns the AI Off for the @{Group} when spawning. + -- @param #SPAWN self + -- @return #SPAWN The SPAWN object + function SPAWN:InitAIOff() + + return self:InitAIOnOff( false ) + end +end -- AI methods --- Will spawn a group based on the internal index. -- Note: Uses @{DATABASE} module defined in MOOSE. @@ -18775,6 +18967,7 @@ function SPAWN:ReSpawn( SpawnIndex ) -- TODO: This logic makes DCS crash and i don't know why (yet). local SpawnGroup = self:GetGroupFromIndex( SpawnIndex ) + local WayPoints = SpawnGroup and SpawnGroup.WayPoints or nil if SpawnGroup then local SpawnDCSGroup = SpawnGroup:GetDCSObject() if SpawnDCSGroup then @@ -18782,7 +18975,18 @@ function SPAWN:ReSpawn( SpawnIndex ) end end - return self:SpawnWithIndex( SpawnIndex ) + local SpawnGroup = self:SpawnWithIndex( SpawnIndex ) + if SpawnGroup and WayPoints then + -- If there were WayPoints set, then Re-Execute those WayPoints! + SpawnGroup:WayPointInitialize( WayPoints ) + SpawnGroup:WayPointExecute( 1, 5 ) + end + + if SpawnGroup.ReSpawnFunction then + SpawnGroup:ReSpawnFunction() + end + + return SpawnGroup end --- Will spawn a group with a specified index number. @@ -18833,6 +19037,14 @@ function SPAWN:SpawnWithIndex( SpawnIndex ) self.SpawnGroups[self.SpawnIndex].Group = _DATABASE:Spawn( SpawnTemplate ) + local SpawnGroup = self.SpawnGroups[self.SpawnIndex].Group -- Wrapper.Group#GROUP + + --TODO: Need to check if this function doesn't need to be scheduled, as the group may not be immediately there! + if SpawnGroup then + + SpawnGroup:SetAIOnOff( self.AIOnOff ) + end + -- If there is a SpawnFunction hook defined, call it. if self.SpawnFunctionHook then self.SpawnFunctionHook( self.SpawnGroups[self.SpawnIndex].Group, unpack( self.SpawnFunctionArguments ) ) @@ -24182,13 +24394,12 @@ function DETECTION_AREAS:CreateDetectionSets() end ---- SP:N MP:Y AI:Y HU:N TYP:A -- This module contains the AI_BALANCER class. AI Balancing will replace in multi player missions +--- Single-Player:**No** / Mulit-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**All** -- **AI Balancing will replace in multi player missions -- non-occupied human slots with AI groups, in order to provide an engaging simulation environment, --- even when there are hardly any players in the mission. +-- even when there are hardly any players in the mission.** -- -- ![Banner Image](..\Presentations\AI_Balancer\Dia1.JPG) -- --- Examples can be found in the test missions. -- -- === -- @@ -24257,6 +24468,8 @@ end -- -- Hereby the change log: -- +-- 2017-01-17: There is still a problem with AI being destroyed, but not respawned. Need to check further upon that. +-- -- 2017-01-08: AI_BALANCER:**InitSpawnInterval( Earliest, Latest )** added. -- -- === @@ -24266,7 +24479,6 @@ end -- ### Contributions: -- -- * **[Dutch_Baron](https://forums.eagle.ru/member.php?u=112075)**: Working together with James has resulted in the creation of the AI_BALANCER class. James has shared his ideas on balancing AI with air units, and together we made a first design which you can use now :-) --- -- * **SNAFU**: Had a couple of mails with the guys to validate, if the same concept in the GCI/CAP script could be reworked within MOOSE. None of the script code has been used however within the new AI_BALANCER moose class. -- -- ### Authors: @@ -24415,16 +24627,15 @@ end --- @param #AI_BALANCER self function AI_BALANCER:onenterMonitoring( SetGroup ) - self:E( { self.SetClient:Count() } ) - self.SetClient:Flush() + self:T2( { self.SetClient:Count() } ) + --self.SetClient:Flush() self.SetClient:ForEachClient( --- @param Wrapper.Client#CLIENT Client function( Client ) - self:E(Client.ClientName) + self:T3(Client.ClientName) local AIGroup = self.Set:Get( Client.UnitName ) -- Wrapper.Group#GROUP - self:E({Client:IsAlive()}) if Client:IsAlive() then if AIGroup and AIGroup:IsAlive() == true then @@ -24439,16 +24650,16 @@ function AI_BALANCER:onenterMonitoring( SetGroup ) local PlayerInRange = { Value = false } local RangeZone = ZONE_RADIUS:New( 'RangeZone', AIGroup:GetVec2(), self.ReturnTresholdRange ) - self:E( RangeZone ) + self:T2( RangeZone ) _DATABASE:ForEachPlayer( --- @param Wrapper.Unit#UNIT RangeTestUnit function( RangeTestUnit, RangeZone, AIGroup, PlayerInRange ) - self:E( { PlayerInRange, RangeTestUnit.UnitName, RangeZone.ZoneName } ) + self:T2( { PlayerInRange, RangeTestUnit.UnitName, RangeZone.ZoneName } ) if RangeTestUnit:IsInZone( RangeZone ) == true then - self:E( "in zone" ) + self:T2( "in zone" ) if RangeTestUnit:GetCoalition() ~= AIGroup:GetCoalition() then - self:E( "in range" ) + self:T2( "in range" ) PlayerInRange.Value = true end end @@ -24469,7 +24680,7 @@ function AI_BALANCER:onenterMonitoring( SetGroup ) end else if not AIGroup or not AIGroup:IsAlive() == true then - self:E( "Client " .. Client.UnitName .. " not alive." ) + self:T( "Client " .. Client.UnitName .. " not alive." ) if not self.SpawnQueue[Client.UnitName] then -- Spawn a new AI taking into account the spawn interval Earliest, Latest self:__Spawn( math.random( self.Earliest, self.Latest ), Client.UnitName ) @@ -24487,113 +24698,125 @@ end ---- (AI) (FSM) Make AI patrol routes or zones. +--- Single-Player:**Yes** / Mulit-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**Air** -- **Air Patrolling or Staging.** +-- +-- ![Banner Image](..\Presentations\AI_PATROL\Dia1.JPG) +-- -- -- === -- --- 1) @{#AI_PATROLZONE} class, extends @{Core.Fsm#FSM_CONTROLLABLE} --- ================================================================ --- The @{#AI_PATROLZONE} class implements the core functions to patrol a @{Zone} by an AIR @{Controllable} @{Group}. --- The patrol algorithm works that for each airplane patrolling, upon arrival at the patrol zone, --- a random point is selected as the route point within the 3D space, within the given boundary limits. --- The airplane will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits. --- Upon arrival at the random 3D point, a new 3D random point will be selected within the patrol zone using the given limits. --- This cycle will continue until a fuel treshold has been reached by the airplane. +-- # 1) @{#AI_PATROL_ZONE} class, extends @{Core.Fsm#FSM_CONTROLLABLE} +-- +-- The @{#AI_PATROL_ZONE} class implements the core functions to patrol a @{Zone} by an AI @{Controllable} or @{Group}. +-- +-- ![Process](..\Presentations\AI_PATROL\Dia3.JPG) +-- +-- The AI_PATROL_ZONE is assigned a @{Group} and this must be done before the AI_PATROL_ZONE process can be started using the **Start** event. +-- +-- ![Process](..\Presentations\AI_PATROL\Dia4.JPG) +-- +-- The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits. +-- Upon arrival at the 3D point, a new random 3D point will be selected within the patrol zone using the given limits. +-- +-- ![Process](..\Presentations\AI_PATROL\Dia5.JPG) +-- +-- This cycle will continue. +-- +-- ![Process](..\Presentations\AI_PATROL\Dia6.JPG) +-- +-- During the patrol, the AI will detect enemy targets, which are reported through the **Detected** event. +-- +-- ![Process](..\Presentations\AI_PATROL\Dia9.JPG) +-- +---- Note that the enemy is not engaged! To model enemy engagement, either tailor the **Detected** event, or +-- use derived AI_ classes to model AI offensive or defensive behaviour. +-- +-- ![Process](..\Presentations\AI_PATROL\Dia10.JPG) +-- +-- Until a fuel or damage treshold has been reached by the AI, or when the AI is commanded to RTB. -- When the fuel treshold has been reached, the airplane will fly towards the nearest friendly airbase and will land. -- --- 1.1) AI_PATROLZONE constructor: --- ---------------------------- +-- ![Process](..\Presentations\AI_PATROL\Dia11.JPG) +-- +-- ## 1.1) AI_PATROL_ZONE constructor -- --- * @{#AI_PATROLZONE.New}(): Creates a new AI_PATROLZONE object. +-- * @{#AI_PATROL_ZONE.New}(): Creates a new AI_PATROL_ZONE object. -- --- 1.2) AI_PATROLZONE state machine: --- ---------------------------------- --- The AI_PATROLZONE is a state machine: it manages the different events and states of the AIControllable it is controlling. +-- ## 1.2) AI_PATROL_ZONE is a FSM -- --- ### 1.2.1) AI_PATROLZONE Events: +-- ![Process](..\Presentations\AI_PATROL\Dia2.JPG) -- --- * @{#AI_PATROLZONE.Route}( AIControllable ): A new 3D route point is selected and the AIControllable will fly towards that point with the given speed. --- * @{#AI_PATROLZONE.Patrol}( AIControllable ): The AIControllable reports it is patrolling. This event is called every 30 seconds. --- * @{#AI_PATROLZONE.RTB}( AIControllable ): The AIControllable will report return to base. --- * @{#AI_PATROLZONE.End}( AIControllable ): The end of the AI_PATROLZONE process. --- * @{#AI_PATROLZONE.Dead}( AIControllable ): The AIControllable is dead. The AI_PATROLZONE process will be ended. +-- ### 1.2.1) AI_PATROL_ZONE States -- --- ### 1.2.2) AI_PATROLZONE States: +-- * **None** ( Group ): The process is not started yet. +-- * **Patrolling** ( Group ): The AI is patrolling the Patrol Zone. +-- * **Returning** ( Group ): The AI is returning to Base.. -- --- * **Route**: A new 3D route point is selected and the AIControllable will fly towards that point with the given speed. --- * **Patrol**: The AIControllable is patrolling. This state is set every 30 seconds, so every 30 seconds, a state transition method can be used. --- * **RTB**: The AIControllable reports it wants to return to the base. --- * **Dead**: The AIControllable is dead ... --- * **End**: The process has come to an end. --- --- ### 1.2.3) AI_PATROLZONE state transition methods: +-- ### 1.2.2) AI_PATROL_ZONE Events -- --- State transition functions can be set **by the mission designer** customizing or improving the behaviour of the state. --- There are 2 moments when state transition methods will be called by the state machine: --- --- * **Before** the state transition. --- The state transition method needs to start with the name **OnBefore + the name of the state**. --- If the state transition method returns false, then the processing of the state transition will not be done! --- If you want to change the behaviour of the AIControllable at this event, return false, --- but then you'll need to specify your own logic using the AIControllable! --- --- * **After** the state transition. --- The state transition method needs to start with the name **OnAfter + the name of the state**. --- These state transition methods need to provide a return value, which is specified at the function description. --- --- An example how to manage a state transition for an AI_PATROLZONE object **Patrol** for the state **RTB**: --- --- local PatrolZoneGroup = GROUP:FindByName( "Patrol Zone" ) --- local PatrolZone = ZONE_POLYGON:New( "PatrolZone", PatrolZoneGroup ) --- --- local PatrolSpawn = SPAWN:New( "Patrol Group" ) --- local PatrolGroup = PatrolSpawn:Spawn() --- --- local Patrol = AI_PATROLZONE:New( PatrolZone, 3000, 6000, 300, 600 ) --- Patrol:SetControllable( PatrolGroup ) --- Patrol:ManageFuel( 0.2, 60 ) --- --- **OnBefore**RTB( AIGroup ) will be called by the AI_PATROLZONE object when the AIGroup reports RTB, but **before** the RTB default action is processed by the AI_PATROLZONE object. --- --- --- State transition function for the AI_PATROLZONE **Patrol** object --- -- @param #AI_PATROLZONE self --- -- @param Wrapper.Controllable#CONTROLLABLE AIGroup --- -- @return #boolean If false is returned, then the OnAfter state transition method will not be called. --- function Patrol:OnBeforeRTB( AIGroup ) --- AIGroup:MessageToRed( "Returning to base", 20 ) --- end --- --- **OnAfter**RTB( AIGroup ) will be called by the AI_PATROLZONE object when the AIGroup reports RTB, but **after** the RTB default action was processed by the AI_PATROLZONE object. --- --- --- State transition function for the AI_PATROLZONE **Patrol** object --- -- @param #AI_PATROLZONE self --- -- @param Wrapper.Controllable#CONTROLLABLE AIGroup --- -- @return #Wrapper.Controllable#CONTROLLABLE The new AIGroup object that is set to be patrolling the zone. --- function Patrol:OnAfterRTB( AIGroup ) --- return PatrolSpawn:Spawn() --- end +-- * **Start** ( Group ): Start the process. +-- * **Route** ( Group ): Route the AI to a new random 3D point within the Patrol Zone. +-- * **RTB** ( Group ): Route the AI to the home base. +-- * **Detect** ( Group ): The AI is detecting targets. +-- * **Detected** ( Group ): The AI has detected new targets. +-- * **Status** ( Group ): The AI is checking status (fuel and damage). When the tresholds have been reached, the AI will RTB. -- --- 1.3) Manage the AI_PATROLZONE parameters: --- ------------------------------------------ --- The following methods are available to modify the parameters of a AI_PATROLZONE object: +-- ## 1.3) Set or Get the AI controllable -- --- * @{#AI_PATROLZONE.SetControllable}(): Set the AIControllable. --- * @{#AI_PATROLZONE.GetControllable}(): Get the AIControllable. --- * @{#AI_PATROLZONE.SetSpeed}(): Set the patrol speed of the AI, for the next patrol. --- * @{#AI_PATROLZONE.SetAltitude}(): Set altitude of the AI, for the next patrol. +-- * @{#AI_PATROL_ZONE.SetControllable}(): Set the AIControllable. +-- * @{#AI_PATROL_ZONE.GetControllable}(): Get the AIControllable. +-- +-- ## 1.4) Set the Speed and Altitude boundaries of the AI controllable +-- +-- * @{#AI_PATROL_ZONE.SetSpeed}(): Set the patrol speed boundaries of the AI, for the next patrol. +-- * @{#AI_PATROL_ZONE.SetAltitude}(): Set altitude boundaries of the AI, for the next patrol. -- --- 1.3) Manage the out of fuel in the AI_PATROLZONE: --- ---------------------------------------------- --- When the AIControllable is out of fuel, it is required that a new AIControllable is started, before the old AIControllable can return to the home base. +-- ## 1.5) Manage the detection process of the AI controllable +-- +-- The detection process of the AI controllable can be manipulated. +-- Detection requires an amount of CPU power, which has an impact on your mission performance. +-- Only put detection on when absolutely necessary, and the frequency of the detection can also be set. +-- +-- * @{#AI_PATROL_ZONE.SetDetectionOn}(): Set the detection on. The AI will detect for targets. +-- * @{#AI_PATROL_ZONE.SetDetectionOff}(): Set the detection off, the AI will not detect for targets. The existing target list will NOT be erased. +-- +-- The detection frequency can be set with @{#AI_PATROL_ZONE.SetDetectionInterval}( seconds ), where the amount of seconds specify how much seconds will be waited before the next detection. +-- Use the method @{#AI_PATROL_ZONE.GetDetectedUnits}() to obtain a list of the @{Unit}s detected by the AI. +-- +-- The detection can be filtered to potential targets in a specific zone. +-- Use the method @{#AI_PATROL_ZONE.SetDetectionZone}() to set the zone where targets need to be detected. +-- Note that when the zone is too far away, or the AI is not heading towards the zone, or the AI is too high, no targets may be detected +-- according the weather conditions. +-- +-- ## 1.6) Manage the "out of fuel" in the AI_PATROL_ZONE +-- +-- When the AI is out of fuel, it is required that a new AI is started, before the old AI can return to the home base. -- Therefore, with a parameter and a calculation of the distance to the home base, the fuel treshold is calculated. --- When the fuel treshold is reached, the AIControllable will continue for a given time its patrol task in orbit, while a new AIControllable is targetted to the AI_PATROLZONE. --- Once the time is finished, the old AIControllable will return to the base. --- Use the method @{#AI_PATROLZONE.ManageFuel}() to have this proces in place. +-- When the fuel treshold is reached, the AI will continue for a given time its patrol task in orbit, +-- while a new AI is targetted to the AI_PATROL_ZONE. +-- Once the time is finished, the old AI will return to the base. +-- Use the method @{#AI_PATROL_ZONE.ManageFuel}() to have this proces in place. +-- +-- ## 1.7) Manage "damage" behaviour of the AI in the AI_PATROL_ZONE +-- +-- When the AI is damaged, it is required that a new AIControllable is started. However, damage cannon be foreseen early on. +-- Therefore, when the damage treshold is reached, the AI will return immediately to the home base (RTB). +-- Use the method @{#AI_PATROL_ZONE.ManageDamage}() to have this proces in place. -- -- ==== -- --- **API CHANGE HISTORY** --- ====================== +-- # **OPEN ISSUES** +-- +-- 2017-01-17: When Spawned AI is located at an airbase, it will be routed first back to the airbase after take-off. +-- +-- 2016-01-17: +-- -- Fixed problem with AI returning to base too early and unexpected. +-- -- ReSpawning of AI will reset the AI_PATROL and derived classes. +-- -- Checked the correct workings of SCHEDULER, and it DOES work correctly. +-- +-- ==== +-- +-- # **API CHANGE HISTORY** -- -- The underlying change log documents the API changes. Please read this carefully. The following notation is used: -- @@ -24602,87 +24825,287 @@ end -- -- Hereby the change log: -- +-- 2017-01-17: Rename of class: **AI\_PATROL\_ZONE** is the new name for the old _AI\_PATROLZONE_. +-- +-- 2017-01-15: Complete revision. AI_PATROL_ZONE is the base class for other AI_PATROL like classes. +-- -- 2016-09-01: Initial class and API. -- -- === -- --- AUTHORS and CONTRIBUTIONS --- ========================= +-- # **AUTHORS and CONTRIBUTIONS** -- -- ### Contributions: -- --- * **DutchBaron**: Testing. --- * **Pikey**: Testing and API concept review. +-- * **[Dutch_Baron](https://forums.eagle.ru/member.php?u=112075)**: Working together with James has resulted in the creation of the AI_BALANCER class. James has shared his ideas on balancing AI with air units, and together we made a first design which you can use now :-) +-- * **[Pikey](https://forums.eagle.ru/member.php?u=62835)**: Testing and API concept review. -- -- ### Authors: -- -- * **FlightControl**: Design & Programming. -- --- --- @module Patrol +-- @module AI_Patrol --- State Transition Functions - ---- OnBefore State Transition Function --- @function [parent=#AI_PATROLZONE] OnBeforeRoute --- @param #AI_PATROLZONE self --- @param Wrapper.Controllable#CONTROLLABLE Controllable --- @return #boolean - ---- OnAfter State Transition Function --- @function [parent=#AI_PATROLZONE] OnAfterRoute --- @param #AI_PATROLZONE self --- @param Wrapper.Controllable#CONTROLLABLE Controllable - - - ---- AI_PATROLZONE class --- @type AI_PATROLZONE +--- AI_PATROL_ZONE class +-- @type AI_PATROL_ZONE -- @field Wrapper.Controllable#CONTROLLABLE AIControllable The @{Controllable} patrolling. -- @field Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed. -- @field Dcs.DCSTypes#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol. -- @field Dcs.DCSTypes#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol. -- @field Dcs.DCSTypes#Speed PatrolMinSpeed The minimum speed of the @{Controllable} in km/h. -- @field Dcs.DCSTypes#Speed PatrolMaxSpeed The maximum speed of the @{Controllable} in km/h. +-- @field Functional.Spawn#SPAWN CoordTest -- @extends Core.Fsm#FSM_CONTROLLABLE -AI_PATROLZONE = { - ClassName = "AI_PATROLZONE", +AI_PATROL_ZONE = { + ClassName = "AI_PATROL_ZONE", } - - ---- Creates a new AI_PATROLZONE object --- @param #AI_PATROLZONE self +--- Creates a new AI_PATROL_ZONE object +-- @param #AI_PATROL_ZONE self -- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed. -- @param Dcs.DCSTypes#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol. -- @param Dcs.DCSTypes#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol. -- @param Dcs.DCSTypes#Speed PatrolMinSpeed The minimum speed of the @{Controllable} in km/h. -- @param Dcs.DCSTypes#Speed PatrolMaxSpeed The maximum speed of the @{Controllable} in km/h. --- @return #AI_PATROLZONE self +-- @return #AI_PATROL_ZONE self -- @usage --- -- Define a new AI_PATROLZONE Object. This PatrolArea will patrol an AIControllable within PatrolZone between 3000 and 6000 meters, with a variying speed between 600 and 900 km/h. +-- -- Define a new AI_PATROL_ZONE Object. This PatrolArea will patrol an AIControllable within PatrolZone between 3000 and 6000 meters, with a variying speed between 600 and 900 km/h. -- PatrolZone = ZONE:New( 'PatrolZone' ) -- PatrolSpawn = SPAWN:New( 'Patrol Group' ) --- PatrolArea = AI_PATROLZONE:New( PatrolZone, 3000, 6000, 600, 900 ) -function AI_PATROLZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed ) +-- PatrolArea = AI_PATROL_ZONE:New( PatrolZone, 3000, 6000, 600, 900 ) +function AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed ) -- Inherits from BASE - local self = BASE:Inherit( self, FSM_CONTROLLABLE:New() ) -- Core.Fsm#FSM_CONTROLLABLE + local self = BASE:Inherit( self, FSM_CONTROLLABLE:New() ) -- #AI_PATROL_ZONE - self:SetStartState( "None" ) - self:AddTransition( "*", "Start", "Route" ) - self:AddTransition( "*", "Route", "Route" ) - self:AddTransition( { "Patrol", "Route" }, "Patrol", "Patrol" ) - self:AddTransition( "Patrol", "RTB", "RTB" ) - self:AddTransition( "*", "End", "End" ) - self:AddTransition( "*", "Dead", "End" ) self.PatrolZone = PatrolZone self.PatrolFloorAltitude = PatrolFloorAltitude self.PatrolCeilingAltitude = PatrolCeilingAltitude self.PatrolMinSpeed = PatrolMinSpeed self.PatrolMaxSpeed = PatrolMaxSpeed + + self:SetDetectionOn() + self.CheckStatus = true + + self:ManageFuel( .2, 60 ) + self:ManageDamage( 1 ) + + self:SetDetectionInterval( 30 ) + + self.DetectedUnits = {} -- This table contains the targets detected during patrol. + + self:SetStartState( "None" ) + + self:AddTransition( "None", "Start", "Patrolling" ) + +--- OnBefore Transition Handler for Event Start. +-- @function [parent=#AI_PATROL_ZONE] OnBeforeStart +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @return #boolean Return false to cancel Transition. + +--- OnAfter Transition Handler for Event Start. +-- @function [parent=#AI_PATROL_ZONE] OnAfterStart +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. + +--- Synchronous Event Trigger for Event Start. +-- @function [parent=#AI_PATROL_ZONE] Start +-- @param #AI_PATROL_ZONE self + +--- Asynchronous Event Trigger for Event Start. +-- @function [parent=#AI_PATROL_ZONE] __Start +-- @param #AI_PATROL_ZONE self +-- @param #number Delay The delay in seconds. + +--- OnLeave Transition Handler for State Patrolling. +-- @function [parent=#AI_PATROL_ZONE] OnLeavePatrolling +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @return #boolean Return false to cancel Transition. + +--- OnEnter Transition Handler for State Patrolling. +-- @function [parent=#AI_PATROL_ZONE] OnEnterPatrolling +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. + + self:AddTransition( "Patrolling", "Route", "Patrolling" ) -- FSM_CONTROLLABLE Transition for type #AI_PATROL_ZONE. + +--- OnBefore Transition Handler for Event Route. +-- @function [parent=#AI_PATROL_ZONE] OnBeforeRoute +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @return #boolean Return false to cancel Transition. + +--- OnAfter Transition Handler for Event Route. +-- @function [parent=#AI_PATROL_ZONE] OnAfterRoute +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. + +--- Synchronous Event Trigger for Event Route. +-- @function [parent=#AI_PATROL_ZONE] Route +-- @param #AI_PATROL_ZONE self + +--- Asynchronous Event Trigger for Event Route. +-- @function [parent=#AI_PATROL_ZONE] __Route +-- @param #AI_PATROL_ZONE self +-- @param #number Delay The delay in seconds. + + self:AddTransition( "*", "Status", "*" ) -- FSM_CONTROLLABLE Transition for type #AI_PATROL_ZONE. + +--- OnBefore Transition Handler for Event Status. +-- @function [parent=#AI_PATROL_ZONE] OnBeforeStatus +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @return #boolean Return false to cancel Transition. + +--- OnAfter Transition Handler for Event Status. +-- @function [parent=#AI_PATROL_ZONE] OnAfterStatus +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. + +--- Synchronous Event Trigger for Event Status. +-- @function [parent=#AI_PATROL_ZONE] Status +-- @param #AI_PATROL_ZONE self + +--- Asynchronous Event Trigger for Event Status. +-- @function [parent=#AI_PATROL_ZONE] __Status +-- @param #AI_PATROL_ZONE self +-- @param #number Delay The delay in seconds. + + self:AddTransition( "*", "Detect", "*" ) -- FSM_CONTROLLABLE Transition for type #AI_PATROL_ZONE. + +--- OnBefore Transition Handler for Event Detect. +-- @function [parent=#AI_PATROL_ZONE] OnBeforeDetect +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @return #boolean Return false to cancel Transition. + +--- OnAfter Transition Handler for Event Detect. +-- @function [parent=#AI_PATROL_ZONE] OnAfterDetect +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. + +--- Synchronous Event Trigger for Event Detect. +-- @function [parent=#AI_PATROL_ZONE] Detect +-- @param #AI_PATROL_ZONE self + +--- Asynchronous Event Trigger for Event Detect. +-- @function [parent=#AI_PATROL_ZONE] __Detect +-- @param #AI_PATROL_ZONE self +-- @param #number Delay The delay in seconds. + + self:AddTransition( "*", "Detected", "*" ) -- FSM_CONTROLLABLE Transition for type #AI_PATROL_ZONE. + +--- OnBefore Transition Handler for Event Detected. +-- @function [parent=#AI_PATROL_ZONE] OnBeforeDetected +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @return #boolean Return false to cancel Transition. + +--- OnAfter Transition Handler for Event Detected. +-- @function [parent=#AI_PATROL_ZONE] OnAfterDetected +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. + +--- Synchronous Event Trigger for Event Detected. +-- @function [parent=#AI_PATROL_ZONE] Detected +-- @param #AI_PATROL_ZONE self + +--- Asynchronous Event Trigger for Event Detected. +-- @function [parent=#AI_PATROL_ZONE] __Detected +-- @param #AI_PATROL_ZONE self +-- @param #number Delay The delay in seconds. + + self:AddTransition( "*", "RTB", "Returning" ) -- FSM_CONTROLLABLE Transition for type #AI_PATROL_ZONE. + +--- OnBefore Transition Handler for Event RTB. +-- @function [parent=#AI_PATROL_ZONE] OnBeforeRTB +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @return #boolean Return false to cancel Transition. + +--- OnAfter Transition Handler for Event RTB. +-- @function [parent=#AI_PATROL_ZONE] OnAfterRTB +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. + +--- Synchronous Event Trigger for Event RTB. +-- @function [parent=#AI_PATROL_ZONE] RTB +-- @param #AI_PATROL_ZONE self + +--- Asynchronous Event Trigger for Event RTB. +-- @function [parent=#AI_PATROL_ZONE] __RTB +-- @param #AI_PATROL_ZONE self +-- @param #number Delay The delay in seconds. + +--- OnLeave Transition Handler for State Returning. +-- @function [parent=#AI_PATROL_ZONE] OnLeaveReturning +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @return #boolean Return false to cancel Transition. + +--- OnEnter Transition Handler for State Returning. +-- @function [parent=#AI_PATROL_ZONE] OnEnterReturning +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. + + self:AddTransition( "*", "Reset", "Patrolling" ) -- FSM_CONTROLLABLE Transition for type #AI_PATROL_ZONE. + + self:AddTransition( "*", "Eject", "Ejected" ) + self:AddTransition( "*", "Crash", "Crashed" ) + self:AddTransition( "*", "PilotDead", "PilotDead" ) + return self end @@ -24690,11 +25113,11 @@ end --- Sets (modifies) the minimum and maximum speed of the patrol. --- @param #AI_PATROLZONE self +-- @param #AI_PATROL_ZONE self -- @param Dcs.DCSTypes#Speed PatrolMinSpeed The minimum speed of the @{Controllable} in km/h. -- @param Dcs.DCSTypes#Speed PatrolMaxSpeed The maximum speed of the @{Controllable} in km/h. --- @return #AI_PATROLZONE self -function AI_PATROLZONE:SetSpeed( PatrolMinSpeed, PatrolMaxSpeed ) +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:SetSpeed( PatrolMinSpeed, PatrolMaxSpeed ) self:F2( { PatrolMinSpeed, PatrolMaxSpeed } ) self.PatrolMinSpeed = PatrolMinSpeed @@ -24704,39 +25127,120 @@ end --- Sets the floor and ceiling altitude of the patrol. --- @param #AI_PATROLZONE self +-- @param #AI_PATROL_ZONE self -- @param Dcs.DCSTypes#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol. -- @param Dcs.DCSTypes#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol. --- @return #AI_PATROLZONE self -function AI_PATROLZONE:SetAltitude( PatrolFloorAltitude, PatrolCeilingAltitude ) +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:SetAltitude( PatrolFloorAltitude, PatrolCeilingAltitude ) self:F2( { PatrolFloorAltitude, PatrolCeilingAltitude } ) self.PatrolFloorAltitude = PatrolFloorAltitude self.PatrolCeilingAltitude = PatrolCeilingAltitude end +-- * @{#AI_PATROL_ZONE.SetDetectionOn}(): Set the detection on. The AI will detect for targets. +-- * @{#AI_PATROL_ZONE.SetDetectionOff}(): Set the detection off, the AI will not detect for targets. The existing target list will NOT be erased. +--- Set the detection on. The AI will detect for targets. +-- @param #AI_PATROL_ZONE self +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:SetDetectionOn() + self:F2() + + self.DetectOn = true +end ---- @param Wrapper.Controllable#CONTROLLABLE AIControllable -function _NewPatrolRoute( AIControllable ) +--- Set the detection off. The AI will NOT detect for targets. +-- However, the list of already detected targets will be kept and can be enquired! +-- @param #AI_PATROL_ZONE self +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:SetDetectionOff() + self:F2() + + self.DetectOn = false +end - AIControllable:T( "NewPatrolRoute" ) - local PatrolZone = AIControllable:GetState( AIControllable, "PatrolZone" ) -- PatrolCore.Zone#AI_PATROLZONE - PatrolZone:__Route( 1 ) +--- Set the status checking off. +-- @param #AI_PATROL_ZONE self +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:SetStatusOff() + self:F2() + + self.CheckStatus = false +end + +--- Activate the detection. The AI will detect for targets if the Detection is switched On. +-- @param #AI_PATROL_ZONE self +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:SetDetectionActivated() + self:F2() + + self.DetectActivated = true + self:__Detect( self.DetectInterval ) +end + +--- Deactivate the detection. The AI will NOT detect for targets. +-- @param #AI_PATROL_ZONE self +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:SetDetectionDeactivated() + self:F2() + + self.DetectActivated = false +end + +--- Set the interval in seconds between each detection executed by the AI. +-- The list of already detected targets will be kept and updated. +-- Newly detected targets will be added, but already detected targets that were +-- not detected in this cycle, will NOT be removed! +-- The default interval is 30 seconds. +-- @param #AI_PATROL_ZONE self +-- @param #number Seconds The interval in seconds. +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:SetDetectionInterval( Seconds ) + self:F2() + + if Seconds then + self.DetectInterval = Seconds + else + self.DetectInterval = 30 + end +end + +--- Set the detection zone where the AI is detecting targets. +-- @param #AI_PATROL_ZONE self +-- @param Core.Zone#ZONE DetectionZone The zone where to detect targets. +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:SetDetectionZone( DetectionZone ) + self:F2() + + if DetectionZone then + self.DetectZone = DetectionZone + else + self.DetectZone = nil + end +end + +--- Gets a list of @{Wrapper.Unit#UNIT}s that were detected by the AI. +-- No filtering is applied, so, ANY detected UNIT can be in this list. +-- It is up to the mission designer to use the @{Unit} class and methods to filter the targets. +-- @param #AI_PATROL_ZONE self +-- @return #table The list of @{Wrapper.Unit#UNIT}s +function AI_PATROL_ZONE:GetDetectedUnits() + self:F2() + + return self.DetectedUnits end - - ---- When the AIControllable is out of fuel, it is required that a new AIControllable is started, before the old AIControllable can return to the home base. +--- When the AI is out of fuel, it is required that a new AI is started, before the old AI can return to the home base. -- Therefore, with a parameter and a calculation of the distance to the home base, the fuel treshold is calculated. --- When the fuel treshold is reached, the AIControllable will continue for a given time its patrol task in orbit, while a new AIControllable is targetted to the AI_PATROLZONE. --- Once the time is finished, the old AIControllable will return to the base. --- @param #AI_PATROLZONE self +-- When the fuel treshold is reached, the AI will continue for a given time its patrol task in orbit, while a new AIControllable is targetted to the AI_PATROL_ZONE. +-- Once the time is finished, the old AI will return to the base. +-- @param #AI_PATROL_ZONE self -- @param #number PatrolFuelTresholdPercentage The treshold in percentage (between 0 and 1) when the AIControllable is considered to get out of fuel. -- @param #number PatrolOutOfFuelOrbitTime The amount of seconds the out of fuel AIControllable will orbit before returning to the base. --- @return #AI_PATROLZONE self -function AI_PATROLZONE:ManageFuel( PatrolFuelTresholdPercentage, PatrolOutOfFuelOrbitTime ) +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:ManageFuel( PatrolFuelTresholdPercentage, PatrolOutOfFuelOrbitTime ) self.PatrolManageFuel = true self.PatrolFuelTresholdPercentage = PatrolFuelTresholdPercentage @@ -24745,60 +25249,171 @@ function AI_PATROLZONE:ManageFuel( PatrolFuelTresholdPercentage, PatrolOutOfFuel return self end +--- When the AI is damaged beyond a certain treshold, it is required that the AI returns to the home base. +-- However, damage cannot be foreseen early on. +-- Therefore, when the damage treshold is reached, +-- the AI will return immediately to the home base (RTB). +-- Note that for groups, the average damage of the complete group will be calculated. +-- So, in a group of 4 airplanes, 2 lost and 2 with damage 0.2, the damage treshold will be 0.25. +-- @param #AI_PATROL_ZONE self +-- @param #number PatrolDamageTreshold The treshold in percentage (between 0 and 1) when the AI is considered to be damaged. +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:ManageDamage( PatrolDamageTreshold ) + + self.PatrolManageDamage = true + self.PatrolDamageTreshold = PatrolDamageTreshold + + return self +end + --- Defines a new patrol route using the @{Process_PatrolZone} parameters and settings. --- @param #AI_PATROLZONE self --- @return #AI_PATROLZONE self -function AI_PATROLZONE:onenterRoute() +-- @param #AI_PATROL_ZONE self +-- @return #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_PATROL_ZONE:onafterStart( Controllable, From, Event, To ) + self:F2() + + self:__Route( 1 ) -- Route to the patrol point. The asynchronous trigger is important, because a spawned group and units takes at least one second to come live. + self:__Status( 60 ) -- Check status status every 30 seconds. + self:SetDetectionActivated() + + self:EventOnPilotDead( self.OnPilotDead ) + self:EventOnCrash( self.OnCrash ) + self:EventOnEjection( self.OnEjection ) + + + Controllable:OptionROEHoldFire() + Controllable:OptionROTVertical() + + self.Controllable:OnReSpawn( + function( PatrolGroup ) + self:E( "ReSpawn" ) + self:__Reset() + self:__Route( 5 ) + end + ) + +end + + +--- @param #AI_PATROL_ZONE self +--- @param Wrapper.Controllable#CONTROLLABLE Controllable +function AI_PATROL_ZONE:onbeforeDetect( Controllable, From, Event, To ) + + return self.DetectOn and self.DetectActivated +end + +--- @param #AI_PATROL_ZONE self +--- @param Wrapper.Controllable#CONTROLLABLE Controllable +function AI_PATROL_ZONE:onafterDetect( Controllable, From, Event, To ) + + local Detected = false + + local DetectedTargets = Controllable:GetDetectedTargets() + for TargetID, Target in pairs( DetectedTargets or {} ) do + local TargetObject = Target.object + self:T( TargetObject ) + if TargetObject and TargetObject:isExist() and TargetObject.id_ < 50000000 then + + local TargetUnit = UNIT:Find( TargetObject ) + local TargetUnitName = TargetUnit:GetName() + + if self.DetectionZone then + if TargetUnit:IsInZone( self.DetectionZone ) then + self:T( {"Detected ", TargetUnit } ) + self.DetectedUnits[TargetUnit] = TargetUnit + Detected = true + end + else + self.DetectedUnits[TargetUnit] = TargetUnit + Detected = true + end + end + end + + self:__Detect( self.DetectInterval ) + + if Detected == true then + self:__Detected( 1.5 ) + end + +end + +--- @param Wrapper.Controllable#CONTROLLABLE AIControllable +-- This statis method is called from the route path within the last task at the last waaypoint of the Controllable. +-- Note that this method is required, as triggers the next route when patrolling for the Controllable. +function AI_PATROL_ZONE:_NewPatrolRoute( AIControllable ) + + local PatrolZone = AIControllable:GetState( AIControllable, "PatrolZone" ) -- PatrolCore.Zone#AI_PATROL_ZONE + PatrolZone:__Route( 1 ) +end + + +--- Defines a new patrol route using the @{Process_PatrolZone} parameters and settings. +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_PATROL_ZONE:onafterRoute( Controllable, From, Event, To ) self:F2() - local PatrolRoute = {} + -- When RTB, don't allow anymore the routing. + if From == "RTB" then + return + end + if self.Controllable:IsAlive() then - --- Determine if the AIControllable is within the PatrolZone. + -- Determine if the AIControllable is within the PatrolZone. -- If not, make a waypoint within the to that the AIControllable will fly at maximum speed to that point. --- --- Calculate the current route point. --- local CurrentVec2 = self.Controllable:GetVec2() --- local CurrentAltitude = self.Controllable:GetUnit(1):GetAltitude() --- local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y ) --- local CurrentRoutePoint = CurrentPointVec3:RoutePointAir( --- POINT_VEC3.RoutePointAltType.BARO, --- POINT_VEC3.RoutePointType.TurningPoint, --- POINT_VEC3.RoutePointAction.TurningPoint, --- ToPatrolZoneSpeed, --- true --- ) --- --- PatrolRoute[#PatrolRoute+1] = CurrentRoutePoint + local PatrolRoute = {} + + -- Calculate the current route point of the controllable as the start point of the route. + -- However, when the controllable is not in the air, + -- the controllable current waypoint is probably the airbase... + -- Thus, if we would take the current waypoint as the startpoint, upon take-off, the controllable flies + -- immediately back to the airbase, and this is not correct. + -- Therefore, when on a runway, get as the current route point a random point within the PatrolZone. + -- This will make the plane fly immediately to the patrol zone. - self:T2( PatrolRoute ) - - if self.Controllable:IsNotInZone( self.PatrolZone ) then - --- Find a random 2D point in PatrolZone. - local ToPatrolZoneVec2 = self.PatrolZone:GetRandomVec2() - self:T2( ToPatrolZoneVec2 ) - - --- Define Speed and Altitude. - local ToPatrolZoneAltitude = math.random( self.PatrolFloorAltitude, self.PatrolCeilingAltitude ) + if self.Controllable:InAir() == false then + self:E( "Not in the air, finding route path within PatrolZone" ) + local CurrentVec2 = self.Controllable:GetVec2() + --TODO: Create GetAltitude function for GROUP, and delete GetUnit(1). + local CurrentAltitude = self.Controllable:GetUnit(1):GetAltitude() + local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y ) local ToPatrolZoneSpeed = self.PatrolMaxSpeed - self:T2( ToPatrolZoneSpeed ) - - --- Obtain a 3D @{Point} from the 2D point + altitude. - local ToPatrolZonePointVec3 = POINT_VEC3:New( ToPatrolZoneVec2.x, ToPatrolZoneAltitude, ToPatrolZoneVec2.y ) - - --- Create a route point of type air. - local ToPatrolZoneRoutePoint = ToPatrolZonePointVec3:RoutePointAir( - POINT_VEC3.RoutePointAltType.BARO, - POINT_VEC3.RoutePointType.TurningPoint, - POINT_VEC3.RoutePointAction.TurningPoint, - ToPatrolZoneSpeed, - true - ) - - PatrolRoute[#PatrolRoute+1] = ToPatrolZoneRoutePoint - - end + local CurrentRoutePoint = CurrentPointVec3:RoutePointAir( + POINT_VEC3.RoutePointAltType.BARO, + POINT_VEC3.RoutePointType.TakeOffParking, + POINT_VEC3.RoutePointAction.FromParkingArea, + ToPatrolZoneSpeed, + true + ) + PatrolRoute[#PatrolRoute+1] = CurrentRoutePoint + else + self:E( "In the air, finding route path within PatrolZone" ) + local CurrentVec2 = self.Controllable:GetVec2() + --TODO: Create GetAltitude function for GROUP, and delete GetUnit(1). + local CurrentAltitude = self.Controllable:GetUnit(1):GetAltitude() + local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y ) + local ToPatrolZoneSpeed = self.PatrolMaxSpeed + local CurrentRoutePoint = CurrentPointVec3:RoutePointAir( + POINT_VEC3.RoutePointAltType.BARO, + POINT_VEC3.RoutePointType.TurningPoint, + POINT_VEC3.RoutePointAction.TurningPoint, + ToPatrolZoneSpeed, + true + ) + PatrolRoute[#PatrolRoute+1] = CurrentRoutePoint + end + --- Define a random point in the @{Zone}. The AI will fly to that point within the zone. @@ -24823,6 +25438,8 @@ function AI_PATROLZONE:onenterRoute() true ) + --self.CoordTest:SpawnFromVec3( ToTargetPointVec3:GetVec3() ) + --ToTargetPointVec3:SmokeRed() PatrolRoute[#PatrolRoute+1] = ToTargetRoutePoint @@ -24832,25 +25449,31 @@ function AI_PATROLZONE:onenterRoute() --- Do a trick, link the NewPatrolRoute function of the PATROLGROUP object to the AIControllable in a temporary variable ... self.Controllable:SetState( self.Controllable, "PatrolZone", self ) - self.Controllable:WayPointFunction( #PatrolRoute, 1, "_NewPatrolRoute" ) + self.Controllable:WayPointFunction( #PatrolRoute, 1, "AI_PATROL_ZONE:_NewPatrolRoute" ) - --- NOW ACT_ROUTE THE GROUP! - self.Controllable:WayPointExecute( 1 ) - - self:__Patrol( 30 ) + --- NOW ROUTE THE GROUP! + self.Controllable:WayPointExecute( 1, 2 ) end - + end +--- @param #AI_PATROL_ZONE self +function AI_PATROL_ZONE:onbeforeStatus() ---- @param #AI_PATROLZONE self -function AI_PATROLZONE:onenterPatrol() + return self.CheckStatus +end + +--- @param #AI_PATROL_ZONE self +function AI_PATROL_ZONE:onafterStatus() self:F2() if self.Controllable and self.Controllable:IsAlive() then + local RTB = false + local Fuel = self.Controllable:GetUnit(1):GetFuel() if Fuel < self.PatrolFuelTresholdPercentage then + self:E( self.Controllable:GetName() .. " is out of fuel:" .. Fuel .. ", RTB!" ) local OldAIControllable = self.Controllable local AIControllableTemplate = self.Controllable:GetTemplate() @@ -24858,14 +25481,1141 @@ function AI_PATROLZONE:onenterPatrol() local TimedOrbitTask = OldAIControllable:TaskControlled( OrbitTask, OldAIControllable:TaskCondition(nil,nil,nil,nil,self.PatrolOutOfFuelOrbitTime,nil ) ) OldAIControllable:SetTask( TimedOrbitTask, 10 ) + RTB = true + else + end + + -- TODO: Check GROUP damage function. + local Damage = self.Controllable:GetLife() + if Damage <= self.PatrolDamageTreshold then + self:E( self.Controllable:GetName() .. " is damaged:" .. Damage .. ", RTB!" ) + RTB = true + end + + if RTB == true then self:RTB() else - self:__Patrol( 30 ) -- Execute the Patrol event after 30 seconds. + self:__Status( 60 ) -- Execute the Patrol event after 30 seconds. end end +end + +--- @param #AI_PATROL_ZONE self +function AI_PATROL_ZONE:onafterRTB() + self:F2() + + if self.Controllable and self.Controllable:IsAlive() then + + self:SetDetectionOff() + self.CheckStatus = false + + local PatrolRoute = {} + + --- Calculate the current route point. + local CurrentVec2 = self.Controllable:GetVec2() + + --TODO: Create GetAltitude function for GROUP, and delete GetUnit(1). + local CurrentAltitude = self.Controllable:GetUnit(1):GetAltitude() + local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y ) + local ToPatrolZoneSpeed = self.PatrolMaxSpeed + local CurrentRoutePoint = CurrentPointVec3:RoutePointAir( + POINT_VEC3.RoutePointAltType.BARO, + POINT_VEC3.RoutePointType.TurningPoint, + POINT_VEC3.RoutePointAction.TurningPoint, + ToPatrolZoneSpeed, + true + ) + + PatrolRoute[#PatrolRoute+1] = CurrentRoutePoint + + --- Now we're going to do something special, we're going to call a function from a waypoint action at the AIControllable... + self.Controllable:WayPointInitialize( PatrolRoute ) + + --- NOW ROUTE THE GROUP! + self.Controllable:WayPointExecute( 1, 1 ) + + end + +end + +--- @param #AI_PATROL_ZONE self +function AI_PATROL_ZONE:onafterDead() + self:SetDetectionOff() + self:SetStatusOff() +end + +--- @param #AI_PATROL_ZONE self +-- @param Core.Event#EVENTDATA EventData +function AI_PATROL_ZONE:OnCrash( EventData ) + + if self.Controllable:IsAlive() and EventData.IniDCSGroupName == self.Controllable:GetName() then + self:__Crash( 1, EventData ) + end +end + +--- @param #AI_PATROL_ZONE self +-- @param Core.Event#EVENTDATA EventData +function AI_PATROL_ZONE:OnEjection( EventData ) + + if self.Controllable:IsAlive() and EventData.IniDCSGroupName == self.Controllable:GetName() then + self:__Eject( 1, EventData ) + end +end + +--- @param #AI_PATROL_ZONE self +-- @param Core.Event#EVENTDATA EventData +function AI_PATROL_ZONE:OnPilotDead( EventData ) + + if self.Controllable:IsAlive() and EventData.IniDCSGroupName == self.Controllable:GetName() then + self:__PilotDead( 1, EventData ) + end +end + +--- Single-Player:**Yes** / Mulit-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**Air** -- **Provide Close Air Support to friendly ground troops.** +-- +-- ![Banner Image](..\Presentations\AI_CAS\Dia1.JPG) +-- +-- +-- === +-- +-- # 1) @{#AI_CAS_ZONE} class, extends @{AI.AI_Patrol#AI_PATROL_ZONE} +-- +-- @{#AI_CAS_ZONE} derives from the @{AI.AI_Patrol#AI_PATROL_ZONE}, inheriting its methods and behaviour. +-- +-- The @{#AI_CAS_ZONE} class implements the core functions to provide Close Air Support in an Engage @{Zone} by an AIR @{Controllable} or @{Group}. +-- The AI_CAS_ZONE runs a process. It holds an AI in a Patrol Zone and when the AI is commanded to engage, it will fly to an Engage Zone. +-- +-- ![HoldAndEngage](..\Presentations\AI_CAS\Dia3.JPG) +-- +-- The AI_CAS_ZONE is assigned a @{Group} and this must be done before the AI_CAS_ZONE process can be started through the **Start** event. +-- +-- ![Start Event](..\Presentations\AI_CAS\Dia4.JPG) +-- +-- Upon started, The AI will **Route** itself towards the random 3D point within a patrol zone, +-- using a random speed within the given altitude and speed limits. +-- Upon arrival at the 3D point, a new random 3D point will be selected within the patrol zone using the given limits. +-- This cycle will continue until a fuel or damage treshold has been reached by the AI, or when the AI is commanded to RTB. +-- +-- ![Route Event](..\Presentations\AI_CAS\Dia5.JPG) +-- +-- When the AI is commanded to provide Close Air Support (through the event **Engage**), the AI will fly towards the Engage Zone. +-- Any target that is detected in the Engage Zone will be reported and will be destroyed by the AI. +-- +-- ![Engage Event](..\Presentations\AI_CAS\Dia6.JPG) +-- +-- The AI will detect the targets and will only destroy the targets within the Engage Zone. +-- +-- ![Engage Event](..\Presentations\AI_CAS\Dia7.JPG) +-- +-- Every target that is destroyed, is reported< by the AI. +-- +-- ![Engage Event](..\Presentations\AI_CAS\Dia8.JPG) +-- +-- Note that the AI does not know when the Engage Zone is cleared, and therefore will keep circling in the zone. +-- +-- ![Engage Event](..\Presentations\AI_CAS\Dia9.JPG) +-- +-- Until it is notified through the event **Accomplish**, which is to be triggered by an observing party: +-- +-- * a FAC +-- * a timed event +-- * a menu option selected by a human +-- * a condition +-- * others ... +-- +-- ![Engage Event](..\Presentations\AI_CAS\Dia10.JPG) +-- +-- When the AI has accomplished the CAS, it will fly back to the Patrol Zone. +-- +-- ![Engage Event](..\Presentations\AI_CAS\Dia11.JPG) +-- +-- It will keep patrolling there, until it is notified to RTB or move to another CAS Zone. +-- It can be notified to go RTB through the **RTB** event. +-- +-- When the fuel treshold has been reached, the airplane will fly towards the nearest friendly airbase and will land. +-- +-- ![Engage Event](..\Presentations\AI_CAS\Dia12.JPG) +-- +-- # 1.1) AI_CAS_ZONE constructor +-- +-- * @{#AI_CAS_ZONE.New}(): Creates a new AI_CAS_ZONE object. +-- +-- ## 1.2) AI_CAS_ZONE is a FSM +-- +-- ![Process](..\Presentations\AI_CAS\Dia2.JPG) +-- +-- ### 1.2.1) AI_CAS_ZONE States +-- +-- * **None** ( Group ): The process is not started yet. +-- * **Patrolling** ( Group ): The AI is patrolling the Patrol Zone. +-- * **Engaging** ( Group ): The AI is engaging the targets in the Engage Zone, executing CAS. +-- * **Returning** ( Group ): The AI is returning to Base.. +-- +-- ### 1.2.2) AI_CAS_ZONE Events +-- +-- * **Start** ( Group ): Start the process. +-- * **Route** ( Group ): Route the AI to a new random 3D point within the Patrol Zone. +-- * **Engage** ( Group ): Engage the AI to provide CAS in the Engage Zone, destroying any target it finds. +-- * **RTB** ( Group ): Route the AI to the home base. +-- * **Detect** ( Group ): The AI is detecting targets. +-- * **Detected** ( Group ): The AI has detected new targets. +-- * **Status** ( Group ): The AI is checking status (fuel and damage). When the tresholds have been reached, the AI will RTB. +-- +-- ==== +-- +-- # **API CHANGE HISTORY** +-- +-- The underlying change log documents the API changes. Please read this carefully. The following notation is used: +-- +-- * **Added** parts are expressed in bold type face. +-- * _Removed_ parts are expressed in italic type face. +-- +-- Hereby the change log: +-- +-- 2017-01-15: Initial class and API. +-- +-- === +-- +-- # **AUTHORS and CONTRIBUTIONS** +-- +-- ### Contributions: +-- +-- * **[Quax](https://forums.eagle.ru/member.php?u=90530)**: Concept, Advice & Testing. +-- * **[Pikey](https://forums.eagle.ru/member.php?u=62835)**: Concept, Advice & Testing. +-- * **[Gunterlund](http://forums.eagle.ru:8080/member.php?u=75036)**: Test case revision. +-- +-- ### Authors: +-- +-- * **FlightControl**: Concept, Design & Programming. +-- +-- @module AI_Cas + + +--- AI_CAS_ZONE class +-- @type AI_CAS_ZONE +-- @field Wrapper.Controllable#CONTROLLABLE AIControllable The @{Controllable} patrolling. +-- @field Core.Zone#ZONE_BASE TargetZone The @{Zone} where the patrol needs to be executed. +-- @extends AI.AI_Patrol#AI_PATROL_ZONE +AI_CAS_ZONE = { + ClassName = "AI_CAS_ZONE", +} + + + +--- Creates a new AI_CAS_ZONE object +-- @param #AI_CAS_ZONE self +-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed. +-- @param Dcs.DCSTypes#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol. +-- @param Dcs.DCSTypes#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol. +-- @param Dcs.DCSTypes#Speed PatrolMinSpeed The minimum speed of the @{Controllable} in km/h. +-- @param Dcs.DCSTypes#Speed PatrolMaxSpeed The maximum speed of the @{Controllable} in km/h. +-- @param Core.Zone#ZONE EngageZone +-- @return #AI_CAS_ZONE self +function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, EngageZone ) + + -- Inherits from BASE + local self = BASE:Inherit( self, AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed ) ) -- #AI_CAS_ZONE + + self.EngageZone = EngageZone + self.Accomplished = false + + self:SetDetectionZone( self.EngageZone ) + + self:AddTransition( { "Patrolling", "Engaging" }, "Engage", "Engaging" ) -- FSM_CONTROLLABLE Transition for type #AI_CAS_ZONE. + + --- OnBefore Transition Handler for Event Engage. + -- @function [parent=#AI_CAS_ZONE] OnBeforeEngage + -- @param #AI_CAS_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + -- @return #boolean Return false to cancel Transition. + + --- OnAfter Transition Handler for Event Engage. + -- @function [parent=#AI_CAS_ZONE] OnAfterEngage + -- @param #AI_CAS_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + + --- Synchronous Event Trigger for Event Engage. + -- @function [parent=#AI_CAS_ZONE] Engage + -- @param #AI_CAS_ZONE self + + --- Asynchronous Event Trigger for Event Engage. + -- @function [parent=#AI_CAS_ZONE] __Engage + -- @param #AI_CAS_ZONE self + -- @param #number Delay The delay in seconds. + +--- OnLeave Transition Handler for State Engaging. +-- @function [parent=#AI_CAS_ZONE] OnLeaveEngaging +-- @param #AI_CAS_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @return #boolean Return false to cancel Transition. + +--- OnEnter Transition Handler for State Engaging. +-- @function [parent=#AI_CAS_ZONE] OnEnterEngaging +-- @param #AI_CAS_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. + + self:AddTransition( "Engaging", "Fired", "Engaging" ) -- FSM_CONTROLLABLE Transition for type #AI_CAS_ZONE. + + --- OnBefore Transition Handler for Event Fired. + -- @function [parent=#AI_CAS_ZONE] OnBeforeFired + -- @param #AI_CAS_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + -- @return #boolean Return false to cancel Transition. + + --- OnAfter Transition Handler for Event Fired. + -- @function [parent=#AI_CAS_ZONE] OnAfterFired + -- @param #AI_CAS_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + + --- Synchronous Event Trigger for Event Fired. + -- @function [parent=#AI_CAS_ZONE] Fired + -- @param #AI_CAS_ZONE self + + --- Asynchronous Event Trigger for Event Fired. + -- @function [parent=#AI_CAS_ZONE] __Fired + -- @param #AI_CAS_ZONE self + -- @param #number Delay The delay in seconds. + + self:AddTransition( "*", "Destroy", "*" ) -- FSM_CONTROLLABLE Transition for type #AI_CAS_ZONE. + + --- OnBefore Transition Handler for Event Destroy. + -- @function [parent=#AI_CAS_ZONE] OnBeforeDestroy + -- @param #AI_CAS_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + -- @return #boolean Return false to cancel Transition. + + --- OnAfter Transition Handler for Event Destroy. + -- @function [parent=#AI_CAS_ZONE] OnAfterDestroy + -- @param #AI_CAS_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + + --- Synchronous Event Trigger for Event Destroy. + -- @function [parent=#AI_CAS_ZONE] Destroy + -- @param #AI_CAS_ZONE self + + --- Asynchronous Event Trigger for Event Destroy. + -- @function [parent=#AI_CAS_ZONE] __Destroy + -- @param #AI_CAS_ZONE self + -- @param #number Delay The delay in seconds. + + + self:AddTransition( "Engaging", "Abort", "Patrolling" ) -- FSM_CONTROLLABLE Transition for type #AI_CAS_ZONE. + + --- OnBefore Transition Handler for Event Abort. + -- @function [parent=#AI_CAS_ZONE] OnBeforeAbort + -- @param #AI_CAS_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + -- @return #boolean Return false to cancel Transition. + + --- OnAfter Transition Handler for Event Abort. + -- @function [parent=#AI_CAS_ZONE] OnAfterAbort + -- @param #AI_CAS_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + + --- Synchronous Event Trigger for Event Abort. + -- @function [parent=#AI_CAS_ZONE] Abort + -- @param #AI_CAS_ZONE self + + --- Asynchronous Event Trigger for Event Abort. + -- @function [parent=#AI_CAS_ZONE] __Abort + -- @param #AI_CAS_ZONE self + -- @param #number Delay The delay in seconds. + + self:AddTransition( "Engaging", "Accomplish", "Patrolling" ) -- FSM_CONTROLLABLE Transition for type #AI_CAS_ZONE. + + --- OnBefore Transition Handler for Event Accomplish. + -- @function [parent=#AI_CAS_ZONE] OnBeforeAccomplish + -- @param #AI_CAS_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + -- @return #boolean Return false to cancel Transition. + + --- OnAfter Transition Handler for Event Accomplish. + -- @function [parent=#AI_CAS_ZONE] OnAfterAccomplish + -- @param #AI_CAS_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + + --- Synchronous Event Trigger for Event Accomplish. + -- @function [parent=#AI_CAS_ZONE] Accomplish + -- @param #AI_CAS_ZONE self + + --- Asynchronous Event Trigger for Event Accomplish. + -- @function [parent=#AI_CAS_ZONE] __Accomplish + -- @param #AI_CAS_ZONE self + -- @param #number Delay The delay in seconds. + + return self +end + + +--- Set the Engage Zone where the AI is performing CAS. Note that if the EngageZone is changed, the AI needs to re-detect targets. +-- @param #AI_CAS_ZONE self +-- @param Core.Zone#ZONE EngageZone The zone where the AI is performing CAS. +-- @return #AI_CAS_ZONE self +function AI_CAS_ZONE:SetEngageZone( EngageZone ) + self:F2() + + if EngageZone then + self.EngageZone = EngageZone + else + self.EngageZone = nil + end +end + + + +--- onafter State Transition for Event Start. +-- @param #AI_CAS_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_CAS_ZONE:onafterStart( Controllable, From, Event, To ) + + -- Call the parent Start event handler + self:GetParent(self).onafterStart( self, Controllable, From, Event, To ) + self:EventOnDead( self.OnDead ) end ---- Management of logical cargo objects, that can be transported from and to transportation carriers. + +--- @param Wrapper.Controllable#CONTROLLABLE AIControllable +function _NewEngageRoute( AIControllable ) + + AIControllable:T( "NewEngageRoute" ) + local EngageZone = AIControllable:GetState( AIControllable, "EngageZone" ) -- AI.AI_Cas#AI_CAS_ZONE + EngageZone:__Engage( 1 ) +end + +--- @param #AI_CAS_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_CAS_ZONE:onbeforeEngage( Controllable, From, Event, To ) + + if self.Accomplished == true then + return false + end +end + + +--- @param #AI_CAS_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To ) + + if Controllable:IsAlive() then + + local EngageRoute = {} + + --- Calculate the current route point. + local CurrentVec2 = self.Controllable:GetVec2() + + --TODO: Create GetAltitude function for GROUP, and delete GetUnit(1). + local CurrentAltitude = self.Controllable:GetUnit(1):GetAltitude() + local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y ) + local ToEngageZoneSpeed = self.PatrolMaxSpeed + local CurrentRoutePoint = CurrentPointVec3:RoutePointAir( + POINT_VEC3.RoutePointAltType.BARO, + POINT_VEC3.RoutePointType.TurningPoint, + POINT_VEC3.RoutePointAction.TurningPoint, + ToEngageZoneSpeed, + true + ) + + EngageRoute[#EngageRoute+1] = CurrentRoutePoint + + + if self.Controllable:IsNotInZone( self.EngageZone ) then + + -- Find a random 2D point in EngageZone. + local ToEngageZoneVec2 = self.EngageZone:GetRandomVec2() + self:T2( ToEngageZoneVec2 ) + + -- Define Speed and Altitude. + local ToEngageZoneAltitude = math.random( self.EngageFloorAltitude, self.EngageCeilingAltitude ) + local ToEngageZoneSpeed = self.PatrolMaxSpeed + self:T2( ToEngageZoneSpeed ) + + -- Obtain a 3D @{Point} from the 2D point + altitude. + local ToEngageZonePointVec3 = POINT_VEC3:New( ToEngageZoneVec2.x, ToEngageZoneAltitude, ToEngageZoneVec2.y ) + + -- Create a route point of type air. + local ToEngageZoneRoutePoint = ToEngageZonePointVec3:RoutePointAir( + POINT_VEC3.RoutePointAltType.BARO, + POINT_VEC3.RoutePointType.TurningPoint, + POINT_VEC3.RoutePointAction.TurningPoint, + ToEngageZoneSpeed, + true + ) + + EngageRoute[#EngageRoute+1] = ToEngageZoneRoutePoint + + end + + --- Define a random point in the @{Zone}. The AI will fly to that point within the zone. + + --- Find a random 2D point in EngageZone. + local ToTargetVec2 = self.EngageZone:GetRandomVec2() + self:T2( ToTargetVec2 ) + + --- Define Speed and Altitude. + local ToTargetAltitude = math.random( self.EngageFloorAltitude, self.EngageCeilingAltitude ) + local ToTargetSpeed = math.random( self.PatrolMinSpeed, self.PatrolMaxSpeed ) + self:T2( { self.PatrolMinSpeed, self.PatrolMaxSpeed, ToTargetSpeed } ) + + --- Obtain a 3D @{Point} from the 2D point + altitude. + local ToTargetPointVec3 = POINT_VEC3:New( ToTargetVec2.x, ToTargetAltitude, ToTargetVec2.y ) + + --- Create a route point of type air. + local ToTargetRoutePoint = ToTargetPointVec3:RoutePointAir( + POINT_VEC3.RoutePointAltType.BARO, + POINT_VEC3.RoutePointType.TurningPoint, + POINT_VEC3.RoutePointAction.TurningPoint, + ToTargetSpeed, + true + ) + + ToTargetPointVec3:SmokeBlue() + + EngageRoute[#EngageRoute+1] = ToTargetRoutePoint + + + Controllable:OptionROEOpenFire() + Controllable:OptionROTPassiveDefense() + + local AttackTasks = {} + + for DetectedUnitID, DetectedUnit in pairs( self.DetectedUnits ) do + local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT + self:T( DetectedUnit ) + if DetectedUnit:IsAlive() then + if DetectedUnit:IsInZone( self.EngageZone ) then + self:E( {"Engaging ", DetectedUnit } ) + AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit ) + end + else + self.DetectedUnits[DetectedUnit] = nil + end + end + + EngageRoute[1].task = Controllable:TaskCombo( AttackTasks ) + + --- Now we're going to do something special, we're going to call a function from a waypoint action at the AIControllable... + self.Controllable:WayPointInitialize( EngageRoute ) + + --- Do a trick, link the NewEngageRoute function of the object to the AIControllable in a temporary variable ... + self.Controllable:SetState( self.Controllable, "EngageZone", self ) + + self.Controllable:WayPointFunction( #EngageRoute, 1, "_NewEngageRoute" ) + + --- NOW ROUTE THE GROUP! + self.Controllable:WayPointExecute( 1, 2 ) + end +end + +--- @param #AI_CAS_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @param Core.Event#EVENTDATA EventData +function AI_CAS_ZONE:onafterDestroy( Controllable, From, Event, To, EventData ) + + if EventData.IniUnit then + self.DetectedUnits[EventData.IniUnit] = nil + end + + Controllable:MessageToAll( "Destroyed a target", 15 , "Destroyed!" ) +end + +--- @param #AI_CAS_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_CAS_ZONE:onafterAccomplish( Controllable, From, Event, To ) + self.Accomplished = true + self:SetDetectionOff() +end + +--- @param #AI_CAS_ZONE self +-- @param Core.Event#EVENTDATA EventData +function AI_CAS_ZONE:OnDead( EventData ) + self:T( { "EventDead", EventData } ) + + if EventData.IniDCSUnit then + self:__Destroy( 1, EventData ) + end +end + + +--- Single-Player:**Yes** / Mulit-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**Air** -- **Execute Combat Air Patrol (CAP).** +-- +-- ![Banner Image](..\Presentations\AI_CAP\Dia1.JPG) +-- +-- +-- === +-- +-- # 1) @{#AI_CAP_ZONE} class, extends @{AI.AI_CAP#AI_PATROL_ZONE} +-- +-- The @{#AI_CAP_ZONE} class implements the core functions to patrol a @{Zone} by an AI @{Controllable} or @{Group} +-- and automatically engage any airborne enemies that are within a certain range or within a certain zone. +-- +-- ![Process](..\Presentations\AI_CAP\Dia3.JPG) +-- +-- The AI_CAP_ZONE is assigned a @{Group} and this must be done before the AI_CAP_ZONE process can be started using the **Start** event. +-- +-- ![Process](..\Presentations\AI_CAP\Dia4.JPG) +-- +-- The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits. +-- Upon arrival at the 3D point, a new random 3D point will be selected within the patrol zone using the given limits. +-- +-- ![Process](..\Presentations\AI_CAP\Dia5.JPG) +-- +-- This cycle will continue. +-- +-- ![Process](..\Presentations\AI_CAP\Dia6.JPG) +-- +-- During the patrol, the AI will detect enemy targets, which are reported through the **Detected** event. +-- +-- ![Process](..\Presentations\AI_CAP\Dia9.JPG) +-- +-- When enemies are detected, the AI will automatically engage the enemy. +-- +-- ![Process](..\Presentations\AI_CAP\Dia10.JPG) +-- +-- Until a fuel or damage treshold has been reached by the AI, or when the AI is commanded to RTB. +-- When the fuel treshold has been reached, the airplane will fly towards the nearest friendly airbase and will land. +-- +-- ![Process](..\Presentations\AI_CAP\Dia13.JPG) +-- +-- ## 1.1) AI_CAP_ZONE constructor +-- +-- * @{#AI_CAP_ZONE.New}(): Creates a new AI_CAP_ZONE object. +-- +-- ## 1.2) AI_CAP_ZONE is a FSM +-- +-- ![Process](..\Presentations\AI_CAP\Dia2.JPG) +-- +-- ### 1.2.1) AI_CAP_ZONE States +-- +-- * **None** ( Group ): The process is not started yet. +-- * **Patrolling** ( Group ): The AI is patrolling the Patrol Zone. +-- * **Engaging** ( Group ): The AI is engaging the bogeys. +-- * **Returning** ( Group ): The AI is returning to Base.. +-- +-- ### 1.2.2) AI_CAP_ZONE Events +-- +-- * **Start** ( Group ): Start the process. +-- * **Route** ( Group ): Route the AI to a new random 3D point within the Patrol Zone. +-- * **Engage** ( Group ): Let the AI engage the bogeys. +-- * **RTB** ( Group ): Route the AI to the home base. +-- * **Detect** ( Group ): The AI is detecting targets. +-- * **Detected** ( Group ): The AI has detected new targets. +-- * **Status** ( Group ): The AI is checking status (fuel and damage). When the tresholds have been reached, the AI will RTB. +-- +-- ## 1.3) Set the Range of Engagement +-- +-- ![Range](..\Presentations\AI_CAP\Dia11.JPG) +-- +-- An optional range can be set in meters, +-- that will define when the AI will engage with the detected airborne enemy targets. +-- The range can be beyond or smaller than the range of the Patrol Zone. +-- The range is applied at the position of the AI. +-- Use the method @{AI.AI_CAP#AI_CAP_ZONE.SetEngageRange}() to define that range. +-- +-- ## 1.4) Set the Zone of Engagement +-- +-- ![Zone](..\Presentations\AI_CAP\Dia12.JPG) +-- +-- An optional @{Zone} can be set, +-- that will define when the AI will engage with the detected airborne enemy targets. +-- Use the method @{AI.AI_Cap#AI_CAP_ZONE.SetEngageZone}() to define that Zone. +-- +-- ==== +-- +-- # **API CHANGE HISTORY** +-- +-- The underlying change log documents the API changes. Please read this carefully. The following notation is used: +-- +-- * **Added** parts are expressed in bold type face. +-- * _Removed_ parts are expressed in italic type face. +-- +-- Hereby the change log: +-- +-- 2017-01-15: Initial class and API. +-- +-- === +-- +-- # **AUTHORS and CONTRIBUTIONS** +-- +-- ### Contributions: +-- +-- * **[Quax](https://forums.eagle.ru/member.php?u=90530)**: Concept, Advice & Testing. +-- * **[Pikey](https://forums.eagle.ru/member.php?u=62835)**: Concept, Advice & Testing. +-- * **[Gunterlund](http://forums.eagle.ru:8080/member.php?u=75036)**: Test case revision. +-- * **[Whisper](http://forums.eagle.ru/member.php?u=3829): Testing. +-- * **[Delta99](https://forums.eagle.ru/member.php?u=125166): Testing. +-- +-- ### Authors: +-- +-- * **FlightControl**: Concept, Design & Programming. +-- +-- @module AI_Cap + + +--- AI_CAP_ZONE class +-- @type AI_CAP_ZONE +-- @field Wrapper.Controllable#CONTROLLABLE AIControllable The @{Controllable} patrolling. +-- @field Core.Zone#ZONE_BASE TargetZone The @{Zone} where the patrol needs to be executed. +-- @extends AI.AI_Patrol#AI_PATROL_ZONE +AI_CAP_ZONE = { + ClassName = "AI_CAP_ZONE", +} + + + +--- Creates a new AI_CAP_ZONE object +-- @param #AI_CAP_ZONE self +-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed. +-- @param Dcs.DCSTypes#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol. +-- @param Dcs.DCSTypes#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol. +-- @param Dcs.DCSTypes#Speed PatrolMinSpeed The minimum speed of the @{Controllable} in km/h. +-- @param Dcs.DCSTypes#Speed PatrolMaxSpeed The maximum speed of the @{Controllable} in km/h. +-- @return #AI_CAP_ZONE self +function AI_CAP_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed ) + + -- Inherits from BASE + local self = BASE:Inherit( self, AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed ) ) -- #AI_CAP_ZONE + + self.Accomplished = false + self.Engaging = false + + self:AddTransition( { "Patrolling", "Engaging" }, "Engage", "Engaging" ) -- FSM_CONTROLLABLE Transition for type #AI_CAP_ZONE. + + --- OnBefore Transition Handler for Event Engage. + -- @function [parent=#AI_CAP_ZONE] OnBeforeEngage + -- @param #AI_CAP_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + -- @return #boolean Return false to cancel Transition. + + --- OnAfter Transition Handler for Event Engage. + -- @function [parent=#AI_CAP_ZONE] OnAfterEngage + -- @param #AI_CAP_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + + --- Synchronous Event Trigger for Event Engage. + -- @function [parent=#AI_CAP_ZONE] Engage + -- @param #AI_CAP_ZONE self + + --- Asynchronous Event Trigger for Event Engage. + -- @function [parent=#AI_CAP_ZONE] __Engage + -- @param #AI_CAP_ZONE self + -- @param #number Delay The delay in seconds. + +--- OnLeave Transition Handler for State Engaging. +-- @function [parent=#AI_CAP_ZONE] OnLeaveEngaging +-- @param #AI_CAP_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @return #boolean Return false to cancel Transition. + +--- OnEnter Transition Handler for State Engaging. +-- @function [parent=#AI_CAP_ZONE] OnEnterEngaging +-- @param #AI_CAP_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. + + self:AddTransition( "Engaging", "Fired", "Engaging" ) -- FSM_CONTROLLABLE Transition for type #AI_CAP_ZONE. + + --- OnBefore Transition Handler for Event Fired. + -- @function [parent=#AI_CAP_ZONE] OnBeforeFired + -- @param #AI_CAP_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + -- @return #boolean Return false to cancel Transition. + + --- OnAfter Transition Handler for Event Fired. + -- @function [parent=#AI_CAP_ZONE] OnAfterFired + -- @param #AI_CAP_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + + --- Synchronous Event Trigger for Event Fired. + -- @function [parent=#AI_CAP_ZONE] Fired + -- @param #AI_CAP_ZONE self + + --- Asynchronous Event Trigger for Event Fired. + -- @function [parent=#AI_CAP_ZONE] __Fired + -- @param #AI_CAP_ZONE self + -- @param #number Delay The delay in seconds. + + self:AddTransition( "*", "Destroy", "*" ) -- FSM_CONTROLLABLE Transition for type #AI_CAP_ZONE. + + --- OnBefore Transition Handler for Event Destroy. + -- @function [parent=#AI_CAP_ZONE] OnBeforeDestroy + -- @param #AI_CAP_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + -- @return #boolean Return false to cancel Transition. + + --- OnAfter Transition Handler for Event Destroy. + -- @function [parent=#AI_CAP_ZONE] OnAfterDestroy + -- @param #AI_CAP_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + + --- Synchronous Event Trigger for Event Destroy. + -- @function [parent=#AI_CAP_ZONE] Destroy + -- @param #AI_CAP_ZONE self + + --- Asynchronous Event Trigger for Event Destroy. + -- @function [parent=#AI_CAP_ZONE] __Destroy + -- @param #AI_CAP_ZONE self + -- @param #number Delay The delay in seconds. + + + self:AddTransition( "Engaging", "Abort", "Patrolling" ) -- FSM_CONTROLLABLE Transition for type #AI_CAP_ZONE. + + --- OnBefore Transition Handler for Event Abort. + -- @function [parent=#AI_CAP_ZONE] OnBeforeAbort + -- @param #AI_CAP_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + -- @return #boolean Return false to cancel Transition. + + --- OnAfter Transition Handler for Event Abort. + -- @function [parent=#AI_CAP_ZONE] OnAfterAbort + -- @param #AI_CAP_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + + --- Synchronous Event Trigger for Event Abort. + -- @function [parent=#AI_CAP_ZONE] Abort + -- @param #AI_CAP_ZONE self + + --- Asynchronous Event Trigger for Event Abort. + -- @function [parent=#AI_CAP_ZONE] __Abort + -- @param #AI_CAP_ZONE self + -- @param #number Delay The delay in seconds. + + self:AddTransition( "Engaging", "Accomplish", "Patrolling" ) -- FSM_CONTROLLABLE Transition for type #AI_CAP_ZONE. + + --- OnBefore Transition Handler for Event Accomplish. + -- @function [parent=#AI_CAP_ZONE] OnBeforeAccomplish + -- @param #AI_CAP_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + -- @return #boolean Return false to cancel Transition. + + --- OnAfter Transition Handler for Event Accomplish. + -- @function [parent=#AI_CAP_ZONE] OnAfterAccomplish + -- @param #AI_CAP_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + + --- Synchronous Event Trigger for Event Accomplish. + -- @function [parent=#AI_CAP_ZONE] Accomplish + -- @param #AI_CAP_ZONE self + + --- Asynchronous Event Trigger for Event Accomplish. + -- @function [parent=#AI_CAP_ZONE] __Accomplish + -- @param #AI_CAP_ZONE self + -- @param #number Delay The delay in seconds. + + return self +end + + +--- Set the Engage Zone which defines where the AI will engage bogies. +-- @param #AI_CAP_ZONE self +-- @param Core.Zone#ZONE EngageZone The zone where the AI is performing CAP. +-- @return #AI_CAP_ZONE self +function AI_CAP_ZONE:SetEngageZone( EngageZone ) + self:F2() + + if EngageZone then + self.EngageZone = EngageZone + else + self.EngageZone = nil + end +end + +--- Set the Engage Range when the AI will engage with airborne enemies. +-- @param #AI_CAP_ZONE self +-- @param #number EngageRange The Engage Range. +-- @return #AI_CAP_ZONE self +function AI_CAP_ZONE:SetEngageRange( EngageRange ) + self:F2() + + if EngageRange then + self.EngageRange = EngageRange + else + self.EngageRange = nil + end +end + +--- onafter State Transition for Event Start. +-- @param #AI_CAP_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_CAP_ZONE:onafterStart( Controllable, From, Event, To ) + + -- Call the parent Start event handler + self:GetParent(self).onafterStart( self, Controllable, From, Event, To ) + +end + +--- @param Wrapper.Controllable#CONTROLLABLE AIControllable +function _NewEngageCapRoute( AIControllable ) + + AIControllable:T( "NewEngageRoute" ) + local EngageZone = AIControllable:GetState( AIControllable, "EngageZone" ) -- AI.AI_Cap#AI_CAP_ZONE + EngageZone:__Engage( 1 ) +end + +--- @param #AI_CAP_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_CAP_ZONE:onbeforeEngage( Controllable, From, Event, To ) + + if self.Accomplished == true then + return false + end +end + +--- @param #AI_CAP_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_CAP_ZONE:onafterDetected( Controllable, From, Event, To ) + + if From ~= "Engaging" then + + local Engage = false + + for DetectedUnitID, DetectedUnit in pairs( self.DetectedUnits ) do + + local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT + self:T( DetectedUnit ) + if DetectedUnit:IsAlive() and DetectedUnit:IsAir() then + Engage = true + break + end + end + + if Engage == true then + self:E( 'Detected -> Engaging' ) + self:__Engage( 1 ) + end + end +end + + + +--- @param #AI_CAP_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_CAP_ZONE:onafterEngage( Controllable, From, Event, To ) + + if Controllable:IsAlive() then + + local EngageRoute = {} + + --- Calculate the current route point. + local CurrentVec2 = self.Controllable:GetVec2() + + --TODO: Create GetAltitude function for GROUP, and delete GetUnit(1). + local CurrentAltitude = self.Controllable:GetUnit(1):GetAltitude() + local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y ) + local ToEngageZoneSpeed = self.PatrolMaxSpeed + local CurrentRoutePoint = CurrentPointVec3:RoutePointAir( + POINT_VEC3.RoutePointAltType.BARO, + POINT_VEC3.RoutePointType.TurningPoint, + POINT_VEC3.RoutePointAction.TurningPoint, + ToEngageZoneSpeed, + true + ) + + EngageRoute[#EngageRoute+1] = CurrentRoutePoint + + + --- Find a random 2D point in PatrolZone. + local ToTargetVec2 = self.PatrolZone:GetRandomVec2() + self:T2( ToTargetVec2 ) + + --- Define Speed and Altitude. + local ToTargetAltitude = math.random( self.EngageFloorAltitude, self.EngageCeilingAltitude ) + local ToTargetSpeed = math.random( self.PatrolMinSpeed, self.PatrolMaxSpeed ) + self:T2( { self.PatrolMinSpeed, self.PatrolMaxSpeed, ToTargetSpeed } ) + + --- Obtain a 3D @{Point} from the 2D point + altitude. + local ToTargetPointVec3 = POINT_VEC3:New( ToTargetVec2.x, ToTargetAltitude, ToTargetVec2.y ) + + --- Create a route point of type air. + local ToPatrolRoutePoint = ToTargetPointVec3:RoutePointAir( + POINT_VEC3.RoutePointAltType.BARO, + POINT_VEC3.RoutePointType.TurningPoint, + POINT_VEC3.RoutePointAction.TurningPoint, + ToTargetSpeed, + true + ) + + EngageRoute[#EngageRoute+1] = ToPatrolRoutePoint + + Controllable:OptionROEOpenFire() + Controllable:OptionROTPassiveDefense() + + local AttackTasks = {} + + for DetectedUnitID, DetectedUnit in pairs( self.DetectedUnits ) do + local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT + self:T( { DetectedUnit, DetectedUnit:IsAlive(), DetectedUnit:IsAir() } ) + if DetectedUnit:IsAlive() and DetectedUnit:IsAir() then + if self.EngageZone then + if DetectedUnit:IsInZone( self.EngageZone ) then + self:E( {"Within Zone and Engaging ", DetectedUnit } ) + AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit ) + end + else + if self.EngageRange then + if DetectedUnit:GetPointVec3():Get2DDistance(Controllable:GetPointVec3() ) <= self.EngageRange then + self:E( {"Within Range and Engaging", DetectedUnit } ) + AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit ) + end + else + AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit ) + end + end + else + self.DetectedUnits[DetectedUnit] = nil + end + end + + --- Now we're going to do something special, we're going to call a function from a waypoint action at the AIControllable... + self.Controllable:WayPointInitialize( EngageRoute ) + + + if #AttackTasks == 0 then + self:E("No targets found -> Going back to Patrolling") + self:__Accomplish( 1 ) + self:__Route( 1 ) + self:SetDetectionActivated() + else + EngageRoute[1].task = Controllable:TaskCombo( AttackTasks ) + + --- Do a trick, link the NewEngageRoute function of the object to the AIControllable in a temporary variable ... + self.Controllable:SetState( self.Controllable, "EngageZone", self ) + + self.Controllable:WayPointFunction( #EngageRoute, 1, "_NewEngageCapRoute" ) + + self:SetDetectionDeactivated() + end + + --- NOW ROUTE THE GROUP! + self.Controllable:WayPointExecute( 1, 2 ) + + end +end + +--- @param #AI_CAP_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @param Core.Event#EVENTDATA EventData +function AI_CAP_ZONE:onafterDestroy( Controllable, From, Event, To, EventData ) + + if EventData.IniUnit then + self.DetectedUnits[EventData.IniUnit] = nil + end + + Controllable:MessageToAll( "Destroyed a target", 15 , "Destroyed!" ) +end + +--- @param #AI_CAP_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_CAP_ZONE:onafterAccomplish( Controllable, From, Event, To ) + self.Accomplished = true + self:SetDetectionOff() +end + + +--- Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Ground -- Management of logical cargo objects, that can be transported from and to transportation carriers. -- -- === -- @@ -27147,7 +28897,8 @@ end function COMMANDCENTER:MessageToCoalition( Message ) local CCCoalition = self:GetPositionable():GetCoalition() - self:GetPositionable():MessageToBlue( Message , 20, CCCoalition ) + --TODO: Fix coalition bug! + self:GetPositionable():MessageToCoalition( Message, 20, CCCoalition, self:GetName() ) end @@ -28770,7 +30521,7 @@ function TASK.MenuTaskAbort( MenuParam ) local self = MenuParam.self local TaskGroup = MenuParam.TaskGroup - --self:AssignToGroup( TaskGroup ) + self:Abort() end @@ -29037,8 +30788,8 @@ end --- FSM function for a TASK -- @param #TASK self --- @param #string Event -- @param #string From +-- @param #string Event -- @param #string To function TASK:onenterAborted( From, Event, To ) @@ -29047,12 +30798,29 @@ function TASK:onenterAborted( From, Event, To ) self:GetMission():GetCommandCenter():MessageToCoalition( "Task " .. self:GetName() .. " has been aborted! Task may be replanned." ) self:UnAssignFromGroups() + + self:__Replan( 5 ) end --- FSM function for a TASK -- @param #TASK self --- @param #string Event -- @param #string From +-- @param #string Event +-- @param #string To +function TASK:onafterReplan( From, Event, To ) + + self:E( "Task Replanned" ) + + self:GetMission():GetCommandCenter():MessageToCoalition( "Replanning Task " .. self:GetName() .. "." ) + + self:SetMenu() + +end + +--- FSM function for a TASK +-- @param #TASK self +-- @param #string From +-- @param #string Event -- @param #string To function TASK:onenterFailed( From, Event, To ) @@ -29856,6 +31624,8 @@ Include.File( "Functional/Detection" ) --- AI Classes Include.File( "AI/AI_Balancer" ) Include.File( "AI/AI_Patrol" ) +Include.File( "AI/AI_Cap" ) +Include.File( "AI/AI_Cas" ) Include.File( "AI/AI_Cargo" ) --- Actions diff --git a/Moose Mission Setup/Moose.lua b/Moose Mission Setup/Moose.lua index 1d9b665ac..31a028f31 100644 --- a/Moose Mission Setup/Moose.lua +++ b/Moose Mission Setup/Moose.lua @@ -1,5 +1,5 @@ env.info( '*** MOOSE STATIC INCLUDE START *** ' ) -env.info( 'Moose Generation Timestamp: 20170110_1254' ) +env.info( 'Moose Generation Timestamp: 20170124_1109' ) local base = _G Include = {} @@ -2907,6 +2907,19 @@ end -- * @{#BASE.GetClassName}(): Gets the name of the object, which is the name of the class the object was instantiated from. -- * @{#BASE.GetClassNameAndID}(): Gets the name and ID of the object. -- +-- ## 1.5) All objects derived from BASE can have "States" +-- +-- A mechanism is in place in MOOSE, that allows to let the objects administer **states**. +-- States are essentially properties of objects, which are identified by a **Key** and a **Value**. +-- The method @{#BASE.SetState}() can be used to set a Value with a reference Key to the object. +-- To **read or retrieve** a state Value based on a Key, use the @{#BASE.GetState} method. +-- These two methods provide a very handy way to keep state at long lasting processes. +-- Values can be stored within the objects, and later retrieved or changed when needed. +-- There is one other important thing to note, the @{#BASE.SetState}() and @{#BASE.GetState} methods +-- receive as the **first parameter the object for which the state needs to be set**. +-- Thus, if the state is to be set for the same object as the object for which the method is used, then provide the same +-- object name to the method. +-- -- ## 1.10) BASE Inheritance (tree) support -- -- The following methods are available to support inheritance: @@ -3498,25 +3511,41 @@ function BASE:onEvent(event) end end -function BASE:SetState( Object, StateName, State ) +--- Set a state or property of the Object given a Key and a Value. +-- Note that if the Object is destroyed, nillified or garbage collected, then the Values and Keys will also be gone. +-- @param #BASE self +-- @param Object The object that will hold the Value set by the Key. +-- @param Key The key that is used as a reference of the value. Note that the key can be a #string, but it can also be any other type! +-- @param Value The value to is stored in the object. +-- @return The Value set. +-- @return #nil The Key was not found and thus the Value could not be retrieved. +function BASE:SetState( Object, Key, Value ) local ClassNameAndID = Object:GetClassNameAndID() self.States[ClassNameAndID] = self.States[ClassNameAndID] or {} - self.States[ClassNameAndID][StateName] = State - self:T2( { ClassNameAndID, StateName, State } ) + self.States[ClassNameAndID][Key] = Value + self:T2( { ClassNameAndID, Key, Value } ) - return self.States[ClassNameAndID][StateName] + return self.States[ClassNameAndID][Key] end - -function BASE:GetState( Object, StateName ) + + +--- Get a Value given a Key from the Object. +-- Note that if the Object is destroyed, nillified or garbage collected, then the Values and Keys will also be gone. +-- @param #BASE self +-- @param Object The object that holds the Value set by the Key. +-- @param Key The key that is used to retrieve the value. Note that the key can be a #string, but it can also be any other type! +-- @param Value The value to is stored in the Object. +-- @return The Value retrieved. +function BASE:GetState( Object, Key ) local ClassNameAndID = Object:GetClassNameAndID() if self.States[ClassNameAndID] then - local State = self.States[ClassNameAndID][StateName] or false - self:T2( { ClassNameAndID, StateName, State } ) - return State + local Value = self.States[ClassNameAndID][Key] or false + self:T2( { ClassNameAndID, Key, Value } ) + return Value end return nil @@ -3857,6 +3886,8 @@ function SCHEDULER:New( SchedulerObject, SchedulerFunction, SchedulerArguments, local ScheduleID = nil + self.MasterObject = SchedulerObject + if SchedulerFunction then ScheduleID = self:Schedule( SchedulerObject, SchedulerFunction, SchedulerArguments, Start, Repeat, RandomizeFactor, Stop ) end @@ -3888,7 +3919,7 @@ function SCHEDULER:Schedule( SchedulerObject, SchedulerFunction, SchedulerArgume if SchedulerObject and SchedulerObject.ClassName and SchedulerObject.ClassID then ObjectName = SchedulerObject.ClassName .. SchedulerObject.ClassID end - self:E( { "Schedule :", ObjectName, tostring( SchedulerObject ), Start, Repeat, RandomizeFactor, Stop } ) + self:F3( { "Schedule :", ObjectName, tostring( SchedulerObject ), Start, Repeat, RandomizeFactor, Stop } ) self.SchedulerObject = SchedulerObject local ScheduleID = _SCHEDULEDISPATCHER:AddSchedule( @@ -4015,12 +4046,12 @@ function SCHEDULEDISPATCHER:AddSchedule( Scheduler, ScheduleFunction, ScheduleAr -- If the object used as the key is nil, then the garbage collector will remove the item from the Functions array. self.ObjectSchedulers = self.ObjectSchedulers or setmetatable( {}, { __mode = "v" } ) - if Scheduler.SchedulerObject then + if Scheduler.MasterObject then self.ObjectSchedulers[self.CallID] = Scheduler - self:E( { CallID = self.CallID, ObjectScheduler = tostring(self.ObjectSchedulers[self.CallID]), SchedulerObject = tostring(Scheduler.SchedulerObject) } ) + self:F3( { CallID = self.CallID, ObjectScheduler = tostring(self.ObjectSchedulers[self.CallID]), MasterObject = tostring(Scheduler.MasterObject) } ) else self.PersistentSchedulers[self.CallID] = Scheduler - self:E( { CallID = self.CallID, PersistentScheduler = self.PersistentSchedulers[self.CallID] } ) + self:F3( { CallID = self.CallID, PersistentScheduler = self.PersistentSchedulers[self.CallID] } ) end self.Schedule = self.Schedule or setmetatable( {}, { __mode = "k" } ) @@ -4029,7 +4060,7 @@ function SCHEDULEDISPATCHER:AddSchedule( Scheduler, ScheduleFunction, ScheduleAr self.Schedule[Scheduler][self.CallID].Function = ScheduleFunction self.Schedule[Scheduler][self.CallID].Arguments = ScheduleArguments self.Schedule[Scheduler][self.CallID].StartTime = timer.getTime() + ( Start or 0 ) - self.Schedule[Scheduler][self.CallID].Start = Start + .001 + self.Schedule[Scheduler][self.CallID].Start = Start + .1 self.Schedule[Scheduler][self.CallID].Repeat = Repeat self.Schedule[Scheduler][self.CallID].Randomize = Randomize self.Schedule[Scheduler][self.CallID].Stop = Stop @@ -4105,7 +4136,7 @@ function SCHEDULEDISPATCHER:AddSchedule( Scheduler, ScheduleFunction, ScheduleAr self:Stop( Scheduler, CallID ) end else - --self:E( "Scheduled obscolete call for CallID: " .. CallID ) + self:E( "Scheduled obscolete call for CallID: " .. CallID ) end return nil @@ -4876,6 +4907,16 @@ end -- @param #EVENTDATA Event function EVENT:onEvent( Event ) + local ErrorHandler = function( errmsg ) + + env.info( "Error in SCHEDULER function:" .. errmsg ) + if debug ~= nil then + env.info( debug.traceback() ) + end + + return errmsg + end + if self and self.Events and self.Events[Event.id] then if Event.initiator and Event.initiator:getCategory() == Object.Category.UNIT then Event.IniDCSUnit = Event.initiator @@ -4917,14 +4958,16 @@ function EVENT:onEvent( Event ) -- If the EventData is for a UNIT, the call directly the EventClass EventFunction for that UNIT. if Event.IniDCSUnitName and EventData.IniUnit and EventData.IniUnit[Event.IniDCSUnitName] then self:T( { "Calling EventFunction for Class ", EventClass:GetClassNameAndID(), ", Unit ", Event.IniUnitName } ) - EventData.IniUnit[Event.IniDCSUnitName].EventFunction( EventData.IniUnit[Event.IniDCSUnitName].EventClass, Event ) + local Result, Value = xpcall( function() return EventData.IniUnit[Event.IniDCSUnitName].EventFunction( EventData.IniUnit[Event.IniDCSUnitName].EventClass, Event ) end, ErrorHandler ) + --EventData.IniUnit[Event.IniDCSUnitName].EventFunction( EventData.IniUnit[Event.IniDCSUnitName].EventClass, Event ) else -- If the EventData is not bound to a specific unit, then call the EventClass EventFunction. -- Note that here the EventFunction will need to implement and determine the logic for the relevant source- or target unit, or weapon. if Event.IniDCSUnit and not EventData.IniUnit then if EventClass == EventData.EventClass then self:T( { "Calling EventFunction for Class ", EventClass:GetClassNameAndID() } ) - EventData.EventFunction( EventData.EventClass, Event ) + local Result, Value = xpcall( function() return EventData.EventFunction( EventData.EventClass, Event ) end, ErrorHandler ) + --EventData.EventFunction( EventData.EventClass, Event ) end end end @@ -9793,9 +9836,11 @@ POINT_VEC3 = { BARO = "BARO", }, RoutePointType = { + TakeOffParking = "TakeOffParking", TurningPoint = "Turning Point", }, RoutePointAction = { + FromParkingArea = "From Parking Area", TurningPoint = "Turning Point", }, } @@ -9818,10 +9863,12 @@ do -- POINT_VEC3 --- RoutePoint Types -- @type POINT_VEC3.RoutePointType +-- @field TakeOffParking "TakeOffParking" -- @field TurningPoint "Turning Point" --- RoutePoint Actions -- @type POINT_VEC3.RoutePointAction +-- @field FromParkingArea "From Parking Area" -- @field TurningPoint "Turning Point" -- Constructor. @@ -10858,7 +10905,7 @@ end -- The following example provides a little demonstration on the difference between synchronous and asynchronous Event Triggering. -- -- function FSM:OnAfterEvent( From, Event, To, Amount ) --- self:E( { Amount = Amount } ) +-- self:T( { Amount = Amount } ) -- end -- -- local Amount = 1 @@ -10906,7 +10953,7 @@ end -- ![Transition Flow](..\Presentations\FSM\Dia7.JPG) -- -- function FsmDemo:OnAfterSwitch( From, Event, To, FsmUnit ) --- self:E( { From, Event, To, FsmUnit } ) +-- self:T( { From, Event, To, FsmUnit } ) -- -- if From == "Green" then -- FsmUnit:Flare(FLARECOLOR.Green) @@ -10929,7 +10976,7 @@ end -- -- For debugging reasons the received parameters are traced within the DCS.log. -- --- self:E( { From, Event, To, FsmUnit } ) +-- self:T( { From, Event, To, FsmUnit } ) -- -- The method will check if the From state received is either "Green" or "Red" and will flare the respective color from the FsmUnit. -- @@ -11073,7 +11120,7 @@ do -- FSM Transition.Event = Event Transition.To = To - self:E( Transition ) + self:T( Transition ) self._Transitions[Transition] = Transition self:_eventmap( self.Events, Transition ) @@ -11095,7 +11142,7 @@ do -- FSM -- @param #table ReturnEvents A table indicating for which returned events of the SubFSM which Event must be triggered in the FSM. -- @return Core.Fsm#FSM_PROCESS The SubFSM. function FSM:AddProcess( From, Event, Process, ReturnEvents ) - self:E( { From, Event, Process, ReturnEvents } ) + self:T( { From, Event, Process, ReturnEvents } ) local Sub = {} Sub.From = From @@ -11125,7 +11172,7 @@ do -- FSM for ProcessID, Process in pairs( self:GetProcesses() ) do if Process.From == From and Process.Event == Event then - self:E( Process ) + self:T( Process ) return Process.fsm end end @@ -11176,7 +11223,7 @@ do -- FSM local Process = self:GetProcess( From, Event ) - self:E( { Process = Process._Name, Scores = Process._Scores, State = State, ScoreText = ScoreText, Score = Score } ) + self:T( { Process = Process._Name, Scores = Process._Scores, State = State, ScoreText = ScoreText, Score = Score } ) Process._Scores[State] = Process._Scores[State] or {} Process._Scores[State].ScoreText = ScoreText Process._Scores[State].Score = Score @@ -11236,26 +11283,35 @@ do -- FSM function FSM:_call_handler(handler, params) if self[handler] then - self:E( "Calling " .. handler ) - return self[handler]( self, unpack(params) ) + self:T( "Calling " .. handler ) + local Value = self[handler]( self, unpack(params) ) + return Value end end function FSM._handler( self, EventName, ... ) - self:E( { EventName, ... } ) - local Can, to = self:can( EventName ) - self:E( { From = self.current, Event = EventName, To = to, Can = Can } ) + + if to == "*" then + to = self.current + end if Can then local from = self.current local params = { from, EventName, to, ... } + + if self.Controllable then + self:T( "FSM Transition for " .. self.Controllable.ControllableName .. " :" .. self.current .. " --> " .. EventName .. " --> " .. to ) + else + self:T( "FSM Transition:" .. self.current .. " --> " .. EventName .. " --> " .. to ) + end - if self:_call_handler("onbefore" .. EventName, params) == false - or self:_call_handler("OnBefore" .. EventName, params) == false - or self:_call_handler("onleave" .. from, params) == false - or self:_call_handler("OnLeave" .. from, params) == false then + if ( self:_call_handler("onbefore" .. EventName, params) == false ) + or ( self:_call_handler("OnBefore" .. EventName, params) == false ) + or ( self:_call_handler("onleave" .. from, params) == false ) + or ( self:_call_handler("OnLeave" .. from, params) == false ) then + self:T( "Cancel Transition" ) return false end @@ -11269,7 +11325,7 @@ do -- FSM -- self:F2( "nextevent = " .. sub.nextevent ) -- self[sub.nextevent]( self ) --end - self:E( "calling sub start event: " .. sub.StartEvent ) + self:T( "calling sub start event: " .. sub.StartEvent ) sub.fsm.fsmparent = self sub.fsm.ReturnEvents = sub.ReturnEvents sub.fsm[sub.StartEvent]( sub.fsm ) @@ -11300,29 +11356,30 @@ do -- FSM self:_call_handler("onstatechange", params) end + else + self:T( "Cannot execute transition." ) + self:T( { From = self.current, Event = EventName, To = to, Can = Can } ) end return nil end function FSM:_delayed_transition( EventName ) - self:E( { EventName = EventName } ) return function( self, DelaySeconds, ... ) - self:T( "Delayed Event: " .. EventName ) + self:T2( "Delayed Event: " .. EventName ) local CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 ) - self:T( { CallID = CallID } ) + self:T2( { CallID = CallID } ) end end function FSM:_create_transition( EventName ) - self:E( { Event = EventName } ) return function( self, ... ) return self._handler( self, EventName , ... ) end end function FSM:_gosub( ParentFrom, ParentEvent ) local fsmtable = {} if self.subs[ParentFrom] and self.subs[ParentFrom][ParentEvent] then - self:E( { ParentFrom, ParentEvent, self.subs[ParentFrom], self.subs[ParentFrom][ParentEvent] } ) + self:T( { ParentFrom, ParentEvent, self.subs[ParentFrom], self.subs[ParentFrom][ParentEvent] } ) return self.subs[ParentFrom][ParentEvent] else return {} @@ -11332,17 +11389,17 @@ do -- FSM function FSM:_isendstate( Current ) local FSMParent = self.fsmparent if FSMParent and self.endstates[Current] then - self:E( { state = Current, endstates = self.endstates, endstate = self.endstates[Current] } ) + self:T( { state = Current, endstates = self.endstates, endstate = self.endstates[Current] } ) FSMParent.current = Current local ParentFrom = FSMParent.current - self:E( ParentFrom ) - self:E( self.ReturnEvents ) + self:T( ParentFrom ) + self:T( self.ReturnEvents ) local Event = self.ReturnEvents[Current] - self:E( { ParentFrom, Event, self.ReturnEvents } ) + self:T( { ParentFrom, Event, self.ReturnEvents } ) if Event then return FSMParent, Event else - self:E( { "Could not find parent event name for state ", ParentFrom } ) + self:T( { "Could not find parent event name for state ", ParentFrom } ) end end @@ -11375,7 +11432,6 @@ do -- FSM end function FSM:can(e) - self:E( { e, self.Events, self.Events[e] } ) local Event = self.Events[e] self:F3( { self.current, Event } ) local To = Event and Event.map[self.current] or Event.map['*'] @@ -11444,8 +11500,9 @@ do -- FSM_CONTROLLABLE end if self[handler] then - self:E( "Calling " .. handler ) - return xpcall( function() return self[handler]( self, self.Controllable, unpack( params ) ) end, ErrorHandler ) + self:F3( "Calling " .. handler ) + local Result, Value = xpcall( function() return self[handler]( self, self.Controllable, unpack( params ) ) end, ErrorHandler ) + return Value --return self[handler]( self, self.Controllable, unpack( params ) ) end end @@ -11477,14 +11534,14 @@ do -- FSM_PROCESS end function FSM_PROCESS:Init( FsmProcess ) - self:E( "No Initialisation" ) + self:T( "No Initialisation" ) end --- Creates a new FSM_PROCESS object based on this FSM_PROCESS. -- @param #FSM_PROCESS self -- @return #FSM_PROCESS function FSM_PROCESS:Copy( Controllable, Task ) - self:E( { self:GetClassNameAndID() } ) + self:T( { self:GetClassNameAndID() } ) local NewFsm = self:New( Controllable, Task ) -- Core.Fsm#FSM_PROCESS @@ -11503,19 +11560,19 @@ do -- FSM_PROCESS -- Copy Processes for ProcessID, Process in pairs( self:GetProcesses() ) do - self:E( { Process} ) + self:T( { Process} ) local FsmProcess = NewFsm:AddProcess( Process.From, Process.Event, Process.fsm:Copy( Controllable, Task ), Process.ReturnEvents ) end -- Copy End States for EndStateID, EndState in pairs( self:GetEndStates() ) do - self:E( EndState ) + self:T( EndState ) NewFsm:AddEndState( EndState ) end -- Copy the score tables for ScoreID, Score in pairs( self:GetScores() ) do - self:E( Score ) + self:T( Score ) NewFsm:AddScore( ScoreID, Score.ScoreText, Score.Score ) end @@ -11585,7 +11642,7 @@ end -- @param Wrapper.Unit#UNIT ProcessUnit -- @return #FSM_PROCESS self function FSM_PROCESS:Assign( ProcessUnit, Task ) - self:E( { Task, ProcessUnit } ) + self:T( { Task, ProcessUnit } ) self:SetControllable( ProcessUnit ) self:SetTask( Task ) @@ -11594,37 +11651,21 @@ end return self end - - --- Adds a score for the FSM_PROCESS to be achieved. - -- @param #FSM_PROCESS self - -- @param #string State is the state of the process when the score needs to be given. (See the relevant state descriptions of the process). - -- @param #string ScoreText is a text describing the score that is given according the status. - -- @param #number Score is a number providing the score of the status. - -- @return #FSM_PROCESS self - function FSM_PROCESS:AddScore( State, ScoreText, Score ) - self:F2( { State, ScoreText, Score } ) - - self.Scores[State] = self.Scores[State] or {} - self.Scores[State].ScoreText = ScoreText - self.Scores[State].Score = Score - - return self - end - + function FSM_PROCESS:onenterAssigned( ProcessUnit ) - self:E( "Assign" ) + self:T( "Assign" ) self.Task:Assign() end function FSM_PROCESS:onenterFailed( ProcessUnit ) - self:E( "Failed" ) + self:T( "Failed" ) self.Task:Fail() end function FSM_PROCESS:onenterSuccess( ProcessUnit ) - self:E( "Success" ) + self:T( "Success" ) self.Task:Success() end @@ -11636,20 +11677,20 @@ end -- @param #string From -- @param #string To function FSM_PROCESS:onstatechange( ProcessUnit, From, Event, To, Dummy ) - self:E( { ProcessUnit, From, Event, To, Dummy, self:IsTrace() } ) + self:T( { ProcessUnit, From, Event, To, Dummy, self:IsTrace() } ) if self:IsTrace() then MESSAGE:New( "@ Process " .. self:GetClassNameAndID() .. " : " .. Event .. " changed to state " .. To, 2 ):ToAll() end - self:E( self.Scores[To] ) + self:T( self._Scores[To] ) -- TODO: This needs to be reworked with a callback functions allocated within Task, and set within the mission script from the Task Objects... - if self.Scores[To] then + if self._Scores[To] then local Task = self.Task local Scoring = Task:GetScoring() if Scoring then - Scoring:_AddMissionTaskScore( Task.Mission, ProcessUnit, self.Scores[To].ScoreText, self.Scores[To].Score ) + Scoring:_AddMissionTaskScore( Task.Mission, ProcessUnit, self._Scores[To].ScoreText, self._Scores[To].Score ) end end end @@ -11683,7 +11724,7 @@ do -- FSM_TASK function FSM_TASK:_call_handler( handler, params ) if self[handler] then - self:E( "Calling " .. handler ) + self:T( "Calling " .. handler ) return self[handler]( self, unpack( params ) ) end end @@ -11735,7 +11776,7 @@ do -- FSM_SET function FSM_SET:_call_handler( handler, params ) if self[handler] then - self:E( "Calling " .. handler ) + self:T( "Calling " .. handler ) return self[handler]( self, self.Set, unpack( params ) ) end end @@ -11767,7 +11808,6 @@ end -- FSM_SET -- === -- -- @module Object --- @author FlightControl --- The OBJECT class -- @type OBJECT @@ -11862,7 +11902,6 @@ end -- === -- -- @module Identifiable --- @author FlightControl --- The IDENTIFIABLE class -- @type IDENTIFIABLE @@ -12084,7 +12123,6 @@ end -- === -- -- @module Positionable --- @author FlightControl --- The POSITIONABLE class -- @type POSITIONABLE @@ -12106,6 +12144,7 @@ POSITIONABLE = { function POSITIONABLE:New( PositionableName ) local self = BASE:Inherit( self, IDENTIFIABLE:New( PositionableName ) ) + self.PositionableName = PositionableName return self end @@ -12114,12 +12153,12 @@ end -- @return Dcs.DCSTypes#Position The 3D position vectors of the POSITIONABLE. -- @return #nil The POSITIONABLE is not existing or alive. function POSITIONABLE:GetPositionVec3() - self:F2( self.PositionableName ) + self:E( self.PositionableName ) local DCSPositionable = self:GetDCSObject() if DCSPositionable then - local PositionablePosition = DCSPositionable:getPosition() + local PositionablePosition = DCSPositionable:getPosition().p self:T3( PositionablePosition ) return PositionablePosition end @@ -12171,6 +12210,27 @@ function POSITIONABLE:GetPointVec2() return nil end +--- Returns a POINT_VEC3 object indicating the point in 3D of the POSITIONABLE within the mission. +-- @param Wrapper.Positionable#POSITIONABLE self +-- @return Core.Point#POINT_VEC3 The 3D point vector of the POSITIONABLE. +-- @return #nil The POSITIONABLE is not existing or alive. +function POSITIONABLE:GetPointVec3() + self:F2( self.PositionableName ) + + local DCSPositionable = self:GetDCSObject() + + if DCSPositionable then + local PositionableVec3 = self:GetPositionVec3() + + local PositionablePointVec3 = POINT_VEC3:NewFromVec3( PositionableVec3 ) + + self:T2( PositionablePointVec3 ) + return PositionablePointVec3 + end + + return nil +end + --- Returns a random @{Dcs.DCSTypes#Vec3} vector within a range, indicating the point in 3D of the POSITIONABLE within the mission. -- @param Wrapper.Positionable#POSITIONABLE self @@ -12280,20 +12340,13 @@ end --- Returns true if the POSITIONABLE is in the air. +-- Polymorphic, is overridden in GROUP and UNIT. -- @param Wrapper.Positionable#POSITIONABLE self -- @return #boolean true if in the air. -- @return #nil The POSITIONABLE is not existing or alive. function POSITIONABLE:InAir() self:F2( self.PositionableName ) - local DCSPositionable = self:GetDCSObject() - - if DCSPositionable then - local PositionableInAir = DCSPositionable:inAir() - self:T3( PositionableInAir ) - return PositionableInAir - end - return nil end @@ -12375,6 +12428,7 @@ end -- @param #POSITIONABLE self -- @param #string Message The message text -- @param Dcs.DCSTYpes#Duration Duration The duration of the message. +-- @param Dcs.DCScoalition#coalition MessageCoalition The Coalition receiving the message. -- @param #string Name (optional) The Name of the sender. If not provided, the Name is the type of the Positionable. function POSITIONABLE:MessageToCoalition( Message, Duration, MessageCoalition, Name ) self:F2( { Message, Duration } ) @@ -12522,7 +12576,7 @@ end -- * @{#CONTROLLABLE.TaskEmbarkToTransport}: (GROUND) Embark to a Transport landed at a location. -- * @{#CONTROLLABLE.TaskEscort}: (AIR) Escort another airborne controllable. -- * @{#CONTROLLABLE.TaskFAC_AttackControllable}: (AIR + GROUND) The task makes the controllable/unit a FAC and orders the FAC to control the target (enemy ground controllable) destruction. --- * @{#CONTROLLABLE.TaskFireAtPoint}: (GROUND) Fire at a VEC2 point until ammunition is finished. +-- * @{#CONTROLLABLE.TaskFireAtPoint}: (GROUND) Fire some or all ammunition at a VEC2 point. -- * @{#CONTROLLABLE.TaskFollow}: (AIR) Following another airborne controllable. -- * @{#CONTROLLABLE.TaskHold}: (GROUND) Hold ground controllable from moving. -- * @{#CONTROLLABLE.TaskHoldPosition}: (AIR) Hold position at the current position of the first unit of the controllable. @@ -12606,7 +12660,6 @@ end -- === -- -- @module Controllable --- @author FlightControl --- The CONTROLLABLE class -- @type CONTROLLABLE @@ -12627,6 +12680,8 @@ function CONTROLLABLE:New( ControllableName ) local self = BASE:Inherit( self, POSITIONABLE:New( ControllableName ) ) self:F2( ControllableName ) self.ControllableName = ControllableName + + self.TaskScheduler = SCHEDULER:New( self ) return self end @@ -12648,6 +12703,58 @@ function CONTROLLABLE:_GetController() return nil end +-- Get methods + +--- Returns the UNITs wrappers of the DCS Units of the Controllable (default is a GROUP). +-- @param #CONTROLLABLE self +-- @return #list The UNITs wrappers. +function CONTROLLABLE:GetUnits() + self:F2( { self.ControllableName } ) + local DCSControllable = self:GetDCSObject() + + if DCSControllable then + local DCSUnits = DCSControllable:getUnits() + local Units = {} + for Index, UnitData in pairs( DCSUnits ) do + Units[#Units+1] = UNIT:Find( UnitData ) + end + self:T3( Units ) + return Units + end + + return nil +end + + +--- Returns the health. Dead controllables have health <= 1.0. +-- @param #CONTROLLABLE self +-- @return #number The controllable health value (unit or group average). +-- @return #nil The controllable is not existing or alive. +function CONTROLLABLE:GetLife() + self:F2( self.ControllableName ) + + local DCSControllable = self:GetDCSObject() + + if DCSControllable then + local UnitLife = 0 + local Units = self:GetUnits() + if #Units == 1 then + local Unit = Units[1] -- Wrapper.Unit#UNIT + UnitLife = Unit:GetLife() + else + local UnitLifeTotal = 0 + for UnitID, Unit in pairs( Units ) do + local Unit = Unit -- Wrapper.Unit#UNIT + UnitLifeTotal = UnitLifeTotal + Unit:GetLife() + end + UnitLife = UnitLifeTotal / #Units + end + return UnitLife + end + + return nil +end + -- Tasks @@ -12685,7 +12792,7 @@ function CONTROLLABLE:PushTask( DCSTask, WaitTime ) -- Controller:pushTask( DCSTask ) if WaitTime then - SCHEDULER:New( Controller, Controller.pushTask, { DCSTask }, WaitTime ) + self.TaskScheduler:Schedule( Controller, Controller.pushTask, { DCSTask }, WaitTime ) else Controller:pushTask( DCSTask ) end @@ -12707,7 +12814,7 @@ function CONTROLLABLE:SetTask( DCSTask, WaitTime ) if DCSControllable then local Controller = self:_GetController() - self:E(Controller) + self:T3( Controller ) -- When a controllable SPAWNs, it takes about a second to get the controllable in the simulator. Setting tasks to unspawned controllables provides unexpected results. -- Therefore we schedule the functions to set the mission and options for the Controllable. @@ -12716,7 +12823,7 @@ function CONTROLLABLE:SetTask( DCSTask, WaitTime ) if not WaitTime then Controller:setTask( DCSTask ) else - SCHEDULER:New( Controller, Controller.setTask, { DCSTask }, WaitTime ) + self.TaskScheduler:Schedule( Controller, Controller.setTask, { DCSTask }, WaitTime ) end return self @@ -12787,6 +12894,10 @@ function CONTROLLABLE:TaskCombo( DCSTasks ) tasks = DCSTasks } } + + for TaskID, Task in ipairs( DCSTasks ) do + self:E( Task ) + end self:T3( { DCSTaskCombo } ) return DCSTaskCombo @@ -12972,19 +13083,24 @@ function CONTROLLABLE:TaskAttackUnit( AttackUnit, WeaponType, WeaponExpend, Atta -- } local DCSTask - DCSTask = { id = 'AttackUnit', + DCSTask = { + id = 'AttackUnit', params = { + altitudeEnabled = true, unitId = AttackUnit:GetID(), - weaponType = WeaponType, - expend = WeaponExpend, - attackQty = AttackQty, - direction = Direction, - attackQtyLimit = AttackQtyLimit, - controllableAttack = ControllableAttack, - }, - }, + attackQtyLimit = AttackQtyLimit or false, + attackQty = AttackQty or 2, + expend = WeaponExpend or "Auto", + altitude = 2000, + directionEnabled = true, + groupAttack = true, + --weaponType = WeaponType or 1073741822, + direction = Direction or 0, + } + } - self:T3( { DCSTask } ) + self:E( DCSTask ) + return DCSTask end @@ -13368,15 +13484,18 @@ end -- @param #CONTROLLABLE self -- @param Dcs.DCSTypes#Vec2 Vec2 The point to fire at. -- @param Dcs.DCSTypes#Distance Radius The radius of the zone to deploy the fire at. +-- @param #number AmmoCount (optional) Quantity of ammunition to expand (omit to fire until ammunition is depleted). -- @return Dcs.DCSTasking.Task#Task The DCS task structure. -function CONTROLLABLE:TaskFireAtPoint( Vec2, Radius ) - self:F2( { self.ControllableName, Vec2, Radius } ) +function CONTROLLABLE:TaskFireAtPoint( Vec2, Radius, AmmoCount ) + self:F2( { self.ControllableName, Vec2, Radius, AmmoCount } ) -- FireAtPoint = { -- id = 'FireAtPoint', -- params = { -- point = Vec2, -- radius = Distance, + -- expendQty = number, + -- expendQtyEnabled = boolean, -- } -- } @@ -13385,8 +13504,15 @@ function CONTROLLABLE:TaskFireAtPoint( Vec2, Radius ) params = { point = Vec2, radius = Radius, + expendQty = 100, -- dummy value + expendQtyEnabled = false, } } + + if AmmoCount then + DCSTask.params.expendQty = AmmoCount + DCSTask.params.expendQtyEnabled = true + end self:T3( { DCSTask } ) return DCSTask @@ -13977,7 +14103,7 @@ function CONTROLLABLE:Route( GoPoints ) local MissionTask = { id = 'Mission', params = { route = { points = Points, }, }, } local Controller = self:_GetController() --Controller.setTask( Controller, MissionTask ) - SCHEDULER:New( Controller, Controller.setTask, { MissionTask }, 1 ) + self.TaskScheduler:Schedule( Controller, Controller.setTask, { MissionTask }, 1 ) return self end @@ -14605,7 +14731,7 @@ end -- @param #table WayPoints If WayPoints is given, then use the route. -- @return #CONTROLLABLE function CONTROLLABLE:WayPointInitialize( WayPoints ) - self:F( { WayPoint, WayPointIndex, WayPointFunction } ) + self:F( { WayPoints } ) if WayPoints then self.WayPoints = WayPoints @@ -14616,6 +14742,18 @@ function CONTROLLABLE:WayPointInitialize( WayPoints ) return self end +--- Get the current WayPoints set with the WayPoint functions( Note that the WayPoints can be nil, although there ARE waypoints). +-- @param #CONTROLLABLE self +-- @return #table WayPoints If WayPoints is given, then return the WayPoints structure. +function CONTROLLABLE:GetWayPoints() + self:F( ) + + if self.WayPoints then + return self.WayPoints + end + + return nil +end --- Registers a waypoint function that will be executed when the controllable moves over the WayPoint. -- @param #CONTROLLABLE self @@ -14684,10 +14822,7 @@ function CONTROLLABLE:WayPointExecute( WayPoint, WaitTime ) return self end --- Message APIs - - ---- This module contains the GROUP class. +-- Message APIs--- This module contains the GROUP class. -- -- 1) @{Wrapper.Group#GROUP} class, extends @{Wrapper.Controllable#CONTROLLABLE} -- ============================================================= @@ -14717,114 +14852,26 @@ end -- * @{#GROUP.Find}(): Find a GROUP instance from the _DATABASE object using a DCS Group object. -- * @{#GROUP.FindByName}(): Find a GROUP instance from the _DATABASE object using a DCS Group name. -- --- 1.2) GROUP task methods --- ----------------------- --- Several group task methods are available that help you to prepare tasks. --- These methods return a string consisting of the task description, which can then be given to either a --- @{Wrapper.Controllable#CONTROLLABLE.PushTask} or @{Wrapper.Controllable#CONTROLLABLE.SetTask} method to assign the task to the GROUP. --- Tasks are specific for the category of the GROUP, more specific, for AIR, GROUND or AIR and GROUND. --- Each task description where applicable indicates for which group category the task is valid. --- There are 2 main subdivisions of tasks: Assigned tasks and EnRoute tasks. --- --- ### 1.2.1) Assigned task methods --- --- Assigned task methods make the group execute the task where the location of the (possible) targets of the task are known before being detected. --- This is different from the EnRoute tasks, where the targets of the task need to be detected before the task can be executed. --- --- Find below a list of the **assigned task** methods: --- --- * @{Wrapper.Controllable#CONTROLLABLE.TaskAttackGroup}: (AIR) Attack a Group. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskAttackMapObject}: (AIR) Attacking the map object (building, structure, e.t.c). --- * @{Wrapper.Controllable#CONTROLLABLE.TaskAttackUnit}: (AIR) Attack the Unit. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskBombing}: (Wrapper.Controllable#CONTROLLABLEDelivering weapon at the point on the ground. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskBombingRunway}: (AIR) Delivering weapon on the runway. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskEmbarking}: (AIR) Move the group to a Vec2 Point, wait for a defined duration and embark a group. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskEmbarkToTransport}: (GROUND) Embark to a Transport landed at a location. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskEscort}: (AIR) Escort another airborne group. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskFAC_AttackGroup}: (AIR + GROUND) The task makes the group/unit a FAC and orders the FAC to control the target (enemy ground group) destruction. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskFireAtPoint}: (GROUND) Fire at a VEC2 point until ammunition is finished. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskFollow}: (AIR) Following another airborne group. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskHold}: (GROUND) Hold ground group from moving. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskHoldPosition}: (AIR) Hold position at the current position of the first unit of the group. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskLand}: (AIR HELICOPTER) Landing at the ground. For helicopters only. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskLandAtZone}: (AIR) Land the group at a @{Core.Zone#ZONE_RADIUS). --- * @{Wrapper.Controllable#CONTROLLABLE.TaskOrbitCircle}: (AIR) Orbit at the current position of the first unit of the group at a specified alititude. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskOrbitCircleAtVec2}: (AIR) Orbit at a specified position at a specified alititude during a specified duration with a specified speed. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskRefueling}: (AIR) Refueling from the nearest tanker. No parameters. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskRoute}: (AIR + GROUND) Return a Misson task to follow a given route defined by Points. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskRouteToVec2}: (AIR + GROUND) Make the Group move to a given point. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskRouteToVec3}: (AIR + GROUND) Make the Group move to a given point. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskRouteToZone}: (AIR + GROUND) Route the group to a given zone. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskReturnToBase}: (AIR) Route the group to an airbase. +-- ## 1.2) GROUP task methods -- --- ### 1.2.2) EnRoute task methods --- --- EnRoute tasks require the targets of the task need to be detected by the group (using its sensors) before the task can be executed: --- --- * @{Wrapper.Controllable#CONTROLLABLE.EnRouteTaskAWACS}: (AIR) Aircraft will act as an AWACS for friendly units (will provide them with information about contacts). No parameters. --- * @{Wrapper.Controllable#CONTROLLABLE.EnRouteTaskEngageGroup}: (AIR) Engaging a group. The task does not assign the target group to the unit/group to attack now; it just allows the unit/group to engage the target group as well as other assigned targets. --- * @{Wrapper.Controllable#CONTROLLABLE.EnRouteTaskEngageTargets}: (AIR) Engaging targets of defined types. --- * @{Wrapper.Controllable#CONTROLLABLE.EnRouteTaskEWR}: (AIR) Attack the Unit. --- * @{Wrapper.Controllable#CONTROLLABLE.EnRouteTaskFAC}: (AIR + GROUND) The task makes the group/unit a FAC and lets the FAC to choose a targets (enemy ground group) around as well as other assigned targets. --- * @{Wrapper.Controllable#CONTROLLABLE.EnRouteTaskFAC_EngageGroup}: (AIR + GROUND) The task makes the group/unit a FAC and lets the FAC to choose the target (enemy ground group) as well as other assigned targets. --- * @{Wrapper.Controllable#CONTROLLABLE.EnRouteTaskTanker}: (AIR) Aircraft will act as a tanker for friendly units. No parameters. --- --- ### 1.2.3) Preparation task methods --- --- There are certain task methods that allow to tailor the task behaviour: +-- A GROUP is a @{Controllable}. See the @{Controllable} task methods section for a description of the task methods. -- --- * @{Wrapper.Controllable#CONTROLLABLE.TaskWrappedAction}: Return a WrappedAction Task taking a Command. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskCombo}: Return a Combo Task taking an array of Tasks. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskCondition}: Return a condition section for a controlled task. --- * @{Wrapper.Controllable#CONTROLLABLE.TaskControlled}: Return a Controlled Task taking a Task and a TaskCondition. --- -- ### 1.2.4) Obtain the mission from group templates -- -- Group templates contain complete mission descriptions. Sometimes you want to copy a complete mission from a group and assign it to another: -- -- * @{Wrapper.Controllable#CONTROLLABLE.TaskMission}: (AIR + GROUND) Return a mission task from a mission template. -- --- 1.3) GROUP Command methods --- -------------------------- --- Group **command methods** prepare the execution of commands using the @{Wrapper.Controllable#CONTROLLABLE.SetCommand} method: +-- ## 1.3) GROUP Command methods +-- +-- A GROUP is a @{Controllable}. See the @{Controllable} command methods section for a description of the command methods. -- --- * @{Wrapper.Controllable#CONTROLLABLE.CommandDoScript}: Do Script command. --- * @{Wrapper.Controllable#CONTROLLABLE.CommandSwitchWayPoint}: Perform a switch waypoint command. +-- ## 1.4) GROUP option methods +-- +-- A GROUP is a @{Controllable}. See the @{Controllable} option methods section for a description of the option methods. -- --- 1.4) GROUP Option methods --- ------------------------- --- Group **Option methods** change the behaviour of the Group while being alive. +-- ## 1.5) GROUP Zone validation methods -- --- ### 1.4.1) Rule of Engagement: --- --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROEWeaponFree} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROEOpenFire} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROEReturnFire} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROEEvadeFire} --- --- To check whether an ROE option is valid for a specific group, use: --- --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROEWeaponFreePossible} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROEOpenFirePossible} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROEReturnFirePossible} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROEEvadeFirePossible} --- --- ### 1.4.2) Rule on thread: --- --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROTNoReaction} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROTPassiveDefense} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROTEvadeFire} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROTVertical} --- --- To test whether an ROT option is valid for a specific group, use: --- --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROTNoReactionPossible} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROTPassiveDefensePossible} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROTEvadeFirePossible} --- * @{Wrapper.Controllable#CONTROLLABLE.OptionROTVerticalPossible} --- --- 1.5) GROUP Zone validation methods --- ---------------------------------- -- The group can be validated whether it is completely, partly or not within a @{Zone}. -- Use the following Zone validation methods on the group: -- @@ -14834,6 +14881,43 @@ end -- -- The zone can be of any @{Zone} class derived from @{Core.Zone#ZONE_BASE}. So, these methods are polymorphic to the zones tested on. -- +-- ## 1.6) GROUP AI methods +-- +-- A GROUP has AI methods to control the AI activation. +-- +-- * @{#GROUP.SetAIOnOff}(): Turns the GROUP AI On or Off. +-- * @{#GROUP.SetAIOn}(): Turns the GROUP AI On. +-- * @{#GROUP.SetAIOff}(): Turns the GROUP AI Off. +-- +-- ==== +-- +-- # **API CHANGE HISTORY** +-- +-- The underlying change log documents the API changes. Please read this carefully. The following notation is used: +-- +-- * **Added** parts are expressed in bold type face. +-- * _Removed_ parts are expressed in italic type face. +-- +-- Hereby the change log: +-- +-- 2017-01-24: GROUP:**SetAIOnOff( AIOnOff )** added. +-- +-- 2017-01-24: GROUP:**SetAIOn()** added. +-- +-- 2017-01-24: GROUP:**SetAIOff()** added. +-- +-- === +-- +-- # **AUTHORS and CONTRIBUTIONS** +-- +-- ### Contributions: +-- +-- * [**Entropy**](https://forums.eagle.ru/member.php?u=111471), **Afinegan**: Came up with the requirement for AIOnOff(). +-- +-- ### Authors: +-- +-- * **FlightControl**: Design & Programming +-- -- @module Group -- @author FlightControl @@ -14894,6 +14978,23 @@ function GROUP:GetDCSObject() return nil end +--- Returns the @{Dcs.DCSTypes#Position3} position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission. +-- @param Wrapper.Positionable#POSITIONABLE self +-- @return Dcs.DCSTypes#Position The 3D position vectors of the POSITIONABLE. +-- @return #nil The POSITIONABLE is not existing or alive. +function GROUP:GetPositionVec3() -- Overridden from POSITIONABLE:GetPositionVec3() + self:F2( self.PositionableName ) + + local DCSPositionable = self:GetDCSObject() + + if DCSPositionable then + local PositionablePosition = DCSPositionable:getUnits()[1]:getPosition().p + self:T3( PositionablePosition ) + return PositionablePosition + end + + return nil +end --- Returns if the DCS Group is alive. -- When the group exists at run-time, this method will return true, otherwise false. @@ -15080,26 +15181,6 @@ function GROUP:GetInitialSize() return nil end ---- Returns the UNITs wrappers of the DCS Units of the DCS Group. --- @param #GROUP self --- @return #table The UNITs wrappers. -function GROUP:GetUnits() - self:F2( { self.GroupName } ) - local DCSGroup = self:GetDCSObject() - - if DCSGroup then - local DCSUnits = DCSGroup:getUnits() - local Units = {} - for Index, UnitData in pairs( DCSUnits ) do - Units[#Units+1] = UNIT:Find( UnitData ) - end - self:T3( Units ) - return Units - end - - return nil -end - --- Returns the DCS Units of the DCS Group. -- @param #GROUP self @@ -15186,7 +15267,7 @@ end --- Is Zone Functions +do -- Is Zone methods --- Returns true if all units of the group are within a @{Zone}. -- @param #GROUP self @@ -15352,6 +15433,49 @@ function GROUP:AllOnGround() return nil end +end + +do -- AI methods + + --- Turns the AI On or Off for the GROUP. + -- @param #GROUP self + -- @param #boolean AIOnOff The value true turns the AI On, the value false turns the AI Off. + -- @return #GROUP The GROUP. + function GROUP:SetAIOnOff( AIOnOff ) + + local DCSGroup = self:GetDCSObject() -- Dcs.DCSGroup#Group + + if DCSGroup then + local DCSController = DCSGroup:getController() -- Dcs.DCSController#Controller + if DCSController then + DCSController:setOnOff( AIOnOff ) + return self + end + end + + return nil + end + + --- Turns the AI On for the GROUP. + -- @param #GROUP self + -- @return #GROUP The GROUP. + function GROUP:SetAIOn() + + return self:SetAIOnOff( true ) + end + + --- Turns the AI Off for the GROUP. + -- @param #GROUP self + -- @return #GROUP The GROUP. + function GROUP:SetAIOff() + + return self:SetAIOnOff( false ) + end + +end + + + --- Returns the current maximum velocity of the group. -- Each unit within the group gets evaluated, and the maximum velocity (= the unit which is going the fastest) is returned. -- @param #GROUP self @@ -15571,6 +15695,32 @@ function GROUP:CalculateThreatLevelA2G() return MaxThreatLevelA2G end +--- Returns true if the first unit of the GROUP is in the air. +-- @param Wrapper.Group#GROUP self +-- @return #boolean true if in the first unit of the group is in the air. +-- @return #nil The GROUP is not existing or not alive. +function GROUP:InAir() + self:F2( self.GroupName ) + + local DCSGroup = self:GetDCSObject() + + if DCSGroup then + local DCSUnit = DCSGroup:getUnit(1) + if DCSUnit then + local GroupInAir = DCSGroup:getUnit(1):inAir() + self:T3( GroupInAir ) + return GroupInAir + end + end + + return nil +end + +function GROUP:OnReSpawn( ReSpawnFunction ) + + self.ReSpawnFunction = ReSpawnFunction +end + --- This module contains the UNIT class. -- @@ -16041,6 +16191,25 @@ function UNIT:GetFuel() return nil end +--- Returns the UNIT in a UNIT list of one element. +-- @param #UNIT self +-- @return #list The UNITs wrappers. +function UNIT:GetUnits() + self:F2( { self.UnitName } ) + local DCSUnit = self:GetDCSObject() + + if DCSUnit then + local DCSUnits = DCSUnit:getUnits() + local Units = {} + Units[1] = UNIT:Find( DCSUnit ) + self:T3( Units ) + return Units + end + + return nil +end + + --- Returns the unit's health. Dead units has health <= 1.0. -- @param #UNIT self -- @return #number The Unit's health value. @@ -16373,6 +16542,24 @@ function UNIT:IsShip() return nil end +--- Returns true if the UNIT is in the air. +-- @param Wrapper.Positionable#UNIT self +-- @return #boolean true if in the air. +-- @return #nil The UNIT is not existing or alive. +function UNIT:InAir() + self:F2( self.UnitName ) + + local DCSUnit = self:GetDCSObject() + + if DCSUnit then + local UnitInAir = DCSUnit:inAir() + self:T3( UnitInAir ) + return UnitInAir + end + + return nil +end + --- This module contains the CLIENT class. -- -- 1) @{Wrapper.Client#CLIENT} class, extends @{Wrapper.Unit#UNIT} @@ -17313,27 +17500,30 @@ function SCORING:_AddMissionTaskScore( Mission, PlayerUnit, Text, Score ) local PlayerName = PlayerUnit:GetPlayerName() local MissionName = Mission:GetName() - self:F( { Mission:GetName(), PlayerUnit.UnitName, PlayerName, Text, Score } ) + self:E( { Mission:GetName(), PlayerUnit.UnitName, PlayerName, Text, Score } ) + + -- PlayerName can be nil, if the Unit with the player crashed or due to another reason. + if PlayerName then + local PlayerData = self.Players[PlayerName] - local PlayerData = self.Players[PlayerName] - - if not PlayerData.Mission[MissionName] then - PlayerData.Mission[MissionName] = {} - PlayerData.Mission[MissionName].ScoreTask = 0 - PlayerData.Mission[MissionName].ScoreMission = 0 + if not PlayerData.Mission[MissionName] then + PlayerData.Mission[MissionName] = {} + PlayerData.Mission[MissionName].ScoreTask = 0 + PlayerData.Mission[MissionName].ScoreMission = 0 + end + + self:T( PlayerName ) + self:T( PlayerData.Mission[MissionName] ) + + PlayerData.Score = self.Players[PlayerName].Score + Score + PlayerData.Mission[MissionName].ScoreTask = self.Players[PlayerName].Mission[MissionName].ScoreTask + Score + + MESSAGE:New( "Player '" .. PlayerName .. "' has " .. Text .. " in Mission '" .. MissionName .. "'. " .. + Score .. " task score!", + 30 ):ToAll() + + self:ScoreCSV( PlayerName, "TASK_" .. MissionName:gsub( ' ', '_' ), 1, Score, PlayerUnit:GetName() ) end - - self:T( PlayerName ) - self:T( PlayerData.Mission[MissionName] ) - - PlayerData.Score = self.Players[PlayerName].Score + Score - PlayerData.Mission[MissionName].ScoreTask = self.Players[PlayerName].Mission[MissionName].ScoreTask + Score - - MESSAGE:New( "Player '" .. PlayerName .. "' has " .. Text .. " in Mission '" .. MissionName .. "'. " .. - Score .. " task score!", - 30 ):ToAll() - - self:ScoreCSV( PlayerName, "TASK_" .. MissionName:gsub( ' ', '_' ), 1, Score, PlayerUnit:GetName() ) end @@ -17475,7 +17665,7 @@ function SCORING:_EventOnHit( Event ) ):ToAll() self:ScoreCSV( InitPlayerName, "HIT_PENALTY", 1, -25, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType ) else - self.Players[InitPlayerName].Score = self.Players[InitPlayerName].Score + 10 + self.Players[InitPlayerName].Score = self.Players[InitPlayerName].Score + 1 self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].Score = self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].Score + 1 self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].ScoreHit = self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].ScoreHit + 1 MESSAGE:New( "Player '" .. InitPlayerName .. "' hit a target " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. @@ -18231,6 +18421,9 @@ end -- * @{#SPAWN.InitRepeat}(): Re-spawn groups when they land at the home base. Similar methods are @{#SPAWN.InitRepeatOnLanding} and @{#SPAWN.InitRepeatOnEngineShutDown}. -- * @{#SPAWN.InitRandomizeUnits}(): Randomizes the @{Unit}s in the @{Group} that is spawned within a **radius band**, given an Outer and Inner radius. -- * @{#SPAWN.InitRandomizeZones}(): Randomizes the spawning between a predefined list of @{Zone}s that are declared using this function. Each zone can be given a probability factor. +-- * @{#SPAWN.InitAIOn}(): Turns the AI On when spawning the new @{Group} object. +-- * @{#SPAWN.InitAIOff}(): Turns the AI Off when spawning the new @{Group} object. +-- * @{#SPAWN.InitAIOnOff}(): Turns the AI On or Off when spawning the new @{Group} object. -- -- ## 1.3) SPAWN spawning methods -- @@ -18293,71 +18486,40 @@ end -- -- Hereby the change log: -- --- 2016-08-15: SPAWN:**InitCleanUp**( SpawnCleanUpInterval ) replaces SPAWN:_CleanUp_( SpawnCleanUpInterval ) +-- 2017-01-24: SPAWN:**InitAIOnOff( AIOnOff )** added. -- --- * Want to ensure that the methods starting with **Init** are the first called methods before any _Spawn_ method is called! --- * This notation makes it now more clear which methods are initialization methods and which methods are Spawn enablement methods. +-- 2017-01-24: SPAWN:**InitAIOn()** added. +-- +-- 2017-01-24: SPAWN:**InitAIOff()** added. +-- +-- 2016-08-15: SPAWN:**InitCleanUp**( SpawnCleanUpInterval ) replaces SPAWN:_CleanUp_( SpawnCleanUpInterval ). -- -- 2016-08-15: SPAWN:**InitRandomizeZones( SpawnZones )** added. -- --- * This method provides the functionality to randomize the spawning of the Groups at a given list of zones of different types. --- -- 2016-08-14: SPAWN:**OnSpawnGroup**( SpawnCallBackFunction, ... ) replaces SPAWN:_SpawnFunction_( SpawnCallBackFunction, ... ). -- -- 2016-08-14: SPAWN.SpawnInZone( Zone, __RandomizeGroup__, SpawnIndex ) replaces SpawnInZone( Zone, _RandomizeUnits, OuterRadius, InnerRadius,_ SpawnIndex ). -- --- * The RandomizeUnits, OuterRadius and InnerRadius have been replaced with a new method @{#SPAWN.InitRandomizeUnits}( RandomizeUnits, OuterRadius, InnerRadius ). --- * A new parameter RandomizeGroup to reflect the randomization of the starting position of the Spawned @{Group}. --- -- 2016-08-14: SPAWN.SpawnFromVec3( Vec3, SpawnIndex ) replaces SpawnFromVec3( Vec3, _RandomizeUnits, OuterRadius, InnerRadius,_ SpawnIndex ): -- --- * The RandomizeUnits, OuterRadius and InnerRadius have been replaced with a new method @{#SPAWN.InitRandomizeUnits}( RandomizeUnits, OuterRadius, InnerRadius ). --- * A new parameter RandomizeGroup to reflect the randomization of the starting position of the Spawned @{Group}. --- -- 2016-08-14: SPAWN.SpawnFromVec2( Vec2, SpawnIndex ) replaces SpawnFromVec2( Vec2, _RandomizeUnits, OuterRadius, InnerRadius,_ SpawnIndex ): -- --- * The RandomizeUnits, OuterRadius and InnerRadius have been replaced with a new method @{#SPAWN.InitRandomizeUnits}( RandomizeUnits, OuterRadius, InnerRadius ). --- * A new parameter RandomizeGroup to reflect the randomization of the starting position of the Spawned @{Group}. --- -- 2016-08-14: SPAWN.SpawnFromUnit( SpawnUnit, SpawnIndex ) replaces SpawnFromUnit( SpawnUnit, _RandomizeUnits, OuterRadius, InnerRadius,_ SpawnIndex ): -- --- * The RandomizeUnits, OuterRadius and InnerRadius have been replaced with a new method @{#SPAWN.InitRandomizeUnits}( RandomizeUnits, OuterRadius, InnerRadius ). --- * A new parameter RandomizeGroup to reflect the randomization of the starting position of the Spawned @{Group}. --- -- 2016-08-14: SPAWN.SpawnFromUnit( SpawnUnit, SpawnIndex ) replaces SpawnFromStatic( SpawnStatic, _RandomizeUnits, OuterRadius, InnerRadius,_ SpawnIndex ): -- --- * The RandomizeUnits, OuterRadius and InnerRadius have been replaced with a new method @{#SPAWN.InitRandomizeUnits}( RandomizeUnits, OuterRadius, InnerRadius ). --- * A new parameter RandomizeGroup to reflect the randomization of the starting position of the Spawned @{Group}. --- -- 2016-08-14: SPAWN.**InitRandomizeUnits( RandomizeUnits, OuterRadius, InnerRadius )** added: -- --- * This method enables the randomization of units at the first route point in a radius band at a spawn event. --- -- 2016-08-14: SPAWN.**Init**Limit( SpawnMaxUnitsAlive, SpawnMaxGroups ) replaces SPAWN._Limit_( SpawnMaxUnitsAlive, SpawnMaxGroups ): -- --- * Want to ensure that the methods starting with **Init** are the first called methods before any _Spawn_ method is called! --- * This notation makes it now more clear which methods are initialization methods and which methods are Spawn enablement methods. --- -- 2016-08-14: SPAWN.**Init**Array( SpawnAngle, SpawnWidth, SpawnDeltaX, SpawnDeltaY ) replaces SPAWN._Array_( SpawnAngle, SpawnWidth, SpawnDeltaX, SpawnDeltaY ). -- --- * Want to ensure that the methods starting with **Init** are the first called methods before any _Spawn_ method is called! --- * This notation makes it now more clear which methods are initialization methods and which methods are Spawn enablement methods. --- -- 2016-08-14: SPAWN.**Init**RandomizeRoute( SpawnStartPoint, SpawnEndPoint, SpawnRadius, SpawnHeight ) replaces SPAWN._RandomizeRoute_( SpawnStartPoint, SpawnEndPoint, SpawnRadius, SpawnHeight ). -- --- * Want to ensure that the methods starting with **Init** are the first called methods before any _Spawn_ method is called! --- * This notation makes it now more clear which methods are initialization methods and which methods are Spawn enablement methods. --- -- 2016-08-14: SPAWN.**Init**RandomizeTemplate( SpawnTemplatePrefixTable ) replaces SPAWN._RandomizeTemplate_( SpawnTemplatePrefixTable ). -- --- * Want to ensure that the methods starting with **Init** are the first called methods before any _Spawn_ method is called! --- * This notation makes it now more clear which methods are initialization methods and which methods are Spawn enablement methods. --- -- 2016-08-14: SPAWN.**Init**UnControlled() replaces SPAWN._UnControlled_(). -- --- * Want to ensure that the methods starting with **Init** are the first called methods before any _Spawn_ method is called! --- * This notation makes it now more clear which methods are initialization methods and which methods are Spawn enablement methods. --- -- === -- -- # **AUTHORS and CONTRIBUTIONS** @@ -18365,6 +18527,7 @@ end -- ### Contributions: -- -- * **Aaron**: Posed the idea for Group position randomization at SpawnInZone and make the Unit randomization separate from the Group randomization. +-- * [**Entropy**](https://forums.eagle.ru/member.php?u=111471), **Afinegan**: Came up with the requirement for AIOnOff(). -- -- ### Authors: -- @@ -18422,6 +18585,7 @@ function SPAWN:New( SpawnTemplatePrefix ) self.SpawnMaxGroups = 0 -- The maximum amount of groups that can be spawned. self.SpawnRandomize = false -- Sets the randomization flag of new Spawned units to false. self.SpawnVisible = false -- Flag that indicates if all the Groups of the SpawnGroup need to be visible when Spawned. + self.AIOnOff = true -- The AI is on by default when spawning a group. self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned. else @@ -18459,6 +18623,7 @@ function SPAWN:NewWithAlias( SpawnTemplatePrefix, SpawnAliasPrefix ) self.SpawnMaxGroups = 0 -- The maximum amount of groups that can be spawned. self.SpawnRandomize = false -- Sets the randomization flag of new Spawned units to false. self.SpawnVisible = false -- Flag that indicates if all the Groups of the SpawnGroup need to be visible when Spawned. + self.AIOnOff = true -- The AI is on by default when spawning a group. self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned. else @@ -18749,7 +18914,34 @@ function SPAWN:InitArray( SpawnAngle, SpawnWidth, SpawnDeltaX, SpawnDeltaY ) return self end +do -- AI methods + --- Turns the AI On or Off for the @{Group} when spawning. + -- @param #SPAWN self + -- @param #boolean AIOnOff A value of true sets the AI On, a value of false sets the AI Off. + -- @return #SPAWN The SPAWN object + function SPAWN:InitAIOnOff( AIOnOff ) + + self.AIOnOff = AIOnOff + return self + end + + --- Turns the AI On for the @{Group} when spawning. + -- @param #SPAWN self + -- @return #SPAWN The SPAWN object + function SPAWN:InitAIOn() + + return self:InitAIOnOff( true ) + end + + --- Turns the AI Off for the @{Group} when spawning. + -- @param #SPAWN self + -- @return #SPAWN The SPAWN object + function SPAWN:InitAIOff() + + return self:InitAIOnOff( false ) + end +end -- AI methods --- Will spawn a group based on the internal index. -- Note: Uses @{DATABASE} module defined in MOOSE. @@ -18775,6 +18967,7 @@ function SPAWN:ReSpawn( SpawnIndex ) -- TODO: This logic makes DCS crash and i don't know why (yet). local SpawnGroup = self:GetGroupFromIndex( SpawnIndex ) + local WayPoints = SpawnGroup and SpawnGroup.WayPoints or nil if SpawnGroup then local SpawnDCSGroup = SpawnGroup:GetDCSObject() if SpawnDCSGroup then @@ -18782,7 +18975,18 @@ function SPAWN:ReSpawn( SpawnIndex ) end end - return self:SpawnWithIndex( SpawnIndex ) + local SpawnGroup = self:SpawnWithIndex( SpawnIndex ) + if SpawnGroup and WayPoints then + -- If there were WayPoints set, then Re-Execute those WayPoints! + SpawnGroup:WayPointInitialize( WayPoints ) + SpawnGroup:WayPointExecute( 1, 5 ) + end + + if SpawnGroup.ReSpawnFunction then + SpawnGroup:ReSpawnFunction() + end + + return SpawnGroup end --- Will spawn a group with a specified index number. @@ -18833,6 +19037,14 @@ function SPAWN:SpawnWithIndex( SpawnIndex ) self.SpawnGroups[self.SpawnIndex].Group = _DATABASE:Spawn( SpawnTemplate ) + local SpawnGroup = self.SpawnGroups[self.SpawnIndex].Group -- Wrapper.Group#GROUP + + --TODO: Need to check if this function doesn't need to be scheduled, as the group may not be immediately there! + if SpawnGroup then + + SpawnGroup:SetAIOnOff( self.AIOnOff ) + end + -- If there is a SpawnFunction hook defined, call it. if self.SpawnFunctionHook then self.SpawnFunctionHook( self.SpawnGroups[self.SpawnIndex].Group, unpack( self.SpawnFunctionArguments ) ) @@ -24182,13 +24394,12 @@ function DETECTION_AREAS:CreateDetectionSets() end ---- SP:N MP:Y AI:Y HU:N TYP:A -- This module contains the AI_BALANCER class. AI Balancing will replace in multi player missions +--- Single-Player:**No** / Mulit-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**All** -- **AI Balancing will replace in multi player missions -- non-occupied human slots with AI groups, in order to provide an engaging simulation environment, --- even when there are hardly any players in the mission. +-- even when there are hardly any players in the mission.** -- -- ![Banner Image](..\Presentations\AI_Balancer\Dia1.JPG) -- --- Examples can be found in the test missions. -- -- === -- @@ -24257,6 +24468,8 @@ end -- -- Hereby the change log: -- +-- 2017-01-17: There is still a problem with AI being destroyed, but not respawned. Need to check further upon that. +-- -- 2017-01-08: AI_BALANCER:**InitSpawnInterval( Earliest, Latest )** added. -- -- === @@ -24266,7 +24479,6 @@ end -- ### Contributions: -- -- * **[Dutch_Baron](https://forums.eagle.ru/member.php?u=112075)**: Working together with James has resulted in the creation of the AI_BALANCER class. James has shared his ideas on balancing AI with air units, and together we made a first design which you can use now :-) --- -- * **SNAFU**: Had a couple of mails with the guys to validate, if the same concept in the GCI/CAP script could be reworked within MOOSE. None of the script code has been used however within the new AI_BALANCER moose class. -- -- ### Authors: @@ -24415,16 +24627,15 @@ end --- @param #AI_BALANCER self function AI_BALANCER:onenterMonitoring( SetGroup ) - self:E( { self.SetClient:Count() } ) - self.SetClient:Flush() + self:T2( { self.SetClient:Count() } ) + --self.SetClient:Flush() self.SetClient:ForEachClient( --- @param Wrapper.Client#CLIENT Client function( Client ) - self:E(Client.ClientName) + self:T3(Client.ClientName) local AIGroup = self.Set:Get( Client.UnitName ) -- Wrapper.Group#GROUP - self:E({Client:IsAlive()}) if Client:IsAlive() then if AIGroup and AIGroup:IsAlive() == true then @@ -24439,16 +24650,16 @@ function AI_BALANCER:onenterMonitoring( SetGroup ) local PlayerInRange = { Value = false } local RangeZone = ZONE_RADIUS:New( 'RangeZone', AIGroup:GetVec2(), self.ReturnTresholdRange ) - self:E( RangeZone ) + self:T2( RangeZone ) _DATABASE:ForEachPlayer( --- @param Wrapper.Unit#UNIT RangeTestUnit function( RangeTestUnit, RangeZone, AIGroup, PlayerInRange ) - self:E( { PlayerInRange, RangeTestUnit.UnitName, RangeZone.ZoneName } ) + self:T2( { PlayerInRange, RangeTestUnit.UnitName, RangeZone.ZoneName } ) if RangeTestUnit:IsInZone( RangeZone ) == true then - self:E( "in zone" ) + self:T2( "in zone" ) if RangeTestUnit:GetCoalition() ~= AIGroup:GetCoalition() then - self:E( "in range" ) + self:T2( "in range" ) PlayerInRange.Value = true end end @@ -24469,7 +24680,7 @@ function AI_BALANCER:onenterMonitoring( SetGroup ) end else if not AIGroup or not AIGroup:IsAlive() == true then - self:E( "Client " .. Client.UnitName .. " not alive." ) + self:T( "Client " .. Client.UnitName .. " not alive." ) if not self.SpawnQueue[Client.UnitName] then -- Spawn a new AI taking into account the spawn interval Earliest, Latest self:__Spawn( math.random( self.Earliest, self.Latest ), Client.UnitName ) @@ -24487,113 +24698,125 @@ end ---- (AI) (FSM) Make AI patrol routes or zones. +--- Single-Player:**Yes** / Mulit-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**Air** -- **Air Patrolling or Staging.** +-- +-- ![Banner Image](..\Presentations\AI_PATROL\Dia1.JPG) +-- -- -- === -- --- 1) @{#AI_PATROLZONE} class, extends @{Core.Fsm#FSM_CONTROLLABLE} --- ================================================================ --- The @{#AI_PATROLZONE} class implements the core functions to patrol a @{Zone} by an AIR @{Controllable} @{Group}. --- The patrol algorithm works that for each airplane patrolling, upon arrival at the patrol zone, --- a random point is selected as the route point within the 3D space, within the given boundary limits. --- The airplane will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits. --- Upon arrival at the random 3D point, a new 3D random point will be selected within the patrol zone using the given limits. --- This cycle will continue until a fuel treshold has been reached by the airplane. +-- # 1) @{#AI_PATROL_ZONE} class, extends @{Core.Fsm#FSM_CONTROLLABLE} +-- +-- The @{#AI_PATROL_ZONE} class implements the core functions to patrol a @{Zone} by an AI @{Controllable} or @{Group}. +-- +-- ![Process](..\Presentations\AI_PATROL\Dia3.JPG) +-- +-- The AI_PATROL_ZONE is assigned a @{Group} and this must be done before the AI_PATROL_ZONE process can be started using the **Start** event. +-- +-- ![Process](..\Presentations\AI_PATROL\Dia4.JPG) +-- +-- The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits. +-- Upon arrival at the 3D point, a new random 3D point will be selected within the patrol zone using the given limits. +-- +-- ![Process](..\Presentations\AI_PATROL\Dia5.JPG) +-- +-- This cycle will continue. +-- +-- ![Process](..\Presentations\AI_PATROL\Dia6.JPG) +-- +-- During the patrol, the AI will detect enemy targets, which are reported through the **Detected** event. +-- +-- ![Process](..\Presentations\AI_PATROL\Dia9.JPG) +-- +---- Note that the enemy is not engaged! To model enemy engagement, either tailor the **Detected** event, or +-- use derived AI_ classes to model AI offensive or defensive behaviour. +-- +-- ![Process](..\Presentations\AI_PATROL\Dia10.JPG) +-- +-- Until a fuel or damage treshold has been reached by the AI, or when the AI is commanded to RTB. -- When the fuel treshold has been reached, the airplane will fly towards the nearest friendly airbase and will land. -- --- 1.1) AI_PATROLZONE constructor: --- ---------------------------- +-- ![Process](..\Presentations\AI_PATROL\Dia11.JPG) +-- +-- ## 1.1) AI_PATROL_ZONE constructor -- --- * @{#AI_PATROLZONE.New}(): Creates a new AI_PATROLZONE object. +-- * @{#AI_PATROL_ZONE.New}(): Creates a new AI_PATROL_ZONE object. -- --- 1.2) AI_PATROLZONE state machine: --- ---------------------------------- --- The AI_PATROLZONE is a state machine: it manages the different events and states of the AIControllable it is controlling. +-- ## 1.2) AI_PATROL_ZONE is a FSM -- --- ### 1.2.1) AI_PATROLZONE Events: +-- ![Process](..\Presentations\AI_PATROL\Dia2.JPG) -- --- * @{#AI_PATROLZONE.Route}( AIControllable ): A new 3D route point is selected and the AIControllable will fly towards that point with the given speed. --- * @{#AI_PATROLZONE.Patrol}( AIControllable ): The AIControllable reports it is patrolling. This event is called every 30 seconds. --- * @{#AI_PATROLZONE.RTB}( AIControllable ): The AIControllable will report return to base. --- * @{#AI_PATROLZONE.End}( AIControllable ): The end of the AI_PATROLZONE process. --- * @{#AI_PATROLZONE.Dead}( AIControllable ): The AIControllable is dead. The AI_PATROLZONE process will be ended. +-- ### 1.2.1) AI_PATROL_ZONE States -- --- ### 1.2.2) AI_PATROLZONE States: +-- * **None** ( Group ): The process is not started yet. +-- * **Patrolling** ( Group ): The AI is patrolling the Patrol Zone. +-- * **Returning** ( Group ): The AI is returning to Base.. -- --- * **Route**: A new 3D route point is selected and the AIControllable will fly towards that point with the given speed. --- * **Patrol**: The AIControllable is patrolling. This state is set every 30 seconds, so every 30 seconds, a state transition method can be used. --- * **RTB**: The AIControllable reports it wants to return to the base. --- * **Dead**: The AIControllable is dead ... --- * **End**: The process has come to an end. --- --- ### 1.2.3) AI_PATROLZONE state transition methods: +-- ### 1.2.2) AI_PATROL_ZONE Events -- --- State transition functions can be set **by the mission designer** customizing or improving the behaviour of the state. --- There are 2 moments when state transition methods will be called by the state machine: --- --- * **Before** the state transition. --- The state transition method needs to start with the name **OnBefore + the name of the state**. --- If the state transition method returns false, then the processing of the state transition will not be done! --- If you want to change the behaviour of the AIControllable at this event, return false, --- but then you'll need to specify your own logic using the AIControllable! --- --- * **After** the state transition. --- The state transition method needs to start with the name **OnAfter + the name of the state**. --- These state transition methods need to provide a return value, which is specified at the function description. --- --- An example how to manage a state transition for an AI_PATROLZONE object **Patrol** for the state **RTB**: --- --- local PatrolZoneGroup = GROUP:FindByName( "Patrol Zone" ) --- local PatrolZone = ZONE_POLYGON:New( "PatrolZone", PatrolZoneGroup ) --- --- local PatrolSpawn = SPAWN:New( "Patrol Group" ) --- local PatrolGroup = PatrolSpawn:Spawn() --- --- local Patrol = AI_PATROLZONE:New( PatrolZone, 3000, 6000, 300, 600 ) --- Patrol:SetControllable( PatrolGroup ) --- Patrol:ManageFuel( 0.2, 60 ) --- --- **OnBefore**RTB( AIGroup ) will be called by the AI_PATROLZONE object when the AIGroup reports RTB, but **before** the RTB default action is processed by the AI_PATROLZONE object. --- --- --- State transition function for the AI_PATROLZONE **Patrol** object --- -- @param #AI_PATROLZONE self --- -- @param Wrapper.Controllable#CONTROLLABLE AIGroup --- -- @return #boolean If false is returned, then the OnAfter state transition method will not be called. --- function Patrol:OnBeforeRTB( AIGroup ) --- AIGroup:MessageToRed( "Returning to base", 20 ) --- end --- --- **OnAfter**RTB( AIGroup ) will be called by the AI_PATROLZONE object when the AIGroup reports RTB, but **after** the RTB default action was processed by the AI_PATROLZONE object. --- --- --- State transition function for the AI_PATROLZONE **Patrol** object --- -- @param #AI_PATROLZONE self --- -- @param Wrapper.Controllable#CONTROLLABLE AIGroup --- -- @return #Wrapper.Controllable#CONTROLLABLE The new AIGroup object that is set to be patrolling the zone. --- function Patrol:OnAfterRTB( AIGroup ) --- return PatrolSpawn:Spawn() --- end +-- * **Start** ( Group ): Start the process. +-- * **Route** ( Group ): Route the AI to a new random 3D point within the Patrol Zone. +-- * **RTB** ( Group ): Route the AI to the home base. +-- * **Detect** ( Group ): The AI is detecting targets. +-- * **Detected** ( Group ): The AI has detected new targets. +-- * **Status** ( Group ): The AI is checking status (fuel and damage). When the tresholds have been reached, the AI will RTB. -- --- 1.3) Manage the AI_PATROLZONE parameters: --- ------------------------------------------ --- The following methods are available to modify the parameters of a AI_PATROLZONE object: +-- ## 1.3) Set or Get the AI controllable -- --- * @{#AI_PATROLZONE.SetControllable}(): Set the AIControllable. --- * @{#AI_PATROLZONE.GetControllable}(): Get the AIControllable. --- * @{#AI_PATROLZONE.SetSpeed}(): Set the patrol speed of the AI, for the next patrol. --- * @{#AI_PATROLZONE.SetAltitude}(): Set altitude of the AI, for the next patrol. +-- * @{#AI_PATROL_ZONE.SetControllable}(): Set the AIControllable. +-- * @{#AI_PATROL_ZONE.GetControllable}(): Get the AIControllable. +-- +-- ## 1.4) Set the Speed and Altitude boundaries of the AI controllable +-- +-- * @{#AI_PATROL_ZONE.SetSpeed}(): Set the patrol speed boundaries of the AI, for the next patrol. +-- * @{#AI_PATROL_ZONE.SetAltitude}(): Set altitude boundaries of the AI, for the next patrol. -- --- 1.3) Manage the out of fuel in the AI_PATROLZONE: --- ---------------------------------------------- --- When the AIControllable is out of fuel, it is required that a new AIControllable is started, before the old AIControllable can return to the home base. +-- ## 1.5) Manage the detection process of the AI controllable +-- +-- The detection process of the AI controllable can be manipulated. +-- Detection requires an amount of CPU power, which has an impact on your mission performance. +-- Only put detection on when absolutely necessary, and the frequency of the detection can also be set. +-- +-- * @{#AI_PATROL_ZONE.SetDetectionOn}(): Set the detection on. The AI will detect for targets. +-- * @{#AI_PATROL_ZONE.SetDetectionOff}(): Set the detection off, the AI will not detect for targets. The existing target list will NOT be erased. +-- +-- The detection frequency can be set with @{#AI_PATROL_ZONE.SetDetectionInterval}( seconds ), where the amount of seconds specify how much seconds will be waited before the next detection. +-- Use the method @{#AI_PATROL_ZONE.GetDetectedUnits}() to obtain a list of the @{Unit}s detected by the AI. +-- +-- The detection can be filtered to potential targets in a specific zone. +-- Use the method @{#AI_PATROL_ZONE.SetDetectionZone}() to set the zone where targets need to be detected. +-- Note that when the zone is too far away, or the AI is not heading towards the zone, or the AI is too high, no targets may be detected +-- according the weather conditions. +-- +-- ## 1.6) Manage the "out of fuel" in the AI_PATROL_ZONE +-- +-- When the AI is out of fuel, it is required that a new AI is started, before the old AI can return to the home base. -- Therefore, with a parameter and a calculation of the distance to the home base, the fuel treshold is calculated. --- When the fuel treshold is reached, the AIControllable will continue for a given time its patrol task in orbit, while a new AIControllable is targetted to the AI_PATROLZONE. --- Once the time is finished, the old AIControllable will return to the base. --- Use the method @{#AI_PATROLZONE.ManageFuel}() to have this proces in place. +-- When the fuel treshold is reached, the AI will continue for a given time its patrol task in orbit, +-- while a new AI is targetted to the AI_PATROL_ZONE. +-- Once the time is finished, the old AI will return to the base. +-- Use the method @{#AI_PATROL_ZONE.ManageFuel}() to have this proces in place. +-- +-- ## 1.7) Manage "damage" behaviour of the AI in the AI_PATROL_ZONE +-- +-- When the AI is damaged, it is required that a new AIControllable is started. However, damage cannon be foreseen early on. +-- Therefore, when the damage treshold is reached, the AI will return immediately to the home base (RTB). +-- Use the method @{#AI_PATROL_ZONE.ManageDamage}() to have this proces in place. -- -- ==== -- --- **API CHANGE HISTORY** --- ====================== +-- # **OPEN ISSUES** +-- +-- 2017-01-17: When Spawned AI is located at an airbase, it will be routed first back to the airbase after take-off. +-- +-- 2016-01-17: +-- -- Fixed problem with AI returning to base too early and unexpected. +-- -- ReSpawning of AI will reset the AI_PATROL and derived classes. +-- -- Checked the correct workings of SCHEDULER, and it DOES work correctly. +-- +-- ==== +-- +-- # **API CHANGE HISTORY** -- -- The underlying change log documents the API changes. Please read this carefully. The following notation is used: -- @@ -24602,87 +24825,287 @@ end -- -- Hereby the change log: -- +-- 2017-01-17: Rename of class: **AI\_PATROL\_ZONE** is the new name for the old _AI\_PATROLZONE_. +-- +-- 2017-01-15: Complete revision. AI_PATROL_ZONE is the base class for other AI_PATROL like classes. +-- -- 2016-09-01: Initial class and API. -- -- === -- --- AUTHORS and CONTRIBUTIONS --- ========================= +-- # **AUTHORS and CONTRIBUTIONS** -- -- ### Contributions: -- --- * **DutchBaron**: Testing. --- * **Pikey**: Testing and API concept review. +-- * **[Dutch_Baron](https://forums.eagle.ru/member.php?u=112075)**: Working together with James has resulted in the creation of the AI_BALANCER class. James has shared his ideas on balancing AI with air units, and together we made a first design which you can use now :-) +-- * **[Pikey](https://forums.eagle.ru/member.php?u=62835)**: Testing and API concept review. -- -- ### Authors: -- -- * **FlightControl**: Design & Programming. -- --- --- @module Patrol +-- @module AI_Patrol --- State Transition Functions - ---- OnBefore State Transition Function --- @function [parent=#AI_PATROLZONE] OnBeforeRoute --- @param #AI_PATROLZONE self --- @param Wrapper.Controllable#CONTROLLABLE Controllable --- @return #boolean - ---- OnAfter State Transition Function --- @function [parent=#AI_PATROLZONE] OnAfterRoute --- @param #AI_PATROLZONE self --- @param Wrapper.Controllable#CONTROLLABLE Controllable - - - ---- AI_PATROLZONE class --- @type AI_PATROLZONE +--- AI_PATROL_ZONE class +-- @type AI_PATROL_ZONE -- @field Wrapper.Controllable#CONTROLLABLE AIControllable The @{Controllable} patrolling. -- @field Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed. -- @field Dcs.DCSTypes#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol. -- @field Dcs.DCSTypes#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol. -- @field Dcs.DCSTypes#Speed PatrolMinSpeed The minimum speed of the @{Controllable} in km/h. -- @field Dcs.DCSTypes#Speed PatrolMaxSpeed The maximum speed of the @{Controllable} in km/h. +-- @field Functional.Spawn#SPAWN CoordTest -- @extends Core.Fsm#FSM_CONTROLLABLE -AI_PATROLZONE = { - ClassName = "AI_PATROLZONE", +AI_PATROL_ZONE = { + ClassName = "AI_PATROL_ZONE", } - - ---- Creates a new AI_PATROLZONE object --- @param #AI_PATROLZONE self +--- Creates a new AI_PATROL_ZONE object +-- @param #AI_PATROL_ZONE self -- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed. -- @param Dcs.DCSTypes#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol. -- @param Dcs.DCSTypes#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol. -- @param Dcs.DCSTypes#Speed PatrolMinSpeed The minimum speed of the @{Controllable} in km/h. -- @param Dcs.DCSTypes#Speed PatrolMaxSpeed The maximum speed of the @{Controllable} in km/h. --- @return #AI_PATROLZONE self +-- @return #AI_PATROL_ZONE self -- @usage --- -- Define a new AI_PATROLZONE Object. This PatrolArea will patrol an AIControllable within PatrolZone between 3000 and 6000 meters, with a variying speed between 600 and 900 km/h. +-- -- Define a new AI_PATROL_ZONE Object. This PatrolArea will patrol an AIControllable within PatrolZone between 3000 and 6000 meters, with a variying speed between 600 and 900 km/h. -- PatrolZone = ZONE:New( 'PatrolZone' ) -- PatrolSpawn = SPAWN:New( 'Patrol Group' ) --- PatrolArea = AI_PATROLZONE:New( PatrolZone, 3000, 6000, 600, 900 ) -function AI_PATROLZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed ) +-- PatrolArea = AI_PATROL_ZONE:New( PatrolZone, 3000, 6000, 600, 900 ) +function AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed ) -- Inherits from BASE - local self = BASE:Inherit( self, FSM_CONTROLLABLE:New() ) -- Core.Fsm#FSM_CONTROLLABLE + local self = BASE:Inherit( self, FSM_CONTROLLABLE:New() ) -- #AI_PATROL_ZONE - self:SetStartState( "None" ) - self:AddTransition( "*", "Start", "Route" ) - self:AddTransition( "*", "Route", "Route" ) - self:AddTransition( { "Patrol", "Route" }, "Patrol", "Patrol" ) - self:AddTransition( "Patrol", "RTB", "RTB" ) - self:AddTransition( "*", "End", "End" ) - self:AddTransition( "*", "Dead", "End" ) self.PatrolZone = PatrolZone self.PatrolFloorAltitude = PatrolFloorAltitude self.PatrolCeilingAltitude = PatrolCeilingAltitude self.PatrolMinSpeed = PatrolMinSpeed self.PatrolMaxSpeed = PatrolMaxSpeed + + self:SetDetectionOn() + self.CheckStatus = true + + self:ManageFuel( .2, 60 ) + self:ManageDamage( 1 ) + + self:SetDetectionInterval( 30 ) + + self.DetectedUnits = {} -- This table contains the targets detected during patrol. + + self:SetStartState( "None" ) + + self:AddTransition( "None", "Start", "Patrolling" ) + +--- OnBefore Transition Handler for Event Start. +-- @function [parent=#AI_PATROL_ZONE] OnBeforeStart +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @return #boolean Return false to cancel Transition. + +--- OnAfter Transition Handler for Event Start. +-- @function [parent=#AI_PATROL_ZONE] OnAfterStart +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. + +--- Synchronous Event Trigger for Event Start. +-- @function [parent=#AI_PATROL_ZONE] Start +-- @param #AI_PATROL_ZONE self + +--- Asynchronous Event Trigger for Event Start. +-- @function [parent=#AI_PATROL_ZONE] __Start +-- @param #AI_PATROL_ZONE self +-- @param #number Delay The delay in seconds. + +--- OnLeave Transition Handler for State Patrolling. +-- @function [parent=#AI_PATROL_ZONE] OnLeavePatrolling +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @return #boolean Return false to cancel Transition. + +--- OnEnter Transition Handler for State Patrolling. +-- @function [parent=#AI_PATROL_ZONE] OnEnterPatrolling +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. + + self:AddTransition( "Patrolling", "Route", "Patrolling" ) -- FSM_CONTROLLABLE Transition for type #AI_PATROL_ZONE. + +--- OnBefore Transition Handler for Event Route. +-- @function [parent=#AI_PATROL_ZONE] OnBeforeRoute +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @return #boolean Return false to cancel Transition. + +--- OnAfter Transition Handler for Event Route. +-- @function [parent=#AI_PATROL_ZONE] OnAfterRoute +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. + +--- Synchronous Event Trigger for Event Route. +-- @function [parent=#AI_PATROL_ZONE] Route +-- @param #AI_PATROL_ZONE self + +--- Asynchronous Event Trigger for Event Route. +-- @function [parent=#AI_PATROL_ZONE] __Route +-- @param #AI_PATROL_ZONE self +-- @param #number Delay The delay in seconds. + + self:AddTransition( "*", "Status", "*" ) -- FSM_CONTROLLABLE Transition for type #AI_PATROL_ZONE. + +--- OnBefore Transition Handler for Event Status. +-- @function [parent=#AI_PATROL_ZONE] OnBeforeStatus +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @return #boolean Return false to cancel Transition. + +--- OnAfter Transition Handler for Event Status. +-- @function [parent=#AI_PATROL_ZONE] OnAfterStatus +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. + +--- Synchronous Event Trigger for Event Status. +-- @function [parent=#AI_PATROL_ZONE] Status +-- @param #AI_PATROL_ZONE self + +--- Asynchronous Event Trigger for Event Status. +-- @function [parent=#AI_PATROL_ZONE] __Status +-- @param #AI_PATROL_ZONE self +-- @param #number Delay The delay in seconds. + + self:AddTransition( "*", "Detect", "*" ) -- FSM_CONTROLLABLE Transition for type #AI_PATROL_ZONE. + +--- OnBefore Transition Handler for Event Detect. +-- @function [parent=#AI_PATROL_ZONE] OnBeforeDetect +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @return #boolean Return false to cancel Transition. + +--- OnAfter Transition Handler for Event Detect. +-- @function [parent=#AI_PATROL_ZONE] OnAfterDetect +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. + +--- Synchronous Event Trigger for Event Detect. +-- @function [parent=#AI_PATROL_ZONE] Detect +-- @param #AI_PATROL_ZONE self + +--- Asynchronous Event Trigger for Event Detect. +-- @function [parent=#AI_PATROL_ZONE] __Detect +-- @param #AI_PATROL_ZONE self +-- @param #number Delay The delay in seconds. + + self:AddTransition( "*", "Detected", "*" ) -- FSM_CONTROLLABLE Transition for type #AI_PATROL_ZONE. + +--- OnBefore Transition Handler for Event Detected. +-- @function [parent=#AI_PATROL_ZONE] OnBeforeDetected +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @return #boolean Return false to cancel Transition. + +--- OnAfter Transition Handler for Event Detected. +-- @function [parent=#AI_PATROL_ZONE] OnAfterDetected +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. + +--- Synchronous Event Trigger for Event Detected. +-- @function [parent=#AI_PATROL_ZONE] Detected +-- @param #AI_PATROL_ZONE self + +--- Asynchronous Event Trigger for Event Detected. +-- @function [parent=#AI_PATROL_ZONE] __Detected +-- @param #AI_PATROL_ZONE self +-- @param #number Delay The delay in seconds. + + self:AddTransition( "*", "RTB", "Returning" ) -- FSM_CONTROLLABLE Transition for type #AI_PATROL_ZONE. + +--- OnBefore Transition Handler for Event RTB. +-- @function [parent=#AI_PATROL_ZONE] OnBeforeRTB +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @return #boolean Return false to cancel Transition. + +--- OnAfter Transition Handler for Event RTB. +-- @function [parent=#AI_PATROL_ZONE] OnAfterRTB +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. + +--- Synchronous Event Trigger for Event RTB. +-- @function [parent=#AI_PATROL_ZONE] RTB +-- @param #AI_PATROL_ZONE self + +--- Asynchronous Event Trigger for Event RTB. +-- @function [parent=#AI_PATROL_ZONE] __RTB +-- @param #AI_PATROL_ZONE self +-- @param #number Delay The delay in seconds. + +--- OnLeave Transition Handler for State Returning. +-- @function [parent=#AI_PATROL_ZONE] OnLeaveReturning +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @return #boolean Return false to cancel Transition. + +--- OnEnter Transition Handler for State Returning. +-- @function [parent=#AI_PATROL_ZONE] OnEnterReturning +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. + + self:AddTransition( "*", "Reset", "Patrolling" ) -- FSM_CONTROLLABLE Transition for type #AI_PATROL_ZONE. + + self:AddTransition( "*", "Eject", "Ejected" ) + self:AddTransition( "*", "Crash", "Crashed" ) + self:AddTransition( "*", "PilotDead", "PilotDead" ) + return self end @@ -24690,11 +25113,11 @@ end --- Sets (modifies) the minimum and maximum speed of the patrol. --- @param #AI_PATROLZONE self +-- @param #AI_PATROL_ZONE self -- @param Dcs.DCSTypes#Speed PatrolMinSpeed The minimum speed of the @{Controllable} in km/h. -- @param Dcs.DCSTypes#Speed PatrolMaxSpeed The maximum speed of the @{Controllable} in km/h. --- @return #AI_PATROLZONE self -function AI_PATROLZONE:SetSpeed( PatrolMinSpeed, PatrolMaxSpeed ) +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:SetSpeed( PatrolMinSpeed, PatrolMaxSpeed ) self:F2( { PatrolMinSpeed, PatrolMaxSpeed } ) self.PatrolMinSpeed = PatrolMinSpeed @@ -24704,39 +25127,120 @@ end --- Sets the floor and ceiling altitude of the patrol. --- @param #AI_PATROLZONE self +-- @param #AI_PATROL_ZONE self -- @param Dcs.DCSTypes#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol. -- @param Dcs.DCSTypes#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol. --- @return #AI_PATROLZONE self -function AI_PATROLZONE:SetAltitude( PatrolFloorAltitude, PatrolCeilingAltitude ) +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:SetAltitude( PatrolFloorAltitude, PatrolCeilingAltitude ) self:F2( { PatrolFloorAltitude, PatrolCeilingAltitude } ) self.PatrolFloorAltitude = PatrolFloorAltitude self.PatrolCeilingAltitude = PatrolCeilingAltitude end +-- * @{#AI_PATROL_ZONE.SetDetectionOn}(): Set the detection on. The AI will detect for targets. +-- * @{#AI_PATROL_ZONE.SetDetectionOff}(): Set the detection off, the AI will not detect for targets. The existing target list will NOT be erased. +--- Set the detection on. The AI will detect for targets. +-- @param #AI_PATROL_ZONE self +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:SetDetectionOn() + self:F2() + + self.DetectOn = true +end ---- @param Wrapper.Controllable#CONTROLLABLE AIControllable -function _NewPatrolRoute( AIControllable ) +--- Set the detection off. The AI will NOT detect for targets. +-- However, the list of already detected targets will be kept and can be enquired! +-- @param #AI_PATROL_ZONE self +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:SetDetectionOff() + self:F2() + + self.DetectOn = false +end - AIControllable:T( "NewPatrolRoute" ) - local PatrolZone = AIControllable:GetState( AIControllable, "PatrolZone" ) -- PatrolCore.Zone#AI_PATROLZONE - PatrolZone:__Route( 1 ) +--- Set the status checking off. +-- @param #AI_PATROL_ZONE self +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:SetStatusOff() + self:F2() + + self.CheckStatus = false +end + +--- Activate the detection. The AI will detect for targets if the Detection is switched On. +-- @param #AI_PATROL_ZONE self +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:SetDetectionActivated() + self:F2() + + self.DetectActivated = true + self:__Detect( self.DetectInterval ) +end + +--- Deactivate the detection. The AI will NOT detect for targets. +-- @param #AI_PATROL_ZONE self +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:SetDetectionDeactivated() + self:F2() + + self.DetectActivated = false +end + +--- Set the interval in seconds between each detection executed by the AI. +-- The list of already detected targets will be kept and updated. +-- Newly detected targets will be added, but already detected targets that were +-- not detected in this cycle, will NOT be removed! +-- The default interval is 30 seconds. +-- @param #AI_PATROL_ZONE self +-- @param #number Seconds The interval in seconds. +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:SetDetectionInterval( Seconds ) + self:F2() + + if Seconds then + self.DetectInterval = Seconds + else + self.DetectInterval = 30 + end +end + +--- Set the detection zone where the AI is detecting targets. +-- @param #AI_PATROL_ZONE self +-- @param Core.Zone#ZONE DetectionZone The zone where to detect targets. +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:SetDetectionZone( DetectionZone ) + self:F2() + + if DetectionZone then + self.DetectZone = DetectionZone + else + self.DetectZone = nil + end +end + +--- Gets a list of @{Wrapper.Unit#UNIT}s that were detected by the AI. +-- No filtering is applied, so, ANY detected UNIT can be in this list. +-- It is up to the mission designer to use the @{Unit} class and methods to filter the targets. +-- @param #AI_PATROL_ZONE self +-- @return #table The list of @{Wrapper.Unit#UNIT}s +function AI_PATROL_ZONE:GetDetectedUnits() + self:F2() + + return self.DetectedUnits end - - ---- When the AIControllable is out of fuel, it is required that a new AIControllable is started, before the old AIControllable can return to the home base. +--- When the AI is out of fuel, it is required that a new AI is started, before the old AI can return to the home base. -- Therefore, with a parameter and a calculation of the distance to the home base, the fuel treshold is calculated. --- When the fuel treshold is reached, the AIControllable will continue for a given time its patrol task in orbit, while a new AIControllable is targetted to the AI_PATROLZONE. --- Once the time is finished, the old AIControllable will return to the base. --- @param #AI_PATROLZONE self +-- When the fuel treshold is reached, the AI will continue for a given time its patrol task in orbit, while a new AIControllable is targetted to the AI_PATROL_ZONE. +-- Once the time is finished, the old AI will return to the base. +-- @param #AI_PATROL_ZONE self -- @param #number PatrolFuelTresholdPercentage The treshold in percentage (between 0 and 1) when the AIControllable is considered to get out of fuel. -- @param #number PatrolOutOfFuelOrbitTime The amount of seconds the out of fuel AIControllable will orbit before returning to the base. --- @return #AI_PATROLZONE self -function AI_PATROLZONE:ManageFuel( PatrolFuelTresholdPercentage, PatrolOutOfFuelOrbitTime ) +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:ManageFuel( PatrolFuelTresholdPercentage, PatrolOutOfFuelOrbitTime ) self.PatrolManageFuel = true self.PatrolFuelTresholdPercentage = PatrolFuelTresholdPercentage @@ -24745,60 +25249,171 @@ function AI_PATROLZONE:ManageFuel( PatrolFuelTresholdPercentage, PatrolOutOfFuel return self end +--- When the AI is damaged beyond a certain treshold, it is required that the AI returns to the home base. +-- However, damage cannot be foreseen early on. +-- Therefore, when the damage treshold is reached, +-- the AI will return immediately to the home base (RTB). +-- Note that for groups, the average damage of the complete group will be calculated. +-- So, in a group of 4 airplanes, 2 lost and 2 with damage 0.2, the damage treshold will be 0.25. +-- @param #AI_PATROL_ZONE self +-- @param #number PatrolDamageTreshold The treshold in percentage (between 0 and 1) when the AI is considered to be damaged. +-- @return #AI_PATROL_ZONE self +function AI_PATROL_ZONE:ManageDamage( PatrolDamageTreshold ) + + self.PatrolManageDamage = true + self.PatrolDamageTreshold = PatrolDamageTreshold + + return self +end + --- Defines a new patrol route using the @{Process_PatrolZone} parameters and settings. --- @param #AI_PATROLZONE self --- @return #AI_PATROLZONE self -function AI_PATROLZONE:onenterRoute() +-- @param #AI_PATROL_ZONE self +-- @return #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_PATROL_ZONE:onafterStart( Controllable, From, Event, To ) + self:F2() + + self:__Route( 1 ) -- Route to the patrol point. The asynchronous trigger is important, because a spawned group and units takes at least one second to come live. + self:__Status( 60 ) -- Check status status every 30 seconds. + self:SetDetectionActivated() + + self:EventOnPilotDead( self.OnPilotDead ) + self:EventOnCrash( self.OnCrash ) + self:EventOnEjection( self.OnEjection ) + + + Controllable:OptionROEHoldFire() + Controllable:OptionROTVertical() + + self.Controllable:OnReSpawn( + function( PatrolGroup ) + self:E( "ReSpawn" ) + self:__Reset() + self:__Route( 5 ) + end + ) + +end + + +--- @param #AI_PATROL_ZONE self +--- @param Wrapper.Controllable#CONTROLLABLE Controllable +function AI_PATROL_ZONE:onbeforeDetect( Controllable, From, Event, To ) + + return self.DetectOn and self.DetectActivated +end + +--- @param #AI_PATROL_ZONE self +--- @param Wrapper.Controllable#CONTROLLABLE Controllable +function AI_PATROL_ZONE:onafterDetect( Controllable, From, Event, To ) + + local Detected = false + + local DetectedTargets = Controllable:GetDetectedTargets() + for TargetID, Target in pairs( DetectedTargets or {} ) do + local TargetObject = Target.object + self:T( TargetObject ) + if TargetObject and TargetObject:isExist() and TargetObject.id_ < 50000000 then + + local TargetUnit = UNIT:Find( TargetObject ) + local TargetUnitName = TargetUnit:GetName() + + if self.DetectionZone then + if TargetUnit:IsInZone( self.DetectionZone ) then + self:T( {"Detected ", TargetUnit } ) + self.DetectedUnits[TargetUnit] = TargetUnit + Detected = true + end + else + self.DetectedUnits[TargetUnit] = TargetUnit + Detected = true + end + end + end + + self:__Detect( self.DetectInterval ) + + if Detected == true then + self:__Detected( 1.5 ) + end + +end + +--- @param Wrapper.Controllable#CONTROLLABLE AIControllable +-- This statis method is called from the route path within the last task at the last waaypoint of the Controllable. +-- Note that this method is required, as triggers the next route when patrolling for the Controllable. +function AI_PATROL_ZONE:_NewPatrolRoute( AIControllable ) + + local PatrolZone = AIControllable:GetState( AIControllable, "PatrolZone" ) -- PatrolCore.Zone#AI_PATROL_ZONE + PatrolZone:__Route( 1 ) +end + + +--- Defines a new patrol route using the @{Process_PatrolZone} parameters and settings. +-- @param #AI_PATROL_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_PATROL_ZONE:onafterRoute( Controllable, From, Event, To ) self:F2() - local PatrolRoute = {} + -- When RTB, don't allow anymore the routing. + if From == "RTB" then + return + end + if self.Controllable:IsAlive() then - --- Determine if the AIControllable is within the PatrolZone. + -- Determine if the AIControllable is within the PatrolZone. -- If not, make a waypoint within the to that the AIControllable will fly at maximum speed to that point. --- --- Calculate the current route point. --- local CurrentVec2 = self.Controllable:GetVec2() --- local CurrentAltitude = self.Controllable:GetUnit(1):GetAltitude() --- local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y ) --- local CurrentRoutePoint = CurrentPointVec3:RoutePointAir( --- POINT_VEC3.RoutePointAltType.BARO, --- POINT_VEC3.RoutePointType.TurningPoint, --- POINT_VEC3.RoutePointAction.TurningPoint, --- ToPatrolZoneSpeed, --- true --- ) --- --- PatrolRoute[#PatrolRoute+1] = CurrentRoutePoint + local PatrolRoute = {} + + -- Calculate the current route point of the controllable as the start point of the route. + -- However, when the controllable is not in the air, + -- the controllable current waypoint is probably the airbase... + -- Thus, if we would take the current waypoint as the startpoint, upon take-off, the controllable flies + -- immediately back to the airbase, and this is not correct. + -- Therefore, when on a runway, get as the current route point a random point within the PatrolZone. + -- This will make the plane fly immediately to the patrol zone. - self:T2( PatrolRoute ) - - if self.Controllable:IsNotInZone( self.PatrolZone ) then - --- Find a random 2D point in PatrolZone. - local ToPatrolZoneVec2 = self.PatrolZone:GetRandomVec2() - self:T2( ToPatrolZoneVec2 ) - - --- Define Speed and Altitude. - local ToPatrolZoneAltitude = math.random( self.PatrolFloorAltitude, self.PatrolCeilingAltitude ) + if self.Controllable:InAir() == false then + self:E( "Not in the air, finding route path within PatrolZone" ) + local CurrentVec2 = self.Controllable:GetVec2() + --TODO: Create GetAltitude function for GROUP, and delete GetUnit(1). + local CurrentAltitude = self.Controllable:GetUnit(1):GetAltitude() + local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y ) local ToPatrolZoneSpeed = self.PatrolMaxSpeed - self:T2( ToPatrolZoneSpeed ) - - --- Obtain a 3D @{Point} from the 2D point + altitude. - local ToPatrolZonePointVec3 = POINT_VEC3:New( ToPatrolZoneVec2.x, ToPatrolZoneAltitude, ToPatrolZoneVec2.y ) - - --- Create a route point of type air. - local ToPatrolZoneRoutePoint = ToPatrolZonePointVec3:RoutePointAir( - POINT_VEC3.RoutePointAltType.BARO, - POINT_VEC3.RoutePointType.TurningPoint, - POINT_VEC3.RoutePointAction.TurningPoint, - ToPatrolZoneSpeed, - true - ) - - PatrolRoute[#PatrolRoute+1] = ToPatrolZoneRoutePoint - - end + local CurrentRoutePoint = CurrentPointVec3:RoutePointAir( + POINT_VEC3.RoutePointAltType.BARO, + POINT_VEC3.RoutePointType.TakeOffParking, + POINT_VEC3.RoutePointAction.FromParkingArea, + ToPatrolZoneSpeed, + true + ) + PatrolRoute[#PatrolRoute+1] = CurrentRoutePoint + else + self:E( "In the air, finding route path within PatrolZone" ) + local CurrentVec2 = self.Controllable:GetVec2() + --TODO: Create GetAltitude function for GROUP, and delete GetUnit(1). + local CurrentAltitude = self.Controllable:GetUnit(1):GetAltitude() + local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y ) + local ToPatrolZoneSpeed = self.PatrolMaxSpeed + local CurrentRoutePoint = CurrentPointVec3:RoutePointAir( + POINT_VEC3.RoutePointAltType.BARO, + POINT_VEC3.RoutePointType.TurningPoint, + POINT_VEC3.RoutePointAction.TurningPoint, + ToPatrolZoneSpeed, + true + ) + PatrolRoute[#PatrolRoute+1] = CurrentRoutePoint + end + --- Define a random point in the @{Zone}. The AI will fly to that point within the zone. @@ -24823,6 +25438,8 @@ function AI_PATROLZONE:onenterRoute() true ) + --self.CoordTest:SpawnFromVec3( ToTargetPointVec3:GetVec3() ) + --ToTargetPointVec3:SmokeRed() PatrolRoute[#PatrolRoute+1] = ToTargetRoutePoint @@ -24832,25 +25449,31 @@ function AI_PATROLZONE:onenterRoute() --- Do a trick, link the NewPatrolRoute function of the PATROLGROUP object to the AIControllable in a temporary variable ... self.Controllable:SetState( self.Controllable, "PatrolZone", self ) - self.Controllable:WayPointFunction( #PatrolRoute, 1, "_NewPatrolRoute" ) + self.Controllable:WayPointFunction( #PatrolRoute, 1, "AI_PATROL_ZONE:_NewPatrolRoute" ) - --- NOW ACT_ROUTE THE GROUP! - self.Controllable:WayPointExecute( 1 ) - - self:__Patrol( 30 ) + --- NOW ROUTE THE GROUP! + self.Controllable:WayPointExecute( 1, 2 ) end - + end +--- @param #AI_PATROL_ZONE self +function AI_PATROL_ZONE:onbeforeStatus() ---- @param #AI_PATROLZONE self -function AI_PATROLZONE:onenterPatrol() + return self.CheckStatus +end + +--- @param #AI_PATROL_ZONE self +function AI_PATROL_ZONE:onafterStatus() self:F2() if self.Controllable and self.Controllable:IsAlive() then + local RTB = false + local Fuel = self.Controllable:GetUnit(1):GetFuel() if Fuel < self.PatrolFuelTresholdPercentage then + self:E( self.Controllable:GetName() .. " is out of fuel:" .. Fuel .. ", RTB!" ) local OldAIControllable = self.Controllable local AIControllableTemplate = self.Controllable:GetTemplate() @@ -24858,14 +25481,1141 @@ function AI_PATROLZONE:onenterPatrol() local TimedOrbitTask = OldAIControllable:TaskControlled( OrbitTask, OldAIControllable:TaskCondition(nil,nil,nil,nil,self.PatrolOutOfFuelOrbitTime,nil ) ) OldAIControllable:SetTask( TimedOrbitTask, 10 ) + RTB = true + else + end + + -- TODO: Check GROUP damage function. + local Damage = self.Controllable:GetLife() + if Damage <= self.PatrolDamageTreshold then + self:E( self.Controllable:GetName() .. " is damaged:" .. Damage .. ", RTB!" ) + RTB = true + end + + if RTB == true then self:RTB() else - self:__Patrol( 30 ) -- Execute the Patrol event after 30 seconds. + self:__Status( 60 ) -- Execute the Patrol event after 30 seconds. end end +end + +--- @param #AI_PATROL_ZONE self +function AI_PATROL_ZONE:onafterRTB() + self:F2() + + if self.Controllable and self.Controllable:IsAlive() then + + self:SetDetectionOff() + self.CheckStatus = false + + local PatrolRoute = {} + + --- Calculate the current route point. + local CurrentVec2 = self.Controllable:GetVec2() + + --TODO: Create GetAltitude function for GROUP, and delete GetUnit(1). + local CurrentAltitude = self.Controllable:GetUnit(1):GetAltitude() + local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y ) + local ToPatrolZoneSpeed = self.PatrolMaxSpeed + local CurrentRoutePoint = CurrentPointVec3:RoutePointAir( + POINT_VEC3.RoutePointAltType.BARO, + POINT_VEC3.RoutePointType.TurningPoint, + POINT_VEC3.RoutePointAction.TurningPoint, + ToPatrolZoneSpeed, + true + ) + + PatrolRoute[#PatrolRoute+1] = CurrentRoutePoint + + --- Now we're going to do something special, we're going to call a function from a waypoint action at the AIControllable... + self.Controllable:WayPointInitialize( PatrolRoute ) + + --- NOW ROUTE THE GROUP! + self.Controllable:WayPointExecute( 1, 1 ) + + end + +end + +--- @param #AI_PATROL_ZONE self +function AI_PATROL_ZONE:onafterDead() + self:SetDetectionOff() + self:SetStatusOff() +end + +--- @param #AI_PATROL_ZONE self +-- @param Core.Event#EVENTDATA EventData +function AI_PATROL_ZONE:OnCrash( EventData ) + + if self.Controllable:IsAlive() and EventData.IniDCSGroupName == self.Controllable:GetName() then + self:__Crash( 1, EventData ) + end +end + +--- @param #AI_PATROL_ZONE self +-- @param Core.Event#EVENTDATA EventData +function AI_PATROL_ZONE:OnEjection( EventData ) + + if self.Controllable:IsAlive() and EventData.IniDCSGroupName == self.Controllable:GetName() then + self:__Eject( 1, EventData ) + end +end + +--- @param #AI_PATROL_ZONE self +-- @param Core.Event#EVENTDATA EventData +function AI_PATROL_ZONE:OnPilotDead( EventData ) + + if self.Controllable:IsAlive() and EventData.IniDCSGroupName == self.Controllable:GetName() then + self:__PilotDead( 1, EventData ) + end +end + +--- Single-Player:**Yes** / Mulit-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**Air** -- **Provide Close Air Support to friendly ground troops.** +-- +-- ![Banner Image](..\Presentations\AI_CAS\Dia1.JPG) +-- +-- +-- === +-- +-- # 1) @{#AI_CAS_ZONE} class, extends @{AI.AI_Patrol#AI_PATROL_ZONE} +-- +-- @{#AI_CAS_ZONE} derives from the @{AI.AI_Patrol#AI_PATROL_ZONE}, inheriting its methods and behaviour. +-- +-- The @{#AI_CAS_ZONE} class implements the core functions to provide Close Air Support in an Engage @{Zone} by an AIR @{Controllable} or @{Group}. +-- The AI_CAS_ZONE runs a process. It holds an AI in a Patrol Zone and when the AI is commanded to engage, it will fly to an Engage Zone. +-- +-- ![HoldAndEngage](..\Presentations\AI_CAS\Dia3.JPG) +-- +-- The AI_CAS_ZONE is assigned a @{Group} and this must be done before the AI_CAS_ZONE process can be started through the **Start** event. +-- +-- ![Start Event](..\Presentations\AI_CAS\Dia4.JPG) +-- +-- Upon started, The AI will **Route** itself towards the random 3D point within a patrol zone, +-- using a random speed within the given altitude and speed limits. +-- Upon arrival at the 3D point, a new random 3D point will be selected within the patrol zone using the given limits. +-- This cycle will continue until a fuel or damage treshold has been reached by the AI, or when the AI is commanded to RTB. +-- +-- ![Route Event](..\Presentations\AI_CAS\Dia5.JPG) +-- +-- When the AI is commanded to provide Close Air Support (through the event **Engage**), the AI will fly towards the Engage Zone. +-- Any target that is detected in the Engage Zone will be reported and will be destroyed by the AI. +-- +-- ![Engage Event](..\Presentations\AI_CAS\Dia6.JPG) +-- +-- The AI will detect the targets and will only destroy the targets within the Engage Zone. +-- +-- ![Engage Event](..\Presentations\AI_CAS\Dia7.JPG) +-- +-- Every target that is destroyed, is reported< by the AI. +-- +-- ![Engage Event](..\Presentations\AI_CAS\Dia8.JPG) +-- +-- Note that the AI does not know when the Engage Zone is cleared, and therefore will keep circling in the zone. +-- +-- ![Engage Event](..\Presentations\AI_CAS\Dia9.JPG) +-- +-- Until it is notified through the event **Accomplish**, which is to be triggered by an observing party: +-- +-- * a FAC +-- * a timed event +-- * a menu option selected by a human +-- * a condition +-- * others ... +-- +-- ![Engage Event](..\Presentations\AI_CAS\Dia10.JPG) +-- +-- When the AI has accomplished the CAS, it will fly back to the Patrol Zone. +-- +-- ![Engage Event](..\Presentations\AI_CAS\Dia11.JPG) +-- +-- It will keep patrolling there, until it is notified to RTB or move to another CAS Zone. +-- It can be notified to go RTB through the **RTB** event. +-- +-- When the fuel treshold has been reached, the airplane will fly towards the nearest friendly airbase and will land. +-- +-- ![Engage Event](..\Presentations\AI_CAS\Dia12.JPG) +-- +-- # 1.1) AI_CAS_ZONE constructor +-- +-- * @{#AI_CAS_ZONE.New}(): Creates a new AI_CAS_ZONE object. +-- +-- ## 1.2) AI_CAS_ZONE is a FSM +-- +-- ![Process](..\Presentations\AI_CAS\Dia2.JPG) +-- +-- ### 1.2.1) AI_CAS_ZONE States +-- +-- * **None** ( Group ): The process is not started yet. +-- * **Patrolling** ( Group ): The AI is patrolling the Patrol Zone. +-- * **Engaging** ( Group ): The AI is engaging the targets in the Engage Zone, executing CAS. +-- * **Returning** ( Group ): The AI is returning to Base.. +-- +-- ### 1.2.2) AI_CAS_ZONE Events +-- +-- * **Start** ( Group ): Start the process. +-- * **Route** ( Group ): Route the AI to a new random 3D point within the Patrol Zone. +-- * **Engage** ( Group ): Engage the AI to provide CAS in the Engage Zone, destroying any target it finds. +-- * **RTB** ( Group ): Route the AI to the home base. +-- * **Detect** ( Group ): The AI is detecting targets. +-- * **Detected** ( Group ): The AI has detected new targets. +-- * **Status** ( Group ): The AI is checking status (fuel and damage). When the tresholds have been reached, the AI will RTB. +-- +-- ==== +-- +-- # **API CHANGE HISTORY** +-- +-- The underlying change log documents the API changes. Please read this carefully. The following notation is used: +-- +-- * **Added** parts are expressed in bold type face. +-- * _Removed_ parts are expressed in italic type face. +-- +-- Hereby the change log: +-- +-- 2017-01-15: Initial class and API. +-- +-- === +-- +-- # **AUTHORS and CONTRIBUTIONS** +-- +-- ### Contributions: +-- +-- * **[Quax](https://forums.eagle.ru/member.php?u=90530)**: Concept, Advice & Testing. +-- * **[Pikey](https://forums.eagle.ru/member.php?u=62835)**: Concept, Advice & Testing. +-- * **[Gunterlund](http://forums.eagle.ru:8080/member.php?u=75036)**: Test case revision. +-- +-- ### Authors: +-- +-- * **FlightControl**: Concept, Design & Programming. +-- +-- @module AI_Cas + + +--- AI_CAS_ZONE class +-- @type AI_CAS_ZONE +-- @field Wrapper.Controllable#CONTROLLABLE AIControllable The @{Controllable} patrolling. +-- @field Core.Zone#ZONE_BASE TargetZone The @{Zone} where the patrol needs to be executed. +-- @extends AI.AI_Patrol#AI_PATROL_ZONE +AI_CAS_ZONE = { + ClassName = "AI_CAS_ZONE", +} + + + +--- Creates a new AI_CAS_ZONE object +-- @param #AI_CAS_ZONE self +-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed. +-- @param Dcs.DCSTypes#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol. +-- @param Dcs.DCSTypes#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol. +-- @param Dcs.DCSTypes#Speed PatrolMinSpeed The minimum speed of the @{Controllable} in km/h. +-- @param Dcs.DCSTypes#Speed PatrolMaxSpeed The maximum speed of the @{Controllable} in km/h. +-- @param Core.Zone#ZONE EngageZone +-- @return #AI_CAS_ZONE self +function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, EngageZone ) + + -- Inherits from BASE + local self = BASE:Inherit( self, AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed ) ) -- #AI_CAS_ZONE + + self.EngageZone = EngageZone + self.Accomplished = false + + self:SetDetectionZone( self.EngageZone ) + + self:AddTransition( { "Patrolling", "Engaging" }, "Engage", "Engaging" ) -- FSM_CONTROLLABLE Transition for type #AI_CAS_ZONE. + + --- OnBefore Transition Handler for Event Engage. + -- @function [parent=#AI_CAS_ZONE] OnBeforeEngage + -- @param #AI_CAS_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + -- @return #boolean Return false to cancel Transition. + + --- OnAfter Transition Handler for Event Engage. + -- @function [parent=#AI_CAS_ZONE] OnAfterEngage + -- @param #AI_CAS_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + + --- Synchronous Event Trigger for Event Engage. + -- @function [parent=#AI_CAS_ZONE] Engage + -- @param #AI_CAS_ZONE self + + --- Asynchronous Event Trigger for Event Engage. + -- @function [parent=#AI_CAS_ZONE] __Engage + -- @param #AI_CAS_ZONE self + -- @param #number Delay The delay in seconds. + +--- OnLeave Transition Handler for State Engaging. +-- @function [parent=#AI_CAS_ZONE] OnLeaveEngaging +-- @param #AI_CAS_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @return #boolean Return false to cancel Transition. + +--- OnEnter Transition Handler for State Engaging. +-- @function [parent=#AI_CAS_ZONE] OnEnterEngaging +-- @param #AI_CAS_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. + + self:AddTransition( "Engaging", "Fired", "Engaging" ) -- FSM_CONTROLLABLE Transition for type #AI_CAS_ZONE. + + --- OnBefore Transition Handler for Event Fired. + -- @function [parent=#AI_CAS_ZONE] OnBeforeFired + -- @param #AI_CAS_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + -- @return #boolean Return false to cancel Transition. + + --- OnAfter Transition Handler for Event Fired. + -- @function [parent=#AI_CAS_ZONE] OnAfterFired + -- @param #AI_CAS_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + + --- Synchronous Event Trigger for Event Fired. + -- @function [parent=#AI_CAS_ZONE] Fired + -- @param #AI_CAS_ZONE self + + --- Asynchronous Event Trigger for Event Fired. + -- @function [parent=#AI_CAS_ZONE] __Fired + -- @param #AI_CAS_ZONE self + -- @param #number Delay The delay in seconds. + + self:AddTransition( "*", "Destroy", "*" ) -- FSM_CONTROLLABLE Transition for type #AI_CAS_ZONE. + + --- OnBefore Transition Handler for Event Destroy. + -- @function [parent=#AI_CAS_ZONE] OnBeforeDestroy + -- @param #AI_CAS_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + -- @return #boolean Return false to cancel Transition. + + --- OnAfter Transition Handler for Event Destroy. + -- @function [parent=#AI_CAS_ZONE] OnAfterDestroy + -- @param #AI_CAS_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + + --- Synchronous Event Trigger for Event Destroy. + -- @function [parent=#AI_CAS_ZONE] Destroy + -- @param #AI_CAS_ZONE self + + --- Asynchronous Event Trigger for Event Destroy. + -- @function [parent=#AI_CAS_ZONE] __Destroy + -- @param #AI_CAS_ZONE self + -- @param #number Delay The delay in seconds. + + + self:AddTransition( "Engaging", "Abort", "Patrolling" ) -- FSM_CONTROLLABLE Transition for type #AI_CAS_ZONE. + + --- OnBefore Transition Handler for Event Abort. + -- @function [parent=#AI_CAS_ZONE] OnBeforeAbort + -- @param #AI_CAS_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + -- @return #boolean Return false to cancel Transition. + + --- OnAfter Transition Handler for Event Abort. + -- @function [parent=#AI_CAS_ZONE] OnAfterAbort + -- @param #AI_CAS_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + + --- Synchronous Event Trigger for Event Abort. + -- @function [parent=#AI_CAS_ZONE] Abort + -- @param #AI_CAS_ZONE self + + --- Asynchronous Event Trigger for Event Abort. + -- @function [parent=#AI_CAS_ZONE] __Abort + -- @param #AI_CAS_ZONE self + -- @param #number Delay The delay in seconds. + + self:AddTransition( "Engaging", "Accomplish", "Patrolling" ) -- FSM_CONTROLLABLE Transition for type #AI_CAS_ZONE. + + --- OnBefore Transition Handler for Event Accomplish. + -- @function [parent=#AI_CAS_ZONE] OnBeforeAccomplish + -- @param #AI_CAS_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + -- @return #boolean Return false to cancel Transition. + + --- OnAfter Transition Handler for Event Accomplish. + -- @function [parent=#AI_CAS_ZONE] OnAfterAccomplish + -- @param #AI_CAS_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + + --- Synchronous Event Trigger for Event Accomplish. + -- @function [parent=#AI_CAS_ZONE] Accomplish + -- @param #AI_CAS_ZONE self + + --- Asynchronous Event Trigger for Event Accomplish. + -- @function [parent=#AI_CAS_ZONE] __Accomplish + -- @param #AI_CAS_ZONE self + -- @param #number Delay The delay in seconds. + + return self +end + + +--- Set the Engage Zone where the AI is performing CAS. Note that if the EngageZone is changed, the AI needs to re-detect targets. +-- @param #AI_CAS_ZONE self +-- @param Core.Zone#ZONE EngageZone The zone where the AI is performing CAS. +-- @return #AI_CAS_ZONE self +function AI_CAS_ZONE:SetEngageZone( EngageZone ) + self:F2() + + if EngageZone then + self.EngageZone = EngageZone + else + self.EngageZone = nil + end +end + + + +--- onafter State Transition for Event Start. +-- @param #AI_CAS_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_CAS_ZONE:onafterStart( Controllable, From, Event, To ) + + -- Call the parent Start event handler + self:GetParent(self).onafterStart( self, Controllable, From, Event, To ) + self:EventOnDead( self.OnDead ) end ---- Management of logical cargo objects, that can be transported from and to transportation carriers. + +--- @param Wrapper.Controllable#CONTROLLABLE AIControllable +function _NewEngageRoute( AIControllable ) + + AIControllable:T( "NewEngageRoute" ) + local EngageZone = AIControllable:GetState( AIControllable, "EngageZone" ) -- AI.AI_Cas#AI_CAS_ZONE + EngageZone:__Engage( 1 ) +end + +--- @param #AI_CAS_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_CAS_ZONE:onbeforeEngage( Controllable, From, Event, To ) + + if self.Accomplished == true then + return false + end +end + + +--- @param #AI_CAS_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To ) + + if Controllable:IsAlive() then + + local EngageRoute = {} + + --- Calculate the current route point. + local CurrentVec2 = self.Controllable:GetVec2() + + --TODO: Create GetAltitude function for GROUP, and delete GetUnit(1). + local CurrentAltitude = self.Controllable:GetUnit(1):GetAltitude() + local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y ) + local ToEngageZoneSpeed = self.PatrolMaxSpeed + local CurrentRoutePoint = CurrentPointVec3:RoutePointAir( + POINT_VEC3.RoutePointAltType.BARO, + POINT_VEC3.RoutePointType.TurningPoint, + POINT_VEC3.RoutePointAction.TurningPoint, + ToEngageZoneSpeed, + true + ) + + EngageRoute[#EngageRoute+1] = CurrentRoutePoint + + + if self.Controllable:IsNotInZone( self.EngageZone ) then + + -- Find a random 2D point in EngageZone. + local ToEngageZoneVec2 = self.EngageZone:GetRandomVec2() + self:T2( ToEngageZoneVec2 ) + + -- Define Speed and Altitude. + local ToEngageZoneAltitude = math.random( self.EngageFloorAltitude, self.EngageCeilingAltitude ) + local ToEngageZoneSpeed = self.PatrolMaxSpeed + self:T2( ToEngageZoneSpeed ) + + -- Obtain a 3D @{Point} from the 2D point + altitude. + local ToEngageZonePointVec3 = POINT_VEC3:New( ToEngageZoneVec2.x, ToEngageZoneAltitude, ToEngageZoneVec2.y ) + + -- Create a route point of type air. + local ToEngageZoneRoutePoint = ToEngageZonePointVec3:RoutePointAir( + POINT_VEC3.RoutePointAltType.BARO, + POINT_VEC3.RoutePointType.TurningPoint, + POINT_VEC3.RoutePointAction.TurningPoint, + ToEngageZoneSpeed, + true + ) + + EngageRoute[#EngageRoute+1] = ToEngageZoneRoutePoint + + end + + --- Define a random point in the @{Zone}. The AI will fly to that point within the zone. + + --- Find a random 2D point in EngageZone. + local ToTargetVec2 = self.EngageZone:GetRandomVec2() + self:T2( ToTargetVec2 ) + + --- Define Speed and Altitude. + local ToTargetAltitude = math.random( self.EngageFloorAltitude, self.EngageCeilingAltitude ) + local ToTargetSpeed = math.random( self.PatrolMinSpeed, self.PatrolMaxSpeed ) + self:T2( { self.PatrolMinSpeed, self.PatrolMaxSpeed, ToTargetSpeed } ) + + --- Obtain a 3D @{Point} from the 2D point + altitude. + local ToTargetPointVec3 = POINT_VEC3:New( ToTargetVec2.x, ToTargetAltitude, ToTargetVec2.y ) + + --- Create a route point of type air. + local ToTargetRoutePoint = ToTargetPointVec3:RoutePointAir( + POINT_VEC3.RoutePointAltType.BARO, + POINT_VEC3.RoutePointType.TurningPoint, + POINT_VEC3.RoutePointAction.TurningPoint, + ToTargetSpeed, + true + ) + + ToTargetPointVec3:SmokeBlue() + + EngageRoute[#EngageRoute+1] = ToTargetRoutePoint + + + Controllable:OptionROEOpenFire() + Controllable:OptionROTPassiveDefense() + + local AttackTasks = {} + + for DetectedUnitID, DetectedUnit in pairs( self.DetectedUnits ) do + local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT + self:T( DetectedUnit ) + if DetectedUnit:IsAlive() then + if DetectedUnit:IsInZone( self.EngageZone ) then + self:E( {"Engaging ", DetectedUnit } ) + AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit ) + end + else + self.DetectedUnits[DetectedUnit] = nil + end + end + + EngageRoute[1].task = Controllable:TaskCombo( AttackTasks ) + + --- Now we're going to do something special, we're going to call a function from a waypoint action at the AIControllable... + self.Controllable:WayPointInitialize( EngageRoute ) + + --- Do a trick, link the NewEngageRoute function of the object to the AIControllable in a temporary variable ... + self.Controllable:SetState( self.Controllable, "EngageZone", self ) + + self.Controllable:WayPointFunction( #EngageRoute, 1, "_NewEngageRoute" ) + + --- NOW ROUTE THE GROUP! + self.Controllable:WayPointExecute( 1, 2 ) + end +end + +--- @param #AI_CAS_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @param Core.Event#EVENTDATA EventData +function AI_CAS_ZONE:onafterDestroy( Controllable, From, Event, To, EventData ) + + if EventData.IniUnit then + self.DetectedUnits[EventData.IniUnit] = nil + end + + Controllable:MessageToAll( "Destroyed a target", 15 , "Destroyed!" ) +end + +--- @param #AI_CAS_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_CAS_ZONE:onafterAccomplish( Controllable, From, Event, To ) + self.Accomplished = true + self:SetDetectionOff() +end + +--- @param #AI_CAS_ZONE self +-- @param Core.Event#EVENTDATA EventData +function AI_CAS_ZONE:OnDead( EventData ) + self:T( { "EventDead", EventData } ) + + if EventData.IniDCSUnit then + self:__Destroy( 1, EventData ) + end +end + + +--- Single-Player:**Yes** / Mulit-Player:**Yes** / AI:**Yes** / Human:**No** / Types:**Air** -- **Execute Combat Air Patrol (CAP).** +-- +-- ![Banner Image](..\Presentations\AI_CAP\Dia1.JPG) +-- +-- +-- === +-- +-- # 1) @{#AI_CAP_ZONE} class, extends @{AI.AI_CAP#AI_PATROL_ZONE} +-- +-- The @{#AI_CAP_ZONE} class implements the core functions to patrol a @{Zone} by an AI @{Controllable} or @{Group} +-- and automatically engage any airborne enemies that are within a certain range or within a certain zone. +-- +-- ![Process](..\Presentations\AI_CAP\Dia3.JPG) +-- +-- The AI_CAP_ZONE is assigned a @{Group} and this must be done before the AI_CAP_ZONE process can be started using the **Start** event. +-- +-- ![Process](..\Presentations\AI_CAP\Dia4.JPG) +-- +-- The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits. +-- Upon arrival at the 3D point, a new random 3D point will be selected within the patrol zone using the given limits. +-- +-- ![Process](..\Presentations\AI_CAP\Dia5.JPG) +-- +-- This cycle will continue. +-- +-- ![Process](..\Presentations\AI_CAP\Dia6.JPG) +-- +-- During the patrol, the AI will detect enemy targets, which are reported through the **Detected** event. +-- +-- ![Process](..\Presentations\AI_CAP\Dia9.JPG) +-- +-- When enemies are detected, the AI will automatically engage the enemy. +-- +-- ![Process](..\Presentations\AI_CAP\Dia10.JPG) +-- +-- Until a fuel or damage treshold has been reached by the AI, or when the AI is commanded to RTB. +-- When the fuel treshold has been reached, the airplane will fly towards the nearest friendly airbase and will land. +-- +-- ![Process](..\Presentations\AI_CAP\Dia13.JPG) +-- +-- ## 1.1) AI_CAP_ZONE constructor +-- +-- * @{#AI_CAP_ZONE.New}(): Creates a new AI_CAP_ZONE object. +-- +-- ## 1.2) AI_CAP_ZONE is a FSM +-- +-- ![Process](..\Presentations\AI_CAP\Dia2.JPG) +-- +-- ### 1.2.1) AI_CAP_ZONE States +-- +-- * **None** ( Group ): The process is not started yet. +-- * **Patrolling** ( Group ): The AI is patrolling the Patrol Zone. +-- * **Engaging** ( Group ): The AI is engaging the bogeys. +-- * **Returning** ( Group ): The AI is returning to Base.. +-- +-- ### 1.2.2) AI_CAP_ZONE Events +-- +-- * **Start** ( Group ): Start the process. +-- * **Route** ( Group ): Route the AI to a new random 3D point within the Patrol Zone. +-- * **Engage** ( Group ): Let the AI engage the bogeys. +-- * **RTB** ( Group ): Route the AI to the home base. +-- * **Detect** ( Group ): The AI is detecting targets. +-- * **Detected** ( Group ): The AI has detected new targets. +-- * **Status** ( Group ): The AI is checking status (fuel and damage). When the tresholds have been reached, the AI will RTB. +-- +-- ## 1.3) Set the Range of Engagement +-- +-- ![Range](..\Presentations\AI_CAP\Dia11.JPG) +-- +-- An optional range can be set in meters, +-- that will define when the AI will engage with the detected airborne enemy targets. +-- The range can be beyond or smaller than the range of the Patrol Zone. +-- The range is applied at the position of the AI. +-- Use the method @{AI.AI_CAP#AI_CAP_ZONE.SetEngageRange}() to define that range. +-- +-- ## 1.4) Set the Zone of Engagement +-- +-- ![Zone](..\Presentations\AI_CAP\Dia12.JPG) +-- +-- An optional @{Zone} can be set, +-- that will define when the AI will engage with the detected airborne enemy targets. +-- Use the method @{AI.AI_Cap#AI_CAP_ZONE.SetEngageZone}() to define that Zone. +-- +-- ==== +-- +-- # **API CHANGE HISTORY** +-- +-- The underlying change log documents the API changes. Please read this carefully. The following notation is used: +-- +-- * **Added** parts are expressed in bold type face. +-- * _Removed_ parts are expressed in italic type face. +-- +-- Hereby the change log: +-- +-- 2017-01-15: Initial class and API. +-- +-- === +-- +-- # **AUTHORS and CONTRIBUTIONS** +-- +-- ### Contributions: +-- +-- * **[Quax](https://forums.eagle.ru/member.php?u=90530)**: Concept, Advice & Testing. +-- * **[Pikey](https://forums.eagle.ru/member.php?u=62835)**: Concept, Advice & Testing. +-- * **[Gunterlund](http://forums.eagle.ru:8080/member.php?u=75036)**: Test case revision. +-- * **[Whisper](http://forums.eagle.ru/member.php?u=3829): Testing. +-- * **[Delta99](https://forums.eagle.ru/member.php?u=125166): Testing. +-- +-- ### Authors: +-- +-- * **FlightControl**: Concept, Design & Programming. +-- +-- @module AI_Cap + + +--- AI_CAP_ZONE class +-- @type AI_CAP_ZONE +-- @field Wrapper.Controllable#CONTROLLABLE AIControllable The @{Controllable} patrolling. +-- @field Core.Zone#ZONE_BASE TargetZone The @{Zone} where the patrol needs to be executed. +-- @extends AI.AI_Patrol#AI_PATROL_ZONE +AI_CAP_ZONE = { + ClassName = "AI_CAP_ZONE", +} + + + +--- Creates a new AI_CAP_ZONE object +-- @param #AI_CAP_ZONE self +-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed. +-- @param Dcs.DCSTypes#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol. +-- @param Dcs.DCSTypes#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol. +-- @param Dcs.DCSTypes#Speed PatrolMinSpeed The minimum speed of the @{Controllable} in km/h. +-- @param Dcs.DCSTypes#Speed PatrolMaxSpeed The maximum speed of the @{Controllable} in km/h. +-- @return #AI_CAP_ZONE self +function AI_CAP_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed ) + + -- Inherits from BASE + local self = BASE:Inherit( self, AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed ) ) -- #AI_CAP_ZONE + + self.Accomplished = false + self.Engaging = false + + self:AddTransition( { "Patrolling", "Engaging" }, "Engage", "Engaging" ) -- FSM_CONTROLLABLE Transition for type #AI_CAP_ZONE. + + --- OnBefore Transition Handler for Event Engage. + -- @function [parent=#AI_CAP_ZONE] OnBeforeEngage + -- @param #AI_CAP_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + -- @return #boolean Return false to cancel Transition. + + --- OnAfter Transition Handler for Event Engage. + -- @function [parent=#AI_CAP_ZONE] OnAfterEngage + -- @param #AI_CAP_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + + --- Synchronous Event Trigger for Event Engage. + -- @function [parent=#AI_CAP_ZONE] Engage + -- @param #AI_CAP_ZONE self + + --- Asynchronous Event Trigger for Event Engage. + -- @function [parent=#AI_CAP_ZONE] __Engage + -- @param #AI_CAP_ZONE self + -- @param #number Delay The delay in seconds. + +--- OnLeave Transition Handler for State Engaging. +-- @function [parent=#AI_CAP_ZONE] OnLeaveEngaging +-- @param #AI_CAP_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @return #boolean Return false to cancel Transition. + +--- OnEnter Transition Handler for State Engaging. +-- @function [parent=#AI_CAP_ZONE] OnEnterEngaging +-- @param #AI_CAP_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. + + self:AddTransition( "Engaging", "Fired", "Engaging" ) -- FSM_CONTROLLABLE Transition for type #AI_CAP_ZONE. + + --- OnBefore Transition Handler for Event Fired. + -- @function [parent=#AI_CAP_ZONE] OnBeforeFired + -- @param #AI_CAP_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + -- @return #boolean Return false to cancel Transition. + + --- OnAfter Transition Handler for Event Fired. + -- @function [parent=#AI_CAP_ZONE] OnAfterFired + -- @param #AI_CAP_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + + --- Synchronous Event Trigger for Event Fired. + -- @function [parent=#AI_CAP_ZONE] Fired + -- @param #AI_CAP_ZONE self + + --- Asynchronous Event Trigger for Event Fired. + -- @function [parent=#AI_CAP_ZONE] __Fired + -- @param #AI_CAP_ZONE self + -- @param #number Delay The delay in seconds. + + self:AddTransition( "*", "Destroy", "*" ) -- FSM_CONTROLLABLE Transition for type #AI_CAP_ZONE. + + --- OnBefore Transition Handler for Event Destroy. + -- @function [parent=#AI_CAP_ZONE] OnBeforeDestroy + -- @param #AI_CAP_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + -- @return #boolean Return false to cancel Transition. + + --- OnAfter Transition Handler for Event Destroy. + -- @function [parent=#AI_CAP_ZONE] OnAfterDestroy + -- @param #AI_CAP_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + + --- Synchronous Event Trigger for Event Destroy. + -- @function [parent=#AI_CAP_ZONE] Destroy + -- @param #AI_CAP_ZONE self + + --- Asynchronous Event Trigger for Event Destroy. + -- @function [parent=#AI_CAP_ZONE] __Destroy + -- @param #AI_CAP_ZONE self + -- @param #number Delay The delay in seconds. + + + self:AddTransition( "Engaging", "Abort", "Patrolling" ) -- FSM_CONTROLLABLE Transition for type #AI_CAP_ZONE. + + --- OnBefore Transition Handler for Event Abort. + -- @function [parent=#AI_CAP_ZONE] OnBeforeAbort + -- @param #AI_CAP_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + -- @return #boolean Return false to cancel Transition. + + --- OnAfter Transition Handler for Event Abort. + -- @function [parent=#AI_CAP_ZONE] OnAfterAbort + -- @param #AI_CAP_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + + --- Synchronous Event Trigger for Event Abort. + -- @function [parent=#AI_CAP_ZONE] Abort + -- @param #AI_CAP_ZONE self + + --- Asynchronous Event Trigger for Event Abort. + -- @function [parent=#AI_CAP_ZONE] __Abort + -- @param #AI_CAP_ZONE self + -- @param #number Delay The delay in seconds. + + self:AddTransition( "Engaging", "Accomplish", "Patrolling" ) -- FSM_CONTROLLABLE Transition for type #AI_CAP_ZONE. + + --- OnBefore Transition Handler for Event Accomplish. + -- @function [parent=#AI_CAP_ZONE] OnBeforeAccomplish + -- @param #AI_CAP_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + -- @return #boolean Return false to cancel Transition. + + --- OnAfter Transition Handler for Event Accomplish. + -- @function [parent=#AI_CAP_ZONE] OnAfterAccomplish + -- @param #AI_CAP_ZONE self + -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. + -- @param #string From The From State string. + -- @param #string Event The Event string. + -- @param #string To The To State string. + + --- Synchronous Event Trigger for Event Accomplish. + -- @function [parent=#AI_CAP_ZONE] Accomplish + -- @param #AI_CAP_ZONE self + + --- Asynchronous Event Trigger for Event Accomplish. + -- @function [parent=#AI_CAP_ZONE] __Accomplish + -- @param #AI_CAP_ZONE self + -- @param #number Delay The delay in seconds. + + return self +end + + +--- Set the Engage Zone which defines where the AI will engage bogies. +-- @param #AI_CAP_ZONE self +-- @param Core.Zone#ZONE EngageZone The zone where the AI is performing CAP. +-- @return #AI_CAP_ZONE self +function AI_CAP_ZONE:SetEngageZone( EngageZone ) + self:F2() + + if EngageZone then + self.EngageZone = EngageZone + else + self.EngageZone = nil + end +end + +--- Set the Engage Range when the AI will engage with airborne enemies. +-- @param #AI_CAP_ZONE self +-- @param #number EngageRange The Engage Range. +-- @return #AI_CAP_ZONE self +function AI_CAP_ZONE:SetEngageRange( EngageRange ) + self:F2() + + if EngageRange then + self.EngageRange = EngageRange + else + self.EngageRange = nil + end +end + +--- onafter State Transition for Event Start. +-- @param #AI_CAP_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_CAP_ZONE:onafterStart( Controllable, From, Event, To ) + + -- Call the parent Start event handler + self:GetParent(self).onafterStart( self, Controllable, From, Event, To ) + +end + +--- @param Wrapper.Controllable#CONTROLLABLE AIControllable +function _NewEngageCapRoute( AIControllable ) + + AIControllable:T( "NewEngageRoute" ) + local EngageZone = AIControllable:GetState( AIControllable, "EngageZone" ) -- AI.AI_Cap#AI_CAP_ZONE + EngageZone:__Engage( 1 ) +end + +--- @param #AI_CAP_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_CAP_ZONE:onbeforeEngage( Controllable, From, Event, To ) + + if self.Accomplished == true then + return false + end +end + +--- @param #AI_CAP_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_CAP_ZONE:onafterDetected( Controllable, From, Event, To ) + + if From ~= "Engaging" then + + local Engage = false + + for DetectedUnitID, DetectedUnit in pairs( self.DetectedUnits ) do + + local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT + self:T( DetectedUnit ) + if DetectedUnit:IsAlive() and DetectedUnit:IsAir() then + Engage = true + break + end + end + + if Engage == true then + self:E( 'Detected -> Engaging' ) + self:__Engage( 1 ) + end + end +end + + + +--- @param #AI_CAP_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_CAP_ZONE:onafterEngage( Controllable, From, Event, To ) + + if Controllable:IsAlive() then + + local EngageRoute = {} + + --- Calculate the current route point. + local CurrentVec2 = self.Controllable:GetVec2() + + --TODO: Create GetAltitude function for GROUP, and delete GetUnit(1). + local CurrentAltitude = self.Controllable:GetUnit(1):GetAltitude() + local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y ) + local ToEngageZoneSpeed = self.PatrolMaxSpeed + local CurrentRoutePoint = CurrentPointVec3:RoutePointAir( + POINT_VEC3.RoutePointAltType.BARO, + POINT_VEC3.RoutePointType.TurningPoint, + POINT_VEC3.RoutePointAction.TurningPoint, + ToEngageZoneSpeed, + true + ) + + EngageRoute[#EngageRoute+1] = CurrentRoutePoint + + + --- Find a random 2D point in PatrolZone. + local ToTargetVec2 = self.PatrolZone:GetRandomVec2() + self:T2( ToTargetVec2 ) + + --- Define Speed and Altitude. + local ToTargetAltitude = math.random( self.EngageFloorAltitude, self.EngageCeilingAltitude ) + local ToTargetSpeed = math.random( self.PatrolMinSpeed, self.PatrolMaxSpeed ) + self:T2( { self.PatrolMinSpeed, self.PatrolMaxSpeed, ToTargetSpeed } ) + + --- Obtain a 3D @{Point} from the 2D point + altitude. + local ToTargetPointVec3 = POINT_VEC3:New( ToTargetVec2.x, ToTargetAltitude, ToTargetVec2.y ) + + --- Create a route point of type air. + local ToPatrolRoutePoint = ToTargetPointVec3:RoutePointAir( + POINT_VEC3.RoutePointAltType.BARO, + POINT_VEC3.RoutePointType.TurningPoint, + POINT_VEC3.RoutePointAction.TurningPoint, + ToTargetSpeed, + true + ) + + EngageRoute[#EngageRoute+1] = ToPatrolRoutePoint + + Controllable:OptionROEOpenFire() + Controllable:OptionROTPassiveDefense() + + local AttackTasks = {} + + for DetectedUnitID, DetectedUnit in pairs( self.DetectedUnits ) do + local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT + self:T( { DetectedUnit, DetectedUnit:IsAlive(), DetectedUnit:IsAir() } ) + if DetectedUnit:IsAlive() and DetectedUnit:IsAir() then + if self.EngageZone then + if DetectedUnit:IsInZone( self.EngageZone ) then + self:E( {"Within Zone and Engaging ", DetectedUnit } ) + AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit ) + end + else + if self.EngageRange then + if DetectedUnit:GetPointVec3():Get2DDistance(Controllable:GetPointVec3() ) <= self.EngageRange then + self:E( {"Within Range and Engaging", DetectedUnit } ) + AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit ) + end + else + AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit ) + end + end + else + self.DetectedUnits[DetectedUnit] = nil + end + end + + --- Now we're going to do something special, we're going to call a function from a waypoint action at the AIControllable... + self.Controllable:WayPointInitialize( EngageRoute ) + + + if #AttackTasks == 0 then + self:E("No targets found -> Going back to Patrolling") + self:__Accomplish( 1 ) + self:__Route( 1 ) + self:SetDetectionActivated() + else + EngageRoute[1].task = Controllable:TaskCombo( AttackTasks ) + + --- Do a trick, link the NewEngageRoute function of the object to the AIControllable in a temporary variable ... + self.Controllable:SetState( self.Controllable, "EngageZone", self ) + + self.Controllable:WayPointFunction( #EngageRoute, 1, "_NewEngageCapRoute" ) + + self:SetDetectionDeactivated() + end + + --- NOW ROUTE THE GROUP! + self.Controllable:WayPointExecute( 1, 2 ) + + end +end + +--- @param #AI_CAP_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +-- @param Core.Event#EVENTDATA EventData +function AI_CAP_ZONE:onafterDestroy( Controllable, From, Event, To, EventData ) + + if EventData.IniUnit then + self.DetectedUnits[EventData.IniUnit] = nil + end + + Controllable:MessageToAll( "Destroyed a target", 15 , "Destroyed!" ) +end + +--- @param #AI_CAP_ZONE self +-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. +-- @param #string From The From State string. +-- @param #string Event The Event string. +-- @param #string To The To State string. +function AI_CAP_ZONE:onafterAccomplish( Controllable, From, Event, To ) + self.Accomplished = true + self:SetDetectionOff() +end + + +--- Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Ground -- Management of logical cargo objects, that can be transported from and to transportation carriers. -- -- === -- @@ -27147,7 +28897,8 @@ end function COMMANDCENTER:MessageToCoalition( Message ) local CCCoalition = self:GetPositionable():GetCoalition() - self:GetPositionable():MessageToBlue( Message , 20, CCCoalition ) + --TODO: Fix coalition bug! + self:GetPositionable():MessageToCoalition( Message, 20, CCCoalition, self:GetName() ) end @@ -28770,7 +30521,7 @@ function TASK.MenuTaskAbort( MenuParam ) local self = MenuParam.self local TaskGroup = MenuParam.TaskGroup - --self:AssignToGroup( TaskGroup ) + self:Abort() end @@ -29037,8 +30788,8 @@ end --- FSM function for a TASK -- @param #TASK self --- @param #string Event -- @param #string From +-- @param #string Event -- @param #string To function TASK:onenterAborted( From, Event, To ) @@ -29047,12 +30798,29 @@ function TASK:onenterAborted( From, Event, To ) self:GetMission():GetCommandCenter():MessageToCoalition( "Task " .. self:GetName() .. " has been aborted! Task may be replanned." ) self:UnAssignFromGroups() + + self:__Replan( 5 ) end --- FSM function for a TASK -- @param #TASK self --- @param #string Event -- @param #string From +-- @param #string Event +-- @param #string To +function TASK:onafterReplan( From, Event, To ) + + self:E( "Task Replanned" ) + + self:GetMission():GetCommandCenter():MessageToCoalition( "Replanning Task " .. self:GetName() .. "." ) + + self:SetMenu() + +end + +--- FSM function for a TASK +-- @param #TASK self +-- @param #string From +-- @param #string Event -- @param #string To function TASK:onenterFailed( From, Event, To ) @@ -29856,6 +31624,8 @@ Include.File( "Functional/Detection" ) --- AI Classes Include.File( "AI/AI_Balancer" ) Include.File( "AI/AI_Patrol" ) +Include.File( "AI/AI_Cap" ) +Include.File( "AI/AI_Cas" ) Include.File( "AI/AI_Cargo" ) --- Actions diff --git a/Moose Mission Setup/Moose_Create.bat b/Moose Mission Setup/Moose_Create.bat index 151558dbe..ea27cb4f9 100644 --- a/Moose Mission Setup/Moose_Create.bat +++ b/Moose Mission Setup/Moose_Create.bat @@ -80,6 +80,8 @@ COPY /b Moose.lua + %1\Functional\Detection.lua Moose.lua rem AI Classes COPY /b Moose.lua + %1\AI\AI_Balancer.lua Moose.lua COPY /b Moose.lua + %1\AI\AI_Patrol.lua Moose.lua +COPY /b Moose.lua + %1\AI\AI_Cas.lua Moose.lua +COPY /b Moose.lua + %1\AI\AI_Cap.lua Moose.lua COPY /b Moose.lua + %1\AI\AI_Cargo.lua Moose.lua diff --git a/docs/Presentations/AI_BALANCER.pptx b/Moose Presentations/AI_BALANCER.pptx similarity index 100% rename from docs/Presentations/AI_BALANCER.pptx rename to Moose Presentations/AI_BALANCER.pptx diff --git a/Moose Presentations/AI_CAP.pptx b/Moose Presentations/AI_CAP.pptx new file mode 100644 index 000000000..17395cd37 Binary files /dev/null and b/Moose Presentations/AI_CAP.pptx differ diff --git a/Moose Presentations/AI_CAS.pptx b/Moose Presentations/AI_CAS.pptx new file mode 100644 index 000000000..07e718c00 Binary files /dev/null and b/Moose Presentations/AI_CAS.pptx differ diff --git a/Moose Presentations/AI_PATROL.pptx b/Moose Presentations/AI_PATROL.pptx new file mode 100644 index 000000000..bf425bd57 Binary files /dev/null and b/Moose Presentations/AI_PATROL.pptx differ diff --git a/docs/Presentations/CARGO.pptx b/Moose Presentations/CARGO.pptx similarity index 100% rename from docs/Presentations/CARGO.pptx rename to Moose Presentations/CARGO.pptx diff --git a/docs/Presentations/FSM.pptx b/Moose Presentations/FSM.pptx similarity index 100% rename from docs/Presentations/FSM.pptx rename to Moose Presentations/FSM.pptx diff --git a/docs/Presentations/MOOSE.pptx b/Moose Presentations/MOOSE.pptx similarity index 76% rename from docs/Presentations/MOOSE.pptx rename to Moose Presentations/MOOSE.pptx index 9fec67a1c..b9c40c706 100644 Binary files a/docs/Presentations/MOOSE.pptx and b/Moose Presentations/MOOSE.pptx differ diff --git a/Moose Presentations/SETUP.pptx b/Moose Presentations/SETUP.pptx new file mode 100644 index 000000000..fc03fc4c9 Binary files /dev/null and b/Moose Presentations/SETUP.pptx differ diff --git a/docs/Presentations/SPAWN.pptx b/Moose Presentations/SPAWN.pptx similarity index 100% rename from docs/Presentations/SPAWN.pptx rename to Moose Presentations/SPAWN.pptx diff --git a/Moose Test Missions/ABP - Airbase Police/APL-001 - Caucasus/APL-001 - Caucasus.miz b/Moose Test Missions/ABP - Airbase Police/APL-001 - Caucasus/APL-001 - Caucasus.miz index 2fa64248e..3973875f2 100644 Binary files a/Moose Test Missions/ABP - Airbase Police/APL-001 - Caucasus/APL-001 - Caucasus.miz and b/Moose Test Missions/ABP - Airbase Police/APL-001 - Caucasus/APL-001 - Caucasus.miz differ diff --git a/Moose Test Missions/ABP - Airbase Police/APL-002 - Nevada/APL-002 - Nevada.miz b/Moose Test Missions/ABP - Airbase Police/APL-002 - Nevada/APL-002 - Nevada.miz index 09e890491..5f6d100ac 100644 Binary files a/Moose Test Missions/ABP - Airbase Police/APL-002 - Nevada/APL-002 - Nevada.miz and b/Moose Test Missions/ABP - Airbase Police/APL-002 - Nevada/APL-002 - Nevada.miz differ diff --git a/Moose Test Missions/ACL - Airbase Cleaner/ACL-001 - Airbase CleanUp/ACL-001 - Airbase CleanUp.miz b/Moose Test Missions/ACL - Airbase Cleaner/ACL-001 - Airbase CleanUp/ACL-001 - Airbase CleanUp.miz index 5d874084a..25ef5d2af 100644 Binary files a/Moose Test Missions/ACL - Airbase Cleaner/ACL-001 - Airbase CleanUp/ACL-001 - Airbase CleanUp.miz and b/Moose Test Missions/ACL - Airbase Cleaner/ACL-001 - Airbase CleanUp/ACL-001 - Airbase CleanUp.miz differ diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-001 - Spawned AI/AIB-001 - Spawned AI.lua b/Moose Test Missions/AIB - AI Balancing/AIB-001 - Spawned AI/AIB-001 - Spawned AI.lua index 7af0df386..5315ae2e7 100644 --- a/Moose Test Missions/AIB - AI Balancing/AIB-001 - Spawned AI/AIB-001 - Spawned AI.lua +++ b/Moose Test Missions/AIB - AI Balancing/AIB-001 - Spawned AI/AIB-001 - Spawned AI.lua @@ -1,8 +1,4 @@ ---- AI Spawning and Decomissioning --- --- === --- --- Name: Spawned AI +-- Name: AIB-001 - Spawned AI -- Author: FlightControl -- Date Created: 07 Dec 2016 -- @@ -18,10 +14,6 @@ -- 1. If no player is logging into the red slots, 2 red AI planes should be alive. -- 2. If a player joins one red slot, one red AI plane should return to the nearest home base. -- 3. If two players join the red slots, no AI plane should be spawned, and all airborne AI planes should return to the nearest home base. --- --- # Status: TESTED 07 Dec 2016 --- --- @module TEST.AI_BALANCER.T001 -- Define the SET of CLIENTs from the red coalition. This SET is filled during startup. local RU_PlanesClientSet = SET_CLIENT:New():FilterCountries( "RUSSIA" ):FilterCategories( "plane" ) diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-001 - Spawned AI/AIB-001 - Spawned AI.miz b/Moose Test Missions/AIB - AI Balancing/AIB-001 - Spawned AI/AIB-001 - Spawned AI.miz index 9779a87ba..cc5984a01 100644 Binary files a/Moose Test Missions/AIB - AI Balancing/AIB-001 - Spawned AI/AIB-001 - Spawned AI.miz and b/Moose Test Missions/AIB - AI Balancing/AIB-001 - Spawned AI/AIB-001 - Spawned AI.miz differ diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-002 - Patrol AI/AIB-002 - Patrol AI.lua b/Moose Test Missions/AIB - AI Balancing/AIB-002 - Patrol AI/AIB-002 - Patrol AI.lua index 78f9a6946..158a8f5ee 100644 --- a/Moose Test Missions/AIB - AI Balancing/AIB-002 - Patrol AI/AIB-002 - Patrol AI.lua +++ b/Moose Test Missions/AIB - AI Balancing/AIB-002 - Patrol AI/AIB-002 - Patrol AI.lua @@ -1,8 +1,4 @@ ---- AI Patrolling --- --- === --- --- Name: Patrol AI +-- Name: AIB-002 - Patrol AI.lua -- Author: FlightControl -- Date Created: 7 December 2016 -- @@ -31,15 +27,17 @@ local RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 ) -- Start the AI_BALANCER, using the SET of red CLIENTs, and the SPAWN object as a parameter. local RU_AI_Balancer = AI_BALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn ) +local PatrolZones = {} + function RU_AI_Balancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup ) local PatrolZoneGroup = GROUP:FindByName( "PatrolZone" ) local PatrolZone = ZONE_POLYGON:New( "PatrolZone", PatrolZoneGroup ) - local Patrol = AI_PATROLZONE:New( PatrolZone, 3000, 6000, 400, 600 ) - Patrol:ManageFuel( 0.2, 60 ) - Patrol:SetControllable( AIGroup ) - Patrol:__Start( 5 ) + PatrolZones[AIGroup] = AI_PATROL_ZONE:New( PatrolZone, 3000, 6000, 400, 600 ) + PatrolZones[AIGroup]:ManageFuel( 0.2, 60 ) + PatrolZones[AIGroup]:SetControllable( AIGroup ) + PatrolZones[AIGroup]:__Start( 5 ) end diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-002 - Patrol AI/AIB-002 - Patrol AI.miz b/Moose Test Missions/AIB - AI Balancing/AIB-002 - Patrol AI/AIB-002 - Patrol AI.miz index 62e5dd39f..ceb060cbc 100644 Binary files a/Moose Test Missions/AIB - AI Balancing/AIB-002 - Patrol AI/AIB-002 - Patrol AI.miz and b/Moose Test Missions/AIB - AI Balancing/AIB-002 - Patrol AI/AIB-002 - Patrol AI.miz differ diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-003 - Two coalitions InitCleanUp test/AIB-003 - Two coalitions InitCleanUp test.lua b/Moose Test Missions/AIB - AI Balancing/AIB-003 - Two coalitions InitCleanUp test/AIB-003 - Two coalitions InitCleanUp test.lua index a647bedee..2f4a137ab 100644 --- a/Moose Test Missions/AIB - AI Balancing/AIB-003 - Two coalitions InitCleanUp test/AIB-003 - Two coalitions InitCleanUp test.lua +++ b/Moose Test Missions/AIB - AI Balancing/AIB-003 - Two coalitions InitCleanUp test/AIB-003 - Two coalitions InitCleanUp test.lua @@ -15,10 +15,10 @@ US_AI_Balancer = AI_BALANCER:New( US_PlanesClientSet, US_PlanesSpawn ) --local PatrolZoneGroup = GROUP:FindByName( "Patrol Zone Blue" ) --local PatrolZoneBlue = ZONE_POLYGON:New( "PatrolZone", PatrolZoneGroup ) ---local PatrolZoneB = AI_PATROLZONE:New( PatrolZoneBlue, 3000, 6000, 900, 1100 ):ManageFuel( 0.2, 180 ) +--local PatrolZoneB = AI_PATROL_ZONE:New( PatrolZoneBlue, 3000, 6000, 900, 1100 ):ManageFuel( 0.2, 180 ) --US_AI_Balancer:SetPatrolZone( PatrolZoneB ) -- --local PatrolZoneGroup = GROUP:FindByName( "Patrol Zone Red" ) --local PatrolZoneRed = ZONE_POLYGON:New( "PatrolZone", PatrolZoneGroup ) ---local PatrolZoneR = AI_PATROLZONE:New( PatrolZoneRed, 3000, 6000, 900, 1100 ):ManageFuel( 0.2, 180 ) +--local PatrolZoneR = AI_PATROL_ZONE:New( PatrolZoneRed, 3000, 6000, 900, 1100 ):ManageFuel( 0.2, 180 ) --RU_AI_Balancer:SetPatrolZone( PatrolZoneR ) diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-003 - Two coalitions InitCleanUp test/AIB-003 - Two coalitions InitCleanUp test.miz b/Moose Test Missions/AIB - AI Balancing/AIB-003 - Two coalitions InitCleanUp test/AIB-003 - Two coalitions InitCleanUp test.miz index 21ab66ee7..3feeeb1a7 100644 Binary files a/Moose Test Missions/AIB - AI Balancing/AIB-003 - Two coalitions InitCleanUp test/AIB-003 - Two coalitions InitCleanUp test.miz and b/Moose Test Missions/AIB - AI Balancing/AIB-003 - Two coalitions InitCleanUp test/AIB-003 - Two coalitions InitCleanUp test.miz differ diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-004 - Respawn Test when Destroyed/AIB-004 - Respawn Test when Destroyed.lua b/Moose Test Missions/AIB - AI Balancing/AIB-004 - Respawn Test when Destroyed/AIB-004 - Respawn Test when Destroyed.lua index f65e27f88..222c56980 100644 --- a/Moose Test Missions/AIB - AI Balancing/AIB-004 - Respawn Test when Destroyed/AIB-004 - Respawn Test when Destroyed.lua +++ b/Moose Test Missions/AIB - AI Balancing/AIB-004 - Respawn Test when Destroyed/AIB-004 - Respawn Test when Destroyed.lua @@ -1,4 +1,4 @@ --- Name: Respawn Test when Destroyed +-- Name: AIB-004 - Respawn Test when Destroyed.lua -- Author: FlightControl -- Date Created: 7 January 2017 -- @@ -19,7 +19,7 @@ -- 2. If a player joins one red slot, one red AI plane should return to the nearest home base. -- 3. If two players join the red slots, no AI plane should be spawned, and all airborne AI planes should return to the nearest home base. -- 4. Monitor that once a red AI is destroyed, that it ReSpawns... --- + -- Define the SET of CLIENTs from the red coalition. This SET is filled during startup. local RU_PlanesClientSet = SET_CLIENT:New():FilterCountries( "RUSSIA" ):FilterCategories( "plane" ) @@ -38,7 +38,7 @@ function RU_AI_Balancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup ) local PatrolZone = ZONE_POLYGON:New( "PatrolZone", PatrolZoneGroup ) - local Patrol = AI_PATROLZONE:New( PatrolZone, 3000, 6000, 400, 600 ) + local Patrol = AI_PATROL_ZONE:New( PatrolZone, 3000, 6000, 400, 600 ) Patrol:ManageFuel( 0.2, 60 ) Patrol:SetControllable( AIGroup ) Patrol:__Start( 5 ) diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-004 - Respawn Test when Destroyed/AIB-004 - Respawn Test when Destroyed.miz b/Moose Test Missions/AIB - AI Balancing/AIB-004 - Respawn Test when Destroyed/AIB-004 - Respawn Test when Destroyed.miz index 49df5cd2f..0eb17b930 100644 Binary files a/Moose Test Missions/AIB - AI Balancing/AIB-004 - Respawn Test when Destroyed/AIB-004 - Respawn Test when Destroyed.miz and b/Moose Test Missions/AIB - AI Balancing/AIB-004 - Respawn Test when Destroyed/AIB-004 - Respawn Test when Destroyed.miz differ diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones.lua b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones.lua index 59722ccda..eab2c2e22 100644 --- a/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones.lua +++ b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones.lua @@ -1,4 +1,4 @@ --- Name: AIB-006 - Declutter AI at Airbases +-- Name: AIB-005 - Patrol AI and Randomize Zones -- Author: FlightControl -- Date Created: 10 Jan 2016 -- @@ -25,7 +25,7 @@ local RU_PlanesClientSet = SET_CLIENT:New():FilterCountries( "RUSSIA" ):FilterCa -- Define the SPAWN object for the red AI plane template. -- We use InitCleanUp to check every 20 seconds, if there are no planes blocked at the airbase, waithing for take-off. -- If a blocked plane exists, this red plane will be ReSpawned. -local RU_PlanesSpawn = SPAWN:New( "AI RU" ) +local RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 ) -- Start the AI_BALANCER, using the SET of red CLIENTs, and the SPAWN object as a parameter. local RU_AI_Balancer = AI_BALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn ) @@ -43,9 +43,9 @@ local PatrolZoneArray = { PatrolZone1, PatrolZone2 } function RU_AI_Balancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup ) - local Patrol = AI_PATROLZONE:New( PatrolZoneArray[math.random( 1, 2 )], 3000, 6000, 400, 600 ) + local Patrol = AI_PATROL_ZONE:New( PatrolZoneArray[math.random( 1, 2 )], 3000, 6000, 400, 600 ) Patrol:ManageFuel( 0.2, 60 ) Patrol:SetControllable( AIGroup ) - Patrol:__Start( 5 ) + Patrol:Start() end diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones.miz b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones.miz index 8ac77207b..f36a9a476 100644 Binary files a/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones.miz and b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones.miz differ diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/Config/View/Server.lua b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/Config/View/Server.lua new file mode 100644 index 000000000..c7db44162 --- /dev/null +++ b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/Config/View/Server.lua @@ -0,0 +1,210 @@ +-- View scripts +-- Copyright (C) 2004, Eagle Dynamics. +DisableCombatViews = false -- F5 & Ctrl-F5 +ExternalObjectsLockDistance = 10000.0 +ShowTargetInfo = false +CameraTerrainRestriction = true +hAngleRearDefault = 180 +vAngleRearDefault = -8.0 +vAngleRearMin = -90 -- -8.0 +vAngleRearMax = 90.0 + +dbg_shell = "weapons.shells.PKT_7_62_T" -- 23mm shell +dbg_shell = "weapons.nurs.WGr21" +-- dbg_shell = "weapons.shells.2A64_152" -- 152mm shell +dbg_shell_v0 = -1 -- Muzzle speed m/s (-1 - speed from shall database) +dbg_shell_fire_rate = 60 +--reformatted per-unit data to be mod system friendly +--this file is no longer should be edited for adding new flyable aircraft , DCS automatically check core database (i.e. where you define your aircraft in aircraft table just define ViewSettings and SnapViews tables) + +function default_fighter_player(t) + local res = { + CameraViewAngleLimits = {20.000000,140.000000}, + CameraAngleRestriction = {false ,90.000000,0.500000}, + EyePoint = {0.05 ,0.000000 ,0.000000}, + limits_6DOF = {x = {-0.050000,0.4500000},y ={-0.300000,0.100000},z = {-0.220000,0.220000},roll = 90.000000}, + Allow360rotation = false, + CameraAngleLimits = {200,-80.000000,110.000000}, + ShoulderSize = 0.2, -- move body when azimuth value more then 90 degrees + } + if t then + for i,o in pairs(t) do + res[i] = o + end + end + return res +end + +function fulcrum() + return { + Cockpit = { + default_fighter_player({CockpitLocalPoint = {4.71,1.28,0.000000}}) + }, + Chase = { + LocalPoint = {1.220000,3.750000,0.000000}, + AnglesDefault = {180.000000,-8.000000}, + }, -- Chase + Arcade = { + LocalPoint = {-15.080000,6.350000,0.000000}, + AnglesDefault = {0.000000,-8.000000}, + }, -- Arcade + } +end + +ViewSettings = {} +ViewSettings["A-10A"] = { + Cockpit = { + [1] = default_fighter_player({CockpitLocalPoint = {4.300000,1.282000,0.000000}, + EyePoint = {0.000000,0.000000,0.000000}, + limits_6DOF = {x = {-0.050000,0.600000}, + y = {-0.300000,0.100000}, + z = {-0.250000,0.250000}, + roll = 90.000000}}), + }, -- Cockpit + Chase = { + LocalPoint = {0.600000,3.682000,0.000000}, + AnglesDefault = {180.000000,-8.000000}, + }, -- Chase + Arcade = { + LocalPoint = {-27.000000,12.000000,0.000000}, + AnglesDefault = {0.000000,-12.000000}, + }, -- Arcade +} +ViewSettings["A-10C"] = { + Cockpit = { + [1] = default_fighter_player({CockpitLocalPoint = {4.300000,1.282000,0.000000}, + EyePoint = {0.000000,0.000000,0.000000}, + limits_6DOF = {x = {-0.050000,0.600000}, + y = {-0.300000,0.100000}, + z = {-0.250000,0.250000}, + roll = 90.000000}}), + }, -- Cockpit + Chase = { + LocalPoint = {0.600000,3.682000,0.000000}, + AnglesDefault = {180.000000,-8.000000}, + }, -- Chase + Arcade = { + LocalPoint = {-27.000000,12.000000,0.000000}, + AnglesDefault = {0.000000,-12.000000}, + }, -- Arcade +} +ViewSettings["F-15C"] = { + Cockpit = { + [1] = default_fighter_player({CockpitLocalPoint = {6.210000,1.204000,0.000000}})-- player slot 1 + }, -- Cockpit + Chase = { + LocalPoint = {2.510000,3.604000,0.000000}, + AnglesDefault = {180.000000,-8.000000}, + }, -- Chase + Arcade = { + LocalPoint = {-13.790000,6.204000,0.000000}, + AnglesDefault = {0.000000,-8.000000}, + }, -- Arcade +} +ViewSettings["Ka-50"] = { + Cockpit = { + [1] = {-- player slot 1 + CockpitLocalPoint = {3.188000,0.390000,0.000000}, + CameraViewAngleLimits = {20.000000,120.000000}, + CameraAngleRestriction = {false,60.000000,0.400000}, + CameraAngleLimits = {140.000000,-65.000000,90.000000}, + EyePoint = {0.090000,0.000000,0.000000}, + limits_6DOF = {x = {-0.020000,0.350000},y ={-0.150000,0.165000},z = {-0.170000,0.170000},roll = 90.000000}, + }, + }, -- Cockpit + Chase = { + LocalPoint = {-0.512000,2.790000,0.000000}, + AnglesDefault = {180.000000,-8.000000}, + }, -- Chase + Arcade = { + LocalPoint = {-16.812000,5.390000,0.000000}, + AnglesDefault = {0.000000,-8.000000}, + }, -- Arcade +} +ViewSettings["MiG-29A"] = fulcrum() +ViewSettings["MiG-29G"] = fulcrum() +ViewSettings["MiG-29S"] = fulcrum() + +ViewSettings["P-51D"] = { + Cockpit = { + [1] = {-- player slot 1 + CockpitLocalPoint = {-1.500000,0.618000,0.000000}, + CameraViewAngleLimits = {20.000000,120.000000}, + CameraAngleRestriction = {false,90.000000,0.500000}, + CameraAngleLimits = {200,-80.000000,90.000000}, + EyePoint = {0.025000,0.100000,0.000000}, + ShoulderSize = 0.15, + Allow360rotation = false, + limits_6DOF = {x = {-0.050000,0.450000},y ={-0.200000,0.200000},z = {-0.220000,0.220000},roll = 90.000000}, + }, + }, -- Cockpit + Chase = { + LocalPoint = {0.200000,-0.652000,-0.650000}, + AnglesDefault = {0.000000,0.000000}, + }, -- Chase + Arcade = { + LocalPoint = {-21.500000,5.618000,0.000000}, + AnglesDefault = {0.000000,-8.000000}, + }, -- Arcade +} +ViewSettings["Su-25"] = { + Cockpit = { + [1] = default_fighter_player({CockpitLocalPoint = {3.352000,0.506000,0.000000}}),-- player slot 1 + }, -- Cockpit + Chase = { + LocalPoint = {-0.348000,2.906000,0.000000}, + AnglesDefault = {180.000000,-8.000000}, + }, -- Chase + Arcade = { + LocalPoint = {-16.648001,5.506000,0.000000}, + AnglesDefault = {0.000000,-8.000000}, + }, -- Arcade +} +ViewSettings["Su-25T"] = { + Cockpit = { + [1] = default_fighter_player({CockpitLocalPoint = {3.406000,0.466000,0.000000}}),-- player slot 1 + }, -- Cockpit + Chase = { + LocalPoint = {-0.294000,2.866000,0.000000}, + AnglesDefault = {180.000000,-8.000000}, + }, -- Chase + Arcade = { + LocalPoint = {-16.594000,5.466000,0.000000}, + AnglesDefault = {0.000000,-8.000000}, + }, -- Arcade +} +ViewSettings["Su-25TM"] = { + Cockpit = { + [1] = {-- player slot 1 + CockpitLocalPoint = {4.000000,1.000000,0.000000}, + CameraViewAngleLimits = {20.000000,140.000000}, + CameraAngleRestriction = {true,90.000000,0.400000}, + CameraAngleLimits = {160.000000,-70.000000,90.000000}, + EyePoint = {0.000000,0.000000,0.000000}, + limits_6DOF = {x = {-0.200000,0.200000},y ={-0.200000,0.200000},z = {-0.200000,0.200000},roll = 60.000000}, + }, + }, -- Cockpit + Chase = { + LocalPoint = {4.000000,2.000000,0.000000}, + AnglesDefault = {180.000000,-8.000000}, + }, -- Chase + Arcade = { + LocalPoint = {4.000000,2.000000,0.000000}, + AnglesDefault = {180.000000,-8.000000}, + }, -- Arcade +} +ViewSettings["Su-27"] = { + Cockpit = { + [1] = default_fighter_player({CockpitLocalPoint = {7.959000,1.419000,0.000000}})-- player slot 1 + }, -- Cockpit + Chase = { + LocalPoint = {4.259000,3.819000,0.000000}, + AnglesDefault = {180.000000,-8.000000}, + }, -- Chase + Arcade = { + LocalPoint = {-12.041000,6.419000,0.000000}, + AnglesDefault = {0.000000,-8.000000}, + }, -- Arcade +} + +ViewSettings["Su-33"] = ViewSettings["Su-27"] diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/Config/View/SnapViews.lua b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/Config/View/SnapViews.lua new file mode 100644 index 000000000..412686113 --- /dev/null +++ b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/Config/View/SnapViews.lua @@ -0,0 +1,2780 @@ +SnapViews = {} +SnapViews["A-10A"] = { +[1] = {-- player slot 1 + [1] = {--LWin + Num0 : Snap View 0 + viewAngle = 65.000000,--FOV + hAngle = 0.000000, + vAngle = -26.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = {--LWin + Num1 : Snap View 1 + viewAngle = 49.626770,--FOV + hAngle = 0.000000, + vAngle = -90.631294, + x_trans = 0.180499, + y_trans = -0.137064, + z_trans = -0.250000, + rollAngle = 0.000000, + }, + [3] = {--LWin + Num2 : Snap View 2 + viewAngle = 30.395041,--FOV + hAngle = 0.000000, + vAngle = -94.329208, + x_trans = 0.372718, + y_trans = -0.054055, + z_trans = 0.250000, + rollAngle = 0.000000, + }, + [4] = {--LWin + Num3 : Snap View 3 + viewAngle = 55.238567,--FOV + hAngle = 0.000000, + vAngle = -90.631294, + x_trans = 0.158523, + y_trans = -0.137064, + z_trans = 0.250000, + rollAngle = 0.000000, + }, + [5] = {--LWin + Num4 : Snap View 4 + viewAngle = 35.000000,--FOV + hAngle = 0.000000, + vAngle = -10.651850, + x_trans = 0.327622, + y_trans = -0.278207, + z_trans = -0.244799, + rollAngle = 0.000000, + }, + [6] = {--LWin + Num5 : Snap View 5 + viewAngle = 34.340549,--FOV + hAngle = 0.000000, + vAngle = -9.500000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = {--LWin + Num6 : Snap View 6 + viewAngle = 35.000000,--FOV + hAngle = 0.000000, + vAngle = -10.651850, + x_trans = 0.327622, + y_trans = -0.278207, + z_trans = 0.244799, + rollAngle = 0.000000, + }, + [8] = {--LWin + Num7 : Snap View 7 + viewAngle = 68.628296,--FOV + hAngle = 68.292320, + vAngle = -11.477349, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = {--LWin + Num8 : Snap View 8 + viewAngle = 68.628296,--FOV + hAngle = 0.000000, + vAngle = 30.227919, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = {--LWin + Num9 : Snap View 9 + viewAngle = 68.628296,--FOV + hAngle = -67.172974, + vAngle = -11.477349, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 70.000000,--FOV + hAngle = 20.000000, + vAngle = 8.000000, + x_trans = 0.360000, + y_trans = -0.041337, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 70.000000,--FOV + hAngle = -20.000000, + vAngle = 8.000000, + x_trans = 0.360000, + y_trans = -0.041337, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 75.000000,--FOV + hAngle = 0.000000, + vAngle = -23.000000, + x_trans = 0.360000, + y_trans = -0.041337, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["A-10C"] = { +[1] = {-- player slot 1 + [1] = {--LWin + Num0 : Snap View 0 + viewAngle = 65.000000,--FOV + hAngle = 0.000000, + vAngle = -26.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = {--LWin + Num1 : Snap View 1 + viewAngle = 49.626770,--FOV + hAngle = 0.000000, + vAngle = -90.631294, + x_trans = 0.180499, + y_trans = -0.137064, + z_trans = -0.250000, + rollAngle = 0.000000, + }, + [3] = {--LWin + Num2 : Snap View 2 + viewAngle = 30.395041,--FOV + hAngle = 0.000000, + vAngle = -94.329208, + x_trans = 0.372718, + y_trans = -0.054055, + z_trans = 0.250000, + rollAngle = 0.000000, + }, + [4] = {--LWin + Num3 : Snap View 3 + viewAngle = 55.238567,--FOV + hAngle = 0.000000, + vAngle = -90.631294, + x_trans = 0.158523, + y_trans = -0.137064, + z_trans = 0.250000, + rollAngle = 0.000000, + }, + [5] = {--LWin + Num4 : Snap View 4 + viewAngle = 35.000000,--FOV + hAngle = 0.000000, + vAngle = -10.651850, + x_trans = 0.327622, + y_trans = -0.278207, + z_trans = -0.244799, + rollAngle = 0.000000, + }, + [6] = {--LWin + Num5 : Snap View 5 + viewAngle = 34.340549,--FOV + hAngle = 0.000000, + vAngle = -9.500000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = {--LWin + Num6 : Snap View 6 + viewAngle = 35.000000,--FOV + hAngle = 0.000000, + vAngle = -10.651850, + x_trans = 0.327622, + y_trans = -0.278207, + z_trans = 0.244799, + rollAngle = 0.000000, + }, + [8] = {--LWin + Num7 : Snap View 7 + viewAngle = 68.628296,--FOV + hAngle = 68.292320, + vAngle = -11.477349, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = {--LWin + Num8 : Snap View 8 + viewAngle = 68.628296,--FOV + hAngle = 0.000000, + vAngle = 30.227919, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = {--LWin + Num9 : Snap View 9 + viewAngle = 68.628296,--FOV + hAngle = -67.172974, + vAngle = -11.477349, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 70.000000,--FOV + hAngle = 20.000000, + vAngle = 8.000000, + x_trans = 0.360000, + y_trans = -0.041337, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 70.000000,--FOV + hAngle = -20.000000, + vAngle = 8.000000, + x_trans = 0.360000, + y_trans = -0.041337, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 75.000000,--FOV + hAngle = 0.000000, + vAngle = -23.000000, + x_trans = 0.360000, + y_trans = -0.041337, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["Bf-109K-4"] = { +[1] = {-- player slot 1 + [1] = {--LWin + Num0 : Snap View 0 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = {--LWin + Num1 : Snap View 1 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = {--LWin + Num2 : Snap View 2 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = {--LWin + Num3 : Snap View 3 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = {--LWin + Num4 : Snap View 4 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [6] = {--LWin + Num5 : Snap View 5 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = {--LWin + Num6 : Snap View 6 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [8] = {--LWin + Num7 : Snap View 7 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = {--LWin + Num8 : Snap View 8 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = {--LWin + Num9 : Snap View 9 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["C-101CC"] = { +[1] = {-- player slot 1 + [1] = {--LWin + Num0 : Snap View 0 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = {--LWin + Num1 : Snap View 1 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = {--LWin + Num2 : Snap View 2 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = {--LWin + Num3 : Snap View 3 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = {--LWin + Num4 : Snap View 4 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [6] = {--LWin + Num5 : Snap View 5 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = {--LWin + Num6 : Snap View 6 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [8] = {--LWin + Num7 : Snap View 7 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = {--LWin + Num8 : Snap View 8 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = {--LWin + Num9 : Snap View 9 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +[2] = {-- player slot 2 + [1] = {--LWin + Num0 : Snap View 0 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = {--LWin + Num1 : Snap View 1 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = {--LWin + Num2 : Snap View 2 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = {--LWin + Num3 : Snap View 3 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = {--LWin + Num4 : Snap View 4 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [6] = {--LWin + Num5 : Snap View 5 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = {--LWin + Num6 : Snap View 6 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [8] = {--LWin + Num7 : Snap View 7 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = {--LWin + Num8 : Snap View 8 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = {--LWin + Num9 : Snap View 9 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["C-101EB"] = { +[1] = {-- player slot 1 + [1] = {--LWin + Num0 : Snap View 0 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = {--LWin + Num1 : Snap View 1 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = {--LWin + Num2 : Snap View 2 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = {--LWin + Num3 : Snap View 3 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = {--LWin + Num4 : Snap View 4 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [6] = {--LWin + Num5 : Snap View 5 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = {--LWin + Num6 : Snap View 6 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [8] = {--LWin + Num7 : Snap View 7 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = {--LWin + Num8 : Snap View 8 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = {--LWin + Num9 : Snap View 9 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +[2] = {-- player slot 2 + [1] = {--LWin + Num0 : Snap View 0 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = {--LWin + Num1 : Snap View 1 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = {--LWin + Num2 : Snap View 2 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = {--LWin + Num3 : Snap View 3 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = {--LWin + Num4 : Snap View 4 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [6] = {--LWin + Num5 : Snap View 5 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = {--LWin + Num6 : Snap View 6 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [8] = {--LWin + Num7 : Snap View 7 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = {--LWin + Num8 : Snap View 8 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = {--LWin + Num9 : Snap View 9 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["F-15C"] = { +[1] = {-- player slot 1 + [1] = {--LWin + Num0 : Snap View 0 + viewAngle = 70.611748,--FOV + hAngle = -1.240272, + vAngle = -33.850250, + x_trans = 0.264295, + y_trans = -0.064373, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = {--LWin + Num1 : Snap View 1 + viewAngle = 32.704346,--FOV + hAngle = 25.696522, + vAngle = -34.778103, + x_trans = 0.264295, + y_trans = -0.064373, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = {--LWin + Num2 : Snap View 2 + viewAngle = 32.704346,--FOV + hAngle = 0.000000, + vAngle = -47.845268, + x_trans = 0.264295, + y_trans = -0.064373, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = {--LWin + Num3 : Snap View 3 + viewAngle = 36.106045,--FOV + hAngle = -28.878576, + vAngle = -36.780628, + x_trans = 0.264295, + y_trans = -0.064373, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = {--LWin + Num4 : Snap View 4 + viewAngle = 88.727844,--FOV + hAngle = 128.508865, + vAngle = 13.131046, + x_trans = 0.264295, + y_trans = -0.064373, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [6] = {--LWin + Num5 : Snap View 5 + viewAngle = 41.928593,--FOV + hAngle = 0.000000, + vAngle = -4.630446, + x_trans = 0.264295, + y_trans = -0.064373, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = {--LWin + Num6 : Snap View 6 + viewAngle = 88.727844,--FOV + hAngle = -128.508865, + vAngle = 13.131046, + x_trans = 0.264295, + y_trans = -0.064373, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [8] = {--LWin + Num7 : Snap View 7 + viewAngle = 88.727844,--FOV + hAngle = 81.648369, + vAngle = -9.500000, + x_trans = 0.264295, + y_trans = -0.064373, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = {--LWin + Num8 : Snap View 8 + viewAngle = 88.727844,--FOV + hAngle = 0.000000, + vAngle = 34.180634, + x_trans = 0.264295, + y_trans = -0.064373, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = {--LWin + Num9 : Snap View 9 + viewAngle = 88.727844,--FOV + hAngle = -80.997551, + vAngle = -9.500000, + x_trans = 0.264295, + y_trans = -0.064373, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 56.032040,--FOV + hAngle = 14.803060, + vAngle = 3.332499, + x_trans = 0.264295, + y_trans = -0.064373, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 56.032040,--FOV + hAngle = -14.414484, + vAngle = 3.332499, + x_trans = 0.264295, + y_trans = -0.064373, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 88.727844,--FOV + hAngle = 0.000000, + vAngle = -9.678451, + x_trans = 0.264295, + y_trans = -0.064373, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["FW-190D9"] = { +[1] = {-- player slot 1 + [1] = {--LWin + Num0 : Snap View 0 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = {--LWin + Num1 : Snap View 1 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = {--LWin + Num2 : Snap View 2 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = {--LWin + Num3 : Snap View 3 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = {--LWin + Num4 : Snap View 4 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [6] = {--LWin + Num5 : Snap View 5 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = {--LWin + Num6 : Snap View 6 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [8] = {--LWin + Num7 : Snap View 7 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = {--LWin + Num8 : Snap View 8 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = {--LWin + Num9 : Snap View 9 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["Hawk"] = { +[1] = {-- player slot 1 + [1] = {--LWin + Num0 : Snap View 0 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = {--LWin + Num1 : Snap View 1 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = {--LWin + Num2 : Snap View 2 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = {--LWin + Num3 : Snap View 3 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = {--LWin + Num4 : Snap View 4 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [6] = {--LWin + Num5 : Snap View 5 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = {--LWin + Num6 : Snap View 6 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [8] = {--LWin + Num7 : Snap View 7 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = {--LWin + Num8 : Snap View 8 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = {--LWin + Num9 : Snap View 9 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["Ka-50"] = { +[1] = {-- player slot 1 + [1] = {--LWin + Num0 : Snap View 0 + viewAngle = 67.452896,--FOV + hAngle = 0.000000, + vAngle = -40.067383, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = {--LWin + Num1 : Snap View 1 + viewAngle = 37.846794,--FOV + hAngle = 51.644135, + vAngle = -51.870411, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = {--LWin + Num2 : Snap View 2 + viewAngle = 36.178646,--FOV + hAngle = -1.912186, + vAngle = -34.446247, + x_trans = 0.000000, + y_trans = -0.025421, + z_trans = 0.073226, + rollAngle = 0.000000, + }, + [4] = {--LWin + Num3 : Snap View 3 + viewAngle = 73.605141,--FOV + hAngle = -90.361992, + vAngle = -44.103138, + x_trans = 0.169696, + y_trans = -0.073508, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = {--LWin + Num4 : Snap View 4 + viewAngle = 91.348198,--FOV + hAngle = 109.752129, + vAngle = 1.484382, + x_trans = 0.190306, + y_trans = 0.044778, + z_trans = -0.150335, + rollAngle = 0.000000, + }, + [6] = {--LWin + Num5 : Snap View 5 + viewAngle = 42.512844,--FOV + hAngle = 0.000000, + vAngle = -4.478010, + x_trans = 0.154018, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = {--LWin + Num6 : Snap View 6 + viewAngle = 91.348198,--FOV + hAngle = -108.852020, + vAngle = 0.085984, + x_trans = 0.190306, + y_trans = 0.044778, + z_trans = 0.139404, + rollAngle = 0.000000, + }, + [8] = {--LWin + Num7 : Snap View 7 + viewAngle = 89.777542,--FOV + hAngle = 16.411518, + vAngle = -27.209915, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = -0.218292, + rollAngle = 0.000000, + }, + [9] = {--LWin + Num8 : Snap View 8 + viewAngle = 88.727844,--FOV + hAngle = 0.000000, + vAngle = 34.042202, + x_trans = 0.142145, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = {--LWin + Num9 : Snap View 9 + viewAngle = 59.208893,--FOV + hAngle = -32.128311, + vAngle = -5.720805, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 56.032040,--FOV + hAngle = 14.803060, + vAngle = 3.332499, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 56.032040,--FOV + hAngle = -14.414484, + vAngle = 3.332499, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 89.777542,--FOV + hAngle = 0.000000, + vAngle = -15.592758, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["MQ-9 Reaper"] = { +[1] = {-- player slot 1 + [1] = {--LWin + Num0 : Snap View 0 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = {--LWin + Num1 : Snap View 1 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = {--LWin + Num2 : Snap View 2 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = {--LWin + Num3 : Snap View 3 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = {--LWin + Num4 : Snap View 4 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [6] = {--LWin + Num5 : Snap View 5 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = {--LWin + Num6 : Snap View 6 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [8] = {--LWin + Num7 : Snap View 7 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = {--LWin + Num8 : Snap View 8 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = {--LWin + Num9 : Snap View 9 + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = 0.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["MiG-29A"] = { +[1] = {-- player slot 1 + [1] = {--LWin + Num0 : Snap View 0 + viewAngle = 76.124840,--FOV + hAngle = -2.623254, + vAngle = -26.566959, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = {--LWin + Num1 : Snap View 1 + viewAngle = 34.911949,--FOV + hAngle = 24.601770, + vAngle = -32.350807, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = {--LWin + Num2 : Snap View 2 + viewAngle = 26.184198,--FOV + hAngle = 12.026249, + vAngle = -40.075508, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = {--LWin + Num3 : Snap View 3 + viewAngle = 39.454399,--FOV + hAngle = -26.664328, + vAngle = -32.355324, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = {--LWin + Num4 : Snap View 4 + viewAngle = 81.240005,--FOV + hAngle = 131.503998, + vAngle = 10.804660, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [6] = {--LWin + Num5 : Snap View 5 + viewAngle = 44.201855,--FOV + hAngle = 0.000000, + vAngle = -2.378299, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = {--LWin + Num6 : Snap View 6 + viewAngle = 81.240005,--FOV + hAngle = -131.503998, + vAngle = 10.804660, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [8] = {--LWin + Num7 : Snap View 7 + viewAngle = 81.240005,--FOV + hAngle = 76.013145, + vAngle = 2.248441, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = {--LWin + Num8 : Snap View 8 + viewAngle = 81.240005,--FOV + hAngle = 0.000000, + vAngle = 36.304676, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = {--LWin + Num9 : Snap View 9 + viewAngle = 81.240005,--FOV + hAngle = -74.774559, + vAngle = 2.248441, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 68.250000,--FOV + hAngle = 13.070938, + vAngle = 7.522498, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 68.250000,--FOV + hAngle = -13.070938, + vAngle = 7.522498, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 81.240005,--FOV + hAngle = 0.000000, + vAngle = -9.500000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["MiG-29G"] = { +[1] = {-- player slot 1 + [1] = {--LWin + Num0 : Snap View 0 + viewAngle = 76.124840,--FOV + hAngle = -2.623254, + vAngle = -26.566959, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = {--LWin + Num1 : Snap View 1 + viewAngle = 34.911949,--FOV + hAngle = 24.601770, + vAngle = -32.350807, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = {--LWin + Num2 : Snap View 2 + viewAngle = 26.184198,--FOV + hAngle = 12.026249, + vAngle = -40.075508, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = {--LWin + Num3 : Snap View 3 + viewAngle = 39.454399,--FOV + hAngle = -26.664328, + vAngle = -32.355324, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = {--LWin + Num4 : Snap View 4 + viewAngle = 81.240005,--FOV + hAngle = 131.503998, + vAngle = 10.804660, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [6] = {--LWin + Num5 : Snap View 5 + viewAngle = 44.201855,--FOV + hAngle = 0.000000, + vAngle = -2.378299, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = {--LWin + Num6 : Snap View 6 + viewAngle = 81.240005,--FOV + hAngle = -131.503998, + vAngle = 10.804660, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [8] = {--LWin + Num7 : Snap View 7 + viewAngle = 81.240005,--FOV + hAngle = 76.013145, + vAngle = 2.248441, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = {--LWin + Num8 : Snap View 8 + viewAngle = 81.240005,--FOV + hAngle = 0.000000, + vAngle = 36.304676, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = {--LWin + Num9 : Snap View 9 + viewAngle = 81.240005,--FOV + hAngle = -74.774559, + vAngle = 2.248441, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 68.250000,--FOV + hAngle = 13.070938, + vAngle = 7.522498, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 68.250000,--FOV + hAngle = -13.070938, + vAngle = 7.522498, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 81.240005,--FOV + hAngle = 0.000000, + vAngle = -9.500000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["MiG-29K"] = { +[1] = {-- player slot 1 + [1] = {--LWin + Num0 : Snap View 0 + viewAngle = 65.000000,--FOV + hAngle = 0.000000, + vAngle = -26.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = {--LWin + Num1 : Snap View 1 + viewAngle = 30.000000,--FOV + hAngle = 20.000000, + vAngle = -43.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = {--LWin + Num2 : Snap View 2 + viewAngle = 30.000000,--FOV + hAngle = 0.000000, + vAngle = -43.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = {--LWin + Num3 : Snap View 3 + viewAngle = 30.000000,--FOV + hAngle = -20.000000, + vAngle = -43.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = {--LWin + Num4 : Snap View 4 + viewAngle = 30.000000,--FOV + hAngle = 20.000000, + vAngle = -23.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [6] = {--LWin + Num5 : Snap View 5 + viewAngle = 30.000000,--FOV + hAngle = 0.000000, + vAngle = -23.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = {--LWin + Num6 : Snap View 6 + viewAngle = 30.000000,--FOV + hAngle = -20.000000, + vAngle = -23.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [8] = {--LWin + Num7 : Snap View 7 + viewAngle = 30.000000,--FOV + hAngle = 20.000000, + vAngle = 2.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = {--LWin + Num8 : Snap View 8 + viewAngle = 30.000000,--FOV + hAngle = 0.000000, + vAngle = 2.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = {--LWin + Num9 : Snap View 9 + viewAngle = 30.000000,--FOV + hAngle = -20.000000, + vAngle = 2.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 68.250000,--FOV + hAngle = 13.070938, + vAngle = 7.522498, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 68.250000,--FOV + hAngle = -13.070938, + vAngle = 7.522498, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = -9.500000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["MiG-29S"] = { +[1] = {-- player slot 1 + [1] = {--LWin + Num0 : Snap View 0 + viewAngle = 76.124840,--FOV + hAngle = -2.623254, + vAngle = -26.566959, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = {--LWin + Num1 : Snap View 1 + viewAngle = 34.911949,--FOV + hAngle = 24.601770, + vAngle = -32.350807, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = {--LWin + Num2 : Snap View 2 + viewAngle = 26.184198,--FOV + hAngle = 12.026249, + vAngle = -40.075508, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = {--LWin + Num3 : Snap View 3 + viewAngle = 39.454399,--FOV + hAngle = -26.664328, + vAngle = -32.355324, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = {--LWin + Num4 : Snap View 4 + viewAngle = 81.240005,--FOV + hAngle = 131.503998, + vAngle = 10.804660, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [6] = {--LWin + Num5 : Snap View 5 + viewAngle = 44.201855,--FOV + hAngle = 0.000000, + vAngle = -2.378299, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = {--LWin + Num6 : Snap View 6 + viewAngle = 81.240005,--FOV + hAngle = -131.503998, + vAngle = 10.804660, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [8] = {--LWin + Num7 : Snap View 7 + viewAngle = 81.240005,--FOV + hAngle = 76.013145, + vAngle = 2.248441, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = {--LWin + Num8 : Snap View 8 + viewAngle = 81.240005,--FOV + hAngle = 0.000000, + vAngle = 36.304676, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = {--LWin + Num9 : Snap View 9 + viewAngle = 81.240005,--FOV + hAngle = -74.774559, + vAngle = 2.248441, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 68.250000,--FOV + hAngle = 13.070938, + vAngle = 7.522498, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 68.250000,--FOV + hAngle = -13.070938, + vAngle = 7.522498, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 81.240005,--FOV + hAngle = 0.000000, + vAngle = -9.500000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["P-51D"] = { +[1] = {-- player slot 1 + [1] = {--LWin + Num0 : Snap View 0 + viewAngle = 80.000000,--FOV + hAngle = 0.000000, + vAngle = -45.000000, + x_trans = 0.120000, + y_trans = 0.059000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = {--LWin + Num1 : Snap View 1 + viewAngle = 80.000000,--FOV + hAngle = 45.000000, + vAngle = -45.000000, + x_trans = 0.120000, + y_trans = 0.059000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = {--LWin + Num2 : Snap View 2 + viewAngle = 80.000000,--FOV + hAngle = 0.000000, + vAngle = -75.000000, + x_trans = 0.120000, + y_trans = 0.059000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = {--LWin + Num3 : Snap View 3 + viewAngle = 80.000000,--FOV + hAngle = -45.000000, + vAngle = -45.000000, + x_trans = 0.120000, + y_trans = 0.059000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = {--LWin + Num4 : Snap View 4 + viewAngle = 91.040001,--FOV + hAngle = 157.332764, + vAngle = -28.359503, + x_trans = 0.063872, + y_trans = 0.082888, + z_trans = -0.116148, + rollAngle = 0.000000, + }, + [6] = {--LWin + Num5 : Snap View 5 + viewAngle = 50.000000,--FOV + hAngle = 0.000000, + vAngle = -8.722581, + x_trans = 0.212078, + y_trans = 0.057813, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = {--LWin + Num6 : Snap View 6 + viewAngle = 80.000000,--FOV + hAngle = -143.000000, + vAngle = 0.000000, + x_trans = 0.350000, + y_trans = 0.059000, + z_trans = 0.100000, + rollAngle = 0.000000, + }, + [8] = {--LWin + Num7 : Snap View 7 + viewAngle = 80.000000,--FOV + hAngle = 45.000000, + vAngle = -5.000000, + x_trans = 0.120000, + y_trans = 0.059000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = {--LWin + Num8 : Snap View 8 + viewAngle = 80.000000,--FOV + hAngle = 0.000000, + vAngle = 10.000000, + x_trans = 0.120000, + y_trans = 0.059000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = {--LWin + Num9 : Snap View 9 + viewAngle = 80.000000,--FOV + hAngle = -45.000000, + vAngle = -5.000000, + x_trans = 0.120000, + y_trans = 0.059000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 80.000000,--FOV + hAngle = 0.000000, + vAngle = 10.000000, + x_trans = 0.120000, + y_trans = 0.059000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 80.000000,--FOV + hAngle = -20.000000, + vAngle = 8.000000, + x_trans = 0.120000, + y_trans = 0.059000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 80.000000,--FOV + hAngle = 0.000000, + vAngle = -9.500000, + x_trans = 0.120000, + y_trans = 0.059000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["Su-25"] = { +[1] = {-- player slot 1 + [1] = {--LWin + Num0 : Snap View 0 + viewAngle = 68.767799,--FOV + hAngle = 1.929517, + vAngle = -30.846605, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = {--LWin + Num1 : Snap View 1 + viewAngle = 29.223452,--FOV + hAngle = 37.489525, + vAngle = -38.883888, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = {--LWin + Num2 : Snap View 2 + viewAngle = 40.635601,--FOV + hAngle = -0.438357, + vAngle = -33.138290, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = {--LWin + Num3 : Snap View 3 + viewAngle = 24.797405,--FOV + hAngle = -34.382549, + vAngle = -34.808853, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = {--LWin + Num4 : Snap View 4 + viewAngle = 69.302101,--FOV + hAngle = 89.405373, + vAngle = 1.213156, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [6] = {--LWin + Num5 : Snap View 5 + viewAngle = 29.761202,--FOV + hAngle = 0.000000, + vAngle = -6.880077, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = {--LWin + Num6 : Snap View 6 + viewAngle = 69.302101,--FOV + hAngle = -89.691940, + vAngle = 4.554290, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [8] = {--LWin + Num7 : Snap View 7 + viewAngle = 69.302101,--FOV + hAngle = 52.113377, + vAngle = -3.970644, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = {--LWin + Num8 : Snap View 8 + viewAngle = 72.856201,--FOV + hAngle = 0.000000, + vAngle = 30.866713, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = {--LWin + Num9 : Snap View 9 + viewAngle = 69.302101,--FOV + hAngle = -50.664936, + vAngle = -3.970644, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 47.680202,--FOV + hAngle = 43.054649, + vAngle = -7.799250, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 47.680202,--FOV + hAngle = -41.743240, + vAngle = -7.799250, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 69.302101,--FOV + hAngle = 0.000000, + vAngle = -15.137112, + x_trans = 0.050000, + y_trans = 0.010000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["Su-25T"] = { +[1] = {-- player slot 1 + [1] = {--LWin + Num0 : Snap View 0 + viewAngle = 80.663399,--FOV + hAngle = 0.000000, + vAngle = -30.619938, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = {--LWin + Num1 : Snap View 1 + viewAngle = 39.764698,--FOV + hAngle = 28.661316, + vAngle = -41.406044, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = {--LWin + Num2 : Snap View 2 + viewAngle = 38.090847,--FOV + hAngle = -24.622110, + vAngle = -45.153934, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = {--LWin + Num3 : Snap View 3 + viewAngle = 36.062012,--FOV + hAngle = -20.779360, + vAngle = -23.755520, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = {--LWin + Num4 : Snap View 4 + viewAngle = 80.663399,--FOV + hAngle = 99.816956, + vAngle = 8.032285, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [6] = {--LWin + Num5 : Snap View 5 + viewAngle = 58.718098,--FOV + hAngle = 0.000000, + vAngle = -5.000803, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = {--LWin + Num6 : Snap View 6 + viewAngle = 80.663399,--FOV + hAngle = -99.999687, + vAngle = 8.032285, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [8] = {--LWin + Num7 : Snap View 7 + viewAngle = 80.663399,--FOV + hAngle = 58.382488, + vAngle = -6.648195, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = {--LWin + Num8 : Snap View 8 + viewAngle = 94.037704,--FOV + hAngle = 0.000000, + vAngle = 41.421227, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = {--LWin + Num9 : Snap View 9 + viewAngle = 80.663399,--FOV + hAngle = -57.531212, + vAngle = -6.648195, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 60.203396,--FOV + hAngle = 55.124939, + vAngle = -8.400513, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 60.203396,--FOV + hAngle = -52.633553, + vAngle = -8.400513, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 90.000000,--FOV + hAngle = 0.000000, + vAngle = -18.382137, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["Su-25TM"] = { +[1] = {-- player slot 1 + [1] = {--LWin + Num0 : Snap View 0 + viewAngle = 80.663399,--FOV + hAngle = 0.000000, + vAngle = -30.619938, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = {--LWin + Num1 : Snap View 1 + viewAngle = 39.764698,--FOV + hAngle = 28.661316, + vAngle = -41.406044, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = {--LWin + Num2 : Snap View 2 + viewAngle = 38.090847,--FOV + hAngle = -24.622110, + vAngle = -45.153934, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = {--LWin + Num3 : Snap View 3 + viewAngle = 33.645596,--FOV + hAngle = -36.653450, + vAngle = -23.703861, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = {--LWin + Num4 : Snap View 4 + viewAngle = 80.663399,--FOV + hAngle = 99.816956, + vAngle = 8.032285, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [6] = {--LWin + Num5 : Snap View 5 + viewAngle = 58.718098,--FOV + hAngle = 0.000000, + vAngle = -5.000803, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = {--LWin + Num6 : Snap View 6 + viewAngle = 80.663399,--FOV + hAngle = -99.999687, + vAngle = 8.032285, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [8] = {--LWin + Num7 : Snap View 7 + viewAngle = 80.663399,--FOV + hAngle = 58.382488, + vAngle = -6.648195, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = {--LWin + Num8 : Snap View 8 + viewAngle = 94.037704,--FOV + hAngle = 0.000000, + vAngle = 41.421227, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = {--LWin + Num9 : Snap View 9 + viewAngle = 80.663399,--FOV + hAngle = -57.531212, + vAngle = -6.648195, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 60.203396,--FOV + hAngle = 55.124939, + vAngle = -8.400513, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 60.203396,--FOV + hAngle = -52.633553, + vAngle = -8.400513, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 90.000000,--FOV + hAngle = 0.000000, + vAngle = -18.382137, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["Su-27"] = { +[1] = {-- player slot 1 + [1] = {--LWin + Num0 : Snap View 0 + viewAngle = 89.752197,--FOV + hAngle = 7.104492, + vAngle = 52.525635, + x_trans = 0.016405, + y_trans = 0.011140, + z_trans = -0.053543, + rollAngle = -7.110901, + }, + [2] = {--LWin + Num1 : Snap View 1 + viewAngle = 33.361835,--FOV + hAngle = 41.045925, + vAngle = -40.805656, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = {--LWin + Num2 : Snap View 2 + viewAngle = 30.427544,--FOV + hAngle = 0.000000, + vAngle = -41.808968, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = {--LWin + Num3 : Snap View 3 + viewAngle = 34.392349,--FOV + hAngle = -32.597401, + vAngle = -35.293747, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = {--LWin + Num4 : Snap View 4 + viewAngle = 87.468338,--FOV + hAngle = 129.012665, + vAngle = 14.547977, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [6] = {--LWin + Num5 : Snap View 5 + viewAngle = 43.977936,--FOV + hAngle = 0.000000, + vAngle = -4.951577, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = {--LWin + Num6 : Snap View 6 + viewAngle = 87.468338,--FOV + hAngle = -129.012665, + vAngle = 14.491872, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [8] = {--LWin + Num7 : Snap View 7 + viewAngle = 87.468338,--FOV + hAngle = 82.862923, + vAngle = -9.500000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = {--LWin + Num8 : Snap View 8 + viewAngle = 87.468338,--FOV + hAngle = 0.000000, + vAngle = 38.979362, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = {--LWin + Num9 : Snap View 9 + viewAngle = 87.468338,--FOV + hAngle = -82.461266, + vAngle = -12.843998, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 68.786629,--FOV + hAngle = 15.618313, + vAngle = 7.522498, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 69.165199,--FOV + hAngle = -15.683434, + vAngle = 8.549150, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 87.468338,--FOV + hAngle = 0.000000, + vAngle = -9.500000, + x_trans = 0.113927, + y_trans = -0.004946, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["Su-33"] = { +[1] = {-- player slot 1 + [1] = {--LWin + Num0 : Snap View 0 + viewAngle = 71.824692,--FOV + hAngle = 0.000000, + vAngle = -32.458889, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = {--LWin + Num1 : Snap View 1 + viewAngle = 33.361835,--FOV + hAngle = 41.045925, + vAngle = -40.805656, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = {--LWin + Num2 : Snap View 2 + viewAngle = 30.427544,--FOV + hAngle = 0.000000, + vAngle = -41.808968, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = {--LWin + Num3 : Snap View 3 + viewAngle = 34.392349,--FOV + hAngle = -32.597401, + vAngle = -35.293747, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = {--LWin + Num4 : Snap View 4 + viewAngle = 87.468338,--FOV + hAngle = 129.012665, + vAngle = 14.547977, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [6] = {--LWin + Num5 : Snap View 5 + viewAngle = 43.977936,--FOV + hAngle = 0.000000, + vAngle = -4.951577, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = {--LWin + Num6 : Snap View 6 + viewAngle = 87.468338,--FOV + hAngle = -129.012665, + vAngle = 14.491872, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [8] = {--LWin + Num7 : Snap View 7 + viewAngle = 87.468338,--FOV + hAngle = 82.862923, + vAngle = -9.500000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = {--LWin + Num8 : Snap View 8 + viewAngle = 87.468338,--FOV + hAngle = 0.000000, + vAngle = 38.979362, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = {--LWin + Num9 : Snap View 9 + viewAngle = 87.468338,--FOV + hAngle = -82.461266, + vAngle = -12.843998, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 68.786629,--FOV + hAngle = 15.618313, + vAngle = 7.522498, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 69.165199,--FOV + hAngle = -15.683434, + vAngle = 8.549150, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 87.468338,--FOV + hAngle = 0.000000, + vAngle = -9.500000, + x_trans = 0.113927, + y_trans = -0.004946, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["TF-51D"] = { +[1] = {-- player slot 1 + [1] = {--LWin + Num0 : Snap View 0 + viewAngle = 80.000000,--FOV + hAngle = 0.000000, + vAngle = -45.000000, + x_trans = 0.120000, + y_trans = 0.059000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = {--LWin + Num1 : Snap View 1 + viewAngle = 80.000000,--FOV + hAngle = 45.000000, + vAngle = -45.000000, + x_trans = 0.120000, + y_trans = 0.059000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = {--LWin + Num2 : Snap View 2 + viewAngle = 80.000000,--FOV + hAngle = 0.000000, + vAngle = -75.000000, + x_trans = 0.120000, + y_trans = 0.059000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = {--LWin + Num3 : Snap View 3 + viewAngle = 80.000000,--FOV + hAngle = -45.000000, + vAngle = -45.000000, + x_trans = 0.120000, + y_trans = 0.059000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = {--LWin + Num4 : Snap View 4 + viewAngle = 91.040001,--FOV + hAngle = 157.332764, + vAngle = -28.359503, + x_trans = 0.063872, + y_trans = 0.082888, + z_trans = -0.116148, + rollAngle = 0.000000, + }, + [6] = {--LWin + Num5 : Snap View 5 + viewAngle = 50.000000,--FOV + hAngle = 0.000000, + vAngle = -8.722581, + x_trans = 0.212078, + y_trans = 0.057813, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = {--LWin + Num6 : Snap View 6 + viewAngle = 80.000000,--FOV + hAngle = -143.000000, + vAngle = 0.000000, + x_trans = 0.350000, + y_trans = 0.059000, + z_trans = 0.100000, + rollAngle = 0.000000, + }, + [8] = {--LWin + Num7 : Snap View 7 + viewAngle = 80.000000,--FOV + hAngle = 45.000000, + vAngle = -5.000000, + x_trans = 0.120000, + y_trans = 0.059000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = {--LWin + Num8 : Snap View 8 + viewAngle = 80.000000,--FOV + hAngle = 0.000000, + vAngle = 10.000000, + x_trans = 0.120000, + y_trans = 0.059000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = {--LWin + Num9 : Snap View 9 + viewAngle = 80.000000,--FOV + hAngle = -45.000000, + vAngle = -5.000000, + x_trans = 0.120000, + y_trans = 0.059000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 80.000000,--FOV + hAngle = 0.000000, + vAngle = 10.000000, + x_trans = 0.120000, + y_trans = 0.059000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 80.000000,--FOV + hAngle = -20.000000, + vAngle = 8.000000, + x_trans = 0.120000, + y_trans = 0.059000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 80.000000,--FOV + hAngle = 0.000000, + vAngle = -9.500000, + x_trans = 0.120000, + y_trans = 0.059000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/Config/View/SnapViewsDefault.lua b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/Config/View/SnapViewsDefault.lua new file mode 100644 index 000000000..754522d55 --- /dev/null +++ b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/Config/View/SnapViewsDefault.lua @@ -0,0 +1,1698 @@ +--reformatted per-unit data to be mod system friendly +--this file is no longer should be edited for adding new flyable aircraft , DCS automatically check core database for this data(i.e. where you define your aircraft in aircraft table just define ViewSettings and SnapViews tables) +-- result of ingame editing is saved to Saved Games//DCS/Config/View/SnapViews.lua +SnapViews = {} +SnapViews["A-10A"] = { +[1] = {-- player slot 1 + [1] = { + viewAngle = 65.000000,--FOV + hAngle = 0.000000, + vAngle = -26.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = { + viewAngle = 49.626770,--FOV + hAngle = 0.000000, + vAngle = -90.631294, + x_trans = 0.180499, + y_trans = -0.137064, + z_trans = -0.250000, + rollAngle = 0.000000, + }, + [3] = { + viewAngle = 30.395041,--FOV + hAngle = 0.000000, + vAngle = -94.329208, + x_trans = 0.372718, + y_trans = -0.054055, + z_trans = 0.250000, + rollAngle = 0.000000, + }, + [4] = { + viewAngle = 55.238567,--FOV + hAngle = 0.000000, + vAngle = -90.631294, + x_trans = 0.158523, + y_trans = -0.137064, + z_trans = 0.250000, + rollAngle = 0.000000, + }, + [5] = { + viewAngle = 35.000000,--FOV + hAngle = 0.000000, + vAngle = -10.651850, + x_trans = 0.327622, + y_trans = -0.278207, + z_trans = -0.244799, + rollAngle = 0.000000, + }, + [6] = { + viewAngle = 34.340549,--FOV + hAngle = 0.000000, + vAngle = -9.500000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = { + viewAngle = 35.000000,--FOV + hAngle = 0.000000, + vAngle = -10.651850, + x_trans = 0.327622, + y_trans = -0.278207, + z_trans = 0.244799, + rollAngle = 0.000000, + }, + [8] = { + viewAngle = 68.628296,--FOV + hAngle = 68.292320, + vAngle = -11.477349, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = { + viewAngle = 68.628296,--FOV + hAngle = 0.000000, + vAngle = 30.227919, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = { + viewAngle = 68.628296,--FOV + hAngle = -67.172974, + vAngle = -11.477349, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 70.000000,--FOV + hAngle = 20.000000, + vAngle = 8.000000, + x_trans = 0.360000, + y_trans = -0.041337, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 70.000000,--FOV + hAngle = -20.000000, + vAngle = 8.000000, + x_trans = 0.360000, + y_trans = -0.041337, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 75.000000,--FOV + hAngle = 0.000000, + vAngle = -23.000000, + x_trans = 0.360000, + y_trans = -0.041337, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["A-10C"] = { +[1] = {-- player slot 1 + [1] = { + viewAngle = 65.000000,--FOV + hAngle = 0.000000, + vAngle = -26.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = { + viewAngle = 49.626770,--FOV + hAngle = 0.000000, + vAngle = -90.631294, + x_trans = 0.180499, + y_trans = -0.137064, + z_trans = -0.250000, + rollAngle = 0.000000, + }, + [3] = { + viewAngle = 30.395041,--FOV + hAngle = 0.000000, + vAngle = -94.329208, + x_trans = 0.372718, + y_trans = -0.054055, + z_trans = 0.250000, + rollAngle = 0.000000, + }, + [4] = { + viewAngle = 55.238567,--FOV + hAngle = 0.000000, + vAngle = -90.631294, + x_trans = 0.158523, + y_trans = -0.137064, + z_trans = 0.250000, + rollAngle = 0.000000, + }, + [5] = { + viewAngle = 35.000000,--FOV + hAngle = 0.000000, + vAngle = -10.651850, + x_trans = 0.327622, + y_trans = -0.278207, + z_trans = -0.244799, + rollAngle = 0.000000, + }, + [6] = { + viewAngle = 34.340549,--FOV + hAngle = 0.000000, + vAngle = -9.500000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = { + viewAngle = 35.000000,--FOV + hAngle = 0.000000, + vAngle = -10.651850, + x_trans = 0.327622, + y_trans = -0.278207, + z_trans = 0.244799, + rollAngle = 0.000000, + }, + [8] = { + viewAngle = 68.628296,--FOV + hAngle = 68.292320, + vAngle = -11.477349, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = { + viewAngle = 68.628296,--FOV + hAngle = 0.000000, + vAngle = 30.227919, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = { + viewAngle = 68.628296,--FOV + hAngle = -67.172974, + vAngle = -11.477349, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 70.000000,--FOV + hAngle = 20.000000, + vAngle = 8.000000, + x_trans = 0.360000, + y_trans = -0.041337, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 70.000000,--FOV + hAngle = -20.000000, + vAngle = 8.000000, + x_trans = 0.360000, + y_trans = -0.041337, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 75.000000,--FOV + hAngle = 0.000000, + vAngle = -23.000000, + x_trans = 0.360000, + y_trans = -0.041337, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["F-15C"] = { +[1] = {-- player slot 1 + [1] = { + viewAngle = 70.611748,--FOV + hAngle = -1.240272, + vAngle = -33.850250, + x_trans = 0.264295, + y_trans = -0.064373, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = { + viewAngle = 32.704346,--FOV + hAngle = 25.696522, + vAngle = -34.778103, + x_trans = 0.264295, + y_trans = -0.064373, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = { + viewAngle = 32.704346,--FOV + hAngle = 0.000000, + vAngle = -47.845268, + x_trans = 0.264295, + y_trans = -0.064373, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = { + viewAngle = 36.106045,--FOV + hAngle = -28.878576, + vAngle = -36.780628, + x_trans = 0.264295, + y_trans = -0.064373, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = { + viewAngle = 88.727844,--FOV + hAngle = 128.508865, + vAngle = 13.131046, + x_trans = 0.264295, + y_trans = -0.064373, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [6] = { + viewAngle = 41.928593,--FOV + hAngle = 0.000000, + vAngle = -4.630446, + x_trans = 0.264295, + y_trans = -0.064373, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = { + viewAngle = 88.727844,--FOV + hAngle = -128.508865, + vAngle = 13.131046, + x_trans = 0.264295, + y_trans = -0.064373, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [8] = { + viewAngle = 88.727844,--FOV + hAngle = 81.648369, + vAngle = -9.500000, + x_trans = 0.264295, + y_trans = -0.064373, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = { + viewAngle = 88.727844,--FOV + hAngle = 0.000000, + vAngle = 34.180634, + x_trans = 0.264295, + y_trans = -0.064373, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = { + viewAngle = 88.727844,--FOV + hAngle = -80.997551, + vAngle = -9.500000, + x_trans = 0.264295, + y_trans = -0.064373, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 56.032040,--FOV + hAngle = 14.803060, + vAngle = 3.332499, + x_trans = 0.264295, + y_trans = -0.064373, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 56.032040,--FOV + hAngle = -14.414484, + vAngle = 3.332499, + x_trans = 0.264295, + y_trans = -0.064373, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 88.727844,--FOV + hAngle = 0.000000, + vAngle = -9.678451, + x_trans = 0.264295, + y_trans = -0.064373, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["Ka-50"] = { +[1] = {-- player slot 1 + [1] = { + viewAngle = 67.452896,--FOV + hAngle = 0.000000, + vAngle = -40.067383, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = { + viewAngle = 37.846794,--FOV + hAngle = 51.644135, + vAngle = -51.870411, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = { + viewAngle = 36.178646,--FOV + hAngle = -1.912186, + vAngle = -34.446247, + x_trans = 0.000000, + y_trans = -0.025421, + z_trans = 0.073226, + rollAngle = 0.000000, + }, + [4] = { + viewAngle = 73.605141,--FOV + hAngle = -90.361992, + vAngle = -44.103138, + x_trans = 0.169696, + y_trans = -0.073508, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = { + viewAngle = 91.348198,--FOV + hAngle = 109.752129, + vAngle = 1.484382, + x_trans = 0.190306, + y_trans = 0.044778, + z_trans = -0.150335, + rollAngle = 0.000000, + }, + [6] = { + viewAngle = 42.512844,--FOV + hAngle = 0.000000, + vAngle = -4.478010, + x_trans = 0.154018, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = { + viewAngle = 91.348198,--FOV + hAngle = -108.852020, + vAngle = 0.085984, + x_trans = 0.190306, + y_trans = 0.044778, + z_trans = 0.139404, + rollAngle = 0.000000, + }, + [8] = { + viewAngle = 89.777542,--FOV + hAngle = 16.411518, + vAngle = -27.209915, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = -0.218292, + rollAngle = 0.000000, + }, + [9] = { + viewAngle = 88.727844,--FOV + hAngle = 0.000000, + vAngle = 34.042202, + x_trans = 0.142145, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = { + viewAngle = 59.208893,--FOV + hAngle = -32.128311, + vAngle = -5.720805, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 56.032040,--FOV + hAngle = 14.803060, + vAngle = 3.332499, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 56.032040,--FOV + hAngle = -14.414484, + vAngle = 3.332499, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 89.777542,--FOV + hAngle = 0.000000, + vAngle = -15.592758, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["MiG-29A"] = { +[1] = {-- player slot 1 + [1] = { + viewAngle = 76.124840,--FOV + hAngle = -2.623254, + vAngle = -26.566959, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = { + viewAngle = 34.911949,--FOV + hAngle = 24.601770, + vAngle = -32.350807, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = { + viewAngle = 26.184198,--FOV + hAngle = 12.026249, + vAngle = -40.075508, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = { + viewAngle = 39.454399,--FOV + hAngle = -26.664328, + vAngle = -32.355324, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = { + viewAngle = 81.240005,--FOV + hAngle = 131.503998, + vAngle = 10.804660, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [6] = { + viewAngle = 44.201855,--FOV + hAngle = 0.000000, + vAngle = -2.378299, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = { + viewAngle = 81.240005,--FOV + hAngle = -131.503998, + vAngle = 10.804660, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [8] = { + viewAngle = 81.240005,--FOV + hAngle = 76.013145, + vAngle = 2.248441, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = { + viewAngle = 81.240005,--FOV + hAngle = 0.000000, + vAngle = 36.304676, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = { + viewAngle = 81.240005,--FOV + hAngle = -74.774559, + vAngle = 2.248441, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 68.250000,--FOV + hAngle = 13.070938, + vAngle = 7.522498, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 68.250000,--FOV + hAngle = -13.070938, + vAngle = 7.522498, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 81.240005,--FOV + hAngle = 0.000000, + vAngle = -9.500000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["MiG-29G"] = { +[1] = {-- player slot 1 + [1] = { + viewAngle = 76.124840,--FOV + hAngle = -2.623254, + vAngle = -26.566959, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = { + viewAngle = 34.911949,--FOV + hAngle = 24.601770, + vAngle = -32.350807, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = { + viewAngle = 26.184198,--FOV + hAngle = 12.026249, + vAngle = -40.075508, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = { + viewAngle = 39.454399,--FOV + hAngle = -26.664328, + vAngle = -32.355324, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = { + viewAngle = 81.240005,--FOV + hAngle = 131.503998, + vAngle = 10.804660, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [6] = { + viewAngle = 44.201855,--FOV + hAngle = 0.000000, + vAngle = -2.378299, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = { + viewAngle = 81.240005,--FOV + hAngle = -131.503998, + vAngle = 10.804660, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [8] = { + viewAngle = 81.240005,--FOV + hAngle = 76.013145, + vAngle = 2.248441, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = { + viewAngle = 81.240005,--FOV + hAngle = 0.000000, + vAngle = 36.304676, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = { + viewAngle = 81.240005,--FOV + hAngle = -74.774559, + vAngle = 2.248441, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 68.250000,--FOV + hAngle = 13.070938, + vAngle = 7.522498, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 68.250000,--FOV + hAngle = -13.070938, + vAngle = 7.522498, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 81.240005,--FOV + hAngle = 0.000000, + vAngle = -9.500000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["MiG-29K"] = { +[1] = {-- player slot 1 + [1] = { + viewAngle = 65.000000,--FOV + hAngle = 0.000000, + vAngle = -26.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = { + viewAngle = 30.000000,--FOV + hAngle = 20.000000, + vAngle = -43.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = { + viewAngle = 30.000000,--FOV + hAngle = 0.000000, + vAngle = -43.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = { + viewAngle = 30.000000,--FOV + hAngle = -20.000000, + vAngle = -43.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = { + viewAngle = 30.000000,--FOV + hAngle = 20.000000, + vAngle = -23.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [6] = { + viewAngle = 30.000000,--FOV + hAngle = 0.000000, + vAngle = -23.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = { + viewAngle = 30.000000,--FOV + hAngle = -20.000000, + vAngle = -23.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [8] = { + viewAngle = 30.000000,--FOV + hAngle = 20.000000, + vAngle = 2.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = { + viewAngle = 30.000000,--FOV + hAngle = 0.000000, + vAngle = 2.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = { + viewAngle = 30.000000,--FOV + hAngle = -20.000000, + vAngle = 2.000000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 68.250000,--FOV + hAngle = 13.070938, + vAngle = 7.522498, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 68.250000,--FOV + hAngle = -13.070938, + vAngle = 7.522498, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 60.000000,--FOV + hAngle = 0.000000, + vAngle = -9.500000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["MiG-29S"] = { +[1] = {-- player slot 1 + [1] = { + viewAngle = 76.124840,--FOV + hAngle = -2.623254, + vAngle = -26.566959, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = { + viewAngle = 34.911949,--FOV + hAngle = 24.601770, + vAngle = -32.350807, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = { + viewAngle = 26.184198,--FOV + hAngle = 12.026249, + vAngle = -40.075508, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = { + viewAngle = 39.454399,--FOV + hAngle = -26.664328, + vAngle = -32.355324, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = { + viewAngle = 81.240005,--FOV + hAngle = 131.503998, + vAngle = 10.804660, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [6] = { + viewAngle = 44.201855,--FOV + hAngle = 0.000000, + vAngle = -2.378299, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = { + viewAngle = 81.240005,--FOV + hAngle = -131.503998, + vAngle = 10.804660, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [8] = { + viewAngle = 81.240005,--FOV + hAngle = 76.013145, + vAngle = 2.248441, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = { + viewAngle = 81.240005,--FOV + hAngle = 0.000000, + vAngle = 36.304676, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = { + viewAngle = 81.240005,--FOV + hAngle = -74.774559, + vAngle = 2.248441, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 68.250000,--FOV + hAngle = 13.070938, + vAngle = 7.522498, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 68.250000,--FOV + hAngle = -13.070938, + vAngle = 7.522498, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 81.240005,--FOV + hAngle = 0.000000, + vAngle = -9.500000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["P-51D"] = { +[1] = {-- player slot 1 + [1] = { + viewAngle = 80.000000,--FOV + hAngle = 0.000000, + vAngle = -45.000000, + x_trans = 0.120000, + y_trans = 0.059000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = { + viewAngle = 80.000000,--FOV + hAngle = 45.000000, + vAngle = -45.000000, + x_trans = 0.120000, + y_trans = 0.059000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = { + viewAngle = 80.000000,--FOV + hAngle = 0.000000, + vAngle = -75.000000, + x_trans = 0.120000, + y_trans = 0.059000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = { + viewAngle = 80.000000,--FOV + hAngle = -45.000000, + vAngle = -45.000000, + x_trans = 0.120000, + y_trans = 0.059000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = { + viewAngle = 91.040001,--FOV + hAngle = 157.332764, + vAngle = -28.359503, + x_trans = 0.063872, + y_trans = 0.082888, + z_trans = -0.116148, + rollAngle = 0.000000, + }, + [6] = { + viewAngle = 50.000000,--FOV + hAngle = 0.000000, + vAngle = -8.722581, + x_trans = 0.212078, + y_trans = 0.057813, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = { + viewAngle = 80.000000,--FOV + hAngle = -143.000000, + vAngle = 0.000000, + x_trans = 0.350000, + y_trans = 0.059000, + z_trans = 0.100000, + rollAngle = 0.000000, + }, + [8] = { + viewAngle = 80.000000,--FOV + hAngle = 45.000000, + vAngle = -5.000000, + x_trans = 0.120000, + y_trans = 0.059000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = { + viewAngle = 80.000000,--FOV + hAngle = 0.000000, + vAngle = 10.000000, + x_trans = 0.120000, + y_trans = 0.059000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = { + viewAngle = 80.000000,--FOV + hAngle = -45.000000, + vAngle = -5.000000, + x_trans = 0.120000, + y_trans = 0.059000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 80.000000,--FOV + hAngle = 0.000000, + vAngle = 10.000000, + x_trans = 0.120000, + y_trans = 0.059000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 80.000000,--FOV + hAngle = -20.000000, + vAngle = 8.000000, + x_trans = 0.120000, + y_trans = 0.059000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 80.000000,--FOV + hAngle = 0.000000, + vAngle = -9.500000, + x_trans = 0.120000, + y_trans = 0.059000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["Su-25"] = { +[1] = {-- player slot 1 + [1] = { + viewAngle = 68.767799,--FOV + hAngle = 1.929517, + vAngle = -30.846605, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = { + viewAngle = 29.223452,--FOV + hAngle = 37.489525, + vAngle = -38.883888, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = { + viewAngle = 40.635601,--FOV + hAngle = -0.438357, + vAngle = -33.138290, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = { + viewAngle = 24.797405,--FOV + hAngle = -34.382549, + vAngle = -34.808853, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = { + viewAngle = 69.302101,--FOV + hAngle = 89.405373, + vAngle = 1.213156, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [6] = { + viewAngle = 29.761202,--FOV + hAngle = 0.000000, + vAngle = -6.880077, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = { + viewAngle = 69.302101,--FOV + hAngle = -89.691940, + vAngle = 4.554290, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [8] = { + viewAngle = 69.302101,--FOV + hAngle = 52.113377, + vAngle = -3.970644, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = { + viewAngle = 72.856201,--FOV + hAngle = 0.000000, + vAngle = 30.866713, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = { + viewAngle = 69.302101,--FOV + hAngle = -50.664936, + vAngle = -3.970644, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 47.680202,--FOV + hAngle = 43.054649, + vAngle = -7.799250, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 47.680202,--FOV + hAngle = -41.743240, + vAngle = -7.799250, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 69.302101,--FOV + hAngle = 0.000000, + vAngle = -15.137112, + x_trans = 0.050000, + y_trans = 0.010000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["Su-25T"] = { +[1] = {-- player slot 1 + [1] = { + viewAngle = 80.663399,--FOV + hAngle = 0.000000, + vAngle = -30.619938, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = { + viewAngle = 39.764698,--FOV + hAngle = 28.661316, + vAngle = -41.406044, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = { + viewAngle = 38.090847,--FOV + hAngle = -24.622110, + vAngle = -45.153934, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = { + viewAngle = 36.062012,--FOV + hAngle = -20.779360, + vAngle = -23.755520, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = { + viewAngle = 80.663399,--FOV + hAngle = 99.816956, + vAngle = 8.032285, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [6] = { + viewAngle = 58.718098,--FOV + hAngle = 0.000000, + vAngle = -5.000803, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = { + viewAngle = 80.663399,--FOV + hAngle = -99.999687, + vAngle = 8.032285, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [8] = { + viewAngle = 80.663399,--FOV + hAngle = 58.382488, + vAngle = -6.648195, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = { + viewAngle = 94.037704,--FOV + hAngle = 0.000000, + vAngle = 41.421227, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = { + viewAngle = 80.663399,--FOV + hAngle = -57.531212, + vAngle = -6.648195, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 60.203396,--FOV + hAngle = 55.124939, + vAngle = -8.400513, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 60.203396,--FOV + hAngle = -52.633553, + vAngle = -8.400513, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 90.000000,--FOV + hAngle = 0.000000, + vAngle = -18.382137, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["Su-25TM"] = { +[1] = {-- player slot 1 + [1] = { + viewAngle = 80.663399,--FOV + hAngle = 0.000000, + vAngle = -30.619938, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = { + viewAngle = 39.764698,--FOV + hAngle = 28.661316, + vAngle = -41.406044, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = { + viewAngle = 38.090847,--FOV + hAngle = -24.622110, + vAngle = -45.153934, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = { + viewAngle = 33.645596,--FOV + hAngle = -36.653450, + vAngle = -23.703861, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = { + viewAngle = 80.663399,--FOV + hAngle = 99.816956, + vAngle = 8.032285, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [6] = { + viewAngle = 58.718098,--FOV + hAngle = 0.000000, + vAngle = -5.000803, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = { + viewAngle = 80.663399,--FOV + hAngle = -99.999687, + vAngle = 8.032285, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [8] = { + viewAngle = 80.663399,--FOV + hAngle = 58.382488, + vAngle = -6.648195, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = { + viewAngle = 94.037704,--FOV + hAngle = 0.000000, + vAngle = 41.421227, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = { + viewAngle = 80.663399,--FOV + hAngle = -57.531212, + vAngle = -6.648195, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 60.203396,--FOV + hAngle = 55.124939, + vAngle = -8.400513, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 60.203396,--FOV + hAngle = -52.633553, + vAngle = -8.400513, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 90.000000,--FOV + hAngle = 0.000000, + vAngle = -18.382137, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["Su-27"] = { +[1] = {-- player slot 1 + [1] = { + viewAngle = 71.824692,--FOV + hAngle = 0.000000, + vAngle = -32.458889, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = { + viewAngle = 33.361835,--FOV + hAngle = 41.045925, + vAngle = -40.805656, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = { + viewAngle = 30.427544,--FOV + hAngle = 0.000000, + vAngle = -41.808968, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = { + viewAngle = 34.392349,--FOV + hAngle = -32.597401, + vAngle = -35.293747, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = { + viewAngle = 87.468338,--FOV + hAngle = 129.012665, + vAngle = 14.547977, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [6] = { + viewAngle = 43.977936,--FOV + hAngle = 0.000000, + vAngle = -4.951577, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = { + viewAngle = 87.468338,--FOV + hAngle = -129.012665, + vAngle = 14.491872, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [8] = { + viewAngle = 87.468338,--FOV + hAngle = 82.862923, + vAngle = -9.500000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = { + viewAngle = 87.468338,--FOV + hAngle = 0.000000, + vAngle = 38.979362, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = { + viewAngle = 87.468338,--FOV + hAngle = -82.461266, + vAngle = -12.843998, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 68.786629,--FOV + hAngle = 15.618313, + vAngle = 7.522498, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 69.165199,--FOV + hAngle = -15.683434, + vAngle = 8.549150, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 87.468338,--FOV + hAngle = 0.000000, + vAngle = -9.500000, + x_trans = 0.113927, + y_trans = -0.004946, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} +SnapViews["Su-33"] = { +[1] = {-- player slot 1 + [1] = { + viewAngle = 71.824692,--FOV + hAngle = 0.000000, + vAngle = -32.458889, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [2] = { + viewAngle = 33.361835,--FOV + hAngle = 41.045925, + vAngle = -40.805656, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [3] = { + viewAngle = 30.427544,--FOV + hAngle = 0.000000, + vAngle = -41.808968, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [4] = { + viewAngle = 34.392349,--FOV + hAngle = -32.597401, + vAngle = -35.293747, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [5] = { + viewAngle = 87.468338,--FOV + hAngle = 129.012665, + vAngle = 14.547977, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [6] = { + viewAngle = 43.977936,--FOV + hAngle = 0.000000, + vAngle = -4.951577, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [7] = { + viewAngle = 87.468338,--FOV + hAngle = -129.012665, + vAngle = 14.491872, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [8] = { + viewAngle = 87.468338,--FOV + hAngle = 82.862923, + vAngle = -9.500000, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [9] = { + viewAngle = 87.468338,--FOV + hAngle = 0.000000, + vAngle = 38.979362, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [10] = { + viewAngle = 87.468338,--FOV + hAngle = -82.461266, + vAngle = -12.843998, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [11] = {--look at left mirror + viewAngle = 68.786629,--FOV + hAngle = 15.618313, + vAngle = 7.522498, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [12] = {--look at right mirror + viewAngle = 69.165199,--FOV + hAngle = -15.683434, + vAngle = 8.549150, + x_trans = 0.000000, + y_trans = 0.000000, + z_trans = 0.000000, + rollAngle = 0.000000, + }, + [13] = {--default view + viewAngle = 87.468338,--FOV + hAngle = 0.000000, + vAngle = -9.500000, + x_trans = 0.113927, + y_trans = -0.004946, + z_trans = 0.000000, + rollAngle = 0.000000, + }, +}, +} \ No newline at end of file diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/Config/View/View.lua b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/Config/View/View.lua new file mode 100644 index 000000000..9baf3b7df --- /dev/null +++ b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/Config/View/View.lua @@ -0,0 +1,128 @@ +-- View scripts +-- Copyright (C) 2004, Eagle Dynamics. + +CockpitMouse = true --false +CockpitMouseSpeedSlow = 1.0 +CockpitMouseSpeedNormal = 10.0 +CockpitMouseSpeedFast = 20.0 +CockpitKeyboardAccelerationSlow = 5.0 +CockpitKeyboardAccelerationNormal = 30.0 +CockpitKeyboardAccelerationFast = 80.0 +CockpitKeyboardZoomAcceleration = 300.0 +DisableSnapViewsSaving = false +UseDefaultSnapViews = true +CockpitPanStepHor = 45.0 +CockpitPanStepVert = 30.0 +CockpitNyMove = true + +CockpitHAngleAccelerateTimeMax = 0.15 +CockpitVAngleAccelerateTimeMax = 0.15 +CockpitZoomAccelerateTimeMax = 0.2 + +function NaturalHeadMoving(tang, roll, omz) + local r = roll + if r > 90.0 then + r = 180.0 - r + elseif roll < -90.0 then + r = -180.0 - r + end + local hAngle = -0.25 * r + local vAngle = math.min(math.max(0.0, 0.4 * tang + 45.0 * omz), 90.0) + return hAngle, vAngle +end + +ExternalMouse = true +ExternalMouseSpeedSlow = 1.0 +ExternalMouseSpeedNormal = 5.0 +ExternalMouseSpeedFast = 20.0 +ExternalViewAngleMin = 3.0 +ExternalViewAngleMax = 170.0 +ExternalViewAngleDefault = 60.0 +ExternalKeyboardZoomAcceleration = 30.0 +ExternalKeyboardZoomAccelerateTimeMax = 1.0 +ExplosionExpoTime = 4.0 +ExternalKeyboardAccelerationSlow = 1.0 +ExternalKeyboardAccelerationNormal = 10.0 +ExternalKeyboardAccelerationFast = 30.0 +ExternalHAngleAccelerateTimeMax = 3.0 +ExternalVAngleAccelerateTimeMax = 3.0 +ExternalDistAccelerateTimeMax = 3.0 +ExternalHAngleLocalAccelerateTimeMax = 3.0 +ExternalVAngleLocalAccelerateTimeMax = 3.0 +ExternalAngleNormalDiscreteStep = 15.0/ExternalKeyboardAccelerationNormal -- When 'S' is pressed only +ChaseCameraNyMove = true +FreeCameraAngleIncrement = 3.0 +FreeCameraDistanceIncrement = 200.0 +FreeCameraLeftRightIncrement = 2.0 +FreeCameraAltitudeIncrement = 2.0 +FreeCameraScalarSpeedAcceleration = 0.1 +xMinMap = -300000 +xMaxMap = 500000 +yMinMap = -400000 +yMaxMap = 200000 +dxMap = 150000 +dyMap = 100000 + +head_roll_shaking = true +head_roll_shaking_max = 30.0 +head_roll_shaking_compensation_gain = 0.3 + +-- CameraJiggle() and CameraFloat() functions make camera position +-- dependent on FPS so be careful in using the Shift-J command with tracks, please. +-- uncomment to use custom jiggle functions +--[[ +function CameraJiggle(t,rnd1,rnd2,rnd3) + local rotX, rotY, rotZ + rotX = 0.05 * rnd1 * math.sin(37.0 * (t - 0.0)) + rotY = 0.05 * rnd2 * math.sin(41.0 * (t - 1.0)) + rotZ = 0.05 * rnd3 * math.sin(53.0 * (t - 2.0)) + return rotX, rotY, rotZ +end + +function CameraFloat(t) + local dX, dY, dZ + dX = 0.61 * math.sin(0.7 * t) + 0.047 * math.sin(1.6 * t); + dY = 0.43 * math.sin(0.6 * t) + 0.067 * math.sin(1.7 * t); + dZ = 0.53 * math.sin(1.0 * t) + 0.083 * math.sin(1.9 * t); + return dX, dY, dZ +end +--]] +--Debug keys + +DEBUG_TEXT = 1 +DEBUG_GEOMETRY = 2 + +debug_keys = { + [DEBUG_TEXT] = 1, + [DEBUG_GEOMETRY] = 1 +} + +function onDebugCommand(command) + if command == 10000 then + if debug_keys[DEBUG_TEXT] ~= 0 or debug_keys[DEBUG_GEOMETRY] ~= 0 then + debug_keys[DEBUG_GEOMETRY] = 0 + debug_keys[DEBUG_TEXT] = 0 + else + debug_keys[DEBUG_GEOMETRY] = 1 + debug_keys[DEBUG_TEXT] = 1 + end + elseif command == 10001 then + if debug_keys[DEBUG_TEXT] ~= 0 then + debug_keys[DEBUG_TEXT] = 0 + else + debug_keys[DEBUG_TEXT] = 1 + end + elseif command == 10002 then + if debug_keys[DEBUG_GEOMETRY] ~= 0 then + debug_keys[DEBUG_GEOMETRY] = 0 + else + debug_keys[DEBUG_GEOMETRY] = 1 + end + end +end + +-- gain values for TrackIR , to unify responce on diffrent types of aircraft +TrackIR_gain_x = -0.6 +TrackIR_gain_y = 0.3 +TrackIR_gain_z = -0.25 +TrackIR_gain_roll = -90 \ No newline at end of file diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/Scripts/World/GPS_GNSS.lua b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/Scripts/World/GPS_GNSS.lua new file mode 100644 index 000000000..2cb4a8e8d --- /dev/null +++ b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/Scripts/World/GPS_GNSS.lua @@ -0,0 +1,880 @@ +SAT_SYS_GLONASS = 0 +SAT_SYS_GPS = 1 + +almanac = {} +--GPS +almanac[0] = {} +almanac[0]["System"] = SAT_SYS_GPS +almanac[0]["Number"] = 1 +almanac[0]["Orbital"] = "F" +almanac[0]["Eccentricity"] = 6.294000e-003 +almanac[0]["Time_of_Applicability"] = 5.898240e+005 +almanac[0]["Orbital_Inclination"] = 9.885676e-001 +almanac[0]["Rate_of_Right_Ascen"] = -7.862702e-009 +almanac[0]["SQRT_A"] = 5.153700e+003 +almanac[0]["Right_Ascen_at_Week"] = 8.096750e-001 +almanac[0]["Argument_of_Perigee"] = -1.777773e+000 +almanac[0]["Mean_Anom"] = -5.315745e-001 +almanac[0]["week"] = 1390 + +almanac[1] = {} +almanac[1]["System"] = SAT_SYS_GPS +almanac[1]["Number"] = 2 +almanac[1]["Orbital"] = "C" +almanac[1]["Eccentricity"] = 8.794000e-003 +almanac[1]["Time_of_Applicability"] = 5.898240e+005 +almanac[1]["Orbital_Inclination"] = 9.487811e-001 +almanac[1]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[1]["SQRT_A"] = 5.153700e+003 +almanac[1]["Right_Ascen_at_Week"] = -1.329172e+000 +almanac[1]["Argument_of_Perigee"] = 2.138637e+000 +almanac[1]["Mean_Anom"] = 7.311702e-001 +almanac[1]["week"] = 1390 + +almanac[2] = {} +almanac[2]["System"] = SAT_SYS_GPS +almanac[2]["Number"] = 3 +almanac[2]["Orbital"] = "F" +almanac[2]["Eccentricity"] = 8.424000e-003 +almanac[2]["Time_of_Applicability"] = 5.898240e+005 +almanac[2]["Orbital_Inclination"] = 9.262804e-001 +almanac[2]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[2]["SQRT_A"] = 5.153600e+003 +almanac[2]["Right_Ascen_at_Week"] = -2.341514e+000 +almanac[2]["Argument_of_Perigee"] = 6.749357e-001 +almanac[2]["Mean_Anom"] = -2.296153e-001 +almanac[2]["week"] = 1389 + +almanac[3] = {} +almanac[3]["System"] = SAT_SYS_GPS +almanac[3]["Number"] = 4 +almanac[3]["Orbital"] = "D" +almanac[3]["Eccentricity"] = 7.413000e-003 +almanac[3]["Time_of_Applicability"] = 5.898240e+005 +almanac[3]["Orbital_Inclination"] = 9.482889e-001 +almanac[3]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[3]["SQRT_A"] = 5.153600e+003 +almanac[3]["Right_Ascen_at_Week"] = -1.309589e+000 +almanac[3]["Argument_of_Perigee"] = 1.623504e-001 +almanac[3]["Mean_Anom"] = -3.022943e+000 +almanac[3]["week"] = 1390 + +almanac[4] = {} +almanac[4]["System"] = SAT_SYS_GPS +almanac[4]["Number"] = 5 +almanac[4]["Orbital"] = "B" +almanac[4]["Eccentricity"] = 7.432000e-003 +almanac[4]["Time_of_Applicability"] = 5.898240e+005 +almanac[4]["Orbital_Inclination"] = 9.387437e-001 +almanac[4]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[4]["SQRT_A"] = 5.153700e+003 +almanac[4]["Right_Ascen_at_Week"] = 2.779487e+000 +almanac[4]["Argument_of_Perigee"] = 1.099033e+000 +almanac[4]["Mean_Anom"] = 2.970984e+000 +almanac[4]["week"] = 1390 + +almanac[5] = {} +almanac[5]["System"] = SAT_SYS_GPS +almanac[5]["Number"] = 6 +almanac[5]["Orbital"] = "C" +almanac[5]["Eccentricity"] = 6.020000e-003 +almanac[5]["Time_of_Applicability"] = 5.898240e+005 +almanac[5]["Orbital_Inclination"] = 9.337591e-001 +almanac[5]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[5]["SQRT_A"] = 5.153600e+003 +almanac[5]["Right_Ascen_at_Week"] = -2.407627e+000 +almanac[5]["Argument_of_Perigee"] = -1.788263e+000 +almanac[5]["Mean_Anom"] = -2.149877e+000 +almanac[5]["week"] = 1390 + +almanac[6] = {} +almanac[6]["System"] = SAT_SYS_GPS +almanac[6]["Number"] = 7 +almanac[6]["Orbital"] = "C" +almanac[6]["Eccentricity"] = 1.052400e-002 +almanac[6]["Time_of_Applicability"] = 5.898240e+005 +almanac[6]["Orbital_Inclination"] = 9.353229e-001 +almanac[6]["Rate_of_Right_Ascen"] = -8.080868e-009 +almanac[6]["SQRT_A"] = 5.153700e+003 +almanac[6]["Right_Ascen_at_Week"] = -2.433580e+000 +almanac[6]["Argument_of_Perigee"] = -1.767301e+000 +almanac[6]["Mean_Anom"] = -3.141503e+000 +almanac[6]["week"] = 1390 + +almanac[7] = {} +almanac[7]["System"] = SAT_SYS_GPS +almanac[7]["Number"] = 8 +almanac[7]["Orbital"] = "A" +almanac[7]["Eccentricity"] = 9.822000e-003 +almanac[7]["Time_of_Applicability"] = 5.898240e+005 +almanac[7]["Orbital_Inclination"] = 9.741390e-001 +almanac[7]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[7]["SQRT_A"] = 5.153600e+003 +almanac[7]["Right_Ascen_at_Week"] = 1.857849e+000 +almanac[7]["Argument_of_Perigee"] = 2.674034e+000 +almanac[7]["Mean_Anom"] = -2.009745e+000 +almanac[7]["week"] = 1390 + +almanac[8] = {} +almanac[8]["System"] = SAT_SYS_GPS +almanac[8]["Number"] = 9 +almanac[8]["Orbital"] = "A" +almanac[8]["Eccentricity"] = 1.839300e-002 +almanac[8]["Time_of_Applicability"] = 5.898240e+005 +almanac[8]["Orbital_Inclination"] = 9.617541e-001 +almanac[8]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[8]["SQRT_A"] = 5.153600e+003 +almanac[8]["Right_Ascen_at_Week"] = 1.777005e+000 +almanac[8]["Argument_of_Perigee"] = 1.274962e+000 +almanac[8]["Mean_Anom"] = -2.349578e+000 +almanac[8]["week"] = 1390 + +almanac[9] = {} +almanac[9]["System"] = SAT_SYS_GPS +almanac[9]["Number"] = 10 +almanac[9]["Orbital"] = "E" +almanac[9]["Eccentricity"] = 7.061000e-003 +almanac[9]["Time_of_Applicability"] = 5.898240e+005 +almanac[9]["Orbital_Inclination"] = 9.728876e-001 +almanac[9]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[9]["SQRT_A"] = 5.153600e+003 +almanac[9]["Right_Ascen_at_Week"] = -2.563014e-001 +almanac[9]["Argument_of_Perigee"] = 4.377980e-001 +almanac[9]["Mean_Anom"] = 1.210716e+000 +almanac[9]["week"] = 1390 + +almanac[10] = {} +almanac[10]["System"] = SAT_SYS_GPS +almanac[10]["Number"] = 11 +almanac[10]["Orbital"] = "D" +almanac[10]["Eccentricity"] = 5.744000e-003 +almanac[10]["Time_of_Applicability"] = 5.898240e+005 +almanac[10]["Orbital_Inclination"] = 8.959309e-001 +almanac[10]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[10]["SQRT_A"] = 5.153600e+003 +almanac[10]["Right_Ascen_at_Week"] = -1.478816e+000 +almanac[10]["Argument_of_Perigee"] = 3.750011e-001 +almanac[10]["Mean_Anom"] = -1.522048e+000 +almanac[10]["week"] = 1390 + +almanac[11] = {} +almanac[11]["System"] = SAT_SYS_GPS +almanac[11]["Number"] = 13 +almanac[11]["Orbital"] = "F" +almanac[11]["Eccentricity"] = 3.088000e-003 +almanac[11]["Time_of_Applicability"] = 5.898240e+005 +almanac[11]["Orbital_Inclination"] = 9.927564e-001 +almanac[11]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[11]["SQRT_A"] = 5.153700e+003 +almanac[11]["Right_Ascen_at_Week"] = 7.956600e-001 +almanac[11]["Argument_of_Perigee"] = 1.279395e+000 +almanac[11]["Mean_Anom"] = 1.004349e+000 +almanac[11]["week"] = 1390 + +almanac[12] = {} +almanac[12]["System"] = SAT_SYS_GPS +almanac[12]["Number"] = 14 +almanac[12]["Orbital"] = "F" +almanac[12]["Eccentricity"] = 2.591000e-003 +almanac[12]["Time_of_Applicability"] = 5.898240e+005 +almanac[12]["Orbital_Inclination"] = 9.868729e-001 +almanac[12]["Rate_of_Right_Ascen"] = -7.885391e-009 +almanac[12]["SQRT_A"] = 5.153600e+003 +almanac[12]["Right_Ascen_at_Week"] = 7.819592e-001 +almanac[12]["Argument_of_Perigee"] = -2.158621e+000 +almanac[12]["Mean_Anom"] = 5.412611e-001 +almanac[12]["week"] = 1390 + +almanac[13] = {} +almanac[13]["System"] = SAT_SYS_GPS +almanac[13]["Number"] = 15 +almanac[13]["Orbital"] = "D" +almanac[13]["Eccentricity"] = 9.828000e-003 +almanac[13]["Time_of_Applicability"] = 3.194880e+005 +almanac[13]["Orbital_Inclination"] = 9.554204e-001 +almanac[13]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[13]["SQRT_A"] = 5.153600e+003 +almanac[13]["Right_Ascen_at_Week"] = -1.123869e+000 +almanac[13]["Argument_of_Perigee"] = 2.690266e+000 +almanac[13]["Mean_Anom"] = 2.220476e+000 +almanac[13]["week"] = 1389 + +almanac[14] = {} +almanac[14]["System"] = SAT_SYS_GPS +almanac[14]["Number"] = 16 +almanac[14]["Orbital"] = "B" +almanac[14]["Eccentricity"] = 3.494000e-003 +almanac[14]["Time_of_Applicability"] = 5.898240e+005 +almanac[14]["Orbital_Inclination"] = 9.629340e-001 +almanac[14]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[14]["SQRT_A"] = 5.153700e+003 +almanac[14]["Right_Ascen_at_Week"] = 2.873124e+000 +almanac[14]["Argument_of_Perigee"] = -7.819243e-001 +almanac[14]["Mean_Anom"] = 2.623629e+000 +almanac[14]["week"] = 1390 + +almanac[15] = {} +almanac[15]["System"] = SAT_SYS_GPS +almanac[15]["Number"] = 17 +almanac[15]["Orbital"] = "C" +almanac[15]["Eccentricity"] = 2.141000e-003 +almanac[15]["Time_of_Applicability"] = 5.898240e+005 +almanac[15]["Orbital_Inclination"] = 9.601170e-001 +almanac[15]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[15]["SQRT_A"] = 5.153700e+003 +almanac[15]["Right_Ascen_at_Week"] = -2.371499e+000 +almanac[15]["Argument_of_Perigee"] = 3.087694e+000 +almanac[15]["Mean_Anom"] = 1.611217e+000 +almanac[15]["week"] = 1390 + +almanac[16] = {} +almanac[16]["System"] = SAT_SYS_GPS +almanac[16]["Number"] = 18 +almanac[16]["Orbital"] = "E" +almanac[16]["Eccentricity"] = 7.636000e-003 +almanac[16]["Time_of_Applicability"] = 5.898240e+005 +almanac[16]["Orbital_Inclination"] = 9.569597e-001 +almanac[16]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[16]["SQRT_A"] = 5.153700e+003 +almanac[16]["Right_Ascen_at_Week"] = -2.359858e-001 +almanac[16]["Argument_of_Perigee"] = -2.649216e+000 +almanac[16]["Mean_Anom"] = 2.675029e+000 +almanac[16]["week"] = 1390 + +almanac[17] = {} +almanac[17]["System"] = SAT_SYS_GPS +almanac[17]["Number"] = 19 +almanac[17]["Orbital"] = "C" +almanac[17]["Eccentricity"] = 3.602000e-003 +almanac[17]["Time_of_Applicability"] = 5.898240e+005 +almanac[17]["Orbital_Inclination"] = 9.580209e-001 +almanac[17]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[17]["SQRT_A"] = 5.153600e+003 +almanac[17]["Right_Ascen_at_Week"] = -2.312385e+000 +almanac[17]["Argument_of_Perigee"] = -1.161079e+000 +almanac[17]["Mean_Anom"] = 1.310619e+000 +almanac[17]["week"] = 1390 + +almanac[18] = {} +almanac[18]["System"] = SAT_SYS_GPS +almanac[18]["Number"] = 20 +almanac[18]["Orbital"] = "E" +almanac[18]["Eccentricity"] = 2.796000e-003 +almanac[18]["Time_of_Applicability"] = 5.898240e+005 +almanac[18]["Orbital_Inclination"] = 9.564693e-001 +almanac[18]["Rate_of_Right_Ascen"] = -7.908080e-009 +almanac[18]["SQRT_A"] = 5.153600e+003 +almanac[18]["Right_Ascen_at_Week"] = -2.889565e-001 +almanac[18]["Argument_of_Perigee"] = 1.379612e+000 +almanac[18]["Mean_Anom"] = 2.461750e+000 +almanac[18]["week"] = 1390 + +almanac[19] = {} +almanac[19]["System"] = SAT_SYS_GPS +almanac[19]["Number"] = 21 +almanac[19]["Orbital"] = "D" +almanac[19]["Eccentricity"] = 1.162900e-002 +almanac[19]["Time_of_Applicability"] = 5.898240e+005 +almanac[19]["Orbital_Inclination"] = 9.418592e-001 +almanac[19]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[19]["SQRT_A"] = 5.153600e+003 +almanac[19]["Right_Ascen_at_Week"] = -1.289972e+000 +almanac[19]["Argument_of_Perigee"] = -2.923686e+000 +almanac[19]["Mean_Anom"] = -2.349194e+000 +almanac[19]["week"] = 1390 + +almanac[20] = {} +almanac[20]["System"] = SAT_SYS_GPS +almanac[20]["Number"] = 22 +almanac[20]["Orbital"] = "E" +almanac[20]["Eccentricity"] = 4.893000e-003 +almanac[20]["Time_of_Applicability"] = 5.898240e+005 +almanac[20]["Orbital_Inclination"] = 9.545093e-001 +almanac[20]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[20]["SQRT_A"] = 5.153600e+003 +almanac[20]["Right_Ascen_at_Week"] = -2.280969e-001 +almanac[20]["Argument_of_Perigee"] = -1.674502e+000 +almanac[20]["Mean_Anom"] = 1.106852e+000 +almanac[20]["week"] = 1390 + +almanac[21] = {} +almanac[21]["System"] = SAT_SYS_GPS +almanac[21]["Number"] = 23 +almanac[21]["Orbital"] = "F" +almanac[21]["Eccentricity"] = 4.822000e-003 +almanac[21]["Time_of_Applicability"] = 5.898240e+005 +almanac[21]["Orbital_Inclination"] = 9.691247e-001 +almanac[21]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[21]["SQRT_A"] = 5.153700e+003 +almanac[21]["Right_Ascen_at_Week"] = 7.667399e-001 +almanac[21]["Argument_of_Perigee"] = 2.497634e+000 +almanac[21]["Mean_Anom"] = 3.184700e-001 +almanac[21]["week"] = 1390 + +almanac[22] = {} +almanac[22]["System"] = SAT_SYS_GPS +almanac[22]["Number"] = 24 +almanac[22]["Orbital"] = "D" +almanac[22]["Eccentricity"] = 9.277000e-003 +almanac[22]["Time_of_Applicability"] = 5.898240e+005 +almanac[22]["Orbital_Inclination"] = 9.585183e-001 +almanac[22]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[22]["SQRT_A"] = 5.153900e+003 +almanac[22]["Right_Ascen_at_Week"] = -1.274840e+000 +almanac[22]["Argument_of_Perigee"] = -8.815651e-001 +almanac[22]["Mean_Anom"] = -1.695551e+000 +almanac[22]["week"] = 1390 + +almanac[23] = {} +almanac[23]["System"] = SAT_SYS_GPS +almanac[23]["Number"] = 25 +almanac[23]["Orbital"] = "A" +almanac[23]["Eccentricity"] = 1.257400e-002 +almanac[23]["Time_of_Applicability"] = 5.898240e+005 +almanac[23]["Orbital_Inclination"] = 9.551027e-001 +almanac[23]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[23]["SQRT_A"] = 5.153600e+003 +almanac[23]["Right_Ascen_at_Week"] = 1.721853e+000 +almanac[23]["Argument_of_Perigee"] = -1.329870e+000 +almanac[23]["Mean_Anom"] = -1.769623e+000 +almanac[23]["week"] = 1390 + +almanac[24] = {} +almanac[24]["System"] = SAT_SYS_GPS +almanac[24]["Number"] = 26 +almanac[24]["Orbital"] = "F" +almanac[24]["Eccentricity"] = 1.745700e-002 +almanac[24]["Time_of_Applicability"] = 5.898240e+005 +almanac[24]["Orbital_Inclination"] = 9.908749e-001 +almanac[24]["Rate_of_Right_Ascen"] = -7.840012e-009 +almanac[24]["SQRT_A"] = 5.153700e+003 +almanac[24]["Right_Ascen_at_Week"] = 7.961836e-001 +almanac[24]["Argument_of_Perigee"] = 8.161502e-001 +almanac[24]["Mean_Anom"] = -5.841961e-001 +almanac[24]["week"] = 1390 + +almanac[25] = {} +almanac[25]["System"] = SAT_SYS_GPS +almanac[25]["Number"] = 27 +almanac[25]["Orbital"] = "A" +almanac[25]["Eccentricity"] = 1.991000e-002 +almanac[25]["Time_of_Applicability"] = 5.898240e+005 +almanac[25]["Orbital_Inclination"] = 9.596563e-001 +almanac[25]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[25]["SQRT_A"] = 5.153600e+003 +almanac[25]["Right_Ascen_at_Week"] = 1.754124e+000 +almanac[25]["Argument_of_Perigee"] = -1.900854e+000 +almanac[25]["Mean_Anom"] = 3.046487e+000 +almanac[25]["week"] = 1390 + +almanac[26] = {} +almanac[26]["System"] = SAT_SYS_GPS +almanac[26]["Number"] = 28 +almanac[26]["Orbital"] = "B" +almanac[26]["Eccentricity"] = 1.162800e-002 +almanac[26]["Time_of_Applicability"] = 5.898240e+005 +almanac[26]["Orbital_Inclination"] = 9.610106e-001 +almanac[26]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[26]["SQRT_A"] = 5.153600e+003 +almanac[26]["Right_Ascen_at_Week"] = 2.882583e+000 +almanac[26]["Argument_of_Perigee"] = -2.242868e+000 +almanac[26]["Mean_Anom"] = 1.860642e+000 +almanac[26]["week"] = 1390 + +almanac[27] = {} +almanac[27]["System"] = SAT_SYS_GPS +almanac[27]["Number"] = 29 +almanac[27]["Orbital"] = "F" +almanac[27]["Eccentricity"] = 9.462000e-003 +almanac[27]["Time_of_Applicability"] = 1.474560e+005 +almanac[27]["Orbital_Inclination"] = 9.874838e-001 +almanac[27]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[27]["SQRT_A"] = 5.153700e+003 +almanac[27]["Right_Ascen_at_Week"] = 7.647503e-001 +almanac[27]["Argument_of_Perigee"] = -8.614589e-001 +almanac[27]["Mean_Anom"] = -4.488983e-001 +almanac[27]["week"] = 1390 + +almanac[28] = {} +almanac[28]["System"] = SAT_SYS_GPS +almanac[28]["Number"] = 30 +almanac[28]["Orbital"] = "B" +almanac[28]["Eccentricity"] = 9.296000e-003 +almanac[28]["Time_of_Applicability"] = 5.898240e+005 +almanac[28]["Orbital_Inclination"] = 9.452992e-001 +almanac[28]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[28]["SQRT_A"] = 5.153600e+003 +almanac[28]["Right_Ascen_at_Week"] = 2.826698e+000 +almanac[28]["Argument_of_Perigee"] = 1.306413e+000 +almanac[28]["Mean_Anom"] = 2.148725e+000 +almanac[28]["week"] = 1390 + + + + + + +--GLONASS +--1 îðáèòàëüíàÿ ïëîñêîñòü, íîìåðà 1-8 +almanac[29] = {} +almanac[29]["System"] = SAT_SYS_GLONASS +almanac[29]["Number"] = 1 +almanac[29]["Orbital"] = 1 +almanac[29]["GLONASS_Data"] = {} +almanac[29]["GLONASS_Data"]["NKU_Number"] = 796 +almanac[29]["GLONASS_Data"]["Cosmos_Number"] = 2411 +almanac[29]["Eccentricity"] = 1.184000e-003 +almanac[29]["Time_of_Applicability"] = 0.000000e+000 +almanac[29]["Orbital_Inclination"] = 1.126443e+000 +almanac[29]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[29]["SQRT_A"] = 5.050500e+003 +almanac[29]["Right_Ascen_at_Week"] = 5.979807e+000 +almanac[29]["Argument_of_Perigee"] = 2.622634e+000 +almanac[29]["Mean_Anom"] = -5.519651e+000 +almanac[29]["week"] = 1390 +almanac[29]["Commit_date"] = "06.02.2005" +almanac[29]["Life_dates"] = {} + +almanac[30] = {} +almanac[30]["System"] = SAT_SYS_GLONASS +almanac[30]["Number"] = 2 +almanac[30]["Orbital"] = 1 +almanac[30]["GLONASS_Data"] = {} +almanac[30]["GLONASS_Data"]["NKU_Number"] = 794 +almanac[30]["GLONASS_Data"]["Cosmos_Number"] = 2401 +almanac[30]["Eccentricity"] = 4.486000e-003 +almanac[30]["Time_of_Applicability"] = 0.000000e+000 +almanac[30]["Orbital_Inclination"] = 1.128459e+000 +almanac[30]["Rate_of_Right_Ascen"] = -6.759654e-009 +almanac[30]["SQRT_A"] = 5.050500e+003 +almanac[30]["Right_Ascen_at_Week"] = 5.997871e+000 +almanac[30]["Argument_of_Perigee"] = 1.709531e+000 +almanac[30]["Mean_Anom"] = -5.367633e+000 +almanac[30]["week"] = 1390 +almanac[30]["Commit_date"] = "02.02.2004" +almanac[30]["Life_dates"] = {} + +almanac[31] = {} +almanac[31]["System"] = SAT_SYS_GLONASS +almanac[31]["Number"] = 3 +almanac[31]["Orbital"] = 1 +almanac[31]["GLONASS_Data"] = {} +almanac[31]["GLONASS_Data"]["NKU_Number"] = 789 +almanac[31]["GLONASS_Data"]["Cosmos_Number"] = 2381 +almanac[31]["Eccentricity"] = 2.459000e-003 +almanac[31]["Time_of_Applicability"] = 0.000000e+000 +almanac[31]["Orbital_Inclination"] = 1.122958e+000 +almanac[31]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[31]["SQRT_A"] = 5.050500e+003 +almanac[31]["Right_Ascen_at_Week"] = 5.960713e+000 +almanac[31]["Argument_of_Perigee"] = -2.683407e+000 +almanac[31]["Mean_Anom"] = -1.791788e+000 +almanac[31]["week"] = 1390 +almanac[31]["Commit_date"] = "04.01.2002" +almanac[31]["Life_dates"] = {} + +almanac[32] = {} +almanac[32]["System"] = SAT_SYS_GLONASS +almanac[32]["Number"] = 4 +almanac[32]["Orbital"] = 1 +almanac[32]["GLONASS_Data"] = {} +almanac[32]["GLONASS_Data"]["NKU_Number"] = 795 +almanac[29]["GLONASS_Data"]["Cosmos_Number"] = 2403 +almanac[32]["Eccentricity"] = 4.054000e-003 +almanac[32]["Time_of_Applicability"] = 0.000000e+000 +almanac[32]["Orbital_Inclination"] = 1.128543e+000 +almanac[32]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[32]["SQRT_A"] = 5.050500e+003 +almanac[32]["Right_Ascen_at_Week"] = 5.998081e+000 +almanac[32]["Argument_of_Perigee"] = 1.497160e+000 +almanac[32]["Mean_Anom"] = -4.293681e-001 +almanac[32]["week"] = 1390 +almanac[32]["Commit_date"] = "29.01.2004" +almanac[32]["Life_dates"] = {} + +almanac[33] = {} +almanac[33]["System"] = SAT_SYS_GLONASS +almanac[33]["Number"] = 5 +almanac[33]["Orbital"] = 1 +almanac[33]["GLONASS_Data"] = {} +almanac[33]["GLONASS_Data"]["NKU_Number"] = 711 +almanac[33]["GLONASS_Data"]["Cosmos_Number"] = 2382 +almanac[33]["Eccentricity"] = 7.040000e-004 +almanac[33]["Time_of_Applicability"] = 0.000000e+000 +almanac[33]["Orbital_Inclination"] = 1.122886e+000 +almanac[33]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[33]["SQRT_A"] = 5.050600e+003 +almanac[33]["Right_Ascen_at_Week"] = 5.960713e+000 +almanac[33]["Argument_of_Perigee"] = 2.740933e+000 +almanac[33]["Mean_Anom"] = -2.523604e+000 +almanac[33]["week"] = 1390 +almanac[33]["Commit_date"] = "13.02.2003" +almanac[33]["Life_dates"] = {} + +almanac[34] = {} +almanac[34]["System"] = SAT_SYS_GLONASS +almanac[34]["Number"] = 6 +almanac[34]["Orbital"] = 1 +almanac[34]["GLONASS_Data"] = {} +almanac[34]["GLONASS_Data"]["NKU_Number"] = 701 +almanac[34]["GLONASS_Data"]["Cosmos_Number"] = 2404 +almanac[34]["Eccentricity"] = 4.766000e-003 +almanac[34]["Time_of_Applicability"] = 0.000000e+000 +almanac[34]["Orbital_Inclination"] = 1.128276e+000 +almanac[34]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[34]["SQRT_A"] = 5.050500e+003 +almanac[34]["Right_Ascen_at_Week"] = 5.997906e+000 +almanac[34]["Argument_of_Perigee"] = 1.802417e+000 +almanac[34]["Mean_Anom"] = -2.426512e+000 +almanac[34]["week"] = 1390 +almanac[34]["Commit_date"] = "08.12.2004" +almanac[34]["Life_dates"] = {} + +almanac[35] = {} +almanac[35]["System"] = SAT_SYS_GLONASS +almanac[35]["Number"] = 7 +almanac[35]["Orbital"] = 1 +almanac[35]["GLONASS_Data"] = {} +almanac[35]["GLONASS_Data"]["NKU_Number"] = 712 +almanac[35]["GLONASS_Data"]["Cosmos_Number"] = 2413 +almanac[35]["Eccentricity"] = 7.570000e-004 +almanac[35]["Time_of_Applicability"] = 0.000000e+000 +almanac[35]["Orbital_Inclination"] = 1.126344e+000 +almanac[35]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[35]["SQRT_A"] = 5.050500e+003 +almanac[35]["Right_Ascen_at_Week"] = 5.979388e+000 +almanac[35]["Argument_of_Perigee"] = 2.566068e+000 +almanac[35]["Mean_Anom"] = -3.921228e+000 +almanac[35]["week"] = 1390 +almanac[35]["Commit_date"] = "07.10.2005" +almanac[35]["Life_dates"] = {} + +almanac[36] = {} +almanac[36]["System"] = SAT_SYS_GLONASS +almanac[36]["GLONASS_Data"] = {} +almanac[36]["Number"] = 8 +almanac[36]["Orbital"] = 1 +almanac[36]["GLONASS_Data"] = {} +almanac[36]["GLONASS_Data"]["NKU_Number"] = 797 +almanac[36]["GLONASS_Data"]["Cosmos_Number"] = 2412 +almanac[36]["Eccentricity"] = 4.060000e-004 +almanac[36]["Time_of_Applicability"] = 0.000000e+000 +almanac[36]["Orbital_Inclination"] = 1.126564e+000 +almanac[36]["Rate_of_Right_Ascen"] = -6.785834e-009 +almanac[36]["SQRT_A"] = 5.050600e+003 +almanac[36]["Right_Ascen_at_Week"] = 5.980069e+000 +almanac[36]["Argument_of_Perigee"] = 2.673633e+000 +almanac[36]["Mean_Anom"] = -4.812026e+000 +almanac[36]["week"] = 1390 +almanac[36]["Commit_date"] = "06.02.2005" +almanac[36]["Life_dates"] = {} + +--3 îðáèòàëüíàÿ ïëîñêîñòü, íîìåðà 17-24 +almanac[37] = {} +almanac[37]["System"] = SAT_SYS_GLONASS +almanac[37]["Number"] = 17 +almanac[37]["Orbital"] = 3 +almanac[37]["GLONASS_Data"] = {} +almanac[37]["GLONASS_Data"]["NKU_Number"] = 787 +almanac[37]["GLONASS_Data"]["Cosmos_Number"] = 2375 +almanac[37]["Eccentricity"] = 5.670000e-004 +almanac[37]["Time_of_Applicability"] = 0.000000e+000 +almanac[37]["Orbital_Inclination"] = 1.126524e+000 +almanac[37]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[37]["SQRT_A"] = 5.050500e+003 +almanac[37]["Right_Ascen_at_Week"] = 3.895554e+000 +almanac[37]["Argument_of_Perigee"] = 6.085085e-001 +almanac[37]["Mean_Anom"] = -2.977407e+000 +almanac[37]["week"] = 1390 +almanac[37]["Commit_date"] = "04.11.2000" +almanac[37]["Life_dates"] = {} + + +almanac[38] = {} +almanac[38]["System"] = SAT_SYS_GLONASS +almanac[38]["Number"] = 18 +almanac[38]["Orbital"] = 3 +almanac[38]["GLONASS_Data"] = {} +almanac[38]["GLONASS_Data"]["NKU_Number"] = 783 +almanac[38]["GLONASS_Data"]["Cosmos_Number"] = 2374 +almanac[38]["Eccentricity"] = 4.520000e-003 +almanac[38]["Time_of_Applicability"] = 0.000000e+000 +almanac[38]["Orbital_Inclination"] = 1.126239e+000 +almanac[38]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[38]["SQRT_A"] = 5.050600e+003 +almanac[38]["Right_Ascen_at_Week"] = 3.894071e+000 +almanac[38]["Argument_of_Perigee"] = -2.509589e+000 +almanac[38]["Mean_Anom"] = -1.020057e+000 +almanac[38]["week"] = 1390 +almanac[38]["Commit_date"] = "05.01.2001" +almanac[38]["Life_dates"] = {} + +almanac[39] = {} +almanac[39]["System"] = SAT_SYS_GLONASS +almanac[39]["Number"] = 19 +almanac[39]["Orbital"] = 3 +almanac[39]["GLONASS_Data"] = {} +almanac[39]["GLONASS_Data"]["NKU_Number"] = 798 +almanac[39]["GLONASS_Data"]["Cosmos_Number"] = 2417 +almanac[39]["Eccentricity"] = 2.023000e-003 +almanac[39]["Time_of_Applicability"] = 0.000000e+000 +almanac[39]["Orbital_Inclination"] = 1.132205e+000 +almanac[39]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[39]["SQRT_A"] = 5.050500e+003 +almanac[39]["Right_Ascen_at_Week"] = 3.884018e+000 +almanac[39]["Argument_of_Perigee"] = 2.718313e+000 +almanac[39]["Mean_Anom"] = -3.933620e-001 +almanac[39]["week"] = 1390 +almanac[39]["Commit_date"] = "22.01.2006" +almanac[39]["Life_dates"] = {} + +almanac[40] = {} +almanac[40]["System"] = SAT_SYS_GLONASS +almanac[40]["Number"] = 20 +almanac[40]["Orbital"] = 3 +almanac[40]["GLONASS_Data"] = {} +almanac[40]["GLONASS_Data"]["NKU_Number"] = 793 +almanac[40]["GLONASS_Data"]["Cosmos_Number"] = 2396 +almanac[40]["Eccentricity"] = 1.822000e-003 +almanac[40]["Time_of_Applicability"] = 0.000000e+000 +almanac[40]["Orbital_Inclination"] = 1.129789e+000 +almanac[40]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[40]["SQRT_A"] = 5.050500e+003 +almanac[40]["Right_Ascen_at_Week"] = 3.896863e+000 +almanac[40]["Argument_of_Perigee"] = 2.723776e+000 +almanac[40]["Mean_Anom"] = -1.193647e+000 +almanac[40]["week"] = 1390 +almanac[40]["Commit_date"] = "31.01.2003" +almanac[40]["Life_dates"] = {} + +almanac[41] = {} +almanac[41]["System"] = SAT_SYS_GLONASS +almanac[41]["Number"] = 21 +almanac[41]["Orbital"] = 3 +almanac[41]["GLONASS_Data"] = {} +almanac[41]["GLONASS_Data"]["NKU_Number"] = 792 +almanac[41]["GLONASS_Data"]["Cosmos_Number"] = 2395 +almanac[41]["Eccentricity"] = 5.290000e-004 +almanac[41]["Time_of_Applicability"] = 0.000000e+000 +almanac[41]["Orbital_Inclination"] = 1.129957e+000 +almanac[41]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[41]["SQRT_A"] = 5.050500e+003 +almanac[41]["Right_Ascen_at_Week"] = 3.897806e+000 +almanac[41]["Argument_of_Perigee"] = -9.519367e-001 +almanac[41]["Mean_Anom"] = -4.578920e+000 +almanac[41]["week"] = 1390 +almanac[41]["Commit_date"] = "31.01.2003" +almanac[41]["Life_dates"] = {} + +almanac[42] = {} +almanac[42]["System"] = SAT_SYS_GLONASS +almanac[42]["Number"] = 22 +almanac[42]["Orbital"] = 3 +almanac[42]["GLONASS_Data"] = {} +almanac[42]["GLONASS_Data"]["NKU_Number"] = 791 +almanac[42]["GLONASS_Data"]["Cosmos_Number"] = 2394 +almanac[42]["Eccentricity"] = 9.200000e-005 +almanac[42]["Time_of_Applicability"] = 0.000000e+000 +almanac[42]["Orbital_Inclination"] = 1.129742e+000 +almanac[42]["Rate_of_Right_Ascen"] = -6.740456e-009 +almanac[42]["SQRT_A"] = 5.050500e+003 +almanac[42]["Right_Ascen_at_Week"] = 3.897404e+000 +almanac[42]["Argument_of_Perigee"] = 2.518211e+000 +almanac[42]["Mean_Anom"] = -2.530167e+000 +almanac[42]["week"] = 1390 +almanac[42]["Commit_date"] = "21.01.2003" +almanac[42]["Life_dates"] = {} + +almanac[43] = {} +almanac[43]["System"] = SAT_SYS_GLONASS +almanac[43]["Number"] = 23 +almanac[43]["Orbital"] = 3 +almanac[43]["GLONASS_Data"] = {} +almanac[43]["GLONASS_Data"]["NKU_Number"] = 714 +almanac[43]["GLONASS_Data"]["Cosmos_Number"] = 2419 +almanac[43]["Eccentricity"] = 8.730000e-004 +almanac[43]["Time_of_Applicability"] = 0.000000e+000 +almanac[43]["Orbital_Inclination"] = 1.132105e+000 +almanac[43]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[43]["SQRT_A"] = 5.050500e+003 +almanac[43]["Right_Ascen_at_Week"] = 3.883808e+000 +almanac[43]["Argument_of_Perigee"] = -3.039139e-001 +almanac[43]["Mean_Anom"] = -5.228304e-001 +almanac[43]["week"] = 1390 +almanac[43]["Commit_date"] = "31.08.2006" +almanac[43]["Life_dates"] = {} + +almanac[44] = {} +almanac[44]["System"] = SAT_SYS_GLONASS +almanac[44]["Number"] = 24 +almanac[44]["Orbital"] = 3 +almanac[44]["GLONASS_Data"] = {} +almanac[44]["GLONASS_Data"]["NKU_Number"] = 713 +almanac[44]["GLONASS_Data"]["Cosmos_Number"] = 2418 +almanac[44]["Eccentricity"] = 2.044000e-003 +almanac[44]["Time_of_Applicability"] = 0.000000e+000 +almanac[44]["Orbital_Inclination"] = 1.132430e+000 +almanac[44]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[44]["SQRT_A"] = 5.050500e+003 +almanac[44]["Right_Ascen_at_Week"] = 3.883983e+000 +almanac[44]["Argument_of_Perigee"] = -3.722784e-001 +almanac[44]["Mean_Anom"] = -1.240457e+000 +almanac[44]["week"] = 1390 +almanac[44]["Commit_date"] = "31.08.2006" +almanac[44]["Life_dates"] = {} + +--2 îðáèòàëüíàÿ ïëîñêîñòü, íîìåðà 9-16 +almanac[45] = {} +almanac[45]["System"] = SAT_SYS_GLONASS +almanac[45]["Number"] = 9 +almanac[45]["Orbital"] = 2 +almanac[45]["GLONASS_Data"] = {} +almanac[45]["GLONASS_Data"]["NKU_Number"] = "N/A" +almanac[45]["GLONASS_Data"]["Cosmos_Number"] = "N/A" +almanac[45]["Eccentricity"] = 1.184000e-003 +almanac[45]["Time_of_Applicability"] = 0.000000e+000 +almanac[45]["Orbital_Inclination"] = 1.126443e+000 +almanac[45]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[45]["SQRT_A"] = 5.050500e+003 +almanac[45]["Right_Ascen_at_Week"] = 1.79067e+000 +almanac[45]["Argument_of_Perigee"] = 2.88430067 +almanac[45]["Mean_Anom"] = -5.519651e+000 +almanac[45]["week"] = 1390 +almanac[45]["Commit_date"] = "N/A" +almanac[45]["Life_dates"] = {} + +almanac[46] = {} +almanac[46]["System"] = SAT_SYS_GLONASS +almanac[46]["Number"] = 10 +almanac[46]["Orbital"] = 2 +almanac[46]["GLONASS_Data"] = {} +almanac[46]["GLONASS_Data"]["NKU_Number"] = "N/A" +almanac[46]["GLONASS_Data"]["Cosmos_Number"] = "N/A" +almanac[46]["Eccentricity"] = 1.184000e-003 +almanac[46]["Time_of_Applicability"] = 0.000000e+000 +almanac[46]["Orbital_Inclination"] = 1.126443e+000 +almanac[46]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[46]["SQRT_A"] = 5.050500e+003 +almanac[46]["Right_Ascen_at_Week"] = 1.79067e+000 +almanac[46]["Argument_of_Perigee"] = 3.66930067 +almanac[46]["Mean_Anom"] = -5.519651e+000 +almanac[46]["week"] = 1390 +almanac[46]["Commit_date"] = "N/A" +almanac[46]["Life_dates"] = {} + +almanac[47] = {} +almanac[47]["System"] = SAT_SYS_GLONASS +almanac[47]["Number"] = 11 +almanac[47]["Orbital"] = 2 +almanac[47]["GLONASS_Data"] = {} +almanac[47]["GLONASS_Data"]["NKU_Number"] = "N/A" +almanac[47]["GLONASS_Data"]["Cosmos_Number"] = "N/A" +almanac[47]["Eccentricity"] = 1.184000e-003 +almanac[47]["Time_of_Applicability"] = 0.000000e+000 +almanac[47]["Orbital_Inclination"] = 1.126443e+000 +almanac[47]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[47]["SQRT_A"] = 5.050500e+003 +almanac[47]["Right_Ascen_at_Week"] = 1.79067e+000 +almanac[47]["Argument_of_Perigee"] = 4.45430067 +almanac[47]["Mean_Anom"] = -5.519651e+000 +almanac[47]["week"] = 1390 +almanac[47]["Commit_date"] = "N/A" +almanac[47]["Life_dates"] = {} + +almanac[48] = {} +almanac[48]["System"] = SAT_SYS_GLONASS +almanac[48]["Number"] = 12 +almanac[48]["Orbital"] = 2 +almanac[48]["GLONASS_Data"] = {} +almanac[48]["GLONASS_Data"]["NKU_Number"] = "N/A" +almanac[48]["GLONASS_Data"]["Cosmos_Number"] = "N/A" +almanac[48]["Eccentricity"] = 1.184000e-003 +almanac[48]["Time_of_Applicability"] = 0.000000e+000 +almanac[48]["Orbital_Inclination"] = 1.126443e+000 +almanac[48]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[48]["SQRT_A"] = 5.050500e+003 +almanac[48]["Right_Ascen_at_Week"] = 1.79067e+000 +almanac[48]["Argument_of_Perigee"] = 5.23930067 +almanac[48]["Mean_Anom"] = -5.519651e+000 +almanac[48]["week"] = 1390 +almanac[48]["Commit_date"] = "N/A" +almanac[48]["Life_dates"] = {} + +almanac[49] = {} +almanac[49]["System"] = SAT_SYS_GLONASS +almanac[49]["Number"] = 13 +almanac[49]["Orbital"] = 2 +almanac[49]["GLONASS_Data"] = {} +almanac[49]["GLONASS_Data"]["NKU_Number"] = "N/A" +almanac[49]["GLONASS_Data"]["Cosmos_Number"] = "N/A" +almanac[49]["Eccentricity"] = 1.184000e-003 +almanac[49]["Time_of_Applicability"] = 0.000000e+000 +almanac[49]["Orbital_Inclination"] = 1.126443e+000 +almanac[49]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[49]["SQRT_A"] = 5.050500e+003 +almanac[49]["Right_Ascen_at_Week"] = 1.79067e+000 +almanac[49]["Argument_of_Perigee"] = 6.02430067 +almanac[49]["Mean_Anom"] = -5.519651e+000 +almanac[49]["week"] = 1390 +almanac[49]["Commit_date"] = "N/A" +almanac[49]["Life_dates"] = {} + +almanac[50] = {} +almanac[50]["System"] = SAT_SYS_GLONASS +almanac[50]["Number"] = 14 +almanac[50]["Orbital"] = 2 +almanac[50]["GLONASS_Data"] = {} +almanac[50]["GLONASS_Data"]["NKU_Number"] = "N/A" +almanac[50]["GLONASS_Data"]["Cosmos_Number"] = "N/A" +almanac[50]["Eccentricity"] = 1.184000e-003 +almanac[50]["Time_of_Applicability"] = 0.000000e+000 +almanac[50]["Orbital_Inclination"] = 1.126443e+000 +almanac[50]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[50]["SQRT_A"] = 5.050500e+003 +almanac[50]["Right_Ascen_at_Week"] = 1.79067e+000 +almanac[50]["Argument_of_Perigee"] = 0.52930067 +almanac[50]["Mean_Anom"] = -5.519651e+000 +almanac[50]["week"] = 1390 +almanac[50]["Commit_date"] = "N/A" +almanac[50]["Life_dates"] = {} + +almanac[51] = {} +almanac[51]["System"] = SAT_SYS_GLONASS +almanac[51]["Number"] = 15 +almanac[51]["Orbital"] = 2 +almanac[51]["GLONASS_Data"] = {} +almanac[51]["GLONASS_Data"]["NKU_Number"] = "N/A" +almanac[51]["GLONASS_Data"]["Cosmos_Number"] = "N/A" +almanac[51]["Eccentricity"] = 1.184000e-003 +almanac[51]["Time_of_Applicability"] = 0.000000e+000 +almanac[51]["Orbital_Inclination"] = 1.126443e+000 +almanac[51]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[51]["SQRT_A"] = 5.050500e+003 +almanac[51]["Right_Ascen_at_Week"] = 1.79067e+000 +almanac[51]["Argument_of_Perigee"] = 1.31430067 +almanac[51]["Mean_Anom"] = -5.519651e+000 +almanac[51]["week"] = 1390 +almanac[51]["Commit_date"] = "N/A" +almanac[51]["Life_dates"] = {} + +almanac[52] = {} +almanac[52]["System"] = SAT_SYS_GLONASS +almanac[52]["Number"] = 16 +almanac[52]["Orbital"] = 2 +almanac[52]["GLONASS_Data"] = {} +almanac[52]["GLONASS_Data"]["NKU_Number"] = "N/A" +almanac[52]["GLONASS_Data"]["Cosmos_Number"] = "N/A" +almanac[52]["Eccentricity"] = 1.184000e-003 +almanac[52]["Time_of_Applicability"] = 0.000000e+000 +almanac[52]["Orbital_Inclination"] = 1.126443e+000 +almanac[52]["Rate_of_Right_Ascen"] = 0.000000e+000 +almanac[52]["SQRT_A"] = 5.050500e+003 +almanac[52]["Right_Ascen_at_Week"] = 1.79067e+000 +almanac[52]["Argument_of_Perigee"] = 2.09930067 +almanac[52]["Mean_Anom"] = -5.519651e+000 +almanac[52]["week"] = 1390 +almanac[52]["Commit_date"] = "N/A" +almanac[52]["Life_dates"] = {} + +SA_mode = false +AS_mode = false diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/Scripts/World/birds.lua b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/Scripts/World/birds.lua new file mode 100644 index 000000000..8aee1f700 --- /dev/null +++ b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/Scripts/World/birds.lua @@ -0,0 +1,27 @@ +birds_avail = true --Birds availability. false - there is no birds +birds_maximum_hrad = 200 --Maximum altitude above ground al sea level bird could be met +birds_maximum_absolute_height = 8000 --Maximum absolute altitude bird could be met +birds_minimum_velocity = 40 --Minimum velocity bird could be met +birds_delta_time = 3.55 +birds_probability = {0.006333333*150, + 0.004166667*150, + 0.001966667*150, + 0.001090909*150, + 0.000741818*150, + 0.0006*150, + 0.000510545*150, + 0.000447273*150, + 0.000389455*150, + 0.000349091*150, + 0.000310909*150, + 0.000282545*150, + 0.000250909*150, + 0.000220364*150, + 0.000196364*150, + 0.000174545*150, + 0.000152727*150, + 0.000128727*150, + 0.000103636*150, + 7.63636E-05*150, + 0*150 +} diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/VHF_RADIO/SETTINGS.lua b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/VHF_RADIO/SETTINGS.lua new file mode 100644 index 000000000..92c6a42c4 --- /dev/null +++ b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/VHF_RADIO/SETTINGS.lua @@ -0,0 +1,14 @@ +settings= +{ + ["dials"]= + { + ["channel"]=-1, + }, + ["presets"]= + { + [1]=124000000, + [2]=124000000, + [3]=131000000, + [4]=139000000, + }, +} diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/l10n/DEFAULT/AIB-005 - Patrol AI and Randomize Zones.lua b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/l10n/DEFAULT/AIB-005 - Patrol AI and Randomize Zones.lua new file mode 100644 index 000000000..eab2c2e22 --- /dev/null +++ b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/l10n/DEFAULT/AIB-005 - Patrol AI and Randomize Zones.lua @@ -0,0 +1,51 @@ +-- Name: AIB-005 - Patrol AI and Randomize Zones +-- Author: FlightControl +-- Date Created: 10 Jan 2016 +-- +-- # Situation: +-- +-- For the red coalition, 2 client slots are foreseen. +-- For those players that have not joined the mission, red AI is spawned. +-- The red AI should start patrolling an area until fuel is empty and return to the home base. +-- For each AI being spawned, ensure that they fly to a random zone defined within the mission editor. +-- Right now there are two patrol zones defined, so the AI should start patrolliing in one of these zones. +-- +-- # Test cases: +-- +-- 1. If no player is logging into the red slots, 2 red AI planes should be alive. +-- 2. If a player joins one red slot, one red AI plane should return to the nearest home base. +-- 3. If two players join the red slots, no AI plane should be spawned, and all airborne AI planes should return to the nearest home base. +-- 4. Spawned AI should take-off from the airbase, and start patrolling the area around Anapa. +-- 5. When the AI is out-of-fuel, it should report it is returning to the home base, and land at Anapa. +-- 6. Ensure that you see the AI patrol in one of the two zones ... + +-- Define the SET of CLIENTs from the red coalition. This SET is filled during startup. +local RU_PlanesClientSet = SET_CLIENT:New():FilterCountries( "RUSSIA" ):FilterCategories( "plane" ) + +-- Define the SPAWN object for the red AI plane template. +-- We use InitCleanUp to check every 20 seconds, if there are no planes blocked at the airbase, waithing for take-off. +-- If a blocked plane exists, this red plane will be ReSpawned. +local RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 ) + +-- Start the AI_BALANCER, using the SET of red CLIENTs, and the SPAWN object as a parameter. +local RU_AI_Balancer = AI_BALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn ) + +-- Create the first polygon zone ... +local PatrolZoneGroup1 = GROUP:FindByName( "PatrolZone1" ) +local PatrolZone1 = ZONE_POLYGON:New( "PatrolZone1", PatrolZoneGroup1 ) + +-- Create the second polygon zone ... +local PatrolZoneGroup2 = GROUP:FindByName( "PatrolZone2" ) +local PatrolZone2 = ZONE_POLYGON:New( "PatrolZone2", PatrolZoneGroup2 ) + +-- Now, create an array of these zones ... +local PatrolZoneArray = { PatrolZone1, PatrolZone2 } + +function RU_AI_Balancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup ) + + local Patrol = AI_PATROL_ZONE:New( PatrolZoneArray[math.random( 1, 2 )], 3000, 6000, 400, 600 ) + Patrol:ManageFuel( 0.2, 60 ) + Patrol:SetControllable( AIGroup ) + Patrol:Start() + +end diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/l10n/DEFAULT/Moose.lua b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/l10n/DEFAULT/Moose.lua new file mode 100644 index 000000000..8faec6fc4 --- /dev/null +++ b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/l10n/DEFAULT/Moose.lua @@ -0,0 +1,31 @@ +env.info( '*** MOOSE DYNAMIC INCLUDE START *** ' ) +env.info( 'Moose Generation Timestamp: 20170116_2116' ) + +local base = _G + +Include = {} + +Include.File = function( IncludeFile ) + if not Include.Files[ IncludeFile ] then + Include.Files[IncludeFile] = IncludeFile + env.info( "Include:" .. IncludeFile .. " from " .. Include.ProgramPath ) + local f = assert( base.loadfile( Include.ProgramPath .. IncludeFile .. ".lua" ) ) + if f == nil then + error ("Could not load MOOSE file " .. IncludeFile .. ".lua" ) + else + env.info( "Include:" .. IncludeFile .. " loaded from " .. Include.ProgramPath ) + return f() + end + end +end + +Include.ProgramPath = "Scripts/Moose/" + +env.info( "Include.ProgramPath = " .. Include.ProgramPath) + +Include.Files = {} + +Include.File( "Moose" ) + +BASE:TraceOnOff( true ) +env.info( '*** MOOSE INCLUDE END *** ' ) diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/l10n/DEFAULT/dictionary b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/l10n/DEFAULT/dictionary new file mode 100644 index 000000000..c29347756 --- /dev/null +++ b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/l10n/DEFAULT/dictionary @@ -0,0 +1,416 @@ +dictionary = +{ + ["DictKey_UnitName_89"] = "", + ["DictKey_UnitName_67"] = "AI US 1", + ["DictKey_UnitName_156"] = "RU Client #020", + ["DictKey_UnitName_297"] = "US Client #023", + ["DictKey_WptName_310"] = "", + ["DictKey_GroupName_125"] = "RU Client #010", + ["DictKey_UnitName_135"] = "RU Client #013", + ["DictKey_UnitName_374"] = "RU Client #004", + ["DictKey_WptName_292"] = "", + ["DictKey_WptName_48"] = "", + ["DictKey_GroupName_137"] = "RU Client #014", + ["DictKey_WptName_70"] = "", + ["DictKey_WptName_295"] = "", + ["DictKey_UnitName_25"] = "AI RU", + ["DictKey_GroupName_113"] = "RU Client #006", + ["DictKey_GroupName_284"] = "US Client #019", + ["DictKey_UnitName_312"] = "US Client #028", + ["DictKey_WptName_13"] = "", + ["DictKey_WptName_124"] = "", + ["DictKey_WptName_217"] = "", + ["DictKey_GroupName_10"] = "Client Group 2", + ["DictKey_GroupName_302"] = "US Client #025", + ["DictKey_UnitName_258"] = "US Client #010", + ["DictKey_WptName_181"] = "", + ["DictKey_WptName_109"] = "", + ["DictKey_WptName_336"] = "", + ["DictKey_GroupName_311"] = "US Client #028", + ["DictKey_GroupName_242"] = "US Client #005", + ["DictKey_UnitName_74"] = "Pilot #004", + ["DictKey_WptName_136"] = "", + ["DictKey_WptName_99"] = "", + ["DictKey_UnitName_315"] = "US Client #029", + ["DictKey_UnitName_43"] = "Client 5", + ["DictKey_GroupName_331"] = "PatrolZone2", + ["DictKey_WptName_178"] = "", + ["DictKey_GroupName_30"] = "AI RU", + ["DictKey_UnitName_249"] = "US Client #007", + ["DictKey_WptName_53"] = "", + ["DictKey_UnitName_171"] = "RU Client #025", + ["DictKey_WptName_289"] = "", + ["DictKey_GroupName_352"] = "RU Client #008", + ["DictKey_GroupName_260"] = "US Client #011", + ["DictKey_descriptionRedTask_2"] = "", + ["DictKey_WptName_55"] = "", + ["DictKey_GroupName_33"] = "AI RU", + ["DictKey_UnitName_183"] = "RU Client #029", + ["DictKey_WptName_190"] = "", + ["DictKey_UnitName_216"] = "RU Client #040", + ["DictKey_WptName_286"] = "", + ["DictKey_UnitName_153"] = "RU Client #019", + ["DictKey_WptName_75"] = "", + ["DictKey_UnitName_105"] = "RU Client #003", + ["DictKey_GroupName_382"] = "RU Client #007", + ["DictKey_UnitName_270"] = "US Client #014", + ["DictKey_WptName_47"] = "", + ["DictKey_GroupName_170"] = "RU Client #025", + ["DictKey_UnitName_46"] = "Client 7", + ["DictKey_WptName_92"] = "", + ["DictKey_UnitName_380"] = "RU Client #006", + ["DictKey_GroupName_191"] = "RU Client #032", + ["DictKey_UnitName_40"] = "Client 6", + ["DictKey_UnitName_95"] = "Pilot #002", + ["DictKey_GroupName_296"] = "US Client #023", + ["DictKey_WptName_244"] = "", + ["DictKey_UnitName_377"] = "RU Client #005", + ["DictKey_WptName_9"] = "", + ["DictKey_UnitName_11"] = "Client 2", + ["DictKey_GroupName_308"] = "US Client #027", + ["DictKey_GroupName_27"] = "AI RU", + ["DictKey_UnitName_22"] = "Client 4", + ["DictKey_WptName_62"] = "", + ["DictKey_GroupName_367"] = "RU Client #002", + ["DictKey_sortie_4"] = "", + ["DictKey_WptName_333"] = "", + ["DictKey_UnitName_356"] = "RU Client #009", + ["DictKey_GroupName_152"] = "RU Client #019", + ["DictKey_GroupName_281"] = "US Client #018", + ["DictKey_WptName_235"] = "", + ["DictKey_UnitName_362"] = "RU Client #011", + ["DictKey_WptName_375"] = "", + ["DictKey_GroupName_379"] = "RU Client #006", + ["DictKey_UnitName_267"] = "US Client #013", + ["DictKey_GroupName_173"] = "RU Client #026", + ["DictKey_GroupName_248"] = "US Client #007", + ["DictKey_WptName_369"] = "", + ["DictKey_UnitName_58"] = "Pilot #003", + ["DictKey_WptName_160"] = "", + ["DictKey_UnitName_246"] = "US Client #006", + ["DictKey_WptName_163"] = "", + ["DictKey_WptName_98"] = "", + ["DictKey_GroupName_340"] = "RU Client #004", + ["DictKey_UnitName_365"] = "RU Client #012", + ["DictKey_GroupName_221"] = "RU Client #042", + ["DictKey_UnitName_318"] = "US Client #030", + ["DictKey_GroupName_158"] = "RU Client #021", + ["DictKey_GroupName_320"] = "US Client #031", + ["DictKey_UnitName_34"] = "AI RU", + ["DictKey_WptName_208"] = "", + ["DictKey_WptName_334"] = "", + ["DictKey_WptName_54"] = "", + ["DictKey_WptName_82"] = "", + ["DictKey_UnitName_383"] = "RU Client #007", + ["DictKey_UnitName_234"] = "US Client #002", + ["DictKey_GroupName_104"] = "RU Client #003", + ["DictKey_UnitName_368"] = "RU Client #002", + ["DictKey_WptName_366"] = "", + ["DictKey_GroupName_206"] = "RU Client #037", + ["DictKey_GroupName_24"] = "AI RU", + ["DictKey_GroupName_325"] = "PatrolZone1", + ["DictKey_UnitName_225"] = "RU Client #043", + ["DictKey_WptName_328"] = "", + ["DictKey_WptName_193"] = "", + ["DictKey_UnitName_219"] = "RU Client #041", + ["DictKey_WptName_68"] = "", + ["DictKey_GroupName_122"] = "RU Client #009", + ["DictKey_GroupName_266"] = "US Client #013", + ["DictKey_UnitName_350"] = "RU Client #007", + ["DictKey_UnitName_341"] = "RU Client #004", + ["DictKey_UnitName_228"] = "RU Client #044", + ["DictKey_UnitName_204"] = "RU Client #036", + ["DictKey_WptName_49"] = "", + ["DictKey_UnitName_303"] = "US Client #025", + ["DictKey_GroupName_245"] = "US Client #006", + ["DictKey_GroupName_275"] = "US Client #016", + ["DictKey_WptName_90"] = "", + ["DictKey_UnitName_222"] = "RU Client #042", + ["DictKey_GroupName_110"] = "RU Client #005", + ["DictKey_UnitName_120"] = "RU Client #008", + ["DictKey_WptName_280"] = "", + ["DictKey_UnitName_144"] = "RU Client #016", + ["DictKey_UnitName_306"] = "US Client #026", + ["DictKey_WptName_118"] = "", + ["DictKey_WptName_307"] = "", + ["DictKey_UnitName_129"] = "RU Client #011", + ["DictKey_GroupName_59"] = "Client Group Range 1", + ["DictKey_GroupName_164"] = "RU Client #023", + ["DictKey_UnitName_252"] = "US Client #008", + ["DictKey_WptName_61"] = "", + ["DictKey_WptName_184"] = "", + ["DictKey_GroupName_361"] = "RU Client #011", + ["DictKey_WptName_80"] = "", + ["DictKey_GroupName_299"] = "US Client #024", + ["DictKey_GroupName_314"] = "US Client #029", + ["DictKey_WptName_86"] = "", + ["DictKey_GroupName_346"] = "RU Client #006", + ["DictKey_WptName_205"] = "", + ["DictKey_WptName_390"] = "", + ["DictKey_WptName_196"] = "", + ["DictKey_GroupName_263"] = "US Client #012", + ["DictKey_WptName_238"] = "", + ["DictKey_WptName_51"] = "", + ["DictKey_UnitName_150"] = "RU Client #018", + ["DictKey_WptName_76"] = "", + ["DictKey_UnitName_291"] = "US Client #021", + ["DictKey_WptName_127"] = "", + ["DictKey_GroupName_21"] = "Client Group 4", + ["DictKey_GroupName_364"] = "RU Client #012", + ["DictKey_GroupName_278"] = "US Client #017", + ["DictKey_WptName_44"] = "", + ["DictKey_WptName_335"] = "", + ["DictKey_WptName_100"] = "", + ["DictKey_GroupName_185"] = "RU Client #030", + ["DictKey_UnitName_321"] = "US Client #031", + ["DictKey_WptName_112"] = "", + ["DictKey_GroupName_230"] = "RU Client #045", + ["DictKey_UnitName_201"] = "RU Client #035", + ["DictKey_WptName_145"] = "", + ["DictKey_GroupName_128"] = "RU Client #011", + ["DictKey_descriptionBlueTask_3"] = "", + ["DictKey_WptName_241"] = "", + ["DictKey_descriptionText_1"] = "-- Name: AIB-005 - Patrol AI and Randomize Zones\ +-- Author: FlightControl\ +-- Date Created: 10 Jan 2016\ +--\ +-- # Situation:\ +--\ +-- For the red coalition, 2 client slots are foreseen.\ +-- For those players that have not joined the mission, red AI is spawned.\ +-- The red AI should start patrolling an area until fuel is empty and return to the home base.\ +-- For each AI being spawned, ensure that they fly to a random zone defined within the mission editor.\ +-- Right now there are two patrol zones defined, so the AI should start patrolliing in one of these zones.\ +-- \ +-- # Test cases:\ +-- \ +-- 1. If no player is logging into the red slots, 2 red AI planes should be alive.\ +-- 2. If a player joins one red slot, one red AI plane should return to the nearest home base.\ +-- 3. If two players join the red slots, no AI plane should be spawned, and all airborne AI planes should return to the nearest home base.\ +-- 4. Spawned AI should take-off from the airbase, and start patrolling the area around Anapa.\ +-- 5. When the AI is out-of-fuel, it should report it is returning to the home base, and land at Anapa.\ +-- 6. Ensure that you see the AI patrol in one of the two zones ...\ +", + ["DictKey_GroupName_134"] = "RU Client #013", + ["DictKey_UnitName_102"] = "RU Client #002", + ["DictKey_WptName_378"] = "", + ["DictKey_GroupName_224"] = "RU Client #043", + ["DictKey_UnitName_371"] = "RU Client #003", + ["DictKey_UnitName_392"] = "RU Client #010", + ["DictKey_UnitName_108"] = "RU Client #004", + ["DictKey_UnitName_132"] = "RU Client #012", + ["DictKey_UnitName_174"] = "RU Client #026", + ["DictKey_WptName_274"] = "", + ["DictKey_GroupName_176"] = "RU Client #027", + ["DictKey_WptName_339"] = "", + ["DictKey_WptName_199"] = "", + ["DictKey_UnitName_123"] = "RU Client #009", + ["DictKey_WptName_81"] = "", + ["DictKey_UnitName_213"] = "RU Client #039", + ["DictKey_WptName_211"] = "", + ["DictKey_GroupName_227"] = "RU Client #044", + ["DictKey_WptName_77"] = "", + ["DictKey_WptName_29"] = "", + ["DictKey_WptName_166"] = "", + ["DictKey_WptName_396"] = "", + ["DictKey_UnitName_168"] = "RU Client #024", + ["DictKey_UnitName_210"] = "RU Client #038", + ["DictKey_WptName_169"] = "", + ["DictKey_GroupName_7"] = "US Client #001", + ["DictKey_WptName_384"] = "", + ["DictKey_WptName_354"] = "", + ["DictKey_GroupName_143"] = "RU Client #016", + ["DictKey_UnitName_288"] = "US Client #020", + ["DictKey_GroupName_155"] = "RU Client #020", + ["DictKey_GroupName_236"] = "US Client #003", + ["DictKey_ActionText_17"] = "", + ["DictKey_WptName_157"] = "", + ["DictKey_UnitName_114"] = "RU Client #006", + ["DictKey_WptName_298"] = "", + ["DictKey_WptName_142"] = "", + ["DictKey_GroupName_254"] = "US Client #009", + ["DictKey_WptName_91"] = "", + ["DictKey_WptName_259"] = "", + ["DictKey_WptName_23"] = "", + ["DictKey_WptName_172"] = "", + ["DictKey_WptName_214"] = "", + ["DictKey_UnitName_264"] = "US Client #012", + ["DictKey_WptName_151"] = "", + ["DictKey_UnitName_15"] = "AI US 2", + ["DictKey_GroupName_45"] = "Client Group 7", + ["DictKey_WptName_71"] = "", + ["DictKey_WptName_26"] = "", + ["DictKey_UnitName_57"] = "Pilot #002", + ["DictKey_UnitName_31"] = "AI RU", + ["DictKey_UnitName_111"] = "RU Client #005", + ["DictKey_WptName_12"] = "", + ["DictKey_GroupName_39"] = "Client Group 6", + ["DictKey_WptName_52"] = "", + ["DictKey_UnitName_159"] = "RU Client #021", + ["DictKey_WptName_38"] = "", + ["DictKey_UnitName_138"] = "RU Client #014", + ["DictKey_WptName_330"] = "", + ["DictKey_UnitName_309"] = "US Client #027", + ["DictKey_WptName_85"] = "", + ["DictKey_GroupName_290"] = "US Client #021", + ["DictKey_GroupName_373"] = "RU Client #004", + ["DictKey_UnitName_240"] = "US Client #004", + ["DictKey_GroupName_358"] = "RU Client #010", + ["DictKey_WptName_247"] = "", + ["DictKey_WptName_223"] = "", + ["DictKey_WptName_324"] = "", + ["DictKey_GroupName_18"] = "RU Client #001", + ["DictKey_WptName_148"] = "", + ["DictKey_GroupName_349"] = "RU Client #007", + ["DictKey_GroupName_36"] = "AI RU", + ["DictKey_WptName_130"] = "", + ["DictKey_WptName_381"] = "", + ["DictKey_UnitName_180"] = "RU Client #028", + ["DictKey_UnitName_117"] = "RU Client #007", + ["DictKey_WptName_329"] = "", + ["DictKey_GroupName_73"] = "Patrol Zone Blue", + ["DictKey_WptName_121"] = "", + ["DictKey_WptName_78"] = "", + ["DictKey_UnitName_147"] = "RU Client #017", + ["DictKey_UnitName_56"] = "Pilot #001", + ["DictKey_GroupName_203"] = "RU Client #036", + ["DictKey_GroupName_337"] = "RU Client #003", + ["DictKey_WptName_304"] = "", + ["DictKey_WptName_103"] = "", + ["DictKey_WptName_265"] = "", + ["DictKey_GroupName_14"] = "AI US 2", + ["DictKey_UnitName_282"] = "US Client #018", + ["DictKey_WptName_357"] = "", + ["DictKey_WptName_175"] = "", + ["DictKey_WptName_327"] = "", + ["DictKey_WptName_342"] = "", + ["DictKey_WptName_154"] = "", + ["DictKey_GroupName_391"] = "RU Client #010", + ["DictKey_UnitName_359"] = "RU Client #010", + ["DictKey_GroupName_197"] = "RU Client #034", + ["DictKey_GroupName_42"] = "Client Group 5", + ["DictKey_WptName_283"] = "", + ["DictKey_GroupName_161"] = "RU Client #022", + ["DictKey_UnitName_19"] = "RU Client #001", + ["DictKey_UnitName_237"] = "US Client #003", + ["DictKey_WptName_65"] = "", + ["DictKey_WptName_372"] = "", + ["DictKey_WptName_322"] = "", + ["DictKey_WptName_97"] = "", + ["DictKey_WptName_360"] = "", + ["DictKey_GroupName_131"] = "RU Client #012", + ["DictKey_WptName_16"] = "", + ["DictKey_GroupName_101"] = "RU Client #002", + ["DictKey_WptName_202"] = "", + ["DictKey_UnitName_198"] = "RU Client #034", + ["DictKey_WptName_253"] = "", + ["DictKey_GroupName_394"] = "RU Client #011", + ["DictKey_WptName_32"] = "", + ["DictKey_UnitName_279"] = "US Client #017", + ["DictKey_GroupName_305"] = "US Client #026", + ["DictKey_UnitName_141"] = "RU Client #015", + ["DictKey_WptName_79"] = "", + ["DictKey_UnitName_207"] = "RU Client #037", + ["DictKey_WptName_250"] = "", + ["DictKey_GroupName_116"] = "RU Client #007", + ["DictKey_GroupName_94"] = "Patrol Zone Red", + ["DictKey_GroupName_212"] = "RU Client #039", + ["DictKey_GroupName_233"] = "US Client #002", + ["DictKey_GroupName_200"] = "RU Client #035", + ["DictKey_WptName_96"] = "", + ["DictKey_WptName_50"] = "", + ["DictKey_WptName_115"] = "", + ["DictKey_WptName_226"] = "", + ["DictKey_UnitName_126"] = "RU Client #010", + ["DictKey_UnitName_243"] = "US Client #005", + ["DictKey_WptName_316"] = "", + ["DictKey_WptName_69"] = "", + ["DictKey_UnitName_347"] = "RU Client #006", + ["DictKey_GroupName_209"] = "RU Client #038", + ["DictKey_UnitName_28"] = "AI RU", + ["DictKey_GroupName_215"] = "RU Client #040", + ["DictKey_WptName_64"] = "", + ["DictKey_UnitName_192"] = "RU Client #032", + ["DictKey_UnitName_338"] = "RU Client #003", + ["DictKey_GroupName_257"] = "US Client #010", + ["DictKey_GroupName_188"] = "RU Client #031", + ["DictKey_GroupName_107"] = "RU Client #004", + ["DictKey_UnitName_255"] = "US Client #009", + ["DictKey_UnitName_231"] = "RU Client #045", + ["DictKey_UnitName_88"] = "Pilot #001", + ["DictKey_WptName_232"] = "", + ["DictKey_UnitName_195"] = "RU Client #033", + ["DictKey_GroupName_370"] = "RU Client #003", + ["DictKey_WptName_229"] = "", + ["DictKey_WptName_256"] = "", + ["DictKey_WptName_345"] = "", + ["DictKey_WptName_277"] = "", + ["DictKey_WptName_63"] = "", + ["DictKey_WptName_363"] = "", + ["DictKey_GroupName_167"] = "RU Client #024", + ["DictKey_GroupName_385"] = "RU Client #008", + ["DictKey_GroupName_376"] = "RU Client #005", + ["DictKey_UnitName_60"] = "Client Range 1", + ["DictKey_UnitName_326"] = "Pilot #001", + ["DictKey_GroupName_388"] = "RU Client #009", + ["DictKey_GroupName_251"] = "US Client #008", + ["DictKey_WptName_41"] = "", + ["DictKey_UnitName_273"] = "US Client #015", + ["DictKey_GroupName_66"] = "AI US", + ["DictKey_WptName_87"] = "", + ["DictKey_GroupName_343"] = "RU Client #005", + ["DictKey_GroupName_119"] = "RU Client #008", + ["DictKey_WptName_268"] = "", + ["DictKey_WptName_220"] = "", + ["DictKey_WptName_262"] = "", + ["DictKey_WptName_83"] = "", + ["DictKey_WptName_72"] = "", + ["DictKey_UnitName_276"] = "US Client #016", + ["DictKey_WptName_387"] = "", + ["DictKey_GroupName_272"] = "US Client #015", + ["DictKey_WptName_187"] = "", + ["DictKey_UnitName_189"] = "RU Client #031", + ["DictKey_UnitName_162"] = "RU Client #022", + ["DictKey_GroupName_146"] = "RU Client #017", + ["DictKey_GroupName_140"] = "RU Client #015", + ["DictKey_GroupName_239"] = "US Client #004", + ["DictKey_UnitName_353"] = "RU Client #008", + ["DictKey_UnitName_386"] = "RU Client #008", + ["DictKey_WptName_351"] = "", + ["DictKey_WptName_313"] = "", + ["DictKey_UnitName_93"] = "Pilot #001", + ["DictKey_GroupName_287"] = "US Client #020", + ["DictKey_UnitName_395"] = "RU Client #011", + ["DictKey_UnitName_332"] = "Pilot #002", + ["DictKey_WptName_133"] = "", + ["DictKey_UnitName_186"] = "RU Client #030", + ["DictKey_GroupName_194"] = "RU Client #033", + ["DictKey_GroupName_179"] = "RU Client #028", + ["DictKey_GroupName_269"] = "US Client #014", + ["DictKey_WptName_20"] = "", + ["DictKey_WptName_348"] = "", + ["DictKey_WptName_301"] = "", + ["DictKey_UnitName_285"] = "US Client #019", + ["DictKey_UnitName_344"] = "RU Client #005", + ["DictKey_WptName_393"] = "", + ["DictKey_WptName_84"] = "", + ["DictKey_GroupName_355"] = "RU Client #009", + ["DictKey_UnitName_177"] = "RU Client #027", + ["DictKey_UnitName_37"] = "AI RU", + ["DictKey_WptName_319"] = "", + ["DictKey_WptName_106"] = "", + ["DictKey_UnitName_294"] = "US Client #022", + ["DictKey_UnitName_165"] = "RU Client #023", + ["DictKey_WptName_35"] = "", + ["DictKey_UnitName_261"] = "US Client #011", + ["DictKey_GroupName_293"] = "US Client #022", + ["DictKey_UnitName_389"] = "RU Client #009", + ["DictKey_GroupName_182"] = "RU Client #029", + ["DictKey_UnitName_300"] = "US Client #024", + ["DictKey_GroupName_317"] = "US Client #030", + ["DictKey_WptName_271"] = "", + ["DictKey_WptName_139"] = "", + ["DictKey_GroupName_149"] = "RU Client #018", + ["DictKey_GroupName_218"] = "RU Client #041", + ["DictKey_UnitName_8"] = "US Client #001", +} -- end of dictionary diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/l10n/DEFAULT/mapResource b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/l10n/DEFAULT/mapResource new file mode 100644 index 000000000..dc130cd07 --- /dev/null +++ b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/l10n/DEFAULT/mapResource @@ -0,0 +1,5 @@ +mapResource = +{ + ["ResKey_Action_323"] = "Moose.lua", + ["ResKey_Action_6"] = "AIB-005 - Patrol AI and Randomize Zones.lua", +} -- end of mapResource diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/mission b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/mission new file mode 100644 index 000000000..d243c5ada --- /dev/null +++ b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/mission @@ -0,0 +1,5000 @@ +mission = +{ + ["trig"] = + { + ["actions"] = + { + [1] = "a_do_script_file(getValueResourceByKey(\"ResKey_Action_323\"));", + [2] = "a_do_script(getValueDictByKey(\"DictKey_ActionText_17\"));", + [3] = "a_do_script_file(getValueResourceByKey(\"ResKey_Action_6\"));", + }, -- end of ["actions"] + ["events"] = + { + }, -- end of ["events"] + ["custom"] = + { + }, -- end of ["custom"] + ["func"] = + { + }, -- end of ["func"] + ["flag"] = + { + [1] = true, + [2] = true, + [3] = true, + }, -- end of ["flag"] + ["conditions"] = + { + [1] = "return(true)", + [2] = "return(true)", + [3] = "return(true)", + }, -- end of ["conditions"] + ["customStartup"] = + { + }, -- end of ["customStartup"] + ["funcStartup"] = + { + [1] = "if mission.trig.conditions[1]() then mission.trig.actions[1]() end", + [2] = "if mission.trig.conditions[2]() then mission.trig.actions[2]() end", + [3] = "if mission.trig.conditions[3]() then mission.trig.actions[3]() end", + }, -- end of ["funcStartup"] + }, -- end of ["trig"] + ["date"] = + { + ["Day"] = 1, + ["Year"] = 2011, + ["Month"] = 6, + }, -- end of ["date"] + ["maxDictId"] = 396, + ["result"] = + { + ["offline"] = + { + ["conditions"] = + { + }, -- end of ["conditions"] + ["actions"] = + { + }, -- end of ["actions"] + ["func"] = + { + }, -- end of ["func"] + }, -- end of ["offline"] + ["total"] = 0, + ["blue"] = + { + ["conditions"] = + { + }, -- end of ["conditions"] + ["actions"] = + { + }, -- end of ["actions"] + ["func"] = + { + }, -- end of ["func"] + }, -- end of ["blue"] + ["red"] = + { + ["conditions"] = + { + }, -- end of ["conditions"] + ["actions"] = + { + }, -- end of ["actions"] + ["func"] = + { + }, -- end of ["func"] + }, -- end of ["red"] + }, -- end of ["result"] + ["groundControl"] = + { + ["isPilotControlVehicles"] = false, + ["roles"] = + { + ["artillery_commander"] = + { + ["blue"] = 0, + ["red"] = 0, + }, -- end of ["artillery_commander"] + ["instructor"] = + { + ["blue"] = 0, + ["red"] = 0, + }, -- end of ["instructor"] + ["observer"] = + { + ["blue"] = 0, + ["red"] = 0, + }, -- end of ["observer"] + ["forward_observer"] = + { + ["blue"] = 0, + ["red"] = 0, + }, -- end of ["forward_observer"] + }, -- end of ["roles"] + }, -- end of ["groundControl"] + ["triggers"] = + { + ["zones"] = + { + }, -- end of ["zones"] + }, -- end of ["triggers"] + ["weather"] = + { + ["atmosphere_type"] = 0, + ["wind"] = + { + ["at8000"] = + { + ["speed"] = 0, + ["dir"] = 0, + }, -- end of ["at8000"] + ["atGround"] = + { + ["speed"] = 0, + ["dir"] = 0, + }, -- end of ["atGround"] + ["at2000"] = + { + ["speed"] = 0, + ["dir"] = 0, + }, -- end of ["at2000"] + }, -- end of ["wind"] + ["enable_fog"] = false, + ["season"] = + { + ["temperature"] = 20, + }, -- end of ["season"] + ["type_weather"] = 0, + ["qnh"] = 760, + ["cyclones"] = + { + }, -- end of ["cyclones"] + ["name"] = "Winter, clean sky", + ["fog"] = + { + ["thickness"] = 0, + ["visibility"] = 25, + ["density"] = 7, + }, -- end of ["fog"] + ["groundTurbulence"] = 0, + ["visibility"] = + { + ["distance"] = 80000, + }, -- end of ["visibility"] + ["clouds"] = + { + ["thickness"] = 200, + ["density"] = 0, + ["base"] = 300, + ["iprecptns"] = 0, + }, -- end of ["clouds"] + }, -- end of ["weather"] + ["theatre"] = "Caucasus", + ["needModules"] = + { + }, -- end of ["needModules"] + ["map"] = + { + ["centerY"] = 295177.98214286, + ["zoom"] = 25000, + ["centerX"] = -8598.8505859375, + }, -- end of ["map"] + ["coalitions"] = + { + ["blue"] = + { + [1] = 11, + [2] = 4, + [3] = 6, + [4] = 16, + [5] = 13, + [6] = 15, + [7] = 9, + [8] = 8, + [9] = 12, + [10] = 2, + [11] = 3, + [12] = 5, + [13] = 10, + [14] = 20, + [15] = 21, + [16] = 40, + [17] = 26, + [18] = 45, + [19] = 28, + }, -- end of ["blue"] + ["neutrals"] = + { + [1] = 7, + [2] = 17, + [3] = 22, + [4] = 23, + [5] = 25, + [6] = 29, + [7] = 30, + [8] = 31, + [9] = 32, + [10] = 33, + [11] = 35, + [12] = 36, + [13] = 39, + [14] = 41, + [15] = 42, + [16] = 44, + [17] = 46, + }, -- end of ["neutrals"] + ["red"] = + { + [1] = 0, + [2] = 1, + [3] = 18, + [4] = 19, + [5] = 37, + [6] = 24, + [7] = 27, + [8] = 43, + [9] = 47, + [10] = 34, + [11] = 38, + }, -- end of ["red"] + }, -- end of ["coalitions"] + ["descriptionText"] = "DictKey_descriptionText_1", + ["pictureFileNameR"] = + { + }, -- end of ["pictureFileNameR"] + ["descriptionBlueTask"] = "DictKey_descriptionBlueTask_3", + ["descriptionRedTask"] = "DictKey_descriptionRedTask_2", + ["pictureFileNameB"] = + { + }, -- end of ["pictureFileNameB"] + ["trigrules"] = + { + [1] = + { + ["rules"] = + { + }, -- end of ["rules"] + ["eventlist"] = "", + ["actions"] = + { + [1] = + { + ["file"] = "ResKey_Action_323", + ["predicate"] = "a_do_script_file", + ["ai_task"] = + { + [1] = "", + [2] = "", + }, -- end of ["ai_task"] + }, -- end of [1] + }, -- end of ["actions"] + ["predicate"] = "triggerStart", + ["comment"] = "Load Moose", + }, -- end of [1] + [2] = + { + ["rules"] = + { + }, -- end of ["rules"] + ["eventlist"] = "", + ["actions"] = + { + [1] = + { + ["KeyDict_text"] = "DictKey_ActionText_17", + ["text"] = "DictKey_ActionText_17", + ["predicate"] = "a_do_script", + ["ai_task"] = + { + [1] = "", + [2] = "", + }, -- end of ["ai_task"] + }, -- end of [1] + }, -- end of ["actions"] + ["predicate"] = "triggerStart", + ["comment"] = "Trace", + }, -- end of [2] + [3] = + { + ["rules"] = + { + }, -- end of ["rules"] + ["eventlist"] = "", + ["actions"] = + { + [1] = + { + ["file"] = "ResKey_Action_6", + ["predicate"] = "a_do_script_file", + ["ai_task"] = + { + [1] = "", + [2] = "", + }, -- end of ["ai_task"] + }, -- end of [1] + }, -- end of ["actions"] + ["predicate"] = "triggerStart", + ["comment"] = "Load Mission", + }, -- end of [3] + }, -- end of ["trigrules"] + ["coalition"] = + { + ["blue"] = + { + ["bullseye"] = + { + ["y"] = 617414, + ["x"] = -291014, + }, -- end of ["bullseye"] + ["nav_points"] = + { + }, -- end of ["nav_points"] + ["name"] = "blue", + ["country"] = + { + [1] = + { + ["id"] = 11, + ["name"] = "Belgium", + }, -- end of [1] + [2] = + { + ["id"] = 4, + ["name"] = "UK", + }, -- end of [2] + [3] = + { + ["id"] = 6, + ["name"] = "Germany", + }, -- end of [3] + [4] = + { + ["id"] = 16, + ["name"] = "Georgia", + }, -- end of [4] + [5] = + { + ["id"] = 13, + ["name"] = "Denmark", + }, -- end of [5] + [6] = + { + ["id"] = 15, + ["name"] = "Israel", + }, -- end of [6] + [7] = + { + ["id"] = 9, + ["name"] = "Spain", + }, -- end of [7] + [8] = + { + ["id"] = 8, + ["name"] = "Canada", + }, -- end of [8] + [9] = + { + ["id"] = 12, + ["name"] = "Norway", + }, -- end of [9] + [10] = + { + ["id"] = 2, + ["name"] = "USA", + }, -- end of [10] + [11] = + { + ["id"] = 3, + ["name"] = "Turkey", + }, -- end of [11] + [12] = + { + ["id"] = 5, + ["name"] = "France", + }, -- end of [12] + [13] = + { + ["id"] = 10, + ["name"] = "The Netherlands", + }, -- end of [13] + [14] = + { + ["id"] = 20, + ["name"] = "Italy", + }, -- end of [14] + [15] = + { + ["id"] = 21, + ["name"] = "Australia", + }, -- end of [15] + [16] = + { + ["id"] = 40, + ["name"] = "Poland", + }, -- end of [16] + [17] = + { + ["id"] = 26, + ["name"] = "Czech Republic", + }, -- end of [17] + [18] = + { + ["id"] = 45, + ["name"] = "South Korea", + }, -- end of [18] + [19] = + { + ["id"] = 28, + ["name"] = "Croatia", + }, -- end of [19] + }, -- end of ["country"] + }, -- end of ["blue"] + ["red"] = + { + ["bullseye"] = + { + ["y"] = 371700, + ["x"] = 11557, + }, -- end of ["bullseye"] + ["nav_points"] = + { + }, -- end of ["nav_points"] + ["name"] = "red", + ["country"] = + { + [1] = + { + ["helicopter"] = + { + ["group"] = + { + [1] = + { + ["lateActivation"] = true, + ["tasks"] = + { + }, -- end of ["tasks"] + ["radioSet"] = false, + ["task"] = "CAS", + ["uncontrolled"] = false, + ["route"] = + { + ["routeRelativeTOT"] = true, + ["points"] = + { + [1] = + { + ["alt"] = 500, + ["action"] = "Turning Point", + ["alt_type"] = "BARO", + ["properties"] = + { + ["vnav"] = 1, + ["scale"] = 0, + ["angle"] = 0, + ["vangle"] = 0, + ["steer"] = 2, + }, -- end of ["properties"] + ["speed"] = 55.555555555556, + ["task"] = + { + ["id"] = "ComboTask", + ["params"] = + { + ["tasks"] = + { + [1] = + { + ["number"] = 1, + ["key"] = "CAS", + ["id"] = "EngageTargets", + ["enabled"] = true, + ["auto"] = true, + ["params"] = + { + ["targetTypes"] = + { + [1] = "Helicopters", + [2] = "Ground Units", + [3] = "Light armed ships", + }, -- end of ["targetTypes"] + ["priority"] = 0, + }, -- end of ["params"] + }, -- end of [1] + }, -- end of ["tasks"] + }, -- end of ["params"] + }, -- end of ["task"] + ["type"] = "Turning Point", + ["ETA"] = 0, + ["ETA_locked"] = true, + ["y"] = 325834.45982144, + ["x"] = 7740.8543526806, + ["name"] = "DictKey_WptName_327", + ["formation_template"] = "", + ["speed_locked"] = true, + }, -- end of [1] + [2] = + { + ["alt"] = 500, + ["action"] = "Turning Point", + ["alt_type"] = "BARO", + ["properties"] = + { + ["vnav"] = 1, + ["scale"] = 0, + ["angle"] = 0, + ["vangle"] = 0, + ["steer"] = 2, + }, -- end of ["properties"] + ["speed"] = 55.555555555556, + ["task"] = + { + ["id"] = "ComboTask", + ["params"] = + { + ["tasks"] = + { + }, -- end of ["tasks"] + }, -- end of ["params"] + }, -- end of ["task"] + ["type"] = "Turning Point", + ["ETA"] = 614.57680810556, + ["ETA_locked"] = false, + ["y"] = 325977.31696429, + ["x"] = 41883.711495538, + ["name"] = "DictKey_WptName_328", + ["formation_template"] = "", + ["speed_locked"] = true, + }, -- end of [2] + [3] = + { + ["alt"] = 500, + ["action"] = "Turning Point", + ["alt_type"] = "BARO", + ["properties"] = + { + ["vnav"] = 1, + ["scale"] = 0, + ["angle"] = 0, + ["vangle"] = 0, + ["steer"] = 2, + }, -- end of ["properties"] + ["speed"] = 55.555555555556, + ["task"] = + { + ["id"] = "ComboTask", + ["params"] = + { + ["tasks"] = + { + }, -- end of ["tasks"] + }, -- end of ["params"] + }, -- end of ["task"] + ["type"] = "Turning Point", + ["ETA"] = 903.60812481849, + ["ETA_locked"] = false, + ["y"] = 311263.03125001, + ["x"] = 48312.282924109, + ["name"] = "DictKey_WptName_329", + ["formation_template"] = "", + ["speed_locked"] = true, + }, -- end of [3] + [4] = + { + ["alt"] = 500, + ["action"] = "Turning Point", + ["alt_type"] = "BARO", + ["properties"] = + { + ["vnav"] = 1, + ["scale"] = 0, + ["angle"] = 0, + ["vangle"] = 0, + ["steer"] = 2, + }, -- end of ["properties"] + ["speed"] = 55.555555555556, + ["task"] = + { + ["id"] = "ComboTask", + ["params"] = + { + ["tasks"] = + { + }, -- end of ["tasks"] + }, -- end of ["params"] + }, -- end of ["task"] + ["type"] = "Turning Point", + ["ETA"] = 1667.3397263538, + ["ETA_locked"] = false, + ["y"] = 310977.31696429, + ["x"] = 5883.7114955378, + ["name"] = "DictKey_WptName_330", + ["formation_template"] = "", + ["speed_locked"] = true, + }, -- end of [4] + }, -- end of ["points"] + }, -- end of ["route"] + ["groupId"] = 19, + ["hidden"] = false, + ["units"] = + { + [1] = + { + ["alt"] = 500, + ["alt_type"] = "BARO", + ["livery_id"] = "Russia Standard Army", + ["skill"] = "High", + ["ropeLength"] = 15, + ["speed"] = 55.555555555556, + ["type"] = "Ka-50", + ["unitId"] = 24, + ["psi"] = -0.0041840760018655, + ["y"] = 325834.45982144, + ["x"] = 7740.8543526806, + ["name"] = "DictKey_UnitName_326", + ["payload"] = + { + ["pylons"] = + { + }, -- end of ["pylons"] + ["fuel"] = "1450", + ["flare"] = 128, + ["chaff"] = 0, + ["gun"] = 100, + }, -- end of ["payload"] + ["heading"] = 0.0041840760018655, + ["callsign"] = 105, + ["onboard_num"] = "050", + }, -- end of [1] + }, -- end of ["units"] + ["y"] = 325834.45982144, + ["x"] = 7740.8543526806, + ["name"] = "DictKey_GroupName_325", + ["communication"] = true, + ["start_time"] = 0, + ["modulation"] = 0, + ["frequency"] = 124, + }, -- end of [1] + [2] = + { + ["lateActivation"] = true, + ["tasks"] = + { + }, -- end of ["tasks"] + ["radioSet"] = false, + ["task"] = "CAS", + ["uncontrolled"] = false, + ["route"] = + { + ["routeRelativeTOT"] = true, + ["points"] = + { + [1] = + { + ["alt"] = 500, + ["action"] = "Turning Point", + ["alt_type"] = "BARO", + ["properties"] = + { + ["vnav"] = 1, + ["scale"] = 0, + ["angle"] = 0, + ["vangle"] = 0, + ["steer"] = 2, + }, -- end of ["properties"] + ["speed"] = 55.555555555556, + ["task"] = + { + ["id"] = "ComboTask", + ["params"] = + { + ["tasks"] = + { + [1] = + { + ["number"] = 1, + ["key"] = "CAS", + ["id"] = "EngageTargets", + ["enabled"] = true, + ["auto"] = true, + ["params"] = + { + ["targetTypes"] = + { + [1] = "Helicopters", + [2] = "Ground Units", + [3] = "Light armed ships", + }, -- end of ["targetTypes"] + ["priority"] = 0, + }, -- end of ["params"] + }, -- end of [1] + }, -- end of ["tasks"] + }, -- end of ["params"] + }, -- end of ["task"] + ["type"] = "Turning Point", + ["ETA"] = 0, + ["ETA_locked"] = true, + ["y"] = 323894.45982144, + ["x"] = -71460.574218749, + ["name"] = "DictKey_WptName_333", + ["formation_template"] = "", + ["speed_locked"] = true, + }, -- end of [1] + [2] = + { + ["alt"] = 500, + ["action"] = "Turning Point", + ["alt_type"] = "BARO", + ["properties"] = + { + ["vnav"] = 1, + ["scale"] = 0, + ["angle"] = 0, + ["vangle"] = 0, + ["steer"] = 2, + }, -- end of ["properties"] + ["speed"] = 55.555555555556, + ["task"] = + { + ["id"] = "ComboTask", + ["params"] = + { + ["tasks"] = + { + }, -- end of ["tasks"] + }, -- end of ["params"] + }, -- end of ["task"] + ["type"] = "Turning Point", + ["ETA"] = 829.44018494895, + ["ETA_locked"] = false, + ["y"] = 321608.74553573, + ["x"] = -7603.4313616057, + ["name"] = "DictKey_WptName_334", + ["formation_template"] = "", + ["speed_locked"] = true, + }, -- end of [2] + [3] = + { + ["alt"] = 500, + ["action"] = "Turning Point", + ["alt_type"] = "BARO", + ["properties"] = + { + ["vnav"] = 1, + ["scale"] = 0, + ["angle"] = 0, + ["vangle"] = 0, + ["steer"] = 2, + }, -- end of ["properties"] + ["speed"] = 55.555555555556, + ["task"] = + { + ["id"] = "ComboTask", + ["params"] = + { + ["tasks"] = + { + }, -- end of ["tasks"] + }, -- end of ["params"] + }, -- end of ["task"] + ["type"] = "Turning Point", + ["ETA"] = 581.44512129878, + ["ETA_locked"] = false, + ["y"] = 309465.88839287, + ["x"] = -8174.8599330343, + ["name"] = "DictKey_WptName_335", + ["formation_template"] = "", + ["speed_locked"] = true, + }, -- end of [3] + [4] = + { + ["alt"] = 500, + ["action"] = "Turning Point", + ["alt_type"] = "BARO", + ["properties"] = + { + ["vnav"] = 1, + ["scale"] = 0, + ["angle"] = 0, + ["vangle"] = 0, + ["steer"] = 2, + }, -- end of ["properties"] + ["speed"] = 55.555555555556, + ["task"] = + { + ["id"] = "ComboTask", + ["params"] = + { + ["tasks"] = + { + }, -- end of ["tasks"] + }, -- end of ["params"] + }, -- end of ["task"] + ["type"] = "Turning Point", + ["ETA"] = 2541.8313343196, + ["ETA_locked"] = false, + ["y"] = 310894.45982144, + ["x"] = -73317.717075891, + ["name"] = "DictKey_WptName_336", + ["formation_template"] = "", + ["speed_locked"] = true, + }, -- end of [4] + }, -- end of ["points"] + }, -- end of ["route"] + ["groupId"] = 20, + ["hidden"] = false, + ["units"] = + { + [1] = + { + ["alt"] = 500, + ["alt_type"] = "BARO", + ["livery_id"] = "Russia Standard Army", + ["skill"] = "High", + ["ropeLength"] = 15, + ["speed"] = 55.555555555556, + ["type"] = "Ka-50", + ["unitId"] = 25, + ["psi"] = 0.035778908402037, + ["y"] = 323894.45982144, + ["x"] = -71460.574218749, + ["name"] = "DictKey_UnitName_332", + ["payload"] = + { + ["pylons"] = + { + }, -- end of ["pylons"] + ["fuel"] = "1450", + ["flare"] = 128, + ["chaff"] = 0, + ["gun"] = 100, + }, -- end of ["payload"] + ["heading"] = -0.035778908402037, + ["callsign"] = 105, + ["onboard_num"] = "050", + }, -- end of [1] + }, -- end of ["units"] + ["y"] = 323894.45982144, + ["x"] = -71460.574218749, + ["name"] = "DictKey_GroupName_331", + ["communication"] = true, + ["start_time"] = 0, + ["modulation"] = 0, + ["frequency"] = 124, + }, -- end of [2] + }, -- end of ["group"] + }, -- end of ["helicopter"] + ["name"] = "Russia", + ["id"] = 0, + ["plane"] = + { + ["group"] = + { + [1] = + { + ["modulation"] = 0, + ["tasks"] = + { + }, -- end of ["tasks"] + ["radioSet"] = false, + ["task"] = "CAP", + ["uncontrolled"] = false, + ["route"] = + { + ["points"] = + { + [1] = + { + ["alt"] = 88, + ["action"] = "From Parking Area", + ["alt_type"] = "BARO", + ["properties"] = + { + ["vnav"] = 1, + ["scale"] = 0, + ["angle"] = 0, + ["vangle"] = 0, + ["steer"] = 2, + }, -- end of ["properties"] + ["speed"] = 138.88888888889, + ["task"] = + { + ["id"] = "ComboTask", + ["params"] = + { + ["tasks"] = + { + [1] = + { + ["enabled"] = true, + ["key"] = "CAP", + ["id"] = "EngageTargets", + ["number"] = 1, + ["auto"] = true, + ["params"] = + { + ["targetTypes"] = + { + [1] = "Air", + }, -- end of ["targetTypes"] + ["priority"] = 0, + }, -- end of ["params"] + }, -- end of [1] + }, -- end of ["tasks"] + }, -- end of ["params"] + }, -- end of ["task"] + ["type"] = "TakeOffParking", + ["ETA"] = 0, + ["ETA_locked"] = true, + ["y"] = 293785.125, + ["x"] = -7523.8505859375, + ["name"] = "DictKey_WptName_20", + ["formation_template"] = "", + ["airdromeId"] = 15, + ["speed_locked"] = true, + }, -- end of [1] + }, -- end of ["points"] + }, -- end of ["route"] + ["groupId"] = 4, + ["hidden"] = false, + ["units"] = + { + [1] = + { + ["alt"] = 88, + ["alt_type"] = "BARO", + ["livery_id"] = "Air Force Standard", + ["skill"] = "Client", + ["parking"] = 2, + ["speed"] = 138.88888888889, + ["type"] = "Su-27", + ["unitId"] = 4, + ["psi"] = 0, + ["parking_id"] = "04", + ["x"] = -7523.8505859375, + ["name"] = "DictKey_UnitName_19", + ["payload"] = + { + ["pylons"] = + { + }, -- end of ["pylons"] + ["fuel"] = 5217, + ["flare"] = 96, + ["chaff"] = 96, + ["gun"] = 100, + }, -- end of ["payload"] + ["y"] = 293785.125, + ["heading"] = 0, + ["callsign"] = 103, + ["onboard_num"] = "013", + }, -- end of [1] + }, -- end of ["units"] + ["y"] = 293785.125, + ["x"] = -7523.8505859375, + ["name"] = "DictKey_GroupName_18", + ["communication"] = true, + ["start_time"] = 0, + ["frequency"] = 127.5, + }, -- end of [1] + [2] = + { + ["lateActivation"] = true, + ["tasks"] = + { + }, -- end of ["tasks"] + ["radioSet"] = false, + ["task"] = "CAP", + ["uncontrolled"] = false, + ["route"] = + { + ["routeRelativeTOT"] = true, + ["points"] = + { + [1] = + { + ["alt"] = 88, + ["action"] = "From Parking Area Hot", + ["alt_type"] = "BARO", + ["properties"] = + { + ["vnav"] = 1, + ["scale"] = 0, + ["angle"] = 0, + ["vangle"] = 0, + ["steer"] = 2, + }, -- end of ["properties"] + ["speed"] = 250, + ["task"] = + { + ["id"] = "ComboTask", + ["params"] = + { + ["tasks"] = + { + }, -- end of ["tasks"] + }, -- end of ["params"] + }, -- end of ["task"] + ["type"] = "TakeOffParkingHot", + ["ETA"] = 0, + ["ETA_locked"] = true, + ["y"] = 294155.125, + ["x"] = -7498.103515625, + ["name"] = "DictKey_WptName_26", + ["formation_template"] = "", + ["airdromeId"] = 15, + ["speed_locked"] = true, + }, -- end of [1] + }, -- end of ["points"] + }, -- end of ["route"] + ["groupId"] = 6, + ["hidden"] = false, + ["units"] = + { + [1] = + { + ["alt"] = 88, + ["hardpoint_racks"] = true, + ["alt_type"] = "BARO", + ["livery_id"] = "`snow` test paint scheme", + ["skill"] = "High", + ["parking"] = 91, + ["speed"] = 250, + ["type"] = "Su-30", + ["unitId"] = 6, + ["psi"] = 1.7036072745551, + ["parking_id"] = "29", + ["x"] = -7498.103515625, + ["name"] = "DictKey_UnitName_25", + ["payload"] = + { + ["pylons"] = + { + [1] = + { + ["CLSID"] = "{44EE8698-89F9-48EE-AF36-5FD31896A82F}", + }, -- end of [1] + [2] = + { + ["CLSID"] = "{FBC29BFE-3D24-4C64-B81D-941239D12249}", + }, -- end of [2] + [3] = + { + ["CLSID"] = "{88DAC840-9F75-4531-8689-B46E64E42E53}", + }, -- end of [3] + [4] = + { + ["CLSID"] = "{B79C379A-9E87-4E50-A1EE-7F7E29C2E87A}", + }, -- end of [4] + [5] = + { + ["CLSID"] = "{E8069896-8435-4B90-95C0-01A03AE6E400}", + }, -- end of [5] + [6] = + { + ["CLSID"] = "{E8069896-8435-4B90-95C0-01A03AE6E400}", + }, -- end of [6] + [7] = + { + ["CLSID"] = "{B79C379A-9E87-4E50-A1EE-7F7E29C2E87A}", + }, -- end of [7] + [8] = + { + ["CLSID"] = "{88DAC840-9F75-4531-8689-B46E64E42E53}", + }, -- end of [8] + [9] = + { + ["CLSID"] = "{FBC29BFE-3D24-4C64-B81D-941239D12249}", + }, -- end of [9] + [10] = + { + ["CLSID"] = "{44EE8698-89F9-48EE-AF36-5FD31896A82A}", + }, -- end of [10] + }, -- end of ["pylons"] + ["fuel"] = "9400", + ["flare"] = 96, + ["chaff"] = 96, + ["gun"] = 100, + }, -- end of ["payload"] + ["y"] = 294155.125, + ["heading"] = 0, + ["callsign"] = 104, + ["onboard_num"] = "013", + }, -- end of [1] + }, -- end of ["units"] + ["y"] = 294155.125, + ["x"] = -7498.103515625, + ["name"] = "DictKey_GroupName_24", + ["communication"] = true, + ["start_time"] = 0, + ["modulation"] = 0, + ["frequency"] = 251, + }, -- end of [2] + [3] = + { + ["modulation"] = 0, + ["tasks"] = + { + }, -- end of ["tasks"] + ["radioSet"] = false, + ["task"] = "CAP", + ["uncontrolled"] = false, + ["route"] = + { + ["points"] = + { + [1] = + { + ["alt"] = 88, + ["action"] = "From Parking Area", + ["alt_type"] = "BARO", + ["properties"] = + { + ["vnav"] = 1, + ["scale"] = 0, + ["angle"] = 0, + ["vangle"] = 0, + ["steer"] = 2, + }, -- end of ["properties"] + ["speed"] = 138.88888888889, + ["task"] = + { + ["id"] = "ComboTask", + ["params"] = + { + ["tasks"] = + { + [1] = + { + ["enabled"] = true, + ["key"] = "CAP", + ["id"] = "EngageTargets", + ["number"] = 1, + ["auto"] = true, + ["params"] = + { + ["targetTypes"] = + { + [1] = "Air", + }, -- end of ["targetTypes"] + ["priority"] = 0, + }, -- end of ["params"] + }, -- end of [1] + }, -- end of ["tasks"] + }, -- end of ["params"] + }, -- end of ["task"] + ["type"] = "TakeOffParking", + ["ETA"] = 0, + ["ETA_locked"] = true, + ["y"] = 294994.1875, + ["x"] = -6702.66796875, + ["name"] = "DictKey_WptName_369", + ["formation_template"] = "", + ["airdromeId"] = 15, + ["speed_locked"] = true, + }, -- end of [1] + }, -- end of ["points"] + }, -- end of ["route"] + ["groupId"] = 21, + ["hidden"] = false, + ["units"] = + { + [1] = + { + ["alt"] = 88, + ["alt_type"] = "BARO", + ["livery_id"] = "Air Force Standard", + ["skill"] = "Client", + ["parking"] = "75", + ["speed"] = 138.88888888889, + ["type"] = "Su-27", + ["unitId"] = 26, + ["psi"] = 0, + ["parking_id"] = "44", + ["x"] = -6702.66796875, + ["name"] = "DictKey_UnitName_368", + ["payload"] = + { + ["pylons"] = + { + }, -- end of ["pylons"] + ["fuel"] = 5217, + ["flare"] = 96, + ["chaff"] = 96, + ["gun"] = 100, + }, -- end of ["payload"] + ["y"] = 294994.1875, + ["heading"] = 0, + ["callsign"] = 103, + ["onboard_num"] = "013", + }, -- end of [1] + }, -- end of ["units"] + ["y"] = 294994.1875, + ["x"] = -6702.66796875, + ["name"] = "DictKey_GroupName_367", + ["communication"] = true, + ["start_time"] = 0, + ["frequency"] = 127.5, + }, -- end of [3] + [4] = + { + ["modulation"] = 0, + ["tasks"] = + { + }, -- end of ["tasks"] + ["radioSet"] = false, + ["task"] = "CAP", + ["uncontrolled"] = false, + ["route"] = + { + ["points"] = + { + [1] = + { + ["alt"] = 88, + ["action"] = "From Parking Area", + ["alt_type"] = "BARO", + ["properties"] = + { + ["vnav"] = 1, + ["scale"] = 0, + ["angle"] = 0, + ["vangle"] = 0, + ["steer"] = 2, + }, -- end of ["properties"] + ["speed"] = 138.88888888889, + ["task"] = + { + ["id"] = "ComboTask", + ["params"] = + { + ["tasks"] = + { + [1] = + { + ["enabled"] = true, + ["key"] = "CAP", + ["id"] = "EngageTargets", + ["number"] = 1, + ["auto"] = true, + ["params"] = + { + ["targetTypes"] = + { + [1] = "Air", + }, -- end of ["targetTypes"] + ["priority"] = 0, + }, -- end of ["params"] + }, -- end of [1] + }, -- end of ["tasks"] + }, -- end of ["params"] + }, -- end of ["task"] + ["type"] = "TakeOffParking", + ["ETA"] = 0, + ["ETA_locked"] = true, + ["y"] = 295139.9375, + ["x"] = -6351.4077148438, + ["name"] = "DictKey_WptName_372", + ["formation_template"] = "", + ["airdromeId"] = 15, + ["speed_locked"] = true, + }, -- end of [1] + }, -- end of ["points"] + }, -- end of ["route"] + ["groupId"] = 22, + ["hidden"] = false, + ["units"] = + { + [1] = + { + ["alt"] = 88, + ["alt_type"] = "BARO", + ["livery_id"] = "Air Force Standard", + ["skill"] = "Client", + ["parking"] = "107", + ["speed"] = 138.88888888889, + ["type"] = "Su-27", + ["unitId"] = 27, + ["psi"] = 0, + ["parking_id"] = "48", + ["x"] = -6351.4077148438, + ["name"] = "DictKey_UnitName_371", + ["payload"] = + { + ["pylons"] = + { + }, -- end of ["pylons"] + ["fuel"] = 5217, + ["flare"] = 96, + ["chaff"] = 96, + ["gun"] = 100, + }, -- end of ["payload"] + ["y"] = 295139.9375, + ["heading"] = 0, + ["callsign"] = 103, + ["onboard_num"] = "013", + }, -- end of [1] + }, -- end of ["units"] + ["y"] = 295139.9375, + ["x"] = -6351.4077148438, + ["name"] = "DictKey_GroupName_370", + ["communication"] = true, + ["start_time"] = 0, + ["frequency"] = 127.5, + }, -- end of [4] + [5] = + { + ["modulation"] = 0, + ["tasks"] = + { + }, -- end of ["tasks"] + ["radioSet"] = false, + ["task"] = "CAP", + ["uncontrolled"] = false, + ["route"] = + { + ["points"] = + { + [1] = + { + ["alt"] = 88, + ["action"] = "From Parking Area", + ["alt_type"] = "BARO", + ["properties"] = + { + ["vnav"] = 1, + ["scale"] = 0, + ["angle"] = 0, + ["vangle"] = 0, + ["steer"] = 2, + }, -- end of ["properties"] + ["speed"] = 138.88888888889, + ["task"] = + { + ["id"] = "ComboTask", + ["params"] = + { + ["tasks"] = + { + [1] = + { + ["enabled"] = true, + ["key"] = "CAP", + ["id"] = "EngageTargets", + ["number"] = 1, + ["auto"] = true, + ["params"] = + { + ["targetTypes"] = + { + [1] = "Air", + }, -- end of ["targetTypes"] + ["priority"] = 0, + }, -- end of ["params"] + }, -- end of [1] + }, -- end of ["tasks"] + }, -- end of ["params"] + }, -- end of ["task"] + ["type"] = "TakeOffParking", + ["ETA"] = 0, + ["ETA_locked"] = true, + ["y"] = 295287.09375, + ["x"] = -6172.1333007813, + ["name"] = "DictKey_WptName_375", + ["formation_template"] = "", + ["airdromeId"] = 15, + ["speed_locked"] = true, + }, -- end of [1] + }, -- end of ["points"] + }, -- end of ["route"] + ["groupId"] = 23, + ["hidden"] = false, + ["units"] = + { + [1] = + { + ["alt"] = 88, + ["alt_type"] = "BARO", + ["livery_id"] = "Air Force Standard", + ["skill"] = "Client", + ["parking"] = "62", + ["speed"] = 138.88888888889, + ["type"] = "Su-27", + ["unitId"] = 28, + ["psi"] = 0, + ["parking_id"] = "51", + ["x"] = -6172.1333007813, + ["name"] = "DictKey_UnitName_374", + ["payload"] = + { + ["pylons"] = + { + }, -- end of ["pylons"] + ["fuel"] = 5217, + ["flare"] = 96, + ["chaff"] = 96, + ["gun"] = 100, + }, -- end of ["payload"] + ["y"] = 295287.09375, + ["heading"] = 0, + ["callsign"] = 103, + ["onboard_num"] = "013", + }, -- end of [1] + }, -- end of ["units"] + ["y"] = 295287.09375, + ["x"] = -6172.1333007813, + ["name"] = "DictKey_GroupName_373", + ["communication"] = true, + ["start_time"] = 0, + ["frequency"] = 127.5, + }, -- end of [5] + [6] = + { + ["modulation"] = 0, + ["tasks"] = + { + }, -- end of ["tasks"] + ["radioSet"] = false, + ["task"] = "CAP", + ["uncontrolled"] = false, + ["route"] = + { + ["points"] = + { + [1] = + { + ["alt"] = 88, + ["action"] = "From Parking Area", + ["alt_type"] = "BARO", + ["properties"] = + { + ["vnav"] = 1, + ["scale"] = 0, + ["angle"] = 0, + ["vangle"] = 0, + ["steer"] = 2, + }, -- end of ["properties"] + ["speed"] = 138.88888888889, + ["task"] = + { + ["id"] = "ComboTask", + ["params"] = + { + ["tasks"] = + { + [1] = + { + ["enabled"] = true, + ["key"] = "CAP", + ["id"] = "EngageTargets", + ["number"] = 1, + ["auto"] = true, + ["params"] = + { + ["targetTypes"] = + { + [1] = "Air", + }, -- end of ["targetTypes"] + ["priority"] = 0, + }, -- end of ["params"] + }, -- end of [1] + }, -- end of ["tasks"] + }, -- end of ["params"] + }, -- end of ["task"] + ["type"] = "TakeOffParking", + ["ETA"] = 0, + ["ETA_locked"] = true, + ["y"] = 295051.375, + ["x"] = -6629.2661132813, + ["name"] = "DictKey_WptName_378", + ["formation_template"] = "", + ["airdromeId"] = 15, + ["speed_locked"] = true, + }, -- end of [1] + }, -- end of ["points"] + }, -- end of ["route"] + ["groupId"] = 24, + ["hidden"] = false, + ["units"] = + { + [1] = + { + ["alt"] = 88, + ["alt_type"] = "BARO", + ["livery_id"] = "Air Force Standard", + ["skill"] = "Client", + ["parking"] = "76", + ["speed"] = 138.88888888889, + ["type"] = "Su-27", + ["unitId"] = 29, + ["psi"] = 0, + ["parking_id"] = "43", + ["x"] = -6629.2661132813, + ["name"] = "DictKey_UnitName_377", + ["payload"] = + { + ["pylons"] = + { + }, -- end of ["pylons"] + ["fuel"] = 5217, + ["flare"] = 96, + ["chaff"] = 96, + ["gun"] = 100, + }, -- end of ["payload"] + ["y"] = 295051.375, + ["heading"] = 0, + ["callsign"] = 103, + ["onboard_num"] = "013", + }, -- end of [1] + }, -- end of ["units"] + ["y"] = 295051.375, + ["x"] = -6629.2661132813, + ["name"] = "DictKey_GroupName_376", + ["communication"] = true, + ["start_time"] = 0, + ["frequency"] = 127.5, + }, -- end of [6] + [7] = + { + ["modulation"] = 0, + ["tasks"] = + { + }, -- end of ["tasks"] + ["radioSet"] = false, + ["task"] = "CAP", + ["uncontrolled"] = false, + ["route"] = + { + ["points"] = + { + [1] = + { + ["alt"] = 88, + ["action"] = "From Parking Area", + ["alt_type"] = "BARO", + ["properties"] = + { + ["vnav"] = 1, + ["scale"] = 0, + ["angle"] = 0, + ["vangle"] = 0, + ["steer"] = 2, + }, -- end of ["properties"] + ["speed"] = 138.88888888889, + ["task"] = + { + ["id"] = "ComboTask", + ["params"] = + { + ["tasks"] = + { + [1] = + { + ["enabled"] = true, + ["key"] = "CAP", + ["id"] = "EngageTargets", + ["number"] = 1, + ["auto"] = true, + ["params"] = + { + ["targetTypes"] = + { + [1] = "Air", + }, -- end of ["targetTypes"] + ["priority"] = 0, + }, -- end of ["params"] + }, -- end of [1] + }, -- end of ["tasks"] + }, -- end of ["params"] + }, -- end of ["task"] + ["type"] = "TakeOffParking", + ["ETA"] = 0, + ["ETA_locked"] = true, + ["y"] = 293769.75, + ["x"] = -7511.0883789063, + ["name"] = "DictKey_WptName_381", + ["formation_template"] = "", + ["airdromeId"] = 15, + ["speed_locked"] = true, + }, -- end of [1] + }, -- end of ["points"] + }, -- end of ["route"] + ["groupId"] = 25, + ["hidden"] = false, + ["units"] = + { + [1] = + { + ["alt"] = 88, + ["alt_type"] = "BARO", + ["livery_id"] = "Air Force Standard", + ["skill"] = "Client", + ["parking"] = "6", + ["speed"] = 138.88888888889, + ["type"] = "Su-27", + ["unitId"] = 30, + ["psi"] = 0, + ["parking_id"] = "03", + ["x"] = -7511.0883789063, + ["name"] = "DictKey_UnitName_380", + ["payload"] = + { + ["pylons"] = + { + }, -- end of ["pylons"] + ["fuel"] = 5217, + ["flare"] = 96, + ["chaff"] = 96, + ["gun"] = 100, + }, -- end of ["payload"] + ["y"] = 293769.75, + ["heading"] = 0, + ["callsign"] = 103, + ["onboard_num"] = "013", + }, -- end of [1] + }, -- end of ["units"] + ["y"] = 293769.75, + ["x"] = -7511.0883789063, + ["name"] = "DictKey_GroupName_379", + ["communication"] = true, + ["start_time"] = 0, + ["frequency"] = 127.5, + }, -- end of [7] + [8] = + { + ["modulation"] = 0, + ["tasks"] = + { + }, -- end of ["tasks"] + ["radioSet"] = false, + ["task"] = "CAP", + ["uncontrolled"] = false, + ["route"] = + { + ["points"] = + { + [1] = + { + ["alt"] = 88, + ["action"] = "From Parking Area", + ["alt_type"] = "BARO", + ["properties"] = + { + ["vnav"] = 1, + ["scale"] = 0, + ["angle"] = 0, + ["vangle"] = 0, + ["steer"] = 2, + }, -- end of ["properties"] + ["speed"] = 138.88888888889, + ["task"] = + { + ["id"] = "ComboTask", + ["params"] = + { + ["tasks"] = + { + [1] = + { + ["enabled"] = true, + ["key"] = "CAP", + ["id"] = "EngageTargets", + ["number"] = 1, + ["auto"] = true, + ["params"] = + { + ["targetTypes"] = + { + [1] = "Air", + }, -- end of ["targetTypes"] + ["priority"] = 0, + }, -- end of ["params"] + }, -- end of [1] + }, -- end of ["tasks"] + }, -- end of ["params"] + }, -- end of ["task"] + ["type"] = "TakeOffParking", + ["ETA"] = 0, + ["ETA_locked"] = true, + ["y"] = 295124.0625, + ["x"] = -6280.3999023438, + ["name"] = "DictKey_WptName_384", + ["formation_template"] = "", + ["airdromeId"] = 15, + ["speed_locked"] = true, + }, -- end of [1] + }, -- end of ["points"] + }, -- end of ["route"] + ["groupId"] = 26, + ["hidden"] = false, + ["units"] = + { + [1] = + { + ["alt"] = 88, + ["alt_type"] = "BARO", + ["livery_id"] = "Air Force Standard", + ["skill"] = "Client", + ["parking"] = "108", + ["speed"] = 138.88888888889, + ["type"] = "Su-27", + ["unitId"] = 31, + ["psi"] = 0, + ["parking_id"] = "49", + ["x"] = -6280.3999023438, + ["name"] = "DictKey_UnitName_383", + ["payload"] = + { + ["pylons"] = + { + }, -- end of ["pylons"] + ["fuel"] = 5217, + ["flare"] = 96, + ["chaff"] = 96, + ["gun"] = 100, + }, -- end of ["payload"] + ["y"] = 295124.0625, + ["heading"] = 0, + ["callsign"] = 103, + ["onboard_num"] = "013", + }, -- end of [1] + }, -- end of ["units"] + ["y"] = 295124.0625, + ["x"] = -6280.3999023438, + ["name"] = "DictKey_GroupName_382", + ["communication"] = true, + ["start_time"] = 0, + ["frequency"] = 127.5, + }, -- end of [8] + [9] = + { + ["modulation"] = 0, + ["tasks"] = + { + }, -- end of ["tasks"] + ["radioSet"] = false, + ["task"] = "CAP", + ["uncontrolled"] = false, + ["route"] = + { + ["points"] = + { + [1] = + { + ["alt"] = 88, + ["action"] = "From Parking Area", + ["alt_type"] = "BARO", + ["properties"] = + { + ["vnav"] = 1, + ["scale"] = 0, + ["angle"] = 0, + ["vangle"] = 0, + ["steer"] = 2, + }, -- end of ["properties"] + ["speed"] = 138.88888888889, + ["task"] = + { + ["id"] = "ComboTask", + ["params"] = + { + ["tasks"] = + { + [1] = + { + ["enabled"] = true, + ["key"] = "CAP", + ["id"] = "EngageTargets", + ["number"] = 1, + ["auto"] = true, + ["params"] = + { + ["targetTypes"] = + { + [1] = "Air", + }, -- end of ["targetTypes"] + ["priority"] = 0, + }, -- end of ["params"] + }, -- end of [1] + }, -- end of ["tasks"] + }, -- end of ["params"] + }, -- end of ["task"] + ["type"] = "TakeOffParking", + ["ETA"] = 0, + ["ETA_locked"] = true, + ["y"] = 293890.4375, + ["x"] = -7713.9541015625, + ["name"] = "DictKey_WptName_387", + ["formation_template"] = "", + ["airdromeId"] = 15, + ["speed_locked"] = true, + }, -- end of [1] + }, -- end of ["points"] + }, -- end of ["route"] + ["groupId"] = 27, + ["hidden"] = false, + ["units"] = + { + [1] = + { + ["alt"] = 88, + ["alt_type"] = "BARO", + ["livery_id"] = "Air Force Standard", + ["skill"] = "Client", + ["parking"] = "124", + ["speed"] = 138.88888888889, + ["type"] = "Su-27", + ["unitId"] = 32, + ["psi"] = 0, + ["parking_id"] = "09", + ["x"] = -7713.9541015625, + ["name"] = "DictKey_UnitName_386", + ["payload"] = + { + ["pylons"] = + { + }, -- end of ["pylons"] + ["fuel"] = 5217, + ["flare"] = 96, + ["chaff"] = 96, + ["gun"] = 100, + }, -- end of ["payload"] + ["y"] = 293890.4375, + ["heading"] = 0, + ["callsign"] = 103, + ["onboard_num"] = "013", + }, -- end of [1] + }, -- end of ["units"] + ["y"] = 293890.4375, + ["x"] = -7713.9541015625, + ["name"] = "DictKey_GroupName_385", + ["communication"] = true, + ["start_time"] = 0, + ["frequency"] = 127.5, + }, -- end of [9] + [10] = + { + ["modulation"] = 0, + ["tasks"] = + { + }, -- end of ["tasks"] + ["radioSet"] = false, + ["task"] = "CAP", + ["uncontrolled"] = false, + ["route"] = + { + ["points"] = + { + [1] = + { + ["alt"] = 88, + ["action"] = "From Parking Area", + ["alt_type"] = "BARO", + ["properties"] = + { + ["vnav"] = 1, + ["scale"] = 0, + ["angle"] = 0, + ["vangle"] = 0, + ["steer"] = 2, + }, -- end of ["properties"] + ["speed"] = 138.88888888889, + ["task"] = + { + ["id"] = "ComboTask", + ["params"] = + { + ["tasks"] = + { + [1] = + { + ["enabled"] = true, + ["key"] = "CAP", + ["id"] = "EngageTargets", + ["number"] = 1, + ["auto"] = true, + ["params"] = + { + ["targetTypes"] = + { + [1] = "Air", + }, -- end of ["targetTypes"] + ["priority"] = 0, + }, -- end of ["params"] + }, -- end of [1] + }, -- end of ["tasks"] + }, -- end of ["params"] + }, -- end of ["task"] + ["type"] = "TakeOffParking", + ["ETA"] = 0, + ["ETA_locked"] = true, + ["y"] = 295106.59375, + ["x"] = -6693.9848632813, + ["name"] = "DictKey_WptName_390", + ["formation_template"] = "", + ["airdromeId"] = 15, + ["speed_locked"] = true, + }, -- end of [1] + }, -- end of ["points"] + }, -- end of ["route"] + ["groupId"] = 28, + ["hidden"] = false, + ["units"] = + { + [1] = + { + ["alt"] = 88, + ["alt_type"] = "BARO", + ["livery_id"] = "Air Force Standard", + ["skill"] = "Client", + ["parking"] = "77", + ["speed"] = 138.88888888889, + ["type"] = "Su-27", + ["unitId"] = 33, + ["psi"] = 0, + ["parking_id"] = "42", + ["x"] = -6693.9848632813, + ["name"] = "DictKey_UnitName_389", + ["payload"] = + { + ["pylons"] = + { + }, -- end of ["pylons"] + ["fuel"] = 5217, + ["flare"] = 96, + ["chaff"] = 96, + ["gun"] = 100, + }, -- end of ["payload"] + ["y"] = 295106.59375, + ["heading"] = 0, + ["callsign"] = 103, + ["onboard_num"] = "013", + }, -- end of [1] + }, -- end of ["units"] + ["y"] = 295106.59375, + ["x"] = -6693.9848632813, + ["name"] = "DictKey_GroupName_388", + ["communication"] = true, + ["start_time"] = 0, + ["frequency"] = 127.5, + }, -- end of [10] + [11] = + { + ["modulation"] = 0, + ["tasks"] = + { + }, -- end of ["tasks"] + ["radioSet"] = false, + ["task"] = "CAP", + ["uncontrolled"] = false, + ["route"] = + { + ["points"] = + { + [1] = + { + ["alt"] = 88, + ["action"] = "From Parking Area", + ["alt_type"] = "BARO", + ["properties"] = + { + ["vnav"] = 1, + ["scale"] = 0, + ["angle"] = 0, + ["vangle"] = 0, + ["steer"] = 2, + }, -- end of ["properties"] + ["speed"] = 138.88888888889, + ["task"] = + { + ["id"] = "ComboTask", + ["params"] = + { + ["tasks"] = + { + [1] = + { + ["enabled"] = true, + ["key"] = "CAP", + ["id"] = "EngageTargets", + ["number"] = 1, + ["auto"] = true, + ["params"] = + { + ["targetTypes"] = + { + [1] = "Air", + }, -- end of ["targetTypes"] + ["priority"] = 0, + }, -- end of ["params"] + }, -- end of [1] + }, -- end of ["tasks"] + }, -- end of ["params"] + }, -- end of ["task"] + ["type"] = "TakeOffParking", + ["ETA"] = 0, + ["ETA_locked"] = true, + ["y"] = 293815.90625, + ["x"] = -7549.3779296875, + ["name"] = "DictKey_WptName_393", + ["formation_template"] = "", + ["airdromeId"] = 15, + ["speed_locked"] = true, + }, -- end of [1] + }, -- end of ["points"] + }, -- end of ["route"] + ["groupId"] = 29, + ["hidden"] = false, + ["units"] = + { + [1] = + { + ["alt"] = 88, + ["alt_type"] = "BARO", + ["livery_id"] = "Air Force Standard", + ["skill"] = "Client", + ["parking"] = "12", + ["speed"] = 138.88888888889, + ["type"] = "Su-27", + ["unitId"] = 34, + ["psi"] = 0, + ["parking_id"] = "06", + ["x"] = -7549.3779296875, + ["name"] = "DictKey_UnitName_392", + ["payload"] = + { + ["pylons"] = + { + }, -- end of ["pylons"] + ["fuel"] = 5217, + ["flare"] = 96, + ["chaff"] = 96, + ["gun"] = 100, + }, -- end of ["payload"] + ["y"] = 293815.90625, + ["heading"] = 0, + ["callsign"] = 103, + ["onboard_num"] = "013", + }, -- end of [1] + }, -- end of ["units"] + ["y"] = 293815.90625, + ["x"] = -7549.3779296875, + ["name"] = "DictKey_GroupName_391", + ["communication"] = true, + ["start_time"] = 0, + ["frequency"] = 127.5, + }, -- end of [11] + [12] = + { + ["modulation"] = 0, + ["tasks"] = + { + }, -- end of ["tasks"] + ["radioSet"] = false, + ["task"] = "CAP", + ["uncontrolled"] = false, + ["route"] = + { + ["points"] = + { + [1] = + { + ["alt"] = 88, + ["action"] = "From Parking Area", + ["alt_type"] = "BARO", + ["properties"] = + { + ["vnav"] = 1, + ["scale"] = 0, + ["angle"] = 0, + ["vangle"] = 0, + ["steer"] = 2, + }, -- end of ["properties"] + ["speed"] = 138.88888888889, + ["task"] = + { + ["id"] = "ComboTask", + ["params"] = + { + ["tasks"] = + { + [1] = + { + ["enabled"] = true, + ["key"] = "CAP", + ["id"] = "EngageTargets", + ["number"] = 1, + ["auto"] = true, + ["params"] = + { + ["targetTypes"] = + { + [1] = "Air", + }, -- end of ["targetTypes"] + ["priority"] = 0, + }, -- end of ["params"] + }, -- end of [1] + }, -- end of ["tasks"] + }, -- end of ["params"] + }, -- end of ["task"] + ["type"] = "TakeOffParking", + ["ETA"] = 0, + ["ETA_locked"] = true, + ["y"] = 293831.25, + ["x"] = -7562.1723632813, + ["name"] = "DictKey_WptName_396", + ["formation_template"] = "", + ["airdromeId"] = 15, + ["speed_locked"] = true, + }, -- end of [1] + }, -- end of ["points"] + }, -- end of ["route"] + ["groupId"] = 30, + ["hidden"] = false, + ["units"] = + { + [1] = + { + ["alt"] = 88, + ["alt_type"] = "BARO", + ["livery_id"] = "Air Force Standard", + ["skill"] = "Client", + ["parking"] = "14", + ["speed"] = 138.88888888889, + ["type"] = "Su-27", + ["unitId"] = 35, + ["psi"] = 0, + ["parking_id"] = "07", + ["x"] = -7562.1723632813, + ["name"] = "DictKey_UnitName_395", + ["payload"] = + { + ["pylons"] = + { + }, -- end of ["pylons"] + ["fuel"] = 5217, + ["flare"] = 96, + ["chaff"] = 96, + ["gun"] = 100, + }, -- end of ["payload"] + ["y"] = 293831.25, + ["heading"] = 0, + ["callsign"] = 103, + ["onboard_num"] = "013", + }, -- end of [1] + }, -- end of ["units"] + ["y"] = 293831.25, + ["x"] = -7562.1723632813, + ["name"] = "DictKey_GroupName_394", + ["communication"] = true, + ["start_time"] = 0, + ["frequency"] = 127.5, + }, -- end of [12] + }, -- end of ["group"] + }, -- end of ["plane"] + }, -- end of [1] + [2] = + { + ["id"] = 1, + ["name"] = "Ukraine", + }, -- end of [2] + [3] = + { + ["id"] = 18, + ["name"] = "Abkhazia", + }, -- end of [3] + [4] = + { + ["id"] = 19, + ["name"] = "South Ossetia", + }, -- end of [4] + [5] = + { + ["id"] = 37, + ["name"] = "Kazakhstan", + }, -- end of [5] + [6] = + { + ["id"] = 24, + ["name"] = "Belarus", + }, -- end of [6] + [7] = + { + ["id"] = 27, + ["name"] = "China", + }, -- end of [7] + [8] = + { + ["id"] = 43, + ["name"] = "Serbia", + }, -- end of [8] + [9] = + { + ["id"] = 47, + ["name"] = "Syria", + }, -- end of [9] + [10] = + { + ["id"] = 34, + ["name"] = "Iran", + }, -- end of [10] + [11] = + { + ["id"] = 38, + ["name"] = "North Korea", + }, -- end of [11] + }, -- end of ["country"] + }, -- end of ["red"] + }, -- end of ["coalition"] + ["sortie"] = "DictKey_sortie_4", + ["version"] = 12, + ["goals"] = + { + }, -- end of ["goals"] + ["currentKey"] = 12213, + ["start_time"] = 43200, + ["forcedOptions"] = + { + }, -- end of ["forcedOptions"] + ["failures"] = + { + ["OIL_RADIATOR_SENSOR"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "OIL_RADIATOR_SENSOR", + ["mm"] = 0, + }, -- end of ["OIL_RADIATOR_SENSOR"] + ["TURNIND_POINTER_FAILS_NO_VACUUM"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "TURNIND_POINTER_FAILS_NO_VACUUM", + ["mm"] = 0, + }, -- end of ["TURNIND_POINTER_FAILS_NO_VACUUM"] + ["helmet"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "helmet", + ["mm"] = 0, + }, -- end of ["helmet"] + ["GUN_LEFT_IN_MOUNT_LOOSE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GUN_LEFT_IN_MOUNT_LOOSE", + ["mm"] = 0, + }, -- end of ["GUN_LEFT_IN_MOUNT_LOOSE"] + ["es_damage_MainInverter"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "es_damage_MainInverter", + ["mm"] = 0, + }, -- end of ["es_damage_MainInverter"] + ["rws"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "rws", + ["mm"] = 0, + }, -- end of ["rws"] + ["AN_ALR69V_FAILURE_SENSOR_TAIL_RIGHT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "AN_ALR69V_FAILURE_SENSOR_TAIL_RIGHT", + ["mm"] = 0, + }, -- end of ["AN_ALR69V_FAILURE_SENSOR_TAIL_RIGHT"] + ["MainReductor_ShaveInOil"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "MainReductor_ShaveInOil", + ["mm"] = 0, + }, -- end of ["MainReductor_ShaveInOil"] + ["asc_y"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "asc_y", + ["mm"] = 0, + }, -- end of ["asc_y"] + ["MAIN_L_GEAR_D_LOCK"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "MAIN_L_GEAR_D_LOCK", + ["mm"] = 0, + }, -- end of ["MAIN_L_GEAR_D_LOCK"] + ["AAR_47_FAILURE_SENSOR_LEFT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "AAR_47_FAILURE_SENSOR_LEFT", + ["mm"] = 0, + }, -- end of ["AAR_47_FAILURE_SENSOR_LEFT"] + ["tail_reductor_chip"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "tail_reductor_chip", + ["mm"] = 0, + }, -- end of ["tail_reductor_chip"] + ["TACAN_FAILURE_TOTAL"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "TACAN_FAILURE_TOTAL", + ["mm"] = 0, + }, -- end of ["TACAN_FAILURE_TOTAL"] + ["OIL_RADIATOR_MOTOR"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "OIL_RADIATOR_MOTOR", + ["mm"] = 0, + }, -- end of ["OIL_RADIATOR_MOTOR"] + ["SUPERCHARGER_WIRE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "SUPERCHARGER_WIRE", + ["mm"] = 0, + }, -- end of ["SUPERCHARGER_WIRE"] + ["CADC_FAILURE_TEMPERATURE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "CADC_FAILURE_TEMPERATURE", + ["mm"] = 0, + }, -- end of ["CADC_FAILURE_TEMPERATURE"] + ["FUSELAGE_TANK_LEAK"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "FUSELAGE_TANK_LEAK", + ["mm"] = 0, + }, -- end of ["FUSELAGE_TANK_LEAK"] + ["AN_ALE_40V_FAILURE_TOTAL"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "AN_ALE_40V_FAILURE_TOTAL", + ["mm"] = 0, + }, -- end of ["AN_ALE_40V_FAILURE_TOTAL"] + ["HORIZON_BAR_NOT_SETTLE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "HORIZON_BAR_NOT_SETTLE", + ["mm"] = 0, + }, -- end of ["HORIZON_BAR_NOT_SETTLE"] + ["AN_ALE_40V_FAILURE_CONTAINER_LEFT_WING"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "AN_ALE_40V_FAILURE_CONTAINER_LEFT_WING", + ["mm"] = 0, + }, -- end of ["AN_ALE_40V_FAILURE_CONTAINER_LEFT_WING"] + ["OIL_DILUTION_WIRE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "OIL_DILUTION_WIRE", + ["mm"] = 0, + }, -- end of ["OIL_DILUTION_WIRE"] + ["FLEX_S_BKP_LAMP_DEFECTIVE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "FLEX_S_BKP_LAMP_DEFECTIVE", + ["mm"] = 0, + }, -- end of ["FLEX_S_BKP_LAMP_DEFECTIVE"] + ["TAIL_GEAR_FAIL_GO_DOWN"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "TAIL_GEAR_FAIL_GO_DOWN", + ["mm"] = 0, + }, -- end of ["TAIL_GEAR_FAIL_GO_DOWN"] + ["GUN_FAIL_RIGHT_CENTER_GUN"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GUN_FAIL_RIGHT_CENTER_GUN", + ["mm"] = 0, + }, -- end of ["GUN_FAIL_RIGHT_CENTER_GUN"] + ["LeftEngine_ShaveInOil"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "LeftEngine_ShaveInOil", + ["mm"] = 0, + }, -- end of ["LeftEngine_ShaveInOil"] + ["MAIN_R_GEAR_D_LOCK"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "MAIN_R_GEAR_D_LOCK", + ["mm"] = 0, + }, -- end of ["MAIN_R_GEAR_D_LOCK"] + ["R_GEAR_DLK_FAULT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "R_GEAR_DLK_FAULT", + ["mm"] = 0, + }, -- end of ["R_GEAR_DLK_FAULT"] + ["GMC_GYRO_FAILURE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GMC_GYRO_FAILURE", + ["mm"] = 0, + }, -- end of ["GMC_GYRO_FAILURE"] + ["L_GEAR_DLK_FAULT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "L_GEAR_DLK_FAULT", + ["mm"] = 0, + }, -- end of ["L_GEAR_DLK_FAULT"] + ["K14_FIXED_LAMP_DEFECTIVE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "K14_FIXED_LAMP_DEFECTIVE", + ["mm"] = 0, + }, -- end of ["K14_FIXED_LAMP_DEFECTIVE"] + ["GUN_FAIL_LEFT_CENTER_GUN"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GUN_FAIL_LEFT_CENTER_GUN", + ["mm"] = 0, + }, -- end of ["GUN_FAIL_LEFT_CENTER_GUN"] + ["engine_droop_failure"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "engine_droop_failure", + ["mm"] = 0, + }, -- end of ["engine_droop_failure"] + ["IGNITION_TERM_CONNECT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "IGNITION_TERM_CONNECT", + ["mm"] = 0, + }, -- end of ["IGNITION_TERM_CONNECT"] + ["CADC_FAILURE_TOTAL"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "CADC_FAILURE_TOTAL", + ["mm"] = 0, + }, -- end of ["CADC_FAILURE_TOTAL"] + ["COOLANT_POOR_CONNTECT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "COOLANT_POOR_CONNTECT", + ["mm"] = 0, + }, -- end of ["COOLANT_POOR_CONNTECT"] + ["TURNIND_POINTER_FAILS_DEFECTIVE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "TURNIND_POINTER_FAILS_DEFECTIVE", + ["mm"] = 0, + }, -- end of ["TURNIND_POINTER_FAILS_DEFECTIVE"] + ["GUN_FAIL_RIGHT_OUT_GUN"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GUN_FAIL_RIGHT_OUT_GUN", + ["mm"] = 0, + }, -- end of ["GUN_FAIL_RIGHT_OUT_GUN"] + ["BOMBS_DAMAGE_LINKAGE_LEFT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "BOMBS_DAMAGE_LINKAGE_LEFT", + ["mm"] = 0, + }, -- end of ["BOMBS_DAMAGE_LINKAGE_LEFT"] + ["FUSELAGE_TANK_PUMP_FAULT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "FUSELAGE_TANK_PUMP_FAULT", + ["mm"] = 0, + }, -- end of ["FUSELAGE_TANK_PUMP_FAULT"] + ["hydro_main"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "hydro_main", + ["mm"] = 0, + }, -- end of ["hydro_main"] + ["CICU_FAILURE_TOTAL"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "CICU_FAILURE_TOTAL", + ["mm"] = 0, + }, -- end of ["CICU_FAILURE_TOTAL"] + ["GUN_LEFT_OUT_MOUNT_LOOSE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GUN_LEFT_OUT_MOUNT_LOOSE", + ["mm"] = 0, + }, -- end of ["GUN_LEFT_OUT_MOUNT_LOOSE"] + ["TAIL_GEAR_U_LOCK"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "TAIL_GEAR_U_LOCK", + ["mm"] = 0, + }, -- end of ["TAIL_GEAR_U_LOCK"] + ["RADAR_ALT_TOTAL_FAILURE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "RADAR_ALT_TOTAL_FAILURE", + ["mm"] = 0, + }, -- end of ["RADAR_ALT_TOTAL_FAILURE"] + ["GUN_RIGHT_CENTER_MOUNT_LOOSE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GUN_RIGHT_CENTER_MOUNT_LOOSE", + ["mm"] = 0, + }, -- end of ["GUN_RIGHT_CENTER_MOUNT_LOOSE"] + ["TAIL_GEAR_FAIL_GO_UP"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "TAIL_GEAR_FAIL_GO_UP", + ["mm"] = 0, + }, -- end of ["TAIL_GEAR_FAIL_GO_UP"] + ["asc_r"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "asc_r", + ["mm"] = 0, + }, -- end of ["asc_r"] + ["BOMBS_SOLENOID_FAULT_LEFT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "BOMBS_SOLENOID_FAULT_LEFT", + ["mm"] = 0, + }, -- end of ["BOMBS_SOLENOID_FAULT_LEFT"] + ["sas_yaw_left"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "sas_yaw_left", + ["mm"] = 0, + }, -- end of ["sas_yaw_left"] + ["BOMBS_ARMING_NO_VOLATAGE_LEFT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "BOMBS_ARMING_NO_VOLATAGE_LEFT", + ["mm"] = 0, + }, -- end of ["BOMBS_ARMING_NO_VOLATAGE_LEFT"] + ["PITOT_HEAT_ELEMENT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "PITOT_HEAT_ELEMENT", + ["mm"] = 0, + }, -- end of ["PITOT_HEAT_ELEMENT"] + ["ILS_FAILURE_ANT_LOCALIZER"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "ILS_FAILURE_ANT_LOCALIZER", + ["mm"] = 0, + }, -- end of ["ILS_FAILURE_ANT_LOCALIZER"] + ["AN_ALE_40V_FAILURE_CONTAINER_LEFT_GEAR"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "AN_ALE_40V_FAILURE_CONTAINER_LEFT_GEAR", + ["mm"] = 0, + }, -- end of ["AN_ALE_40V_FAILURE_CONTAINER_LEFT_GEAR"] + ["CARBAIR_SHORT_CIRCUIT_BLB"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "CARBAIR_SHORT_CIRCUIT_BLB", + ["mm"] = 0, + }, -- end of ["CARBAIR_SHORT_CIRCUIT_BLB"] + ["LEFT_TANK_PUMP_FAULT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "LEFT_TANK_PUMP_FAULT", + ["mm"] = 0, + }, -- end of ["LEFT_TANK_PUMP_FAULT"] + ["Surge_RightEngine"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "Surge_RightEngine", + ["mm"] = 0, + }, -- end of ["Surge_RightEngine"] + ["RightEngine_Fire"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["mm"] = 0, + }, -- end of ["RightEngine_Fire"] + ["GUN_FAIL_LEFT_IN_GUN"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GUN_FAIL_LEFT_IN_GUN", + ["mm"] = 0, + }, -- end of ["GUN_FAIL_LEFT_IN_GUN"] + ["CADC_FAILURE_TAS"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "CADC_FAILURE_TAS", + ["mm"] = 0, + }, -- end of ["CADC_FAILURE_TAS"] + ["STARTER_SOL_SHORT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "STARTER_SOL_SHORT", + ["mm"] = 0, + }, -- end of ["STARTER_SOL_SHORT"] + ["asc_p"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "asc_p", + ["mm"] = 0, + }, -- end of ["asc_p"] + ["COOLANT_SHORT_CIRCUIT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "COOLANT_SHORT_CIRCUIT", + ["mm"] = 0, + }, -- end of ["COOLANT_SHORT_CIRCUIT"] + ["GUN_LEFT_IN_AMMUN_FAULT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GUN_LEFT_IN_AMMUN_FAULT", + ["mm"] = 0, + }, -- end of ["GUN_LEFT_IN_AMMUN_FAULT"] + ["PUMP_RELIEF_VALVE_SCREEN_CLOGGED"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "PUMP_RELIEF_VALVE_SCREEN_CLOGGED", + ["mm"] = 0, + }, -- end of ["PUMP_RELIEF_VALVE_SCREEN_CLOGGED"] + ["abris_hardware"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "abris_hardware", + ["mm"] = 0, + }, -- end of ["abris_hardware"] + ["EEC_Failure_LeftEngine"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "EEC_Failure_LeftEngine", + ["mm"] = 0, + }, -- end of ["EEC_Failure_LeftEngine"] + ["COMPASS_POINTER_PULLS"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "COMPASS_POINTER_PULLS", + ["mm"] = 0, + }, -- end of ["COMPASS_POINTER_PULLS"] + ["GUN_RIGHT_OUT_OPEN_CIRCUIT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GUN_RIGHT_OUT_OPEN_CIRCUIT", + ["mm"] = 0, + }, -- end of ["GUN_RIGHT_OUT_OPEN_CIRCUIT"] + ["VHF_SHORTED_CTL_BOX"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "VHF_SHORTED_CTL_BOX", + ["mm"] = 0, + }, -- end of ["VHF_SHORTED_CTL_BOX"] + ["CLOCK_FAILURE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "CLOCK_FAILURE", + ["mm"] = 0, + }, -- end of ["CLOCK_FAILURE"] + ["TURNIND_INCORRECT_SENS_VAC_HIGH"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "TURNIND_INCORRECT_SENS_VAC_HIGH", + ["mm"] = 0, + }, -- end of ["TURNIND_INCORRECT_SENS_VAC_HIGH"] + ["OIL_RADIATOR_WIRING"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "OIL_RADIATOR_WIRING", + ["mm"] = 0, + }, -- end of ["OIL_RADIATOR_WIRING"] + ["IGNITION_NO_OUTPUT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "IGNITION_NO_OUTPUT", + ["mm"] = 0, + }, -- end of ["IGNITION_NO_OUTPUT"] + ["AAR_47_FAILURE_TOTAL"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "AAR_47_FAILURE_TOTAL", + ["mm"] = 0, + }, -- end of ["AAR_47_FAILURE_TOTAL"] + ["PILOT_KILLED_FAILURE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "PILOT_KILLED_FAILURE", + ["mm"] = 0, + }, -- end of ["PILOT_KILLED_FAILURE"] + ["GUN_LEFT_CENTER_MOUNT_LOOSE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GUN_LEFT_CENTER_MOUNT_LOOSE", + ["mm"] = 0, + }, -- end of ["GUN_LEFT_CENTER_MOUNT_LOOSE"] + ["GUN_LEFT_OUT_AMMUN_FAULT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GUN_LEFT_OUT_AMMUN_FAULT", + ["mm"] = 0, + }, -- end of ["GUN_LEFT_OUT_AMMUN_FAULT"] + ["COMPASS_ERRATIC_OPERATION"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "COMPASS_ERRATIC_OPERATION", + ["mm"] = 0, + }, -- end of ["COMPASS_ERRATIC_OPERATION"] + ["asc_a"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "asc_a", + ["mm"] = 0, + }, -- end of ["asc_a"] + ["AIRSPEED_INDICATOR_FAILURE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "AIRSPEED_INDICATOR_FAILURE", + ["mm"] = 0, + }, -- end of ["AIRSPEED_INDICATOR_FAILURE"] + ["GUN_LEFT_CENTER_BARREL_WORN"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GUN_LEFT_CENTER_BARREL_WORN", + ["mm"] = 0, + }, -- end of ["GUN_LEFT_CENTER_BARREL_WORN"] + ["abris_software"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "abris_software", + ["mm"] = 0, + }, -- end of ["abris_software"] + ["GUN_FAIL_LEFT_OUT_GUN"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GUN_FAIL_LEFT_OUT_GUN", + ["mm"] = 0, + }, -- end of ["GUN_FAIL_LEFT_OUT_GUN"] + ["SAR_1_101"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "SAR_1_101", + ["mm"] = 0, + }, -- end of ["SAR_1_101"] + ["ROCKETS_INTERVALOMETER_WIRING"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "ROCKETS_INTERVALOMETER_WIRING", + ["mm"] = 0, + }, -- end of ["ROCKETS_INTERVALOMETER_WIRING"] + ["MainReductor_LowOilPressure"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "MainReductor_LowOilPressure", + ["mm"] = 0, + }, -- end of ["MainReductor_LowOilPressure"] + ["GUN_RIGHT_IN_AMMUN_FAULT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GUN_RIGHT_IN_AMMUN_FAULT", + ["mm"] = 0, + }, -- end of ["GUN_RIGHT_IN_AMMUN_FAULT"] + ["D2_LEFT_CYLINDER"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "D2_LEFT_CYLINDER", + ["mm"] = 0, + }, -- end of ["D2_LEFT_CYLINDER"] + ["Surge_LeftEngine"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "Surge_LeftEngine", + ["mm"] = 0, + }, -- end of ["Surge_LeftEngine"] + ["BOMBS_RUST_LEFT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "BOMBS_RUST_LEFT", + ["mm"] = 0, + }, -- end of ["BOMBS_RUST_LEFT"] + ["GUN_RIGHT_CENTER_BARREL_WORN"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GUN_RIGHT_CENTER_BARREL_WORN", + ["mm"] = 0, + }, -- end of ["GUN_RIGHT_CENTER_BARREL_WORN"] + ["asc"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "asc", + ["mm"] = 0, + }, -- end of ["asc"] + ["COMPASS_NO_TORQUE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "COMPASS_NO_TORQUE", + ["mm"] = 0, + }, -- end of ["COMPASS_NO_TORQUE"] + ["COOLANT_BREAK_BULB"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "COOLANT_BREAK_BULB", + ["mm"] = 0, + }, -- end of ["COOLANT_BREAK_BULB"] + ["PROP_GOVERNOR"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "PROP_GOVERNOR", + ["mm"] = 0, + }, -- end of ["PROP_GOVERNOR"] + ["MANIFOLD_SHIFT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "MANIFOLD_SHIFT", + ["mm"] = 0, + }, -- end of ["MANIFOLD_SHIFT"] + ["RIGHT_GUNNER_KILLED_FAILURE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "RIGHT_GUNNER_KILLED_FAILURE", + ["mm"] = 0, + }, -- end of ["RIGHT_GUNNER_KILLED_FAILURE"] + ["UNLOAD_VALVE_NOT_UNLOAD"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "UNLOAD_VALVE_NOT_UNLOAD", + ["mm"] = 0, + }, -- end of ["UNLOAD_VALVE_NOT_UNLOAD"] + ["STARTER_BURNOUT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "STARTER_BURNOUT", + ["mm"] = 0, + }, -- end of ["STARTER_BURNOUT"] + ["UNLOAD_VALVE_NOT_LOAD"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "UNLOAD_VALVE_NOT_LOAD", + ["mm"] = 0, + }, -- end of ["UNLOAD_VALVE_NOT_LOAD"] + ["TURNIND_INCORRECT_SENS_VAC_LOW"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "TURNIND_INCORRECT_SENS_VAC_LOW", + ["mm"] = 0, + }, -- end of ["TURNIND_INCORRECT_SENS_VAC_LOW"] + ["Failure_LeftEngine"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "Failure_LeftEngine", + ["mm"] = 0, + }, -- end of ["Failure_LeftEngine"] + ["GUN_RIGHT_IN_BARREL_WORN"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GUN_RIGHT_IN_BARREL_WORN", + ["mm"] = 0, + }, -- end of ["GUN_RIGHT_IN_BARREL_WORN"] + ["K14_MOV_LAMP_DEFECTIVE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "K14_MOV_LAMP_DEFECTIVE", + ["mm"] = 0, + }, -- end of ["K14_MOV_LAMP_DEFECTIVE"] + ["ILS_FAILURE_TOTAL"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "ILS_FAILURE_TOTAL", + ["mm"] = 0, + }, -- end of ["ILS_FAILURE_TOTAL"] + ["GUN_RIGHT_OUT_BARREL_WORN"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GUN_RIGHT_OUT_BARREL_WORN", + ["mm"] = 0, + }, -- end of ["GUN_RIGHT_OUT_BARREL_WORN"] + ["fuel_sys_transfer_pumps"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "fuel_sys_transfer_pumps", + ["mm"] = 0, + }, -- end of ["fuel_sys_transfer_pumps"] + ["PITOT_HEAT_WIRING"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "PITOT_HEAT_WIRING", + ["mm"] = 0, + }, -- end of ["PITOT_HEAT_WIRING"] + ["TURNIND_POINTER_NOT_SET_ZERO"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "TURNIND_POINTER_NOT_SET_ZERO", + ["mm"] = 0, + }, -- end of ["TURNIND_POINTER_NOT_SET_ZERO"] + ["MD1_GYRO_TOTAL_FAILURE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "MD1_GYRO_TOTAL_FAILURE", + ["mm"] = 0, + }, -- end of ["MD1_GYRO_TOTAL_FAILURE"] + ["VHF_FM_RADIO_FAILURE_TOTAL"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "VHF_FM_RADIO_FAILURE_TOTAL", + ["mm"] = 0, + }, -- end of ["VHF_FM_RADIO_FAILURE_TOTAL"] + ["RIGHT_MFCD_FAILURE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "RIGHT_MFCD_FAILURE", + ["mm"] = 0, + }, -- end of ["RIGHT_MFCD_FAILURE"] + ["F2_BOTTOM_CYLINDER"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "F2_BOTTOM_CYLINDER", + ["mm"] = 0, + }, -- end of ["F2_BOTTOM_CYLINDER"] + ["LEFT_WING_TANK_LEAK"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "LEFT_WING_TANK_LEAK", + ["mm"] = 0, + }, -- end of ["LEFT_WING_TANK_LEAK"] + ["CARBAIR_BREAK_LEADS"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "CARBAIR_BREAK_LEADS", + ["mm"] = 0, + }, -- end of ["CARBAIR_BREAK_LEADS"] + ["GUN_LEFT_IN_OPEN_CIRCUIT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GUN_LEFT_IN_OPEN_CIRCUIT", + ["mm"] = 0, + }, -- end of ["GUN_LEFT_IN_OPEN_CIRCUIT"] + ["EGI_FAILURE_TOTAL"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "EGI_FAILURE_TOTAL", + ["mm"] = 0, + }, -- end of ["EGI_FAILURE_TOTAL"] + ["UHF_RADIO_FAILURE_TOTAL"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "UHF_RADIO_FAILURE_TOTAL", + ["mm"] = 0, + }, -- end of ["UHF_RADIO_FAILURE_TOTAL"] + ["GUN_RIGHT_CENTER_AMMUN_FAULT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GUN_RIGHT_CENTER_AMMUN_FAULT", + ["mm"] = 0, + }, -- end of ["GUN_RIGHT_CENTER_AMMUN_FAULT"] + ["LEFT_GUNNER_KILLED_FAILURE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "LEFT_GUNNER_KILLED_FAILURE", + ["mm"] = 0, + }, -- end of ["LEFT_GUNNER_KILLED_FAILURE"] + ["VHF_VT207_DEFECTIVE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "VHF_VT207_DEFECTIVE", + ["mm"] = 0, + }, -- end of ["VHF_VT207_DEFECTIVE"] + ["RightEngine_LowOilPressure"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "RightEngine_LowOilPressure", + ["mm"] = 0, + }, -- end of ["RightEngine_LowOilPressure"] + ["radar"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "radar", + ["mm"] = 0, + }, -- end of ["radar"] + ["RIGHT_TANK_PUMP_FAULT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "RIGHT_TANK_PUMP_FAULT", + ["mm"] = 0, + }, -- end of ["RIGHT_TANK_PUMP_FAULT"] + ["COOLANT_UNPRES"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "COOLANT_UNPRES", + ["mm"] = 0, + }, -- end of ["COOLANT_UNPRES"] + ["ARN_82_FAILURE_TOTAL"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "ARN_82_FAILURE_TOTAL", + ["mm"] = 0, + }, -- end of ["ARN_82_FAILURE_TOTAL"] + ["FLEX_S_NO_POWER_SUPPLY"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "FLEX_S_NO_POWER_SUPPLY", + ["mm"] = 0, + }, -- end of ["FLEX_S_NO_POWER_SUPPLY"] + ["eos"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "eos", + ["mm"] = 0, + }, -- end of ["eos"] + ["HYDRO_LOW_AIR_PRESSURE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "HYDRO_LOW_AIR_PRESSURE", + ["mm"] = 0, + }, -- end of ["HYDRO_LOW_AIR_PRESSURE"] + ["K14_MOTOR_DEFECTIVE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "K14_MOTOR_DEFECTIVE", + ["mm"] = 0, + }, -- end of ["K14_MOTOR_DEFECTIVE"] + ["GENERATOR_FAULT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GENERATOR_FAULT", + ["mm"] = 0, + }, -- end of ["GENERATOR_FAULT"] + ["FUEL_PUMP_FAILURE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "FUEL_PUMP_FAILURE", + ["mm"] = 0, + }, -- end of ["FUEL_PUMP_FAILURE"] + ["RADAR_ALTIMETR_LEFT_ANT_FAILURE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "RADAR_ALTIMETR_LEFT_ANT_FAILURE", + ["mm"] = 0, + }, -- end of ["RADAR_ALTIMETR_LEFT_ANT_FAILURE"] + ["hydro"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "hydro", + ["mm"] = 0, + }, -- end of ["hydro"] + ["BAT_SOLENOID_DEFECTIVE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "BAT_SOLENOID_DEFECTIVE", + ["mm"] = 0, + }, -- end of ["BAT_SOLENOID_DEFECTIVE"] + ["LeftEngine_Fire"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["mm"] = 0, + }, -- end of ["LeftEngine_Fire"] + ["SUPERCHARGER_LIGHT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "SUPERCHARGER_LIGHT", + ["mm"] = 0, + }, -- end of ["SUPERCHARGER_LIGHT"] + ["L_GEAR_UPL_FAULT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "L_GEAR_UPL_FAULT", + ["mm"] = 0, + }, -- end of ["L_GEAR_UPL_FAULT"] + ["fs_damage_right_cell_boost_pump"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "fs_damage_right_cell_boost_pump", + ["mm"] = 0, + }, -- end of ["fs_damage_right_cell_boost_pump"] + ["TACH_RESISTANCE_ADJ"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "TACH_RESISTANCE_ADJ", + ["mm"] = 0, + }, -- end of ["TACH_RESISTANCE_ADJ"] + ["MAGNETO_1"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "MAGNETO_1", + ["mm"] = 0, + }, -- end of ["MAGNETO_1"] + ["BOMBS_NO_VOLATAGE_AT_RACK_RIGHT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "BOMBS_NO_VOLATAGE_AT_RACK_RIGHT", + ["mm"] = 0, + }, -- end of ["BOMBS_NO_VOLATAGE_AT_RACK_RIGHT"] + ["GUN_RIGHT_OUT_MOUNT_LOOSE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GUN_RIGHT_OUT_MOUNT_LOOSE", + ["mm"] = 0, + }, -- end of ["GUN_RIGHT_OUT_MOUNT_LOOSE"] + ["TailReductor_ShaveInOil"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "TailReductor_ShaveInOil", + ["mm"] = 0, + }, -- end of ["TailReductor_ShaveInOil"] + ["R_GEAR_UPL_FAULT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "R_GEAR_UPL_FAULT", + ["mm"] = 0, + }, -- end of ["R_GEAR_UPL_FAULT"] + ["BOMBS_TRAIN_DEFECTIVE_WIRING"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "BOMBS_TRAIN_DEFECTIVE_WIRING", + ["mm"] = 0, + }, -- end of ["BOMBS_TRAIN_DEFECTIVE_WIRING"] + ["autopilot"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "autopilot", + ["mm"] = 0, + }, -- end of ["autopilot"] + ["BOMBS_TRAIN_DEFECTIVE_SWITCH"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "BOMBS_TRAIN_DEFECTIVE_SWITCH", + ["mm"] = 0, + }, -- end of ["BOMBS_TRAIN_DEFECTIVE_SWITCH"] + ["CARBAIR_SHORT_CIRCUIT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "CARBAIR_SHORT_CIRCUIT", + ["mm"] = 0, + }, -- end of ["CARBAIR_SHORT_CIRCUIT"] + ["STARTER_RELAY"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "STARTER_RELAY", + ["mm"] = 0, + }, -- end of ["STARTER_RELAY"] + ["AN_ALE_40V_FAILURE_CONTAINER_RIGHT_WING"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "AN_ALE_40V_FAILURE_CONTAINER_RIGHT_WING", + ["mm"] = 0, + }, -- end of ["AN_ALE_40V_FAILURE_CONTAINER_RIGHT_WING"] + ["TACH_POOR_CONNECTION"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "TACH_POOR_CONNECTION", + ["mm"] = 0, + }, -- end of ["TACH_POOR_CONNECTION"] + ["GUN_RIGHT_IN_MOUNT_LOOSE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GUN_RIGHT_IN_MOUNT_LOOSE", + ["mm"] = 0, + }, -- end of ["GUN_RIGHT_IN_MOUNT_LOOSE"] + ["LEFT_MFCD_FAILURE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "LEFT_MFCD_FAILURE", + ["mm"] = 0, + }, -- end of ["LEFT_MFCD_FAILURE"] + ["sas_yaw_right"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "sas_yaw_right", + ["mm"] = 0, + }, -- end of ["sas_yaw_right"] + ["DOORS_TVC_BROKEN"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "DOORS_TVC_BROKEN", + ["mm"] = 0, + }, -- end of ["DOORS_TVC_BROKEN"] + ["SADL_FAILURE_TOTAL"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "SADL_FAILURE_TOTAL", + ["mm"] = 0, + }, -- end of ["SADL_FAILURE_TOTAL"] + ["fs_damage_left_cell_boost_pump"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "fs_damage_left_cell_boost_pump", + ["mm"] = 0, + }, -- end of ["fs_damage_left_cell_boost_pump"] + ["BOOST_REG"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "BOOST_REG", + ["mm"] = 0, + }, -- end of ["BOOST_REG"] + ["r_conv"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "r_conv", + ["mm"] = 0, + }, -- end of ["r_conv"] + ["ENGINE_JAM"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "ENGINE_JAM", + ["mm"] = 0, + }, -- end of ["ENGINE_JAM"] + ["MAGNETO_2"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "MAGNETO_2", + ["mm"] = 0, + }, -- end of ["MAGNETO_2"] + ["SAR_1_95"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "SAR_1_95", + ["mm"] = 0, + }, -- end of ["SAR_1_95"] + ["BOMBS_SOLENOID_FAULT_RIGHT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "BOMBS_SOLENOID_FAULT_RIGHT", + ["mm"] = 0, + }, -- end of ["BOMBS_SOLENOID_FAULT_RIGHT"] + ["CDU_FAILURE_TOTAL"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "CDU_FAILURE_TOTAL", + ["mm"] = 0, + }, -- end of ["CDU_FAILURE_TOTAL"] + ["AN_ALR69V_FAILURE_SENSOR_NOSE_RIGHT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "AN_ALR69V_FAILURE_SENSOR_NOSE_RIGHT", + ["mm"] = 0, + }, -- end of ["AN_ALR69V_FAILURE_SENSOR_NOSE_RIGHT"] + ["TAIL_GEAR_C_CABLE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "TAIL_GEAR_C_CABLE", + ["mm"] = 0, + }, -- end of ["TAIL_GEAR_C_CABLE"] + ["STARTER_WIRING"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "STARTER_WIRING", + ["mm"] = 0, + }, -- end of ["STARTER_WIRING"] + ["engine_driveshaft_failure"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "engine_driveshaft_failure", + ["mm"] = 0, + }, -- end of ["engine_driveshaft_failure"] + ["PUMP_RELIEF_VALVE_LEAKS"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "PUMP_RELIEF_VALVE_LEAKS", + ["mm"] = 0, + }, -- end of ["PUMP_RELIEF_VALVE_LEAKS"] + ["HUD_FAILURE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "HUD_FAILURE", + ["mm"] = 0, + }, -- end of ["HUD_FAILURE"] + ["mfd"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "mfd", + ["mm"] = 0, + }, -- end of ["mfd"] + ["CARBAIR_GND_LEAD"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "CARBAIR_GND_LEAD", + ["mm"] = 0, + }, -- end of ["CARBAIR_GND_LEAD"] + ["GMC_MAGN_COMP_FAILURE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GMC_MAGN_COMP_FAILURE", + ["mm"] = 0, + }, -- end of ["GMC_MAGN_COMP_FAILURE"] + ["es_damage_GeneratorLeft"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "es_damage_GeneratorLeft", + ["mm"] = 0, + }, -- end of ["es_damage_GeneratorLeft"] + ["ILS_FAILURE_ANT_GLIDESLOPE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "ILS_FAILURE_ANT_GLIDESLOPE", + ["mm"] = 0, + }, -- end of ["ILS_FAILURE_ANT_GLIDESLOPE"] + ["engine_chip"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "engine_chip", + ["mm"] = 0, + }, -- end of ["engine_chip"] + ["ARN_83_TOTAL_FAILURE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "ARN_83_TOTAL_FAILURE", + ["mm"] = 0, + }, -- end of ["ARN_83_TOTAL_FAILURE"] + ["CADC_FAILURE_MACH"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "CADC_FAILURE_MACH", + ["mm"] = 0, + }, -- end of ["CADC_FAILURE_MACH"] + ["ROCKETS_DEFECTIVE_WIRING"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "ROCKETS_DEFECTIVE_WIRING", + ["mm"] = 0, + }, -- end of ["ROCKETS_DEFECTIVE_WIRING"] + ["COPILOT_GYRO_TOTAL_FAILURE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "COPILOT_GYRO_TOTAL_FAILURE", + ["mm"] = 0, + }, -- end of ["COPILOT_GYRO_TOTAL_FAILURE"] + ["RightEngine_ShaveInOil"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "RightEngine_ShaveInOil", + ["mm"] = 0, + }, -- end of ["RightEngine_ShaveInOil"] + ["EEC_Failure_RightEngine"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "EEC_Failure_RightEngine", + ["mm"] = 0, + }, -- end of ["EEC_Failure_RightEngine"] + ["laser_failure"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "laser_failure", + ["mm"] = 0, + }, -- end of ["laser_failure"] + ["ARN_83_ADF_DAMAGE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "ARN_83_ADF_DAMAGE", + ["mm"] = 0, + }, -- end of ["ARN_83_ADF_DAMAGE"] + ["BOMBS_NO_VOLATAGE_BOTH"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "BOMBS_NO_VOLATAGE_BOTH", + ["mm"] = 0, + }, -- end of ["BOMBS_NO_VOLATAGE_BOTH"] + ["es_damage_SpareInverter"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "es_damage_SpareInverter", + ["mm"] = 0, + }, -- end of ["es_damage_SpareInverter"] + ["AAR_47_FAILURE_SENSOR_BOTTOM"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "AAR_47_FAILURE_SENSOR_BOTTOM", + ["mm"] = 0, + }, -- end of ["AAR_47_FAILURE_SENSOR_BOTTOM"] + ["CARBAIR_SHORT_CIRCUIT_LEADS"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "CARBAIR_SHORT_CIRCUIT_LEADS", + ["mm"] = 0, + }, -- end of ["CARBAIR_SHORT_CIRCUIT_LEADS"] + ["sas_pitch_left"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "sas_pitch_left", + ["mm"] = 0, + }, -- end of ["sas_pitch_left"] + ["BATTERY_OVERHEAT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "BATTERY_OVERHEAT", + ["mm"] = 0, + }, -- end of ["BATTERY_OVERHEAT"] + ["NOSE_AIRSPEED_INDICATOR_FAILURE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "NOSE_AIRSPEED_INDICATOR_FAILURE", + ["mm"] = 0, + }, -- end of ["NOSE_AIRSPEED_INDICATOR_FAILURE"] + ["CADC_FAILURE_DYNAMIC"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "CADC_FAILURE_DYNAMIC", + ["mm"] = 0, + }, -- end of ["CADC_FAILURE_DYNAMIC"] + ["INSUF_FUEL_PRES"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "INSUF_FUEL_PRES", + ["mm"] = 0, + }, -- end of ["INSUF_FUEL_PRES"] + ["GUN_LEFT_CENTER_OPEN_CIRCUIT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GUN_LEFT_CENTER_OPEN_CIRCUIT", + ["mm"] = 0, + }, -- end of ["GUN_LEFT_CENTER_OPEN_CIRCUIT"] + ["AN_ALR69V_FAILURE_SENSOR_TAIL_LEFT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "AN_ALR69V_FAILURE_SENSOR_TAIL_LEFT", + ["mm"] = 0, + }, -- end of ["AN_ALR69V_FAILURE_SENSOR_TAIL_LEFT"] + ["CADC_FAILURE_IAS"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "CADC_FAILURE_IAS", + ["mm"] = 0, + }, -- end of ["CADC_FAILURE_IAS"] + ["GUN_LEFT_CENTER_AMMUN_FAULT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GUN_LEFT_CENTER_AMMUN_FAULT", + ["mm"] = 0, + }, -- end of ["GUN_LEFT_CENTER_AMMUN_FAULT"] + ["GMC_TOTAL_FAILURE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GMC_TOTAL_FAILURE", + ["mm"] = 0, + }, -- end of ["GMC_TOTAL_FAILURE"] + ["DEFECTIVE_MECHANISM"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "DEFECTIVE_MECHANISM", + ["mm"] = 0, + }, -- end of ["DEFECTIVE_MECHANISM"] + ["INT_HYDRO_LEAK"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "INT_HYDRO_LEAK", + ["mm"] = 0, + }, -- end of ["INT_HYDRO_LEAK"] + ["TACH_BREAK_CIRCUIT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "TACH_BREAK_CIRCUIT", + ["mm"] = 0, + }, -- end of ["TACH_BREAK_CIRCUIT"] + ["hydro_main_irreversible_valve"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "hydro_main_irreversible_valve", + ["mm"] = 0, + }, -- end of ["hydro_main_irreversible_valve"] + ["COOLANT_DEFECTIVE_IND"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "COOLANT_DEFECTIVE_IND", + ["mm"] = 0, + }, -- end of ["COOLANT_DEFECTIVE_IND"] + ["hud"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "hud", + ["mm"] = 0, + }, -- end of ["hud"] + ["STARTER_SOLENOID"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "STARTER_SOLENOID", + ["mm"] = 0, + }, -- end of ["STARTER_SOLENOID"] + ["hydro_left"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "hydro_left", + ["mm"] = 0, + }, -- end of ["hydro_left"] + ["SAR_1_2_95"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "SAR_1_2_95", + ["mm"] = 0, + }, -- end of ["SAR_1_2_95"] + ["fuel_sys_left_transfer_pump"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "fuel_sys_left_transfer_pump", + ["mm"] = 0, + }, -- end of ["fuel_sys_left_transfer_pump"] + ["LeftEngine_LowOilPressure"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "LeftEngine_LowOilPressure", + ["mm"] = 0, + }, -- end of ["LeftEngine_LowOilPressure"] + ["BOMBS_ARMING_BROKEN_SOLENOID_LEFT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "BOMBS_ARMING_BROKEN_SOLENOID_LEFT", + ["mm"] = 0, + }, -- end of ["BOMBS_ARMING_BROKEN_SOLENOID_LEFT"] + ["FAULTY_ROCKET_LEFT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "FAULTY_ROCKET_LEFT", + ["mm"] = 0, + }, -- end of ["FAULTY_ROCKET_LEFT"] + ["l_conv"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "l_conv", + ["mm"] = 0, + }, -- end of ["l_conv"] + ["hydro_right"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "hydro_right", + ["mm"] = 0, + }, -- end of ["hydro_right"] + ["es_damage_StarterGenerator"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "es_damage_StarterGenerator", + ["mm"] = 0, + }, -- end of ["es_damage_StarterGenerator"] + ["es_damage_Battery"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "es_damage_Battery", + ["mm"] = 0, + }, -- end of ["es_damage_Battery"] + ["ILS_FAILURE_ANT_MARKER"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "ILS_FAILURE_ANT_MARKER", + ["mm"] = 0, + }, -- end of ["ILS_FAILURE_ANT_MARKER"] + ["TGP_FAILURE_LEFT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "TGP_FAILURE_LEFT", + ["mm"] = 0, + }, -- end of ["TGP_FAILURE_LEFT"] + ["VHF_CRYSTAL"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "VHF_CRYSTAL", + ["mm"] = 0, + }, -- end of ["VHF_CRYSTAL"] + ["VHF_VT_BURNED_OUT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "VHF_VT_BURNED_OUT", + ["mm"] = 0, + }, -- end of ["VHF_VT_BURNED_OUT"] + ["sas_pitch_right"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "sas_pitch_right", + ["mm"] = 0, + }, -- end of ["sas_pitch_right"] + ["BOMBS_NO_VOLATAGE_AT_RACK_LEFT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "BOMBS_NO_VOLATAGE_AT_RACK_LEFT", + ["mm"] = 0, + }, -- end of ["BOMBS_NO_VOLATAGE_AT_RACK_LEFT"] + ["TGP_FAILURE_RIGHT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "TGP_FAILURE_RIGHT", + ["mm"] = 0, + }, -- end of ["TGP_FAILURE_RIGHT"] + ["TACAN_FAILURE_RECEIVER"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "TACAN_FAILURE_RECEIVER", + ["mm"] = 0, + }, -- end of ["TACAN_FAILURE_RECEIVER"] + ["VHF_AM_RADIO_FAILURE_TOTAL"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "VHF_AM_RADIO_FAILURE_TOTAL", + ["mm"] = 0, + }, -- end of ["VHF_AM_RADIO_FAILURE_TOTAL"] + ["main_reductor_chip"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "main_reductor_chip", + ["mm"] = 0, + }, -- end of ["main_reductor_chip"] + ["VHF_SQUELCH_RELAY"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "VHF_SQUELCH_RELAY", + ["mm"] = 0, + }, -- end of ["VHF_SQUELCH_RELAY"] + ["COOLANT_RADIATOR_WIRING"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "COOLANT_RADIATOR_WIRING", + ["mm"] = 0, + }, -- end of ["COOLANT_RADIATOR_WIRING"] + ["RADAR_ALTIMETR_RIGHT_ANT_FAILURE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "RADAR_ALTIMETR_RIGHT_ANT_FAILURE", + ["mm"] = 0, + }, -- end of ["RADAR_ALTIMETR_RIGHT_ANT_FAILURE"] + ["F2_TOP_CYLINDER"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "F2_TOP_CYLINDER", + ["mm"] = 0, + }, -- end of ["F2_TOP_CYLINDER"] + ["FLEX_S_MAIN_LAMP_DEFECTIVE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "FLEX_S_MAIN_LAMP_DEFECTIVE", + ["mm"] = 0, + }, -- end of ["FLEX_S_MAIN_LAMP_DEFECTIVE"] + ["MANIFOLD_LINE_LEAK"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "MANIFOLD_LINE_LEAK", + ["mm"] = 0, + }, -- end of ["MANIFOLD_LINE_LEAK"] + ["engine_surge_failure"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "engine_surge_failure", + ["mm"] = 0, + }, -- end of ["engine_surge_failure"] + ["CADC_FAILURE_PRESSURE_ALT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "CADC_FAILURE_PRESSURE_ALT", + ["mm"] = 0, + }, -- end of ["CADC_FAILURE_PRESSURE_ALT"] + ["K14_NO_POWER_SUPPLY"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "K14_NO_POWER_SUPPLY", + ["mm"] = 0, + }, -- end of ["K14_NO_POWER_SUPPLY"] + ["PUMP_FAILS"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "PUMP_FAILS", + ["mm"] = 0, + }, -- end of ["PUMP_FAILS"] + ["RIGHT_WING_TANK_LEAK"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "RIGHT_WING_TANK_LEAK", + ["mm"] = 0, + }, -- end of ["RIGHT_WING_TANK_LEAK"] + ["BOMBS_DAMAGE_LINKAGE_RIGHT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "BOMBS_DAMAGE_LINKAGE_RIGHT", + ["mm"] = 0, + }, -- end of ["BOMBS_DAMAGE_LINKAGE_RIGHT"] + ["fs_damage_engine_pump"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "fs_damage_engine_pump", + ["mm"] = 0, + }, -- end of ["fs_damage_engine_pump"] + ["ROOF_AIRSPEED_INDICATOR_FAILURE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "ROOF_AIRSPEED_INDICATOR_FAILURE", + ["mm"] = 0, + }, -- end of ["ROOF_AIRSPEED_INDICATOR_FAILURE"] + ["CADC_FAILURE_STATIC"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "CADC_FAILURE_STATIC", + ["mm"] = 0, + }, -- end of ["CADC_FAILURE_STATIC"] + ["CADC_FAILURE_BARO_ALT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "CADC_FAILURE_BARO_ALT", + ["mm"] = 0, + }, -- end of ["CADC_FAILURE_BARO_ALT"] + ["GUN_RIGHT_CENTER_OPEN_CIRCUIT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GUN_RIGHT_CENTER_OPEN_CIRCUIT", + ["mm"] = 0, + }, -- end of ["GUN_RIGHT_CENTER_OPEN_CIRCUIT"] + ["IFFCC_FAILURE_TOTAL"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "IFFCC_FAILURE_TOTAL", + ["mm"] = 0, + }, -- end of ["IFFCC_FAILURE_TOTAL"] + ["GUN_FAIL_RIGHT_IN_GUN"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GUN_FAIL_RIGHT_IN_GUN", + ["mm"] = 0, + }, -- end of ["GUN_FAIL_RIGHT_IN_GUN"] + ["BOMBS_ARMING_BROKEN_WIRING_LEFT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "BOMBS_ARMING_BROKEN_WIRING_LEFT", + ["mm"] = 0, + }, -- end of ["BOMBS_ARMING_BROKEN_WIRING_LEFT"] + ["Failure_RightEngine"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "Failure_RightEngine", + ["mm"] = 0, + }, -- end of ["Failure_RightEngine"] + ["ecf"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["mm"] = 0, + }, -- end of ["ecf"] + ["GUN_LEFT_OUT_BARREL_WORN"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GUN_LEFT_OUT_BARREL_WORN", + ["mm"] = 0, + }, -- end of ["GUN_LEFT_OUT_BARREL_WORN"] + ["EXT_HYDRO_LEAK"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "EXT_HYDRO_LEAK", + ["mm"] = 0, + }, -- end of ["EXT_HYDRO_LEAK"] + ["BOMBS_ARMING_BROKEN_SOLENOID_RIGHT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "BOMBS_ARMING_BROKEN_SOLENOID_RIGHT", + ["mm"] = 0, + }, -- end of ["BOMBS_ARMING_BROKEN_SOLENOID_RIGHT"] + ["DEFECTIVE_INSTRUMENT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "DEFECTIVE_INSTRUMENT", + ["mm"] = 0, + }, -- end of ["DEFECTIVE_INSTRUMENT"] + ["AN_ALR69V_FAILURE_SENSOR_NOSE_LEFT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "AN_ALR69V_FAILURE_SENSOR_NOSE_LEFT", + ["mm"] = 0, + }, -- end of ["AN_ALR69V_FAILURE_SENSOR_NOSE_LEFT"] + ["mlws"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "mlws", + ["mm"] = 0, + }, -- end of ["mlws"] + ["BOMBS_ARMING_NO_VOLATAGE_BOTH"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "BOMBS_ARMING_NO_VOLATAGE_BOTH", + ["mm"] = 0, + }, -- end of ["BOMBS_ARMING_NO_VOLATAGE_BOTH"] + ["BAT_SOLENOID_WIRING"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "BAT_SOLENOID_WIRING", + ["mm"] = 0, + }, -- end of ["BAT_SOLENOID_WIRING"] + ["STARTER_LOSE_CON"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "STARTER_LOSE_CON", + ["mm"] = 0, + }, -- end of ["STARTER_LOSE_CON"] + ["FUEL_VALVE_LEAK"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "FUEL_VALVE_LEAK", + ["mm"] = 0, + }, -- end of ["FUEL_VALVE_LEAK"] + ["FLEX_S_NO_GUN_SIGN"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "FLEX_S_NO_GUN_SIGN", + ["mm"] = 0, + }, -- end of ["FLEX_S_NO_GUN_SIGN"] + ["fuel_sys_right_transfer_pump"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "fuel_sys_right_transfer_pump", + ["mm"] = 0, + }, -- end of ["fuel_sys_right_transfer_pump"] + ["COOLANT_RADIATOR_MOTOR"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "COOLANT_RADIATOR_MOTOR", + ["mm"] = 0, + }, -- end of ["COOLANT_RADIATOR_MOTOR"] + ["CARBAIR_OPEN_CIRCUIT_BLB"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "CARBAIR_OPEN_CIRCUIT_BLB", + ["mm"] = 0, + }, -- end of ["CARBAIR_OPEN_CIRCUIT_BLB"] + ["AAR_47_FAILURE_SENSOR_TAIL"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "AAR_47_FAILURE_SENSOR_TAIL", + ["mm"] = 0, + }, -- end of ["AAR_47_FAILURE_SENSOR_TAIL"] + ["GUN_LEFT_OUT_OPEN_CIRCUIT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GUN_LEFT_OUT_OPEN_CIRCUIT", + ["mm"] = 0, + }, -- end of ["GUN_LEFT_OUT_OPEN_CIRCUIT"] + ["TACAN_FAILURE_TRANSMITTER"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "TACAN_FAILURE_TRANSMITTER", + ["mm"] = 0, + }, -- end of ["TACAN_FAILURE_TRANSMITTER"] + ["BOMBS_ARMING_BROKEN_WIRING_RIGHT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "BOMBS_ARMING_BROKEN_WIRING_RIGHT", + ["mm"] = 0, + }, -- end of ["BOMBS_ARMING_BROKEN_WIRING_RIGHT"] + ["l_gen"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "l_gen", + ["mm"] = 0, + }, -- end of ["l_gen"] + ["TURNIND_POINTER_VIBRATES"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "TURNIND_POINTER_VIBRATES", + ["mm"] = 0, + }, -- end of ["TURNIND_POINTER_VIBRATES"] + ["GUN_LEFT_IN_BARREL_WORN"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GUN_LEFT_IN_BARREL_WORN", + ["mm"] = 0, + }, -- end of ["GUN_LEFT_IN_BARREL_WORN"] + ["r_gen"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "r_gen", + ["mm"] = 0, + }, -- end of ["r_gen"] + ["COOLANT_RADIATOR_SENSOR"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "COOLANT_RADIATOR_SENSOR", + ["mm"] = 0, + }, -- end of ["COOLANT_RADIATOR_SENSOR"] + ["AAR_47_FAILURE_SENSOR_RIGHT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "AAR_47_FAILURE_SENSOR_RIGHT", + ["mm"] = 0, + }, -- end of ["AAR_47_FAILURE_SENSOR_RIGHT"] + ["ROCKETS_INTERVALOMETER_SEQ"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "ROCKETS_INTERVALOMETER_SEQ", + ["mm"] = 0, + }, -- end of ["ROCKETS_INTERVALOMETER_SEQ"] + ["hydro_common"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "hydro_common", + ["mm"] = 0, + }, -- end of ["hydro_common"] + ["SAR_2_95"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "SAR_2_95", + ["mm"] = 0, + }, -- end of ["SAR_2_95"] + ["SAR_2_101"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "SAR_2_101", + ["mm"] = 0, + }, -- end of ["SAR_2_101"] + ["BOOSTER_COIL"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "BOOSTER_COIL", + ["mm"] = 0, + }, -- end of ["BOOSTER_COIL"] + ["BOMBS_DAMAGE_ELINKAGE_RIGHT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "BOMBS_DAMAGE_ELINKAGE_RIGHT", + ["mm"] = 0, + }, -- end of ["BOMBS_DAMAGE_ELINKAGE_RIGHT"] + ["FAULTY_ROCKET_RIGHT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "FAULTY_ROCKET_RIGHT", + ["mm"] = 0, + }, -- end of ["FAULTY_ROCKET_RIGHT"] + ["GUN_RIGHT_IN_OPEN_CIRCUIT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GUN_RIGHT_IN_OPEN_CIRCUIT", + ["mm"] = 0, + }, -- end of ["GUN_RIGHT_IN_OPEN_CIRCUIT"] + ["COMPASS_ERRATIC_INDIACATON"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "COMPASS_ERRATIC_INDIACATON", + ["mm"] = 0, + }, -- end of ["COMPASS_ERRATIC_INDIACATON"] + ["OIL_DILUTION_SOLENOID"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "OIL_DILUTION_SOLENOID", + ["mm"] = 0, + }, -- end of ["OIL_DILUTION_SOLENOID"] + ["PUMP_SEPARATOR_CLOGGED"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "PUMP_SEPARATOR_CLOGGED", + ["mm"] = 0, + }, -- end of ["PUMP_SEPARATOR_CLOGGED"] + ["es_damage_MainGenerator"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "es_damage_MainGenerator", + ["mm"] = 0, + }, -- end of ["es_damage_MainGenerator"] + ["BOMBS_RUST_RIGHT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "BOMBS_RUST_RIGHT", + ["mm"] = 0, + }, -- end of ["BOMBS_RUST_RIGHT"] + ["CLOGGED_FUEL_STRAINER"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "CLOGGED_FUEL_STRAINER", + ["mm"] = 0, + }, -- end of ["CLOGGED_FUEL_STRAINER"] + ["BOMBS_DAMAGE_ELINKAGE_LEFT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "BOMBS_DAMAGE_ELINKAGE_LEFT", + ["mm"] = 0, + }, -- end of ["BOMBS_DAMAGE_ELINKAGE_LEFT"] + ["r_engine"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "r_engine", + ["mm"] = 0, + }, -- end of ["r_engine"] + ["TACH_BREAK_IN_INDICATOR"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "TACH_BREAK_IN_INDICATOR", + ["mm"] = 0, + }, -- end of ["TACH_BREAK_IN_INDICATOR"] + ["A11_CLOCK_FAILURE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "A11_CLOCK_FAILURE", + ["mm"] = 0, + }, -- end of ["A11_CLOCK_FAILURE"] + ["DOORS_TV_JAMMED"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "DOORS_TV_JAMMED", + ["mm"] = 0, + }, -- end of ["DOORS_TV_JAMMED"] + ["D2_RIGHT_CYLINDER"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "D2_RIGHT_CYLINDER", + ["mm"] = 0, + }, -- end of ["D2_RIGHT_CYLINDER"] + ["ecm"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "ecm", + ["mm"] = 0, + }, -- end of ["ecm"] + ["AN_ALR69V_FAILURE_TOTAL"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "AN_ALR69V_FAILURE_TOTAL", + ["mm"] = 0, + }, -- end of ["AN_ALR69V_FAILURE_TOTAL"] + ["es_damage_GeneratorRight"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "es_damage_GeneratorRight", + ["mm"] = 0, + }, -- end of ["es_damage_GeneratorRight"] + ["SUPERCHARGER_SOLENOID"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "SUPERCHARGER_SOLENOID", + ["mm"] = 0, + }, -- end of ["SUPERCHARGER_SOLENOID"] + ["GUN_RIGHT_OUT_AMMUN_FAULT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "GUN_RIGHT_OUT_AMMUN_FAULT", + ["mm"] = 0, + }, -- end of ["GUN_RIGHT_OUT_AMMUN_FAULT"] + ["l_engine"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "l_engine", + ["mm"] = 0, + }, -- end of ["l_engine"] + ["AN_ALE_40V_FAILURE_CONTAINER_RIGHT_GEAR"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "AN_ALE_40V_FAILURE_CONTAINER_RIGHT_GEAR", + ["mm"] = 0, + }, -- end of ["AN_ALE_40V_FAILURE_CONTAINER_RIGHT_GEAR"] + ["TransitionalReductor_ShaveInOil"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "TransitionalReductor_ShaveInOil", + ["mm"] = 0, + }, -- end of ["TransitionalReductor_ShaveInOil"] + ["COPILOT_KILLED_FAILURE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "COPILOT_KILLED_FAILURE", + ["mm"] = 0, + }, -- end of ["COPILOT_KILLED_FAILURE"] + ["TAIL_GEAR_D_LOCK"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "TAIL_GEAR_D_LOCK", + ["mm"] = 0, + }, -- end of ["TAIL_GEAR_D_LOCK"] + ["JADRO_1A_FAILURE_TOTAL"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["mm"] = 0, + }, -- end of ["JADRO_1A_FAILURE_TOTAL"] + ["BOMBS_ARMING_NO_VOLATAGE_RIGHT"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "BOMBS_ARMING_NO_VOLATAGE_RIGHT", + ["mm"] = 0, + }, -- end of ["BOMBS_ARMING_NO_VOLATAGE_RIGHT"] + ["IFFCC_FAILURE_GUN"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "IFFCC_FAILURE_GUN", + ["mm"] = 0, + }, -- end of ["IFFCC_FAILURE_GUN"] + ["APU_Fire"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["mm"] = 0, + }, -- end of ["APU_Fire"] + ["TURNIND_INCORRECT_SENS_DEFECTIVE"] = + { + ["hh"] = 0, + ["prob"] = 100, + ["enable"] = false, + ["mmint"] = 1, + ["id"] = "TURNIND_INCORRECT_SENS_DEFECTIVE", + ["mm"] = 0, + }, -- end of ["TURNIND_INCORRECT_SENS_DEFECTIVE"] + }, -- end of ["failures"] +} -- end of mission diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/options b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/options new file mode 100644 index 000000000..bf093522c --- /dev/null +++ b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/options @@ -0,0 +1,229 @@ +options = +{ + ["playerName"] = "Killer", + ["miscellaneous"] = + { + ["headmove"] = true, + ["TrackIR_external_views"] = true, + ["f5_nearest_ac"] = true, + ["f11_free_camera"] = true, + ["F2_view_effects"] = 2, + ["f10_awacs"] = true, + ["Coordinate_Display"] = "Lat Long", + ["accidental_failures"] = false, + ["force_feedback_enabled"] = true, + ["synchronize_controls"] = false, + ["show_pilot_body"] = true, + }, -- end of ["miscellaneous"] + ["difficulty"] = + { + ["padlock"] = true, + ["labels"] = false, + ["easyCommunication"] = true, + ["easyRadar"] = false, + ["fuel"] = false, + ["miniHUD"] = false, + ["tips"] = true, + ["birds"] = 0, + ["optionsView"] = "optview_all", + ["permitCrash"] = true, + ["immortal"] = false, + ["cockpitStatusBarAllowed"] = false, + ["cockpitVisualRM"] = true, + ["easyFlight"] = false, + ["reports"] = true, + ["hideStick"] = false, + ["radio"] = true, + ["externalViews"] = true, + ["units"] = "metric", + ["userMarks"] = true, + ["cockpitLanguage"] = "english", + ["spectatorExternalViews"] = true, + ["userSnapView"] = true, + ["avionicsLanguage"] = "native", + ["impostors"] = "medium", + ["iconsTheme"] = "nato", + ["map"] = true, + ["weapons"] = false, + ["setGlobal"] = true, + ["geffect"] = "realistic", + }, -- end of ["difficulty"] + ["VR"] = + { + ["use_mouse"] = false, + ["enable"] = true, + ["box_mouse_cursor"] = true, + ["pixel_density"] = 1, + }, -- end of ["VR"] + ["graphics"] = + { + ["OculusRift"] = false, + ["color"] = "32", + ["LensEffects"] = 3, + ["heatBlr"] = 2, + ["scenes"] = "high", + ["water"] = 2, + ["visibRange"] = "High", + ["treesVisibility"] = 25000, + ["aspect"] = 1.25, + ["lights"] = 2, + ["HDR"] = 1, + ["MSAA"] = 2, + ["civTraffic"] = "high", + ["clutterMaxDistance"] = 1500, + ["terrainTextures"] = "max", + ["multiMonitorSetup"] = "1camera", + ["shadowTree"] = true, + ["fullScreen"] = false, + ["disableAero"] = false, + ["DOF"] = 0, + ["clouds"] = 1, + ["flatTerrainShadows"] = 1, + ["cockpitShadows"] = true, + ["height"] = 1024, + ["width"] = 1280, + ["shadows"] = 4, + ["TranspSSAA"] = false, + ["sync"] = true, + ["preloadRadius"] = 73885, + ["anisotropy"] = 2, + ["haze"] = 1, + ["textures"] = 2, + ["effects"] = 3, + }, -- end of ["graphics"] + ["plugins"] = + { + ["CA"] = + { + ["kompass_options"] = 1, + ["ground_target_info"] = true, + ["ground_aim_helper"] = true, + ["ground_platform_shake"] = true, + ["ground_automatic"] = true, + }, -- end of ["CA"] + ["M-2000C"] = + { + ["UNI_NODRIFT"] = false, + ["TDC_"] = false, + ["CPLocalList"] = "default", + ["PPA_TOTPAR"] = false, + ["UNI_ALIGNED"] = false, + }, -- end of ["M-2000C"] + ["A-10C"] = + { + ["CPLocalList"] = "default", + }, -- end of ["A-10C"] + ["FC3"] = + { + ["CPLocalList_F-15C"] = "default", + ["CPLocalList_MiG-29S"] = "default", + ["CPLocalList_MiG-29A"] = "default", + ["CPLocalList_Su-25"] = "default", + ["CPLocalList_A-10A"] = "default", + ["CPLocalList_Su-27"] = "chinese", + ["CPLocalList_MiG-29G"] = "default", + ["CPLocalList_Su-33"] = "default", + }, -- end of ["FC3"] + ["Hawk"] = + { + ["CPLocalList"] = "high", + }, -- end of ["Hawk"] + ["P-51D"] = + { + ["assistance"] = 100, + ["CPLocalList"] = "default", + ["autoRudder"] = false, + }, -- end of ["P-51D"] + ["TF-51D"] = + { + ["assistance"] = 100, + ["CPLocalList"] = "default", + ["autoRudder"] = false, + }, -- end of ["TF-51D"] + ["MiG-21Bis"] = + { + ["Engine"] = false, + ["Shake"] = 100, + ["CustomCockpit"] = false, + ["Reticle"] = false, + ["Freeze"] = false, + }, -- end of ["MiG-21Bis"] + ["F-86F"] = + { + ["landSeatAdjustF86"] = true, + ["aiHelper"] = false, + ["CPLocalList"] = "default", + ["NoseWheelSteeringSimpleBehaviourF86"] = true, + ["gunCamera"] = 0, + }, -- end of ["F-86F"] + ["Su-25T"] = + { + ["CPLocalList"] = "default", + }, -- end of ["Su-25T"] + ["Mi-8MTV2"] = + { + ["Mi8TrimmingMethod"] = 0, + ["Mi8AutopilotAdjustment"] = false, + ["gunCamera"] = 0, + ["controlHelperMi8"] = false, + ["weapTooltipsMi8"] = true, + ["Mi8RudderTrimmer"] = false, + ["CPLocalList"] = "default", + ["altMi8TrimmingMethod"] = false, + ["Mi8FOV"] = 120, + }, -- end of ["Mi-8MTV2"] + ["MiG-15bis"] = + { + ["autoLeanToAimMiG15"] = true, + ["CPLocalList"] = "chinese", + ["gunCamera"] = 0, + ["aiHelper"] = false, + }, -- end of ["MiG-15bis"] + ["FW-190D9"] = + { + ["assistance"] = 100, + ["CPLocalList"] = "default", + ["autoRudder"] = false, + }, -- end of ["FW-190D9"] + ["UH-1H"] = + { + ["UHTrackIRAiming"] = true, + ["autoPilot"] = true, + ["UHTrimmingMethod"] = 0, + ["altUHTrimmingMethod"] = false, + ["CPLocalList"] = "default", + ["weapTooltips"] = true, + ["UHRudderTrimmer"] = false, + }, -- end of ["UH-1H"] + ["Ka-50"] = + { + ["altTrimmingMethod"] = false, + ["Ka50RudderTrimmer"] = false, + ["CPLocalList"] = "english", + }, -- end of ["Ka-50"] + }, -- end of ["plugins"] + ["format"] = 1, + ["sound"] = + { + ["hear_in_helmet"] = false, + ["headphones"] = 100, + ["cockpit"] = 100, + ["GBreathEffect"] = true, + ["gui"] = 100, + ["volume"] = 100, + ["radioSpeech"] = true, + ["music"] = 100, + ["subtitles"] = true, + ["world"] = 100, + }, -- end of ["sound"] + ["views"] = + { + ["cockpit"] = + { + ["mirrors"] = false, + ["reflections"] = false, + ["avionics"] = 3, + ["russianHud"] = false, + }, -- end of ["cockpit"] + }, -- end of ["views"] +} -- end of options diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/warehouses b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/warehouses new file mode 100644 index 000000000..52b43d127 --- /dev/null +++ b/Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones/warehouses @@ -0,0 +1,807 @@ +warehouses = +{ + ["airports"] = + { + [12] = + { + ["gasoline"] = + { + ["InitFuel"] = 100, + }, -- end of ["gasoline"] + ["unlimitedMunitions"] = true, + ["methanol_mixture"] = + { + ["InitFuel"] = 100, + }, -- end of ["methanol_mixture"] + ["OperatingLevel_Air"] = 10, + ["diesel"] = + { + ["InitFuel"] = 100, + }, -- end of ["diesel"] + ["speed"] = 16.666666, + ["size"] = 100, + ["periodicity"] = 30, + ["suppliers"] = + { + }, -- end of ["suppliers"] + ["coalition"] = "RED", + ["jet_fuel"] = + { + ["InitFuel"] = 100, + }, -- end of ["jet_fuel"] + ["OperatingLevel_Eqp"] = 10, + ["unlimitedFuel"] = true, + ["aircrafts"] = + { + }, -- end of ["aircrafts"] + ["weapons"] = + { + }, -- end of ["weapons"] + ["OperatingLevel_Fuel"] = 10, + ["unlimitedAircrafts"] = true, + }, -- end of [12] + [13] = + { + ["gasoline"] = + { + ["InitFuel"] = 100, + }, -- end of ["gasoline"] + ["unlimitedMunitions"] = true, + ["methanol_mixture"] = + { + ["InitFuel"] = 100, + }, -- end of ["methanol_mixture"] + ["OperatingLevel_Air"] = 10, + ["diesel"] = + { + ["InitFuel"] = 100, + }, -- end of ["diesel"] + ["speed"] = 16.666666, + ["size"] = 100, + ["periodicity"] = 30, + ["suppliers"] = + { + }, -- end of ["suppliers"] + ["coalition"] = "BLUE", + ["jet_fuel"] = + { + ["InitFuel"] = 100, + }, -- end of ["jet_fuel"] + ["OperatingLevel_Eqp"] = 10, + ["unlimitedFuel"] = true, + ["aircrafts"] = + { + }, -- end of ["aircrafts"] + ["weapons"] = + { + }, -- end of ["weapons"] + ["OperatingLevel_Fuel"] = 10, + ["unlimitedAircrafts"] = true, + }, -- end of [13] + [14] = + { + ["gasoline"] = + { + ["InitFuel"] = 100, + }, -- end of ["gasoline"] + ["unlimitedMunitions"] = true, + ["methanol_mixture"] = + { + ["InitFuel"] = 100, + }, -- end of ["methanol_mixture"] + ["OperatingLevel_Air"] = 10, + ["diesel"] = + { + ["InitFuel"] = 100, + }, -- end of ["diesel"] + ["speed"] = 16.666666, + ["size"] = 100, + ["periodicity"] = 30, + ["suppliers"] = + { + }, -- end of ["suppliers"] + ["coalition"] = "RED", + ["jet_fuel"] = + { + ["InitFuel"] = 100, + }, -- end of ["jet_fuel"] + ["OperatingLevel_Eqp"] = 10, + ["unlimitedFuel"] = true, + ["aircrafts"] = + { + }, -- end of ["aircrafts"] + ["weapons"] = + { + }, -- end of ["weapons"] + ["OperatingLevel_Fuel"] = 10, + ["unlimitedAircrafts"] = true, + }, -- end of [14] + [15] = + { + ["gasoline"] = + { + ["InitFuel"] = 100, + }, -- end of ["gasoline"] + ["unlimitedMunitions"] = true, + ["methanol_mixture"] = + { + ["InitFuel"] = 100, + }, -- end of ["methanol_mixture"] + ["OperatingLevel_Air"] = 10, + ["diesel"] = + { + ["InitFuel"] = 100, + }, -- end of ["diesel"] + ["speed"] = 16.666666, + ["size"] = 100, + ["periodicity"] = 30, + ["suppliers"] = + { + }, -- end of ["suppliers"] + ["coalition"] = "RED", + ["jet_fuel"] = + { + ["InitFuel"] = 100, + }, -- end of ["jet_fuel"] + ["OperatingLevel_Eqp"] = 10, + ["unlimitedFuel"] = true, + ["aircrafts"] = + { + }, -- end of ["aircrafts"] + ["weapons"] = + { + }, -- end of ["weapons"] + ["OperatingLevel_Fuel"] = 10, + ["unlimitedAircrafts"] = true, + }, -- end of [15] + [16] = + { + ["gasoline"] = + { + ["InitFuel"] = 100, + }, -- end of ["gasoline"] + ["unlimitedMunitions"] = true, + ["methanol_mixture"] = + { + ["InitFuel"] = 100, + }, -- end of ["methanol_mixture"] + ["OperatingLevel_Air"] = 10, + ["diesel"] = + { + ["InitFuel"] = 100, + }, -- end of ["diesel"] + ["speed"] = 16.666666, + ["size"] = 100, + ["periodicity"] = 30, + ["suppliers"] = + { + }, -- end of ["suppliers"] + ["coalition"] = "BLUE", + ["jet_fuel"] = + { + ["InitFuel"] = 100, + }, -- end of ["jet_fuel"] + ["OperatingLevel_Eqp"] = 10, + ["unlimitedFuel"] = true, + ["aircrafts"] = + { + }, -- end of ["aircrafts"] + ["weapons"] = + { + }, -- end of ["weapons"] + ["OperatingLevel_Fuel"] = 10, + ["unlimitedAircrafts"] = true, + }, -- end of [16] + [17] = + { + ["gasoline"] = + { + ["InitFuel"] = 100, + }, -- end of ["gasoline"] + ["unlimitedMunitions"] = true, + ["methanol_mixture"] = + { + ["InitFuel"] = 100, + }, -- end of ["methanol_mixture"] + ["OperatingLevel_Air"] = 10, + ["diesel"] = + { + ["InitFuel"] = 100, + }, -- end of ["diesel"] + ["speed"] = 16.666666, + ["size"] = 100, + ["periodicity"] = 30, + ["suppliers"] = + { + }, -- end of ["suppliers"] + ["coalition"] = "NEUTRAL", + ["jet_fuel"] = + { + ["InitFuel"] = 100, + }, -- end of ["jet_fuel"] + ["OperatingLevel_Eqp"] = 10, + ["unlimitedFuel"] = true, + ["aircrafts"] = + { + }, -- end of ["aircrafts"] + ["weapons"] = + { + }, -- end of ["weapons"] + ["OperatingLevel_Fuel"] = 10, + ["unlimitedAircrafts"] = true, + }, -- end of [17] + [18] = + { + ["gasoline"] = + { + ["InitFuel"] = 100, + }, -- end of ["gasoline"] + ["unlimitedMunitions"] = true, + ["methanol_mixture"] = + { + ["InitFuel"] = 100, + }, -- end of ["methanol_mixture"] + ["OperatingLevel_Air"] = 10, + ["diesel"] = + { + ["InitFuel"] = 100, + }, -- end of ["diesel"] + ["speed"] = 16.666666, + ["size"] = 100, + ["periodicity"] = 30, + ["suppliers"] = + { + }, -- end of ["suppliers"] + ["coalition"] = "NEUTRAL", + ["jet_fuel"] = + { + ["InitFuel"] = 100, + }, -- end of ["jet_fuel"] + ["OperatingLevel_Eqp"] = 10, + ["unlimitedFuel"] = true, + ["aircrafts"] = + { + }, -- end of ["aircrafts"] + ["weapons"] = + { + }, -- end of ["weapons"] + ["OperatingLevel_Fuel"] = 10, + ["unlimitedAircrafts"] = true, + }, -- end of [18] + [19] = + { + ["gasoline"] = + { + ["InitFuel"] = 100, + }, -- end of ["gasoline"] + ["unlimitedMunitions"] = true, + ["methanol_mixture"] = + { + ["InitFuel"] = 100, + }, -- end of ["methanol_mixture"] + ["OperatingLevel_Air"] = 10, + ["diesel"] = + { + ["InitFuel"] = 100, + }, -- end of ["diesel"] + ["speed"] = 16.666666, + ["size"] = 100, + ["periodicity"] = 30, + ["suppliers"] = + { + }, -- end of ["suppliers"] + ["coalition"] = "NEUTRAL", + ["jet_fuel"] = + { + ["InitFuel"] = 100, + }, -- end of ["jet_fuel"] + ["OperatingLevel_Eqp"] = 10, + ["unlimitedFuel"] = true, + ["aircrafts"] = + { + }, -- end of ["aircrafts"] + ["weapons"] = + { + }, -- end of ["weapons"] + ["OperatingLevel_Fuel"] = 10, + ["unlimitedAircrafts"] = true, + }, -- end of [19] + [20] = + { + ["gasoline"] = + { + ["InitFuel"] = 100, + }, -- end of ["gasoline"] + ["unlimitedMunitions"] = true, + ["methanol_mixture"] = + { + ["InitFuel"] = 100, + }, -- end of ["methanol_mixture"] + ["OperatingLevel_Air"] = 10, + ["diesel"] = + { + ["InitFuel"] = 100, + }, -- end of ["diesel"] + ["speed"] = 16.666666, + ["size"] = 100, + ["periodicity"] = 30, + ["suppliers"] = + { + }, -- end of ["suppliers"] + ["coalition"] = "NEUTRAL", + ["jet_fuel"] = + { + ["InitFuel"] = 100, + }, -- end of ["jet_fuel"] + ["OperatingLevel_Eqp"] = 10, + ["unlimitedFuel"] = true, + ["aircrafts"] = + { + }, -- end of ["aircrafts"] + ["weapons"] = + { + }, -- end of ["weapons"] + ["OperatingLevel_Fuel"] = 10, + ["unlimitedAircrafts"] = true, + }, -- end of [20] + [21] = + { + ["gasoline"] = + { + ["InitFuel"] = 100, + }, -- end of ["gasoline"] + ["unlimitedMunitions"] = true, + ["methanol_mixture"] = + { + ["InitFuel"] = 100, + }, -- end of ["methanol_mixture"] + ["OperatingLevel_Air"] = 10, + ["diesel"] = + { + ["InitFuel"] = 100, + }, -- end of ["diesel"] + ["speed"] = 16.666666, + ["size"] = 100, + ["periodicity"] = 30, + ["suppliers"] = + { + }, -- end of ["suppliers"] + ["coalition"] = "NEUTRAL", + ["jet_fuel"] = + { + ["InitFuel"] = 100, + }, -- end of ["jet_fuel"] + ["OperatingLevel_Eqp"] = 10, + ["unlimitedFuel"] = true, + ["aircrafts"] = + { + }, -- end of ["aircrafts"] + ["weapons"] = + { + }, -- end of ["weapons"] + ["OperatingLevel_Fuel"] = 10, + ["unlimitedAircrafts"] = true, + }, -- end of [21] + [22] = + { + ["gasoline"] = + { + ["InitFuel"] = 100, + }, -- end of ["gasoline"] + ["unlimitedMunitions"] = true, + ["methanol_mixture"] = + { + ["InitFuel"] = 100, + }, -- end of ["methanol_mixture"] + ["OperatingLevel_Air"] = 10, + ["diesel"] = + { + ["InitFuel"] = 100, + }, -- end of ["diesel"] + ["speed"] = 16.666666, + ["size"] = 100, + ["periodicity"] = 30, + ["suppliers"] = + { + }, -- end of ["suppliers"] + ["coalition"] = "NEUTRAL", + ["jet_fuel"] = + { + ["InitFuel"] = 100, + }, -- end of ["jet_fuel"] + ["OperatingLevel_Eqp"] = 10, + ["unlimitedFuel"] = true, + ["aircrafts"] = + { + }, -- end of ["aircrafts"] + ["weapons"] = + { + }, -- end of ["weapons"] + ["OperatingLevel_Fuel"] = 10, + ["unlimitedAircrafts"] = true, + }, -- end of [22] + [23] = + { + ["gasoline"] = + { + ["InitFuel"] = 100, + }, -- end of ["gasoline"] + ["unlimitedMunitions"] = true, + ["methanol_mixture"] = + { + ["InitFuel"] = 100, + }, -- end of ["methanol_mixture"] + ["OperatingLevel_Air"] = 10, + ["diesel"] = + { + ["InitFuel"] = 100, + }, -- end of ["diesel"] + ["speed"] = 16.666666, + ["size"] = 100, + ["periodicity"] = 30, + ["suppliers"] = + { + }, -- end of ["suppliers"] + ["coalition"] = "NEUTRAL", + ["jet_fuel"] = + { + ["InitFuel"] = 100, + }, -- end of ["jet_fuel"] + ["OperatingLevel_Eqp"] = 10, + ["unlimitedFuel"] = true, + ["aircrafts"] = + { + }, -- end of ["aircrafts"] + ["weapons"] = + { + }, -- end of ["weapons"] + ["OperatingLevel_Fuel"] = 10, + ["unlimitedAircrafts"] = true, + }, -- end of [23] + [24] = + { + ["gasoline"] = + { + ["InitFuel"] = 100, + }, -- end of ["gasoline"] + ["unlimitedMunitions"] = true, + ["methanol_mixture"] = + { + ["InitFuel"] = 100, + }, -- end of ["methanol_mixture"] + ["OperatingLevel_Air"] = 10, + ["diesel"] = + { + ["InitFuel"] = 100, + }, -- end of ["diesel"] + ["speed"] = 16.666666, + ["size"] = 100, + ["periodicity"] = 30, + ["suppliers"] = + { + }, -- end of ["suppliers"] + ["coalition"] = "NEUTRAL", + ["jet_fuel"] = + { + ["InitFuel"] = 100, + }, -- end of ["jet_fuel"] + ["OperatingLevel_Eqp"] = 10, + ["unlimitedFuel"] = true, + ["aircrafts"] = + { + }, -- end of ["aircrafts"] + ["weapons"] = + { + }, -- end of ["weapons"] + ["OperatingLevel_Fuel"] = 10, + ["unlimitedAircrafts"] = true, + }, -- end of [24] + [25] = + { + ["gasoline"] = + { + ["InitFuel"] = 100, + }, -- end of ["gasoline"] + ["unlimitedMunitions"] = true, + ["methanol_mixture"] = + { + ["InitFuel"] = 100, + }, -- end of ["methanol_mixture"] + ["OperatingLevel_Air"] = 10, + ["diesel"] = + { + ["InitFuel"] = 100, + }, -- end of ["diesel"] + ["speed"] = 16.666666, + ["size"] = 100, + ["periodicity"] = 30, + ["suppliers"] = + { + }, -- end of ["suppliers"] + ["coalition"] = "NEUTRAL", + ["jet_fuel"] = + { + ["InitFuel"] = 100, + }, -- end of ["jet_fuel"] + ["OperatingLevel_Eqp"] = 10, + ["unlimitedFuel"] = true, + ["aircrafts"] = + { + }, -- end of ["aircrafts"] + ["weapons"] = + { + }, -- end of ["weapons"] + ["OperatingLevel_Fuel"] = 10, + ["unlimitedAircrafts"] = true, + }, -- end of [25] + [26] = + { + ["gasoline"] = + { + ["InitFuel"] = 100, + }, -- end of ["gasoline"] + ["unlimitedMunitions"] = true, + ["methanol_mixture"] = + { + ["InitFuel"] = 100, + }, -- end of ["methanol_mixture"] + ["OperatingLevel_Air"] = 10, + ["diesel"] = + { + ["InitFuel"] = 100, + }, -- end of ["diesel"] + ["speed"] = 16.666666, + ["size"] = 100, + ["periodicity"] = 30, + ["suppliers"] = + { + }, -- end of ["suppliers"] + ["coalition"] = "NEUTRAL", + ["jet_fuel"] = + { + ["InitFuel"] = 100, + }, -- end of ["jet_fuel"] + ["OperatingLevel_Eqp"] = 10, + ["unlimitedFuel"] = true, + ["aircrafts"] = + { + }, -- end of ["aircrafts"] + ["weapons"] = + { + }, -- end of ["weapons"] + ["OperatingLevel_Fuel"] = 10, + ["unlimitedAircrafts"] = true, + }, -- end of [26] + [27] = + { + ["gasoline"] = + { + ["InitFuel"] = 100, + }, -- end of ["gasoline"] + ["unlimitedMunitions"] = true, + ["methanol_mixture"] = + { + ["InitFuel"] = 100, + }, -- end of ["methanol_mixture"] + ["OperatingLevel_Air"] = 10, + ["diesel"] = + { + ["InitFuel"] = 100, + }, -- end of ["diesel"] + ["speed"] = 16.666666, + ["size"] = 100, + ["periodicity"] = 30, + ["suppliers"] = + { + }, -- end of ["suppliers"] + ["coalition"] = "NEUTRAL", + ["jet_fuel"] = + { + ["InitFuel"] = 100, + }, -- end of ["jet_fuel"] + ["OperatingLevel_Eqp"] = 10, + ["unlimitedFuel"] = true, + ["aircrafts"] = + { + }, -- end of ["aircrafts"] + ["weapons"] = + { + }, -- end of ["weapons"] + ["OperatingLevel_Fuel"] = 10, + ["unlimitedAircrafts"] = true, + }, -- end of [27] + [28] = + { + ["gasoline"] = + { + ["InitFuel"] = 100, + }, -- end of ["gasoline"] + ["unlimitedMunitions"] = true, + ["methanol_mixture"] = + { + ["InitFuel"] = 100, + }, -- end of ["methanol_mixture"] + ["OperatingLevel_Air"] = 10, + ["diesel"] = + { + ["InitFuel"] = 100, + }, -- end of ["diesel"] + ["speed"] = 16.666666, + ["size"] = 100, + ["periodicity"] = 30, + ["suppliers"] = + { + }, -- end of ["suppliers"] + ["coalition"] = "NEUTRAL", + ["jet_fuel"] = + { + ["InitFuel"] = 100, + }, -- end of ["jet_fuel"] + ["OperatingLevel_Eqp"] = 10, + ["unlimitedFuel"] = true, + ["aircrafts"] = + { + }, -- end of ["aircrafts"] + ["weapons"] = + { + }, -- end of ["weapons"] + ["OperatingLevel_Fuel"] = 10, + ["unlimitedAircrafts"] = true, + }, -- end of [28] + [29] = + { + ["gasoline"] = + { + ["InitFuel"] = 100, + }, -- end of ["gasoline"] + ["unlimitedMunitions"] = true, + ["methanol_mixture"] = + { + ["InitFuel"] = 100, + }, -- end of ["methanol_mixture"] + ["OperatingLevel_Air"] = 10, + ["diesel"] = + { + ["InitFuel"] = 100, + }, -- end of ["diesel"] + ["speed"] = 16.666666, + ["size"] = 100, + ["periodicity"] = 30, + ["suppliers"] = + { + }, -- end of ["suppliers"] + ["coalition"] = "NEUTRAL", + ["jet_fuel"] = + { + ["InitFuel"] = 100, + }, -- end of ["jet_fuel"] + ["OperatingLevel_Eqp"] = 10, + ["unlimitedFuel"] = true, + ["aircrafts"] = + { + }, -- end of ["aircrafts"] + ["weapons"] = + { + }, -- end of ["weapons"] + ["OperatingLevel_Fuel"] = 10, + ["unlimitedAircrafts"] = true, + }, -- end of [29] + [30] = + { + ["gasoline"] = + { + ["InitFuel"] = 100, + }, -- end of ["gasoline"] + ["unlimitedMunitions"] = true, + ["methanol_mixture"] = + { + ["InitFuel"] = 100, + }, -- end of ["methanol_mixture"] + ["OperatingLevel_Air"] = 10, + ["diesel"] = + { + ["InitFuel"] = 100, + }, -- end of ["diesel"] + ["speed"] = 16.666666, + ["size"] = 100, + ["periodicity"] = 30, + ["suppliers"] = + { + }, -- end of ["suppliers"] + ["coalition"] = "NEUTRAL", + ["jet_fuel"] = + { + ["InitFuel"] = 100, + }, -- end of ["jet_fuel"] + ["OperatingLevel_Eqp"] = 10, + ["unlimitedFuel"] = true, + ["aircrafts"] = + { + }, -- end of ["aircrafts"] + ["weapons"] = + { + }, -- end of ["weapons"] + ["OperatingLevel_Fuel"] = 10, + ["unlimitedAircrafts"] = true, + }, -- end of [30] + [31] = + { + ["gasoline"] = + { + ["InitFuel"] = 100, + }, -- end of ["gasoline"] + ["unlimitedMunitions"] = true, + ["methanol_mixture"] = + { + ["InitFuel"] = 100, + }, -- end of ["methanol_mixture"] + ["OperatingLevel_Air"] = 10, + ["diesel"] = + { + ["InitFuel"] = 100, + }, -- end of ["diesel"] + ["speed"] = 16.666666, + ["size"] = 100, + ["periodicity"] = 30, + ["suppliers"] = + { + }, -- end of ["suppliers"] + ["coalition"] = "NEUTRAL", + ["jet_fuel"] = + { + ["InitFuel"] = 100, + }, -- end of ["jet_fuel"] + ["OperatingLevel_Eqp"] = 10, + ["unlimitedFuel"] = true, + ["aircrafts"] = + { + }, -- end of ["aircrafts"] + ["weapons"] = + { + }, -- end of ["weapons"] + ["OperatingLevel_Fuel"] = 10, + ["unlimitedAircrafts"] = true, + }, -- end of [31] + [32] = + { + ["gasoline"] = + { + ["InitFuel"] = 100, + }, -- end of ["gasoline"] + ["unlimitedMunitions"] = true, + ["methanol_mixture"] = + { + ["InitFuel"] = 100, + }, -- end of ["methanol_mixture"] + ["OperatingLevel_Air"] = 10, + ["diesel"] = + { + ["InitFuel"] = 100, + }, -- end of ["diesel"] + ["speed"] = 16.666666, + ["size"] = 100, + ["periodicity"] = 30, + ["suppliers"] = + { + }, -- end of ["suppliers"] + ["coalition"] = "NEUTRAL", + ["jet_fuel"] = + { + ["InitFuel"] = 100, + }, -- end of ["jet_fuel"] + ["OperatingLevel_Eqp"] = 10, + ["unlimitedFuel"] = true, + ["aircrafts"] = + { + }, -- end of ["aircrafts"] + ["weapons"] = + { + }, -- end of ["weapons"] + ["OperatingLevel_Fuel"] = 10, + ["unlimitedAircrafts"] = true, + }, -- end of [32] + }, -- end of ["airports"] + ["warehouses"] = + { + }, -- end of ["warehouses"] +} -- end of warehouses diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-006 - Declutter AI at Airbases/AIB-006 - Declutter AI at Airbases.lua b/Moose Test Missions/AIB - AI Balancing/AIB-006 - Declutter AI at Airbases/AIB-006 - Declutter AI at Airbases.lua index 650aca254..1b604a94f 100644 --- a/Moose Test Missions/AIB - AI Balancing/AIB-006 - Declutter AI at Airbases/AIB-006 - Declutter AI at Airbases.lua +++ b/Moose Test Missions/AIB - AI Balancing/AIB-006 - Declutter AI at Airbases/AIB-006 - Declutter AI at Airbases.lua @@ -35,7 +35,7 @@ local PatrolZone1 = ZONE_POLYGON:New( "PatrolZone1", PatrolZoneGroup1 ) function RU_AI_Balancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup ) - local Patrol = AI_PATROLZONE:New( PatrolZone1, 3000, 6000, 400, 600 ) + local Patrol = AI_PATROL_ZONE:New( PatrolZone1, 3000, 6000, 400, 600 ) Patrol:ManageFuel( 0.2, 60 ) Patrol:SetControllable( AIGroup ) Patrol:__Start( 5 ) diff --git a/Moose Test Missions/AIB - AI Balancing/AIB-006 - Declutter AI at Airbases/AIB-006 - Declutter AI at Airbases.miz b/Moose Test Missions/AIB - AI Balancing/AIB-006 - Declutter AI at Airbases/AIB-006 - Declutter AI at Airbases.miz index f2ae2b38b..eb1db3feb 100644 Binary files a/Moose Test Missions/AIB - AI Balancing/AIB-006 - Declutter AI at Airbases/AIB-006 - Declutter AI at Airbases.miz and b/Moose Test Missions/AIB - AI Balancing/AIB-006 - Declutter AI at Airbases/AIB-006 - Declutter AI at Airbases.miz differ diff --git a/Moose Test Missions/CAP - Combat Air Patrol/CAP-001 - Combat Air Patrol/CAP-001 - Combat Air Patrol.lua b/Moose Test Missions/CAP - Combat Air Patrol/CAP-001 - Combat Air Patrol/CAP-001 - Combat Air Patrol.lua new file mode 100644 index 000000000..92d27b1b2 --- /dev/null +++ b/Moose Test Missions/CAP - Combat Air Patrol/CAP-001 - Combat Air Patrol/CAP-001 - Combat Air Patrol.lua @@ -0,0 +1,18 @@ +-- Name: CAP-001 - Combat Air Patrol +-- Author: FlightControl +-- Date Created: 16 January 2017 +-- +-- # Situation: +-- +-- # Test cases: +-- + +local CapPlane = GROUP:FindByName( "Plane" ) + +local PatrolZone = ZONE:New( "Patrol Zone" ) + +local AICapZone = AI_CAP_ZONE:New( PatrolZone, 500, 1000, 500, 600 ) + +AICapZone:SetControllable( CapPlane ) + +AICapZone:__Start( 1 ) -- They should statup, and start patrolling in the PatrolZone. diff --git a/Moose Test Missions/CAP - Combat Air Patrol/CAP-001 - Combat Air Patrol/CAP-001 - Combat Air Patrol.miz b/Moose Test Missions/CAP - Combat Air Patrol/CAP-001 - Combat Air Patrol/CAP-001 - Combat Air Patrol.miz new file mode 100644 index 000000000..ac476310f Binary files /dev/null and b/Moose Test Missions/CAP - Combat Air Patrol/CAP-001 - Combat Air Patrol/CAP-001 - Combat Air Patrol.miz differ diff --git a/Moose Test Missions/CAP - Combat Air Patrol/CAP-010 - CAP and Engage within Range/CAP-010 - CAP and Engage within Range.lua b/Moose Test Missions/CAP - Combat Air Patrol/CAP-010 - CAP and Engage within Range/CAP-010 - CAP and Engage within Range.lua new file mode 100644 index 000000000..283396d73 --- /dev/null +++ b/Moose Test Missions/CAP - Combat Air Patrol/CAP-010 - CAP and Engage within Range/CAP-010 - CAP and Engage within Range.lua @@ -0,0 +1,19 @@ +-- Name: CAP-001 - Combat Air Patrol +-- Author: FlightControl +-- Date Created: 16 January 2017 +-- +-- # Situation: +-- +-- # Test cases: +-- + +local CapPlane = GROUP:FindByName( "Plane" ) + +local PatrolZone = ZONE:New( "Patrol Zone" ) + +local AICapZone = AI_CAP_ZONE:New( PatrolZone, 500, 1000, 500, 600 ) + +AICapZone:SetControllable( CapPlane ) +AICapZone:SetEngageRange( 20000 ) -- Set the Engage Range to 20.000 meters. The AI won't engage when the enemy is beyond 20.000 meters. + +AICapZone:__Start( 1 ) -- They should statup, and start patrolling in the PatrolZone. diff --git a/Moose Test Missions/CAP - Combat Air Patrol/CAP-010 - CAP and Engage within Range/CAP-010 - CAP and Engage within Range.miz b/Moose Test Missions/CAP - Combat Air Patrol/CAP-010 - CAP and Engage within Range/CAP-010 - CAP and Engage within Range.miz new file mode 100644 index 000000000..83dc5b234 Binary files /dev/null and b/Moose Test Missions/CAP - Combat Air Patrol/CAP-010 - CAP and Engage within Range/CAP-010 - CAP and Engage within Range.miz differ diff --git a/Moose Test Missions/CAP - Combat Air Patrol/CAP-010 - CAP and Engage within Zone/CAP-010 - CAP and Engage within Zone.lua b/Moose Test Missions/CAP - Combat Air Patrol/CAP-010 - CAP and Engage within Zone/CAP-010 - CAP and Engage within Zone.lua new file mode 100644 index 000000000..5e911a096 --- /dev/null +++ b/Moose Test Missions/CAP - Combat Air Patrol/CAP-010 - CAP and Engage within Zone/CAP-010 - CAP and Engage within Zone.lua @@ -0,0 +1,23 @@ +-- Name: CAP-001 - Combat Air Patrol +-- Author: FlightControl +-- Date Created: 16 January 2017 +-- +-- # Situation: +-- +-- # Test cases: +-- + +local CapPlane = GROUP:FindByName( "Plane" ) + +local PatrolZone = ZONE:New( "Patrol Zone" ) + +local AICapZone = AI_CAP_ZONE:New( PatrolZone, 500, 1000, 500, 600 ) + +local EngageZoneGroup = GROUP:FindByName( "Engage Zone" ) + +local CapEngageZone = ZONE_POLYGON:New( "Engage Zone", EngageZoneGroup ) + +AICapZone:SetControllable( CapPlane ) +AICapZone:SetEngageZone( CapEngageZone ) -- Set the Engage Zone. The AI will only engage when the bogeys are within the CapEngageZone. + +AICapZone:__Start( 1 ) -- They should statup, and start patrolling in the PatrolZone. diff --git a/Moose Test Missions/CAP - Combat Air Patrol/CAP-010 - CAP and Engage within Zone/CAP-010 - CAP and Engage within Zone.miz b/Moose Test Missions/CAP - Combat Air Patrol/CAP-010 - CAP and Engage within Zone/CAP-010 - CAP and Engage within Zone.miz new file mode 100644 index 000000000..818f3886c Binary files /dev/null and b/Moose Test Missions/CAP - Combat Air Patrol/CAP-010 - CAP and Engage within Zone/CAP-010 - CAP and Engage within Zone.miz differ diff --git a/Moose Test Missions/CAS - Close Air Support/CAS-001 - CAS in a ZONE/CAS-001 - CAS in a ZONE.lua b/Moose Test Missions/CAS - Close Air Support/CAS-001 - CAS in a ZONE/CAS-001 - CAS in a ZONE.lua new file mode 100644 index 000000000..f5f267f69 --- /dev/null +++ b/Moose Test Missions/CAS - Close Air Support/CAS-001 - CAS in a ZONE/CAS-001 - CAS in a ZONE.lua @@ -0,0 +1,59 @@ +-- Name: CAS in a ZONE +-- Author: FlightControl +-- Date Created: 13 January 2017 +-- +-- # Situation: +-- +-- # Test cases: +-- +-- Create a local variable (in this case called CASEngagementZone) and +-- using the ZONE function find the pre-defined zone called "Engagement Zone" +-- currently on the map and assign it to this variable +local CASEngagementZone = ZONE:New( "Engagement Zone" ) + +-- Create a local variable (in this case called CASPlane) and +-- using the GROUP function find the aircraft group called "Plane" and assign to this variable +local CASPlane = GROUP:FindByName( "Plane" ) + +-- Create a local Variable (in this cased called PatrolZone and +-- using the ZONE function find the pre-defined zone called "Patrol Zone" and assign it to this variable +local PatrolZone = ZONE:New( "Patrol Zone" ) + +-- Create and object (in this case called AICasZone) and +-- using the functions AI_CAS_ZONE assign the parameters that define this object +-- (in this case PatrolZone, 500, 1000, 500, 600, CASEngagementZone) +local AICasZone = AI_CAS_ZONE:New( PatrolZone, 500, 1000, 500, 600, CASEngagementZone ) + +-- Create an object (in this case called Targets) and +-- using the GROUP function find the group labeled "Targets" and assign it to this object +local Targets = GROUP:FindByName("Targets") + + +-- Tell the program to use the object (in this case called CASPlane) as the group to use in the CAS function +AICasZone:SetControllable( CASPlane ) + +-- Tell the group CASPlane to start the mission in 1 second. +AICasZone:__Start( 1 ) -- They should statup, and start patrolling in the PatrolZone. + +-- After 10 minutes, tell the group CASPlane to engage the targets located in the engagement zone called CASEngagement Zone. (600 is 600 seconds) +AICasZone:__Engage( 600 ) + +-- Check every 60 seconds whether the Targets have been eliminated. +-- When the trigger completed has been fired, the Plane will go back to the Patrol Zone. +Check, CheckScheduleID = SCHEDULER:New(nil, + function() + BASE:E( { "In Scheduler: ", Targets:GetSize() } ) + if Targets:IsAlive() and Targets:GetSize() > 5 then + BASE:E("Still alive") + else + BASE:E("Destroyed") + AICasZone:__Accomplish( 1 ) -- Now they should fly back to teh patrolzone and patrol. + Check:Stop(CheckScheduleID) + end + end, {}, 20, 60, 0.2 ) + + +-- When the targets in the zone are destroyed, (see scheduled function), the planes will return home ... +function AICasZone:OnAfterAccomplish( Controllable, From, Event, To ) + AICasZone:__RTB( 1 ) +end diff --git a/Moose Test Missions/CAS - Close Air Support/CAS-001 - CAS in a ZONE/CAS-001 - CAS in a ZONE.miz b/Moose Test Missions/CAS - Close Air Support/CAS-001 - CAS in a ZONE/CAS-001 - CAS in a ZONE.miz new file mode 100644 index 000000000..698e0358a Binary files /dev/null and b/Moose Test Missions/CAS - Close Air Support/CAS-001 - CAS in a ZONE/CAS-001 - CAS in a ZONE.miz differ diff --git a/Moose Test Missions/CAS - Close Air Support/CAS-001 - CAS in a ZONE/CAS-001 - Manual Test.miz b/Moose Test Missions/CAS - Close Air Support/CAS-001 - CAS in a ZONE/CAS-001 - Manual Test.miz new file mode 100644 index 000000000..a4be72495 Binary files /dev/null and b/Moose Test Missions/CAS - Close Air Support/CAS-001 - CAS in a ZONE/CAS-001 - Manual Test.miz differ diff --git a/Moose Test Missions/CGO - Cargo/CGO-001 - Unit Boarding/CGO-001 - Unit Boarding.miz b/Moose Test Missions/CGO - Cargo/CGO-001 - Unit Boarding/CGO-001 - Unit Boarding.miz index 808322184..408240b41 100644 Binary files a/Moose Test Missions/CGO - Cargo/CGO-001 - Unit Boarding/CGO-001 - Unit Boarding.miz and b/Moose Test Missions/CGO - Cargo/CGO-001 - Unit Boarding/CGO-001 - Unit Boarding.miz differ diff --git a/Moose Test Missions/CGO - Cargo/CGO-002 - Unit Unboarding/CGO-002 - Unit Unboarding.miz b/Moose Test Missions/CGO - Cargo/CGO-002 - Unit Unboarding/CGO-002 - Unit Unboarding.miz index c24e68a17..9e8678047 100644 Binary files a/Moose Test Missions/CGO - Cargo/CGO-002 - Unit Unboarding/CGO-002 - Unit Unboarding.miz and b/Moose Test Missions/CGO - Cargo/CGO-002 - Unit Unboarding/CGO-002 - Unit Unboarding.miz differ diff --git a/Moose Test Missions/CGO - Cargo/CGO-003 - Unit Transferring/CGO-003 - Unit Transferring.miz b/Moose Test Missions/CGO - Cargo/CGO-003 - Unit Transferring/CGO-003 - Unit Transferring.miz index 2b9ec75de..406d1ea2d 100644 Binary files a/Moose Test Missions/CGO - Cargo/CGO-003 - Unit Transferring/CGO-003 - Unit Transferring.miz and b/Moose Test Missions/CGO - Cargo/CGO-003 - Unit Transferring/CGO-003 - Unit Transferring.miz differ diff --git a/Moose Test Missions/CGO - Cargo/CGO-101 - Group Boarding/CGO-101 - Group Boarding.miz b/Moose Test Missions/CGO - Cargo/CGO-101 - Group Boarding/CGO-101 - Group Boarding.miz index c42e4a6d8..48b4390a6 100644 Binary files a/Moose Test Missions/CGO - Cargo/CGO-101 - Group Boarding/CGO-101 - Group Boarding.miz and b/Moose Test Missions/CGO - Cargo/CGO-101 - Group Boarding/CGO-101 - Group Boarding.miz differ diff --git a/Moose Test Missions/CGO - Cargo/CGO-102 - Group Unboarding/CGO-102 - Group Unboarding.miz b/Moose Test Missions/CGO - Cargo/CGO-102 - Group Unboarding/CGO-102 - Group Unboarding.miz index 979dacd9c..58a83e558 100644 Binary files a/Moose Test Missions/CGO - Cargo/CGO-102 - Group Unboarding/CGO-102 - Group Unboarding.miz and b/Moose Test Missions/CGO - Cargo/CGO-102 - Group Unboarding/CGO-102 - Group Unboarding.miz differ diff --git a/Moose Test Missions/CGO - Cargo/CGO-103 - Group Transferring/CGO-103 - Group Transferring.miz b/Moose Test Missions/CGO - Cargo/CGO-103 - Group Transferring/CGO-103 - Group Transferring.miz index 953b4dfed..8cb8af7fe 100644 Binary files a/Moose Test Missions/CGO - Cargo/CGO-103 - Group Transferring/CGO-103 - Group Transferring.miz and b/Moose Test Missions/CGO - Cargo/CGO-103 - Group Transferring/CGO-103 - Group Transferring.miz differ diff --git a/Moose Test Missions/CGO - Cargo/CGO-201 - Package Boarding/CGO-201 - Package Boarding.miz b/Moose Test Missions/CGO - Cargo/CGO-201 - Package Boarding/CGO-201 - Package Boarding.miz index 5b11724c3..034515f4f 100644 Binary files a/Moose Test Missions/CGO - Cargo/CGO-201 - Package Boarding/CGO-201 - Package Boarding.miz and b/Moose Test Missions/CGO - Cargo/CGO-201 - Package Boarding/CGO-201 - Package Boarding.miz differ diff --git a/Moose Test Missions/CGO - Cargo/CGO-202 - Package Unboarding/CGO-202 - Package Unboarding.miz b/Moose Test Missions/CGO - Cargo/CGO-202 - Package Unboarding/CGO-202 - Package Unboarding.miz index 460568e74..d3d4231ec 100644 Binary files a/Moose Test Missions/CGO - Cargo/CGO-202 - Package Unboarding/CGO-202 - Package Unboarding.miz and b/Moose Test Missions/CGO - Cargo/CGO-202 - Package Unboarding/CGO-202 - Package Unboarding.miz differ diff --git a/Moose Test Missions/DET - Detection/DET-001 - Detection Areas/DET-001 - Detection Areas.miz b/Moose Test Missions/DET - Detection/DET-001 - Detection Areas/DET-001 - Detection Areas.miz index 681ced6f4..670aa650b 100644 Binary files a/Moose Test Missions/DET - Detection/DET-001 - Detection Areas/DET-001 - Detection Areas.miz and b/Moose Test Missions/DET - Detection/DET-001 - Detection Areas/DET-001 - Detection Areas.miz differ diff --git a/Moose Test Missions/DET - Detection/DET-101 - Detection Reporting/DET-101 - Detection Reporting.miz b/Moose Test Missions/DET - Detection/DET-101 - Detection Reporting/DET-101 - Detection Reporting.miz index 33af8db4b..5f8be5603 100644 Binary files a/Moose Test Missions/DET - Detection/DET-101 - Detection Reporting/DET-101 - Detection Reporting.miz and b/Moose Test Missions/DET - Detection/DET-101 - Detection Reporting/DET-101 - Detection Reporting.miz differ diff --git a/Moose Test Missions/ESC - Escorting/ESC-001 - Escorting Helicopters/ESC-001 - Escorting Helicopters.miz b/Moose Test Missions/ESC - Escorting/ESC-001 - Escorting Helicopters/ESC-001 - Escorting Helicopters.miz index 5cfab268c..7186b303d 100644 Binary files a/Moose Test Missions/ESC - Escorting/ESC-001 - Escorting Helicopters/ESC-001 - Escorting Helicopters.miz and b/Moose Test Missions/ESC - Escorting/ESC-001 - Escorting Helicopters/ESC-001 - Escorting Helicopters.miz differ diff --git a/Moose Test Missions/FSM - Finite State Machine/FSM-100 - Transition Explanation/FSM-100 - Transition Explanation.miz b/Moose Test Missions/FSM - Finite State Machine/FSM-100 - Transition Explanation/FSM-100 - Transition Explanation.miz index dfd4b16f3..a5e5ff1aa 100644 Binary files a/Moose Test Missions/FSM - Finite State Machine/FSM-100 - Transition Explanation/FSM-100 - Transition Explanation.miz and b/Moose Test Missions/FSM - Finite State Machine/FSM-100 - Transition Explanation/FSM-100 - Transition Explanation.miz differ diff --git a/Moose Test Missions/GRP - Group Commands/GRP-200 - Follow Group/GRP-200 - Follow Group.miz b/Moose Test Missions/GRP - Group Commands/GRP-200 - Follow Group/GRP-200 - Follow Group.miz index 639da8b1a..014ce79c4 100644 Binary files a/Moose Test Missions/GRP - Group Commands/GRP-200 - Follow Group/GRP-200 - Follow Group.miz and b/Moose Test Missions/GRP - Group Commands/GRP-200 - Follow Group/GRP-200 - Follow Group.miz differ diff --git a/Moose Test Missions/GRP - Group Commands/GRP-300 - Switch WayPoints/GRP-300 - Switch WayPoints.miz b/Moose Test Missions/GRP - Group Commands/GRP-300 - Switch WayPoints/GRP-300 - Switch WayPoints.miz index 5d0e79229..e8d7f7209 100644 Binary files a/Moose Test Missions/GRP - Group Commands/GRP-300 - Switch WayPoints/GRP-300 - Switch WayPoints.miz and b/Moose Test Missions/GRP - Group Commands/GRP-300 - Switch WayPoints/GRP-300 - Switch WayPoints.miz differ diff --git a/Moose Test Missions/GRP - Group Commands/Moose_Test_WRAPPER.miz b/Moose Test Missions/GRP - Group Commands/Moose_Test_WRAPPER.miz index 1fc0bef9d..948a18e31 100644 Binary files a/Moose Test Missions/GRP - Group Commands/Moose_Test_WRAPPER.miz and b/Moose Test Missions/GRP - Group Commands/Moose_Test_WRAPPER.miz differ diff --git a/Moose Test Missions/MEN - Menu Options/MEN-001 - Menu Client/MEN-001 - Menu Client.miz b/Moose Test Missions/MEN - Menu Options/MEN-001 - Menu Client/MEN-001 - Menu Client.miz index b769d6e13..6c64db365 100644 Binary files a/Moose Test Missions/MEN - Menu Options/MEN-001 - Menu Client/MEN-001 - Menu Client.miz and b/Moose Test Missions/MEN - Menu Options/MEN-001 - Menu Client/MEN-001 - Menu Client.miz differ diff --git a/Moose Test Missions/MEN - Menu Options/MEN-002 - Menu Coalition/MEN-002 - Menu Coalition.miz b/Moose Test Missions/MEN - Menu Options/MEN-002 - Menu Coalition/MEN-002 - Menu Coalition.miz index 3604ea088..63d3e306c 100644 Binary files a/Moose Test Missions/MEN - Menu Options/MEN-002 - Menu Coalition/MEN-002 - Menu Coalition.miz and b/Moose Test Missions/MEN - Menu Options/MEN-002 - Menu Coalition/MEN-002 - Menu Coalition.miz differ diff --git a/Moose Test Missions/MEN - Menu Options/MEN-003 - Menu Group/MEN-003 - Menu Group.miz b/Moose Test Missions/MEN - Menu Options/MEN-003 - Menu Group/MEN-003 - Menu Group.miz index 7feb24ab7..40723eeb2 100644 Binary files a/Moose Test Missions/MEN - Menu Options/MEN-003 - Menu Group/MEN-003 - Menu Group.miz and b/Moose Test Missions/MEN - Menu Options/MEN-003 - Menu Group/MEN-003 - Menu Group.miz differ diff --git a/Moose Test Missions/MIT - Missile Trainer/MIT-001 - Missile Trainer/MIT-001 - Missile Trainer.miz b/Moose Test Missions/MIT - Missile Trainer/MIT-001 - Missile Trainer/MIT-001 - Missile Trainer.miz index b2efbcb21..89e89d96b 100644 Binary files a/Moose Test Missions/MIT - Missile Trainer/MIT-001 - Missile Trainer/MIT-001 - Missile Trainer.miz and b/Moose Test Missions/MIT - Missile Trainer/MIT-001 - Missile Trainer/MIT-001 - Missile Trainer.miz differ diff --git a/Moose Test Missions/MOOSE_Test_Template.miz b/Moose Test Missions/MOOSE_Test_Template.miz index e3c65b88d..e272cfdad 100644 Binary files a/Moose Test Missions/MOOSE_Test_Template.miz and b/Moose Test Missions/MOOSE_Test_Template.miz differ diff --git a/Moose Test Missions/PAT - Patrolling/PAT-001 - Switching Patrol Zones/PAT-001 - Switching Patrol Zones.lua b/Moose Test Missions/PAT - Patrolling/PAT-001 - Switching Patrol Zones/PAT-001 - Switching Patrol Zones.lua index 5d96265c3..0cbc54bdc 100644 --- a/Moose Test Missions/PAT - Patrolling/PAT-001 - Switching Patrol Zones/PAT-001 - Switching Patrol Zones.lua +++ b/Moose Test Missions/PAT - Patrolling/PAT-001 - Switching Patrol Zones/PAT-001 - Switching Patrol Zones.lua @@ -1,6 +1,6 @@ --- This test mission models the behaviour of the AI_PATROLZONE class. +-- This test mission models the behaviour of the AI_PATROL_ZONE class. -- --- It creates a 2 AI_PATROLZONE objects with the name Patrol1 and Patrol2. +-- It creates a 2 AI_PATROL_ZONE objects with the name Patrol1 and Patrol2. -- Patrol1 will govern a GROUP object to patrol the zone defined by PatrolZone1, within 3000 meters and 6000 meters, within a speed of 400 and 600 km/h. -- When the GROUP object that is assigned to Patrol has fuel below 20%, the GROUP object will orbit for 60 secondes, before returning to base. -- @@ -23,16 +23,16 @@ local PatrolZone2 = ZONE_POLYGON:New( "Patrol Zone 2", PatrolZoneGroup2 ) local PatrolSpawn = SPAWN:New( "Patrol Group" ) local PatrolGroup = PatrolSpawn:Spawn() -local Patrol1 = AI_PATROLZONE:New( PatrolZone1, 3000, 6000, 400, 600 ) +local Patrol1 = AI_PATROL_ZONE:New( PatrolZone1, 3000, 6000, 400, 600 ) Patrol1:ManageFuel( 0.2, 60 ) Patrol1:SetControllable( PatrolGroup ) Patrol1:__Start( 5 ) -local Patrol2 = AI_PATROLZONE:New( PatrolZone2, 600, 1000, 300, 400 ) +local Patrol2 = AI_PATROL_ZONE:New( PatrolZone2, 600, 1000, 300, 400 ) Patrol2:ManageFuel( 0.2, 0 ) --- State transition function for the PROCESS\_PATROLZONE **Patrol1** object --- @param #AI_PATROLZONE self +-- @param #AI_PATROL_ZONE self -- @param Wrapper.Group#GROUP AIGroup -- @return #boolean If false is returned, then the OnAfter state transition function will not be called. function Patrol1:OnLeaveRTB( AIGroup ) @@ -40,7 +40,7 @@ function Patrol1:OnLeaveRTB( AIGroup ) end --- State transition function for the PROCESS\_PATROLZONE **Patrol1** object --- @param Process_PatrolCore.Zone#AI_PATROLZONE self +-- @param Process_PatrolCore.Zone#AI_PATROL_ZONE self -- @param Wrapper.Group#GROUP AIGroup function Patrol1:OnAfterRTB( AIGroup ) local NewGroup = PatrolSpawn:Spawn() @@ -49,14 +49,14 @@ function Patrol1:OnAfterRTB( AIGroup ) end --- State transition function for the PROCESS\_PATROLZONE **Patrol1** object --- @param Process_PatrolCore.Zone#AI_PATROLZONE self +-- @param Process_PatrolCore.Zone#AI_PATROL_ZONE self -- @param Wrapper.Group#GROUP AIGroup function Patrol1:OnEnterPatrol( AIGroup ) AIGroup:MessageToRed( "Patrolling in zone " .. PatrolZone1:GetName() , 20 ) end --- State transition function for the PROCESS\_PATROLZONE **Patrol2** object --- @param #AI_PATROLZONE self +-- @param #AI_PATROL_ZONE self -- @param Wrapper.Group#GROUP AIGroup -- @return #boolean If false is returned, then the OnEnter state transition function will not be called. function Patrol2:OnBeforeRTB( AIGroup ) @@ -64,7 +64,7 @@ function Patrol2:OnBeforeRTB( AIGroup ) end --- State transition function for the PROCESS\_PATROLZONE **Patrol2** object --- @param Process_PatrolCore.Zone#AI_PATROLZONE self +-- @param Process_PatrolCore.Zone#AI_PATROL_ZONE self -- @param Wrapper.Group#GROUP AIGroup function Patrol2:OnEnterRTB( AIGroup ) local NewGroup = PatrolSpawn:Spawn() @@ -73,7 +73,7 @@ function Patrol2:OnEnterRTB( AIGroup ) end --- State transition function for the PROCESS\_PATROLZONE **Patrol2** object --- @param Process_PatrolCore.Zone#AI_PATROLZONE self +-- @param Process_PatrolCore.Zone#AI_PATROL_ZONE self -- @param Wrapper.Group#GROUP AIGroup function Patrol2:OnEnterPatrol( AIGroup ) AIGroup:MessageToRed( "Patrolling in zone " .. PatrolZone2:GetName() , 20 ) diff --git a/Moose Test Missions/PAT - Patrolling/PAT-001 - Switching Patrol Zones/PAT-001 - Switching Patrol Zones.miz b/Moose Test Missions/PAT - Patrolling/PAT-001 - Switching Patrol Zones/PAT-001 - Switching Patrol Zones.miz index e8aa9d174..896613e0b 100644 Binary files a/Moose Test Missions/PAT - Patrolling/PAT-001 - Switching Patrol Zones/PAT-001 - Switching Patrol Zones.miz and b/Moose Test Missions/PAT - Patrolling/PAT-001 - Switching Patrol Zones/PAT-001 - Switching Patrol Zones.miz differ diff --git a/Moose Test Missions/SCH - Scheduler/SCH-000 - Simple Scheduling/SCH-000 - Simple Scheduling.miz b/Moose Test Missions/SCH - Scheduler/SCH-000 - Simple Scheduling/SCH-000 - Simple Scheduling.miz index 7d12e2702..3efe78840 100644 Binary files a/Moose Test Missions/SCH - Scheduler/SCH-000 - Simple Scheduling/SCH-000 - Simple Scheduling.miz and b/Moose Test Missions/SCH - Scheduler/SCH-000 - Simple Scheduling/SCH-000 - Simple Scheduling.miz differ diff --git a/Moose Test Missions/SCH - Scheduler/SCH-001 - Simple Object Scheduling/SCH-001 - Simple Object Scheduling.miz b/Moose Test Missions/SCH - Scheduler/SCH-001 - Simple Object Scheduling/SCH-001 - Simple Object Scheduling.miz index 307749e4c..85a492e5e 100644 Binary files a/Moose Test Missions/SCH - Scheduler/SCH-001 - Simple Object Scheduling/SCH-001 - Simple Object Scheduling.miz and b/Moose Test Missions/SCH - Scheduler/SCH-001 - Simple Object Scheduling/SCH-001 - Simple Object Scheduling.miz differ diff --git a/Moose Test Missions/SCH - Scheduler/SCH-100 - Simple Repeat Scheduling/SCH-100 - Simple Repeat Scheduling.miz b/Moose Test Missions/SCH - Scheduler/SCH-100 - Simple Repeat Scheduling/SCH-100 - Simple Repeat Scheduling.miz index d4e82029c..2358dafb5 100644 Binary files a/Moose Test Missions/SCH - Scheduler/SCH-100 - Simple Repeat Scheduling/SCH-100 - Simple Repeat Scheduling.miz and b/Moose Test Missions/SCH - Scheduler/SCH-100 - Simple Repeat Scheduling/SCH-100 - Simple Repeat Scheduling.miz differ diff --git a/Moose Test Missions/SCH - Scheduler/SCH-110 - Object Repeat Scheduling/SCH-110 - Object Repeat Scheduling.miz b/Moose Test Missions/SCH - Scheduler/SCH-110 - Object Repeat Scheduling/SCH-110 - Object Repeat Scheduling.miz index 227aa073b..b24865b53 100644 Binary files a/Moose Test Missions/SCH - Scheduler/SCH-110 - Object Repeat Scheduling/SCH-110 - Object Repeat Scheduling.miz and b/Moose Test Missions/SCH - Scheduler/SCH-110 - Object Repeat Scheduling/SCH-110 - Object Repeat Scheduling.miz differ diff --git a/Moose Test Missions/SCH - Scheduler/SCH-200 - Simple Repeat Scheduling Stop and Start/SCH-200 - Simple Repeat Scheduling Stop and Start.miz b/Moose Test Missions/SCH - Scheduler/SCH-200 - Simple Repeat Scheduling Stop and Start/SCH-200 - Simple Repeat Scheduling Stop and Start.miz index 737b82ef0..7232e635e 100644 Binary files a/Moose Test Missions/SCH - Scheduler/SCH-200 - Simple Repeat Scheduling Stop and Start/SCH-200 - Simple Repeat Scheduling Stop and Start.miz and b/Moose Test Missions/SCH - Scheduler/SCH-200 - Simple Repeat Scheduling Stop and Start/SCH-200 - Simple Repeat Scheduling Stop and Start.miz differ diff --git a/Moose Test Missions/SCH - Scheduler/SCH-300 - GC Simple Object Scheduling/SCH-300 - GC Simple Object Scheduling.miz b/Moose Test Missions/SCH - Scheduler/SCH-300 - GC Simple Object Scheduling/SCH-300 - GC Simple Object Scheduling.miz index 6aa2f3056..05a5d07d6 100644 Binary files a/Moose Test Missions/SCH - Scheduler/SCH-300 - GC Simple Object Scheduling/SCH-300 - GC Simple Object Scheduling.miz and b/Moose Test Missions/SCH - Scheduler/SCH-300 - GC Simple Object Scheduling/SCH-300 - GC Simple Object Scheduling.miz differ diff --git a/Moose Test Missions/SCH - Scheduler/SCH-310 - GC Object Repeat Scheduling/SCH-310 - GC Object Repeat Scheduling.miz b/Moose Test Missions/SCH - Scheduler/SCH-310 - GC Object Repeat Scheduling/SCH-310 - GC Object Repeat Scheduling.miz index c04cb84ed..629391f82 100644 Binary files a/Moose Test Missions/SCH - Scheduler/SCH-310 - GC Object Repeat Scheduling/SCH-310 - GC Object Repeat Scheduling.miz and b/Moose Test Missions/SCH - Scheduler/SCH-310 - GC Object Repeat Scheduling/SCH-310 - GC Object Repeat Scheduling.miz differ diff --git a/Moose Test Missions/SET - Data Sets/SET-001 - Airbase Sets/SET-001 - Airbase Sets.miz b/Moose Test Missions/SET - Data Sets/SET-001 - Airbase Sets/SET-001 - Airbase Sets.miz index fc80169e9..250448ff8 100644 Binary files a/Moose Test Missions/SET - Data Sets/SET-001 - Airbase Sets/SET-001 - Airbase Sets.miz and b/Moose Test Missions/SET - Data Sets/SET-001 - Airbase Sets/SET-001 - Airbase Sets.miz differ diff --git a/Moose Test Missions/SET - Data Sets/SET-101 - Group Sets/SET-101 - Group Sets.miz b/Moose Test Missions/SET - Data Sets/SET-101 - Group Sets/SET-101 - Group Sets.miz index 9afd0edb2..6e2f66de4 100644 Binary files a/Moose Test Missions/SET - Data Sets/SET-101 - Group Sets/SET-101 - Group Sets.miz and b/Moose Test Missions/SET - Data Sets/SET-101 - Group Sets/SET-101 - Group Sets.miz differ diff --git a/Moose Test Missions/SET - Data Sets/SET-201 - Client Sets/SET-201 - Client Sets.miz b/Moose Test Missions/SET - Data Sets/SET-201 - Client Sets/SET-201 - Client Sets.miz index 31f510c5e..e62678b67 100644 Binary files a/Moose Test Missions/SET - Data Sets/SET-201 - Client Sets/SET-201 - Client Sets.miz and b/Moose Test Missions/SET - Data Sets/SET-201 - Client Sets/SET-201 - Client Sets.miz differ diff --git a/Moose Test Missions/SEV - SEAD Evasion/SEV-001 - SEAD Evasion/SEV-001 - SEAD Evasion.miz b/Moose Test Missions/SEV - SEAD Evasion/SEV-001 - SEAD Evasion/SEV-001 - SEAD Evasion.miz index ec3ee871a..7982420d4 100644 Binary files a/Moose Test Missions/SEV - SEAD Evasion/SEV-001 - SEAD Evasion/SEV-001 - SEAD Evasion.miz and b/Moose Test Missions/SEV - SEAD Evasion/SEV-001 - SEAD Evasion/SEV-001 - SEAD Evasion.miz differ diff --git a/Moose Test Missions/SPA - Spawning/SPA-010 - Spawn Demo/SPA-010 - Spawn Demo.miz b/Moose Test Missions/SPA - Spawning/SPA-010 - Spawn Demo/SPA-010 - Spawn Demo.miz index 7711d017a..2dd55d76c 100644 Binary files a/Moose Test Missions/SPA - Spawning/SPA-010 - Spawn Demo/SPA-010 - Spawn Demo.miz and b/Moose Test Missions/SPA - Spawning/SPA-010 - Spawn Demo/SPA-010 - Spawn Demo.miz differ diff --git a/Moose Test Missions/SPA - Spawning/SPA-011 - Ground Ops - Simple Spawning/SPA-011 - Ground Ops - Simple Spawning.miz b/Moose Test Missions/SPA - Spawning/SPA-011 - Ground Ops - Simple Spawning/SPA-011 - Ground Ops - Simple Spawning.miz index 4e24428cf..7ba6a0a43 100644 Binary files a/Moose Test Missions/SPA - Spawning/SPA-011 - Ground Ops - Simple Spawning/SPA-011 - Ground Ops - Simple Spawning.miz and b/Moose Test Missions/SPA - Spawning/SPA-011 - Ground Ops - Simple Spawning/SPA-011 - Ground Ops - Simple Spawning.miz differ diff --git a/Moose Test Missions/SPA - Spawning/SPA-012 - Ground Ops - Multiple Spawns/SPA-012 - Ground Ops - Multiple Spawns.miz b/Moose Test Missions/SPA - Spawning/SPA-012 - Ground Ops - Multiple Spawns/SPA-012 - Ground Ops - Multiple Spawns.miz index ca7a60962..363239a0b 100644 Binary files a/Moose Test Missions/SPA - Spawning/SPA-012 - Ground Ops - Multiple Spawns/SPA-012 - Ground Ops - Multiple Spawns.miz and b/Moose Test Missions/SPA - Spawning/SPA-012 - Ground Ops - Multiple Spawns/SPA-012 - Ground Ops - Multiple Spawns.miz differ diff --git a/Moose Test Missions/SPA - Spawning/SPA-013 - Ground Ops - Scheduled Spawns/SPA-013 - Ground Ops - Scheduled Spawns.miz b/Moose Test Missions/SPA - Spawning/SPA-013 - Ground Ops - Scheduled Spawns/SPA-013 - Ground Ops - Scheduled Spawns.miz index b6aed4f06..c212e1e61 100644 Binary files a/Moose Test Missions/SPA - Spawning/SPA-013 - Ground Ops - Scheduled Spawns/SPA-013 - Ground Ops - Scheduled Spawns.miz and b/Moose Test Missions/SPA - Spawning/SPA-013 - Ground Ops - Scheduled Spawns/SPA-013 - Ground Ops - Scheduled Spawns.miz differ diff --git a/Moose Test Missions/SPA - Spawning/SPA-014 - Ground Ops - Scheduled Spawns Limited/SPA-014 - Ground Ops - Scheduled Spawns Limited.miz b/Moose Test Missions/SPA - Spawning/SPA-014 - Ground Ops - Scheduled Spawns Limited/SPA-014 - Ground Ops - Scheduled Spawns Limited.miz index e37d08881..ed17829ed 100644 Binary files a/Moose Test Missions/SPA - Spawning/SPA-014 - Ground Ops - Scheduled Spawns Limited/SPA-014 - Ground Ops - Scheduled Spawns Limited.miz and b/Moose Test Missions/SPA - Spawning/SPA-014 - Ground Ops - Scheduled Spawns Limited/SPA-014 - Ground Ops - Scheduled Spawns Limited.miz differ diff --git a/Moose Test Missions/SPA - Spawning/SPA-015 - Ground Ops - Randomize Route/SPA-015 - Ground Ops - Randomize Route.miz b/Moose Test Missions/SPA - Spawning/SPA-015 - Ground Ops - Randomize Route/SPA-015 - Ground Ops - Randomize Route.miz index e5f7dc706..1fb3bc5d7 100644 Binary files a/Moose Test Missions/SPA - Spawning/SPA-015 - Ground Ops - Randomize Route/SPA-015 - Ground Ops - Randomize Route.miz and b/Moose Test Missions/SPA - Spawning/SPA-015 - Ground Ops - Randomize Route/SPA-015 - Ground Ops - Randomize Route.miz differ diff --git a/Moose Test Missions/SPA - Spawning/SPA-016 - Ground Ops - Randomize Zones/SPA-016 - Ground Ops - Randomize Zones.miz b/Moose Test Missions/SPA - Spawning/SPA-016 - Ground Ops - Randomize Zones/SPA-016 - Ground Ops - Randomize Zones.miz index 4d2a28148..23ec1282f 100644 Binary files a/Moose Test Missions/SPA - Spawning/SPA-016 - Ground Ops - Randomize Zones/SPA-016 - Ground Ops - Randomize Zones.miz and b/Moose Test Missions/SPA - Spawning/SPA-016 - Ground Ops - Randomize Zones/SPA-016 - Ground Ops - Randomize Zones.miz differ diff --git a/Moose Test Missions/SPA - Spawning/SPA-017 - Ground Ops - Set AI inactive while spawning/SPA-017 - Ground Ops - Set AI inactive while spawning.lua b/Moose Test Missions/SPA - Spawning/SPA-017 - Ground Ops - Set AI inactive while spawning/SPA-017 - Ground Ops - Set AI inactive while spawning.lua new file mode 100644 index 000000000..54d89d920 --- /dev/null +++ b/Moose Test Missions/SPA - Spawning/SPA-017 - Ground Ops - Set AI inactive while spawning/SPA-017 - Ground Ops - Set AI inactive while spawning.lua @@ -0,0 +1,31 @@ +-- Name: SPA-017 - Ground Ops - Set AI inactive while spawning +-- Author: FlightControl +-- Date Created: 24 Jan 2017 +-- +-- # Situation: +-- +-- At Gudauta spawn multiple ground vehicles, in a scheduled fashion. +-- But set the AI inactive when spawning. +-- +-- # Test cases: +-- +-- 1. Observe that the ground vehicles are spawned at the position declared within the mission editor. +-- 2. The vehicles should spawn according the scheduler parameters. +-- 3. There should not be more than 5 groups spawned. +-- 4. Observe that the AI is inactivated, and thus, the vehicles aren't moving. +-- 5. Observe that the position where the units are spawned, is randomized in the zones perimeters. + + + +-- Tests Gudauta +-- ------------- +-- Create a zone table of the 2 zones. +ZoneTable = { ZONE:New( "Zone1" ), ZONE:New( "Zone2" ) } + +Spawn_Vehicle_1 = SPAWN:New( "Spawn Vehicle 1" ) + :InitLimit( 10, 10 ) + :InitRandomizeRoute( 1, 1, 200 ) + :InitRandomizeZones( ZoneTable ) + :InitAIOnOff( false ) -- This will disable the AI. You can also use :InitAIOff(). Set AI On (for those groups with AI Off in the ME), with :InitAIOn(). + :SpawnScheduled( 5, .5 ) + diff --git a/Moose Test Missions/SPA - Spawning/SPA-017 - Ground Ops - Set AI inactive while spawning/SPA-017 - Ground Ops - Set AI inactive while spawning.miz b/Moose Test Missions/SPA - Spawning/SPA-017 - Ground Ops - Set AI inactive while spawning/SPA-017 - Ground Ops - Set AI inactive while spawning.miz new file mode 100644 index 000000000..9fee7d9a9 Binary files /dev/null and b/Moose Test Missions/SPA - Spawning/SPA-017 - Ground Ops - Set AI inactive while spawning/SPA-017 - Ground Ops - Set AI inactive while spawning.miz differ diff --git a/Moose Test Missions/SPA - Spawning/SPA-100 - CleanUp Inactive Units/SPA-100 - CleanUp Inactive Units.miz b/Moose Test Missions/SPA - Spawning/SPA-100 - CleanUp Inactive Units/SPA-100 - CleanUp Inactive Units.miz index 63dc70fda..dc945bbc9 100644 Binary files a/Moose Test Missions/SPA - Spawning/SPA-100 - CleanUp Inactive Units/SPA-100 - CleanUp Inactive Units.miz and b/Moose Test Missions/SPA - Spawning/SPA-100 - CleanUp Inactive Units/SPA-100 - CleanUp Inactive Units.miz differ diff --git a/Moose Test Missions/SPA - Spawning/SPA-110 - Limit Spawning/SPA-110 - Limit Spawning.miz b/Moose Test Missions/SPA - Spawning/SPA-110 - Limit Spawning/SPA-110 - Limit Spawning.miz index f3e63d599..7658bd657 100644 Binary files a/Moose Test Missions/SPA - Spawning/SPA-110 - Limit Spawning/SPA-110 - Limit Spawning.miz and b/Moose Test Missions/SPA - Spawning/SPA-110 - Limit Spawning/SPA-110 - Limit Spawning.miz differ diff --git a/Moose Test Missions/SPA - Spawning/SPA-120 - Repeat Spawning/SPA-120 - Repeat Spawning.miz b/Moose Test Missions/SPA - Spawning/SPA-120 - Repeat Spawning/SPA-120 - Repeat Spawning.miz index 01ef607ba..bd0b7ac7d 100644 Binary files a/Moose Test Missions/SPA - Spawning/SPA-120 - Repeat Spawning/SPA-120 - Repeat Spawning.miz and b/Moose Test Missions/SPA - Spawning/SPA-120 - Repeat Spawning/SPA-120 - Repeat Spawning.miz differ diff --git a/Moose Test Missions/SPA - Spawning/SPA-200 - Randomize Unit Types/SPA-200 - Randomize Unit Types.miz b/Moose Test Missions/SPA - Spawning/SPA-200 - Randomize Unit Types/SPA-200 - Randomize Unit Types.miz index 97315de54..644ca630a 100644 Binary files a/Moose Test Missions/SPA - Spawning/SPA-200 - Randomize Unit Types/SPA-200 - Randomize Unit Types.miz and b/Moose Test Missions/SPA - Spawning/SPA-200 - Randomize Unit Types/SPA-200 - Randomize Unit Types.miz differ diff --git a/Moose Test Missions/SPA - Spawning/SPA-220 - Randomize Zones/SPA-220 - Randomize Zones.miz b/Moose Test Missions/SPA - Spawning/SPA-220 - Randomize Zones/SPA-220 - Randomize Zones.miz index 9051b9918..36e8416e6 100644 Binary files a/Moose Test Missions/SPA - Spawning/SPA-220 - Randomize Zones/SPA-220 - Randomize Zones.miz and b/Moose Test Missions/SPA - Spawning/SPA-220 - Randomize Zones/SPA-220 - Randomize Zones.miz differ diff --git a/Moose Test Missions/SPA - Spawning/SPA-310 - Spawn at Static position/SPA-310 - Spawn at Static position.miz b/Moose Test Missions/SPA - Spawning/SPA-310 - Spawn at Static position/SPA-310 - Spawn at Static position.miz index 9bd543072..7cad1deb6 100644 Binary files a/Moose Test Missions/SPA - Spawning/SPA-310 - Spawn at Static position/SPA-310 - Spawn at Static position.miz and b/Moose Test Missions/SPA - Spawning/SPA-310 - Spawn at Static position/SPA-310 - Spawn at Static position.miz differ diff --git a/Moose Test Missions/SPA - Spawning/SPA-320 - Spawn at Unit position/SPA-320 - Spawn at Unit position.miz b/Moose Test Missions/SPA - Spawning/SPA-320 - Spawn at Unit position/SPA-320 - Spawn at Unit position.miz index e620045ef..e02c08e08 100644 Binary files a/Moose Test Missions/SPA - Spawning/SPA-320 - Spawn at Unit position/SPA-320 - Spawn at Unit position.miz and b/Moose Test Missions/SPA - Spawning/SPA-320 - Spawn at Unit position/SPA-320 - Spawn at Unit position.miz differ diff --git a/Moose Test Missions/SPA - Spawning/SPA-330 - Spawn at Vec2 position/SPA-330 - Spawn at Vec2 position.miz b/Moose Test Missions/SPA - Spawning/SPA-330 - Spawn at Vec2 position/SPA-330 - Spawn at Vec2 position.miz index 843d0dd54..60bab00e5 100644 Binary files a/Moose Test Missions/SPA - Spawning/SPA-330 - Spawn at Vec2 position/SPA-330 - Spawn at Vec2 position.miz and b/Moose Test Missions/SPA - Spawning/SPA-330 - Spawn at Vec2 position/SPA-330 - Spawn at Vec2 position.miz differ diff --git a/Moose Test Missions/SPA - Spawning/SPA-340 - Spawn at Vec3 position/SPA-340 - Spawn at Vec3 position.miz b/Moose Test Missions/SPA - Spawning/SPA-340 - Spawn at Vec3 position/SPA-340 - Spawn at Vec3 position.miz index 758d1a89d..468ae9c66 100644 Binary files a/Moose Test Missions/SPA - Spawning/SPA-340 - Spawn at Vec3 position/SPA-340 - Spawn at Vec3 position.miz and b/Moose Test Missions/SPA - Spawning/SPA-340 - Spawn at Vec3 position/SPA-340 - Spawn at Vec3 position.miz differ diff --git a/Moose Test Missions/TAD - Task Dispatching/TAD-010 - Task Dispatching Demo/TAD-010 - Task Dispatching Demo.miz b/Moose Test Missions/TAD - Task Dispatching/TAD-010 - Task Dispatching Demo/TAD-010 - Task Dispatching Demo.miz index 408771e36..0d5f4a7cc 100644 Binary files a/Moose Test Missions/TAD - Task Dispatching/TAD-010 - Task Dispatching Demo/TAD-010 - Task Dispatching Demo.miz and b/Moose Test Missions/TAD - Task Dispatching/TAD-010 - Task Dispatching Demo/TAD-010 - Task Dispatching Demo.miz differ diff --git a/Moose Test Missions/TSK - Task Modelling/TSK-010 - Task Modelling - SEAD/TSK-010 - Task Modelling - SEAD.lua b/Moose Test Missions/TSK - Task Modelling/TSK-010 - Task Modelling - SEAD/TSK-010 - Task Modelling - SEAD.lua index 520e32cec..f9b7e8f7f 100644 --- a/Moose Test Missions/TSK - Task Modelling/TSK-010 - Task Modelling - SEAD/TSK-010 - Task Modelling - SEAD.lua +++ b/Moose Test Missions/TSK - Task Modelling/TSK-010 - Task Modelling - SEAD/TSK-010 - Task Modelling - SEAD.lua @@ -1,7 +1,4 @@ ---- Task Modelling - SEAD --- --- === --- +-- Name: TSK-010 - Task Modelling - SEAD -- Author: FlightControl -- Date Created: 15 Dec 2016 -- @@ -62,9 +59,6 @@ -- * When a player joins the task, a message is displayed of the player joining, but only to the group assigned to execute the task. -- * When a player crashes into the ground, a message is displayed of that event. -- * In multi player, when the Task was assigned to the group, but all players in that group aborted the Task, the Task should become Aborted. It will be replanned in 30 seconds. --- --- # Status: TESTING - 15 Dec 2016 - -- Create the HQ object. local HQ = COMMANDCENTER:New( GROUP:FindByName( "HQ" ) ) @@ -140,89 +134,9 @@ local SEADProcess = SEADTask:GetUnitProcess() -- #SEADProcess -- 4.2 When the return state is Rejected, fire the event in the Task FsmSEAD:Eject() -- All other AddProcess calls are working in a similar manner. - ---SEADProcess:AddProcess ( "Planned", "Accept", ACT_ASSIGN_ACCEPT:New( "SEAD the Area" ), { Assigned = "Route", Rejected = "Eject" } ) - -do SEADProcess:AddProcess( "Planned", "Accept", ACT_ASSIGN_ACCEPT:New( "SEAD the Area" ), { Assigned = "Route", Rejected = "Eject" } ) -- FSM SUB for type SEADProcess. +SEADProcess:AddProcess( "Planned", "Accept", ACT_ASSIGN_ACCEPT:New( "SEAD the Area" ), { Assigned = "Route", Rejected = "Eject" } ) -- FSM SUB for type SEADProcess. - --- OnLeave State Transition for Planned. - -- @function [parent=#SEADProcess] OnLeavePlanned - -- @param #SEADProcess self - -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. - -- @param #string From The From State string. - -- @param #string Event The Event string. - -- @param #string To The To State string. - -- @return #boolean Return false to cancel Transition. - - --- OnBefore State Transition for Accept. - -- @function [parent=#SEADProcess] OnBeforeAccept - -- @param #SEADProcess self - -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. - -- @param #string From The From State string. - -- @param #string Event The Event string. - -- @param #string To The To State string. - -- @return #boolean Return false to cancel Transition. - - --- OnAfter State Transition for Accept. - -- @function [parent=#SEADProcess] OnAfterAccept - -- @param #SEADProcess self - -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. - -- @param #string From The From State string. - -- @param #string Event The Event string. - -- @param #string To The To State string. - - --- Embedded Event Trigger for Accept. - -- @function [parent=#SEADProcess] Accept - -- @param #SEADProcess self - - --- Delayed Event Trigger for Accept - -- @function [parent=#SEADProcess] __Accept - -- @param #SEADProcess self - -- @param #number Delay The delay in seconds. - -end -- SEADProcess - --- Same, adding a process. ---SEADProcess:AddProcess ( "Assigned", "Route", ACT_ROUTE_ZONE:New( TargetZone ), { Arrived = "Update" } ) - -do SEADProcess:AddProcess( "Assigned", "Route", ACT_ROUTE_ZONE:New( TargetZone ), { Arrived = "Update" } ) -- FSM SUB for type SEADProcess. - - --- OnLeave State Transition for Assigned. - -- @function [parent=#SEADProcess] OnLeaveAssigned - -- @param #SEADProcess self - -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. - -- @param #string From The From State string. - -- @param #string Event The Event string. - -- @param #string To The To State string. - -- @return #boolean Return false to cancel Transition. - - --- OnBefore State Transition for Route. - -- @function [parent=#SEADProcess] OnBeforeRoute - -- @param #SEADProcess self - -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. - -- @param #string From The From State string. - -- @param #string Event The Event string. - -- @param #string To The To State string. - -- @return #boolean Return false to cancel Transition. - - --- OnAfter State Transition for Route. - -- @function [parent=#SEADProcess] OnAfterRoute - -- @param #SEADProcess self - -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. - -- @param #string From The From State string. - -- @param #string Event The Event string. - -- @param #string To The To State string. - - --- Embedded Event Trigger for Route. - -- @function [parent=#SEADProcess] Route - -- @param #SEADProcess self - - --- Delayed Event Trigger for Route - -- @function [parent=#SEADProcess] __Route - -- @param #SEADProcess self - -- @param #number Delay The delay in seconds. - -end -- SEADProcess +SEADProcess:AddProcess( "Assigned", "Route", ACT_ROUTE_ZONE:New( TargetZone ), { Arrived = "Update" } ) -- FSM SUB for type SEADProcess. -- Adding a new Action... -- Actions define also the flow of the Task, but the actions will need to be programmed within your script. @@ -231,272 +145,18 @@ end -- SEADProcess -- 1. State From "Rejected". When the FsmSEAD is in state "Rejected", the event "Eject" can be fired. -- 2. Event "Eject". This event can be triggered synchronously through FsmSEAD:Eject() or asynchronously through FsmSEAD:__Eject(secs). -- 3. State To "Planned". After the event has been fired, the FsmSEAD will transition to Planned. -do SEADProcess:AddTransition( "Rejected", "Eject", "Planned" ) -- FSM_CONTROLLABLE TRANSITION for type SEADProcess. - - --- OnLeave State Transition for Rejected. - -- @function [parent=#SEADProcess] OnLeaveRejected - -- @param #SEADProcess self - -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. - -- @param #string From The From State string. - -- @param #string Event The Event string. - -- @param #string To The To State string. - -- @return #boolean Return false to cancel Transition. - --- OnEnter State Transition for Planned. - -- @function [parent=#SEADProcess] OnEnterPlanned - -- @param #SEADProcess self - -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. - -- @param #string From The From State string. - -- @param #string Event The Event string. - -- @param #string To The To State string. - - --- OnBefore State Transition for Eject. - -- @function [parent=#SEADProcess] OnBeforeEject - -- @param #SEADProcess self - -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. - -- @param #string From The From State string. - -- @param #string Event The Event string. - -- @param #string To The To State string. - -- @return #boolean Return false to cancel Transition. +SEADProcess:AddTransition( "Rejected", "Eject", "Planned" ) - --- OnAfter State Transition for Eject. - -- @function [parent=#SEADProcess] OnAfterEject - -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. - -- @param #SEADProcess self - -- @param #string From The From State string. - -- @param #string Event The Event string. - -- @param #string To The To State string. - - --- Embedded Event Trigger for Eject. - -- @function [parent=#SEADProcess] Eject - -- @param #SEADProcess self +SEADProcess:AddTransition( "Arrived", "Update", "Updated" ) - --- Delayed Event Trigger for Eject - -- @function [parent=#SEADProcess] __Eject - -- @param #SEADProcess self - -- @param #number Delay The delay in seconds. +SEADProcess:AddProcess( "Updated", "Account", ACT_ACCOUNT_DEADS:New( TargetSet, "SEAD" ), { Accounted = "Success" } ) -end -- SEADProcess -do SEADProcess:AddTransition( "Arrived", "Update", "Updated" ) -- FSM_CONTROLLABLE TRANSITION for type SEADProcess. +SEADProcess:AddProcess( "Updated", "Smoke", ACT_ASSIST_SMOKE_TARGETS_ZONE:New( TargetSet, TargetZone ) ) - SEADProcess:AddTransition( "Arrived", "Update", "Updated" ) - - --- OnLeave State Transition for Arrived. - -- @function [parent=#SEADProcess] OnLeaveArrived - -- @param #SEADProcess self - -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. - -- @param #string From The From State string. - -- @param #string Event The Event string. - -- @param #string To The To State string. - -- @return #boolean Return false to cancel Transition. +SEADProcess:AddTransition( "Accounted", "Success", "Success" ) - --- OnEnter State Transition for Updated. - -- @function [parent=#SEADProcess] OnEnterUpdated - -- @param #SEADProcess self - -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. - -- @param #string From The From State string. - -- @param #string Event The Event string. - -- @param #string To The To State string. - - --- OnBefore State Transition for Update. - -- @function [parent=#SEADProcess] OnBeforeUpdate - -- @param #SEADProcess self - -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. - -- @param #string From The From State string. - -- @param #string Event The Event string. - -- @param #string To The To State string. - -- @return #boolean Return false to cancel Transition. - - --- OnAfter State Transition for Update. - -- @function [parent=#SEADProcess] OnAfterUpdate - -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. - -- @param #SEADProcess self - -- @param #string From The From State string. - -- @param #string Event The Event string. - -- @param #string To The To State string. - - --- Embedded Event Trigger for Update. - -- @function [parent=#SEADProcess] Update - -- @param #SEADProcess self - - --- Delayed Event Trigger for Update - -- @function [parent=#SEADProcess] __Update - -- @param #SEADProcess self - -- @param #number Delay The delay in seconds. - -end -- SEADProcess - -do SEADProcess:AddProcess( "Updated", "Account", ACT_ACCOUNT_DEADS:New( TargetSet, "SEAD" ), { Accounted = "Success" } ) -- FSM_CONTROLLABLE Process for #SEADProcess. - - --- OnLeave State Transition for Updated. - -- @function [parent=#SEADProcess] OnLeaveUpdated - -- @param #SEADProcess self - -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. - -- @param #string From The From State string. - -- @param #string Event The Event string. - -- @param #string To The To State string. - -- @return #boolean Return false to cancel Transition. - - --- OnBefore State Transition for Account. - -- @function [parent=#SEADProcess] OnBeforeAccount - -- @param #SEADProcess self - -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. - -- @param #string From The From State string. - -- @param #string Event The Event string. - -- @param #string To The To State string. - -- @return #boolean Return false to cancel Transition. - - --- OnAfter State Transition for Account. - -- @function [parent=#SEADProcess] OnAfterAccount - -- @param #SEADProcess self - -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. - -- @param #string From The From State string. - -- @param #string Event The Event string. - -- @param #string To The To State string. - - --- Embedded Event Trigger for Account. - -- @function [parent=#SEADProcess] Account - -- @param #SEADProcess self - - --- Delayed Event Trigger for Account - -- @function [parent=#SEADProcess] __Account - -- @param #SEADProcess self - -- @param #number Delay The delay in seconds. - -end -- SEADProcess - -do SEADProcess:AddProcess( "Updated", "Smoke", ACT_ASSIST_SMOKE_TARGETS_ZONE:New( TargetSet, TargetZone ) ) -- FSM_CONTROLLABLE Process for #SEADProcess. - - --- OnLeave State Transition for Updated. - -- @function [parent=#SEADProcess] OnLeaveUpdated - -- @param #SEADProcess self - -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. - -- @param #string From The From State string. - -- @param #string Event The Event string. - -- @param #string To The To State string. - -- @return #boolean Return false to cancel Transition. - - --- OnBefore State Transition for Smoke. - -- @function [parent=#SEADProcess] OnBeforeSmoke - -- @param #SEADProcess self - -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. - -- @param #string From The From State string. - -- @param #string Event The Event string. - -- @param #string To The To State string. - -- @return #boolean Return false to cancel Transition. - - --- OnAfter State Transition for Smoke. - -- @function [parent=#SEADProcess] OnAfterSmoke - -- @param #SEADProcess self - -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. - -- @param #string From The From State string. - -- @param #string Event The Event string. - -- @param #string To The To State string. - - --- Embedded Event Trigger for Smoke. - -- @function [parent=#SEADProcess] Smoke - -- @param #SEADProcess self - - --- Delayed Event Trigger for Smoke - -- @function [parent=#SEADProcess] __Smoke - -- @param #SEADProcess self - -- @param #number Delay The delay in seconds. - -end -- SEADProcess - -do SEADProcess:AddTransition( "Accounted", "Success", "Success" ) -- FSM_CONTROLLABLE Transition for type #SEADProcess. - - --- OnLeave State Transition for Accounted. - -- @function [parent=#SEADProcess] OnLeaveAccounted - -- @param #SEADProcess self - -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. - -- @param #string From The From State string. - -- @param #string Event The Event string. - -- @param #string To The To State string. - -- @return #boolean Return false to cancel Transition. - - --- OnEnter State Transition for Success. - -- @function [parent=#SEADProcess] OnEnterSuccess - -- @param #SEADProcess self - -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. - -- @param #string From The From State string. - -- @param #string Event The Event string. - -- @param #string To The To State string. - - --- OnBefore State Transition for Success. - -- @function [parent=#SEADProcess] OnBeforeSuccess - -- @param #SEADProcess self - -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. - -- @param #string From The From State string. - -- @param #string Event The Event string. - -- @param #string To The To State string. - -- @return #boolean Return false to cancel Transition. - - --- OnAfter State Transition for Success. - -- @function [parent=#SEADProcess] OnAfterSuccess - -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. - -- @param #SEADProcess self - -- @param #string From The From State string. - -- @param #string Event The Event string. - -- @param #string To The To State string. - - --- Embedded Event Trigger for Success. - -- @function [parent=#SEADProcess] Success - -- @param #SEADProcess self - - --- Delayed Event Trigger for Success - -- @function [parent=#SEADProcess] __Success - -- @param #SEADProcess self - -- @param #number Delay The delay in seconds. - -end -- SEADProcess - -do SEADProcess:AddTransition( "*", "Fail", "Failed" ) -- FSM_CONTROLLABLE Transition for type #SEADProcess. - - --- OnLeave State Transition for *. - -- @function [parent=#SEADProcess] OnLeave* - -- @param #SEADProcess self - -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. - -- @param #string From The From State string. - -- @param #string Event The Event string. - -- @param #string To The To State string. - -- @return #boolean Return false to cancel Transition. - - --- OnEnter State Transition for Failed. - -- @function [parent=#SEADProcess] OnEnterFailed - -- @param #SEADProcess self - -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. - -- @param #string From The From State string. - -- @param #string Event The Event string. - -- @param #string To The To State string. - - --- OnBefore State Transition for Fail. - -- @function [parent=#SEADProcess] OnBeforeFail - -- @param #SEADProcess self - -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. - -- @param #string From The From State string. - -- @param #string Event The Event string. - -- @param #string To The To State string. - -- @return #boolean Return false to cancel Transition. - - --- OnAfter State Transition for Fail. - -- @function [parent=#SEADProcess] OnAfterFail - -- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM. - -- @param #SEADProcess self - -- @param #string From The From State string. - -- @param #string Event The Event string. - -- @param #string To The To State string. - - --- Embedded Event Trigger for Fail. - -- @function [parent=#SEADProcess] Fail - -- @param #SEADProcess self - - --- Delayed Event Trigger for Fail - -- @function [parent=#SEADProcess] __Fail - -- @param #SEADProcess self - -- @param #number Delay The delay in seconds. - -end -- SEADProcess +SEADProcess:AddTransition( "*", "Fail", "Failed" ) SEADProcess:AddScoreProcess( "Updated", "Account", "Account", "destroyed a radar", 25 ) SEADProcess:AddScoreProcess( "Updated", "Account", "Failed", "failed to destroy a radar", -10 ) @@ -520,7 +180,6 @@ end function SEADTask:OnEnterPlayerCrashed( PlayerUnit, PlayerName ) if not SEADTask:HasAliveUnits() then SEADTask:__Abort() - SEADTask:__Replan( 30 ) end end diff --git a/Moose Test Missions/TSK - Task Modelling/TSK-010 - Task Modelling - SEAD/TSK-010 - Task Modelling - SEAD.miz b/Moose Test Missions/TSK - Task Modelling/TSK-010 - Task Modelling - SEAD/TSK-010 - Task Modelling - SEAD.miz index eca761fb0..8e56e629c 100644 Binary files a/Moose Test Missions/TSK - Task Modelling/TSK-010 - Task Modelling - SEAD/TSK-010 - Task Modelling - SEAD.miz and b/Moose Test Missions/TSK - Task Modelling/TSK-010 - Task Modelling - SEAD/TSK-010 - Task Modelling - SEAD.miz differ diff --git a/Moose Test Missions/TSK - Task Modelling/TSK-020 - Task Modelling - Pickup/TSK-020 - Task Modelling - Pickup.miz b/Moose Test Missions/TSK - Task Modelling/TSK-020 - Task Modelling - Pickup/TSK-020 - Task Modelling - Pickup.miz index 87adc7a16..e7f90ff5b 100644 Binary files a/Moose Test Missions/TSK - Task Modelling/TSK-020 - Task Modelling - Pickup/TSK-020 - Task Modelling - Pickup.miz and b/Moose Test Missions/TSK - Task Modelling/TSK-020 - Task Modelling - Pickup/TSK-020 - Task Modelling - Pickup.miz differ diff --git a/Moose Test Missions/ZON - Zones/ZON-100 - Normal Zone/ZON-100 - Normal Zone.lua b/Moose Test Missions/ZON - Zones/ZON-100 - Normal Zone/ZON-100 - Normal Zone.lua index 0cc8bca29..0bcb21604 100644 --- a/Moose Test Missions/ZON - Zones/ZON-100 - Normal Zone/ZON-100 - Normal Zone.lua +++ b/Moose Test Missions/ZON - Zones/ZON-100 - Normal Zone/ZON-100 - Normal Zone.lua @@ -6,7 +6,8 @@ local GroupInside = GROUP:FindByName( "Test Inside Polygon" ) local GroupOutside = GROUP:FindByName( "Test Outside Polygon" ) -local ZoneA = ZONE:New( "Zone A" ):SmokeZone( SMOKECOLOR.White, 90 ) +local ZoneA = ZONE:New( "Zone A" ) +ZoneA:SmokeZone( SMOKECOLOR.White, 90 ) Messager = SCHEDULER:New( nil, function() diff --git a/Moose Test Missions/ZON - Zones/ZON-100 - Normal Zone/ZON-100 - Normal Zone.miz b/Moose Test Missions/ZON - Zones/ZON-100 - Normal Zone/ZON-100 - Normal Zone.miz index 215474151..bc0246b3d 100644 Binary files a/Moose Test Missions/ZON - Zones/ZON-100 - Normal Zone/ZON-100 - Normal Zone.miz and b/Moose Test Missions/ZON - Zones/ZON-100 - Normal Zone/ZON-100 - Normal Zone.miz differ diff --git a/Moose Test Missions/ZON - Zones/ZON-200 - Group Zone/ZON-200 - Group Zone.miz b/Moose Test Missions/ZON - Zones/ZON-200 - Group Zone/ZON-200 - Group Zone.miz index 419e503aa..0af0a21e4 100644 Binary files a/Moose Test Missions/ZON - Zones/ZON-200 - Group Zone/ZON-200 - Group Zone.miz and b/Moose Test Missions/ZON - Zones/ZON-200 - Group Zone/ZON-200 - Group Zone.miz differ diff --git a/Moose Test Missions/ZON - Zones/ZON-300 - Unit Zone/ZON-300 - Unit Zone.miz b/Moose Test Missions/ZON - Zones/ZON-300 - Unit Zone/ZON-300 - Unit Zone.miz index 9475fcada..7b0cf0758 100644 Binary files a/Moose Test Missions/ZON - Zones/ZON-300 - Unit Zone/ZON-300 - Unit Zone.miz and b/Moose Test Missions/ZON - Zones/ZON-300 - Unit Zone/ZON-300 - Unit Zone.miz differ diff --git a/Moose Test Missions/ZON - Zones/ZON-400 - Radius Zone/ZON-400 - Radius Zone.lua b/Moose Test Missions/ZON - Zones/ZON-400 - Radius Zone/ZON-400 - Radius Zone.lua index 7eb347e91..07cfc8515 100644 --- a/Moose Test Missions/ZON - Zones/ZON-400 - Radius Zone/ZON-400 - Radius Zone.lua +++ b/Moose Test Missions/ZON - Zones/ZON-400 - Radius Zone/ZON-400 - Radius Zone.lua @@ -7,7 +7,8 @@ local GroupInside = GROUP:FindByName( "Test Inside Polygon" ) local GroupOutside = GROUP:FindByName( "Test Outside Polygon" ) local House = STATIC:FindByName( "House" ) -local ZoneA = ZONE_RADIUS:New( "Zone A", House:GetPointVec2(), 300 ):SmokeZone( SMOKECOLOR.White, 90 ) +local ZoneA = ZONE_RADIUS:New( "Zone A", House:GetVec2(), 300 ) +ZoneA:SmokeZone( SMOKECOLOR.White, 90 ) Messager = SCHEDULER:New( nil, function() diff --git a/Moose Test Missions/ZON - Zones/ZON-400 - Radius Zone/ZON-400 - Radius Zone.miz b/Moose Test Missions/ZON - Zones/ZON-400 - Radius Zone/ZON-400 - Radius Zone.miz index 35356c345..28a664c8e 100644 Binary files a/Moose Test Missions/ZON - Zones/ZON-400 - Radius Zone/ZON-400 - Radius Zone.miz and b/Moose Test Missions/ZON - Zones/ZON-400 - Radius Zone/ZON-400 - Radius Zone.miz differ diff --git a/Moose Test Missions/ZON - Zones/ZON-500 - Polygon Zone/ZON-500 - Polygon Zone.lua b/Moose Test Missions/ZON - Zones/ZON-500 - Polygon Zone/ZON-500 - Polygon Zone.lua index e38d859ee..50334ba5e 100644 --- a/Moose Test Missions/ZON - Zones/ZON-500 - Polygon Zone/ZON-500 - Polygon Zone.lua +++ b/Moose Test Missions/ZON - Zones/ZON-500 - Polygon Zone/ZON-500 - Polygon Zone.lua @@ -8,7 +8,8 @@ local GroupOutside = GROUP:FindByName( "Test Outside Polygon" ) local GroupPolygon = GROUP:FindByName( "Polygon A" ) -local PolygonZone = ZONE_POLYGON:New( "Polygon A", GroupPolygon ):SmokeZone( SMOKECOLOR.White, 20 ) +local PolygonZone = ZONE_POLYGON:New( "Polygon A", GroupPolygon ) +PolygonZone:SmokeZone( SMOKECOLOR.White, 20 ) Messager = SCHEDULER:New( nil, function() diff --git a/Moose Test Missions/ZON - Zones/ZON-500 - Polygon Zone/ZON-500 - Polygon Zone.miz b/Moose Test Missions/ZON - Zones/ZON-500 - Polygon Zone/ZON-500 - Polygon Zone.miz index 1232bd760..d79a2c175 100644 Binary files a/Moose Test Missions/ZON - Zones/ZON-500 - Polygon Zone/ZON-500 - Polygon Zone.miz and b/Moose Test Missions/ZON - Zones/ZON-500 - Polygon Zone/ZON-500 - Polygon Zone.miz differ diff --git a/Moose Test Missions/ZON - Zones/ZON-510 - Send message if Clients fly the first time in the Polygon Zones/ZON-510 - Send message if Clients fly the first time in the Polygon Zones.lua b/Moose Test Missions/ZON - Zones/ZON-510 - Send message if Clients fly the first time in the Polygon Zones/ZON-510 - Send message if Clients fly the first time in the Polygon Zones.lua new file mode 100644 index 000000000..2216f6efa --- /dev/null +++ b/Moose Test Missions/ZON - Zones/ZON-510 - Send message if Clients fly the first time in the Polygon Zones/ZON-510 - Send message if Clients fly the first time in the Polygon Zones.lua @@ -0,0 +1,86 @@ +-- Name: ZON-510 - Send message if Clients fly the first time in the Polygon Zones +-- Author: Wingthor and FlightControl +-- Date Created: 20 January 2017 +-- +-- # Situation: +-- +-- There are a couple of player slots of Su-25Ts, that need to fly through two poly zones. +-- Once a player flies through a poly zone, a message will be sent. But only once. If he flies back through the same zone, +-- nothing is displayed anymore. Unless he logs off and rejoins the mission. +-- +-- # Test cases: +-- +-- + +-- MOOSE wraps each Group alive in the mission into a GROUP class object. The GROUP class object is a wrapper object, wrapping +-- the Group object from DCS and adding methods to it. +-- Get the GROUP wrapper objects that were created by MOOSE at mission startup, by using the GROUP:FindByName() method. +-- The Group name is the parameter to be searched for. +-- Note that late activated groups are also "alive" and have a corresponding GROUP object in the running mission. +local PolyZoneGroup1 = GROUP:FindByName("PolyZone1") +local PolyZoneGroup2 = GROUP:FindByName("PolyZone2") + +-- Create 2 Polygon objects, using the ZONE_POLYGON:New constructor. +-- The first parameter gives a name to the zone, the second is the GROUP object that defines the zone form. +local PolyZone1 = ZONE_POLYGON:New( "PolyZone1", PolyZoneGroup1 ) +local PolyZone2 = ZONE_POLYGON:New( "PolyZone2", PolyZoneGroup2 ) + +-- Create a SET of Moose CLIENT wrapper objects. At mission startup, a SET of Moose client wrapper objects is created. +-- Note that CLIENT objects don't necessarily need to be alive!!! +-- So this set contains EVERY RED coalition client defined within the mission. +local RedClients = SET_CLIENT:New():FilterCoalitions("red"):FilterStart() + + + +RedClients:ForEachClient( + function( MooseClient ) + + -- Here we register the state of the client in which step he is in. + -- We set the state of the client "ZoneStep" to 0, indicating that he is not out of the first zone. + local function ResetClientForZone( MooseClient ) + BASE:E("Reset") + MooseClient:SetState( MooseClient, "ZoneStep", "0" ) + end + + BASE:E( { "Alive Init", Client = MooseClient } ) + MooseClient:Alive( ResetClientForZone ) + end +) + +Scheduler, SchedulerID = SCHEDULER:New( nil, + function () + + RedClients:ForEachClientInZone( PolyZone1, + function( MooseClient ) + BASE:E( { Client = MooseClient, State = MooseClient:GetState( MooseClient, "ZoneStep" ) } ) + if MooseClient:GetState( MooseClient, "ZoneStep" ) == "0" then + MooseClient:SetState( MooseClient, "ZoneStep", "1" ) + MESSAGE:New("Lorem Ipsum", 15, "Pilot Update" ):ToClient( MooseClient ) + end + end + ) + + RedClients:ForEachClientNotInZone( PolyZone1, + function( MooseClient ) + BASE:E( { Client = MooseClient, State = MooseClient:GetState( MooseClient, "ZoneStep" ) } ) + if MooseClient:GetState( MooseClient, "ZoneStep" ) == "1" then + MooseClient:SetState( MooseClient, "ZoneStep", "2" ) + MESSAGE:New("Ipsum Ipsum", 15, "Pilot Update" ):ToClient( MooseClient ) + end + end + ) + + RedClients:ForEachClientInZone( PolyZone2, + function( MooseClient ) + BASE:E( { Client = MooseClient, State = MooseClient:GetState( MooseClient, "ZoneStep" ) } ) + if MooseClient:GetState( MooseClient, "ZoneStep" ) == "2" then + MooseClient:SetState( MooseClient, "ZoneStep", "3" ) + MESSAGE:New("Lorem Lorem", 15, "Pilot Update" ):ToClient( MooseClient ) + end + end + ) + + end, {}, 10, 1 + ) + + \ No newline at end of file diff --git a/Moose Test Missions/ZON - Zones/ZON-510 - Send message if Clients fly the first time in the Polygon Zones/ZON-510 - Send message if Clients fly the first time in the Polygon Zones.miz b/Moose Test Missions/ZON - Zones/ZON-510 - Send message if Clients fly the first time in the Polygon Zones/ZON-510 - Send message if Clients fly the first time in the Polygon Zones.miz new file mode 100644 index 000000000..a9a725b63 Binary files /dev/null and b/Moose Test Missions/ZON - Zones/ZON-510 - Send message if Clients fly the first time in the Polygon Zones/ZON-510 - Send message if Clients fly the first time in the Polygon Zones.miz differ diff --git a/README.md b/README.md index 199db6fef..d779ca5a9 100644 --- a/README.md +++ b/README.md @@ -1,168 +1,17 @@ -# Context +# MOOSE framework MOOSE is a **M**ission **O**bject **O**riented **S**cripting **E**nvironment, and is meant for mission designers and mission hosters. It allows to quickly setup complex missions using pre-scripted scenarios using the available classes within the MOOSE Framework. -MOOSE is currently still in alpha version, but will evolve over time. Right now, it has been updated to work with DCS world 1.5. and 2.0. +MOOSE works with DCS world 1.5. and 2.0. -You can find the source of MOOSE here on GITHUB. It is free for download: -https://github.com/FlightControl-Master/MOOSE/ +## MOOSE framework goal -Note: MOOSE is complementary to [MIST](https://github.com/mrSkortch/MissionScriptingTools/releases), so if you use MIST in parallel with MOOSE objects, this should work. +The goal of MOOSE is to allow mission designers to enhance their scripting with mission orchestration objects, which can be instantiated from defined classes within the framework. This will allow to write mission scripts with minimal code embedded. Of course, the richness of the framework will determine the richness of the misson scenarios. +The MOOSE is a service that is produced while being consumed ... , it will evolve further as more classes are developed for the framework, and as more users are using it. +MOOSE is meant to be a one-man show, it is meant to evolve within a growing community around the framework. +Within the community, key users will start supporting, documenting, explaining and even creating new classes for the framework. +It is the ambition to grow this framework as a de-facto standard for mission designers to use. -# Goals +## MOOSE main site -The goal of MOOSE is to allow mission designers to enhance their scripting with mission orchestration objects, which can be instantiated from defined classes within the framework. This will allow to write mission scripts with minimal code embedded. Of course, the richness of the framework will determine the richness of the misson scenarios. We can expect that MOOSE will evolve over time, as more missions will be designed within the framework. - -# MOOSE Directory Structure - -* Moose Development: Contains the collection of lua files that define the MOOSE classes. You can use this directory to build the dynamic luadoc documentation intellisense in your eclipse development environment. -* Moose Mission Setup: Contains the Moose.lua file to be included in your scripts when using MOOSE classes (see below the point Mission Design with Moose). -* Moose Test Missions: Contains a directory structure with Moose Test Missions and examples. In each directory, you will find a miz file and a lua file containing the main mission script. -* Moose Training: Contains the documentation of Moose generated with luadoc from the Moose source code. The presentations used during the videos in my [youtube channel](https://www.youtube.com/channel/UCjrA9j5LQoWsG4SpS8i79Qg), are also to be found here. - -# Mission Design with Moose - -In order to create a mission using MOOSE, you'll have to include a file named **Moose.lua**: - -1. Create a new mission in the DCS World Mission Editor. -2. In the mission editor, create a new trigger. -3. Name the trigger Moose Load and let it execute only at MISSION START. -4. Add an action DO SCRIPT FILE (without a condition, so the middle column must be empty). -5. In the action, browse to the **[Moose.lua](https://github.com/FlightControl-Master/MOOSE/tree/master/Moose%20Mission%20Setup)** file in the **Moose Mission Setup** directory, and include this file within your mission. -6. Make sure that the "Moose Load" trigger is completely at the top of your mission. - -Voila, MOOSE is now included in your mission. During the execution of this mission, all MOOSE classes will be loaded, and all MOOSE initializations will be exectuted before any other mission action is executed. - -IMPORTANT NOTE: When a new version of MOOSE is released, you'll have to UPDATE the Moose.lua file in EACH OF YOUR MISSION. -This can be a tedious task, and for this purpose, a tool has been developed that will update the Moose.lua files automatically within your missions. -Refer to the tool at [Moose Mission Setup\Moose Mission Update](https://github.com/FlightControl-Master/MOOSE/tree/master/Moose%20Mission%20Setup/Moose%20Mission%20Update) directory for further information included in the [READ.ME]() file. - - -# MOOSE Classes - -The following classes are currently embedded within MOOSE and can be included within your mission scripts: - -## MOOSE Core Classes - -These classes define the base building blocks of the MOOSE framework. These classes are heavily used within the MOOSE framework. - -* [BASE](Documentation/Base.html): The main class from which all MOOSE classes are derived from. The BASE class contains essential functions to support inheritance and MOOSE object execution tracing (logging within the DCS.log file in the saved games folder of the user). - -* [DATABASE](Documentation/Database.html): Creates a collection of GROUPS[], UNITS[], CLIENTS[] and managed these sets automatically. Provides an API set to retrieve a GROUP, UNIT or CLIENT instance from the _DATABASE object using defined APIs. The collections are maintained dynamically during the execution of the mission, so when players join, leave, when units are created or destroyed, the collections are dynamically updated. - -* [EVENT](Documentation/Event.html): Provides the Event Dispatcher base class to handle DCS Events, being fired upon registered events within the DCS simulator. Note that EVENT is used by BASE, exposing OnEvent() methods to catch these DCS events. - -* [FSM](Documentation/Fsm.html): The main FSM class can be used to build a Finite State Machine. The derived FSM_ classes provide Finite State Machine building capability for CONTROLLABLEs, ACT_ (Task Actions) classes, TASKs and SETs. - -* [MENU](Documentation/Menu.html): Set Menu options (F10) for All Players, Coalitions, Groups, Clients. MENU also manages the recursive removal of menus, which is a big asset! - -* [SETS](Documentation/Set.html): Create SETs of MOOSE objects. SETs can be created for GROUPs, UNITs, AIRBASEs, ... -The SET can be filtered with defined filter criteria. -Iterators are available that iterate through the GROUPSET, calling a function for each object within the SET. - -* [MESSAGE](Documentation/Message.html): A message publishing system, displaying messages to Clients, Coalitions or All players. - -* [POINTS](Documentation/Point.html): A set of point classes to manage the 2D or 3D simulation space, through an extensive method library. -The POINT_VEC3 class manages the 3D simulation space, while the POINT_VEC2 class manages the 2D simulation space. - -* [ZONES](Documentation/Zone.html): A set of zone classes that provide the functionality to validate the presence of GROUPS, UNITS, CLIENTS, STATICS within a certain ZONE. The zones can take various forms and can be movable. - -* [SCHEDULER](Documentation/Scheduler.html): This class implements a timer scheduler that will call at optional specified intervals repeatedly or just one time a scheduled function. - - -## MOOSE Wrapper Classes - -MOOSE Wrapper Classes provide an object oriented hierarchical mechanism to manage the DCS objects within the simulator. -Wrapper classes provide another easier mechanism to control Groups, Units, Statics, Airbases and other objects. - -* **[OBJECT](Documentation/Object.html)**: This class provides the base for MOOSE objects. - -* **[IDENTIFIABLE](Documentation/Identifiable.html)**: This class provides the base for MOOSE identifiable objects, which is every object within the simulator :-). - -* **[POSITIONABLE](Documentation/Positionable.html)**: This class provides the base for MOOSE positionable objects. These are AIRBASEs, STATICs, GROUPs, UNITs ... - -* **[CONTROLLABLE](Documentation/Controllable.html)**: This class provides the base for MOOSE controllable objects. These are GROUPs, UNITs, CLIENTs. - -* **[AIRBASE](Documentation/Airbase.html)**: This class wraps a DCS Airbase object within the simulator. - -* **[GROUP](Documentation/Group.html)**: This class wraps a DCS Group objects within the simulator, which are currently alive. -It provides a more extensive API set. -It takes an abstraction of the complexity to give tasks, commands and set various options to DCS Groups. -Additionally, the GROUP class provides a much richer API to identify various properties of the DCS Group. -For each DCS Group created object within a running mission, a GROUP object will be created automatically, beging managed within the DATABASE. - -* **[UNIT](Documentation/Unit.html)**: This class wraps a DCS Unit object within the simulator, which are currently alive. It provides a more extensive API set, as well takes an abstraction of the complexity to give commands and set various options to DCS Units. Additionally, the UNIT class provides a much richer API to identify various properties of the DCS Unit. For each DCS Unit object created within a running mission, a UNIT object will be created automatically, that is stored within the DATABASE, under the _DATABASE object. -the UNIT class provides a more extensive API set, taking an abstraction of the complexity to give tasks, commands and set various options to DCS Units. -For each DCS Unit created object within a running mission, a UNIT object will be created automatically, beging managed within the DATABASE. - -* **[CLIENT](Documentation/Client.html)**: This class wraps a DCS Unit object within the simulator, which has a skill Client or Player. -The CLIENT class derives from the UNIT class, thus contains the complete UNIT API set, and additionally, the CLIENT class provides an API set to manage players joining or leaving clients, sending messages to players, and manage the state of units joined by players. For each DCS Unit object created within a running mission that can be joined by a player, a CLIENT object will be created automatically, that is stored within the DATABASE, under the _DATABASE object. - -* **[STATIC](Documentation/Static.html)**: This class wraps a DCS StaticObject object within the simulator. -The STATIC class derives from the POSITIONABLE class, thus contains also the position API set. - - -## MOOSE Functional Classes - -* [SPAWN](Documentation/Spawn.html): Spawn new groups (and units) during mission execution. - -* [ESCORT](Moose Training/Documentation/Escort.html): Makes groups consisting of helicopters, airplanes, ground troops or ships within a mission joining your flight. You can control these groups through the ratio menu during your flight. Available commands are around: Navigation, Position Hold, Reporting (Target Detection), Attacking, Assisted Attacks, ROE, Evasion, Mission Execution and more ... - -* [MISSILETRAINER](Moose Training/Documentation/MissileTrainer.html): Missile trainer, it destroys missiles when they are within a certain range of player airplanes, displays tracking and alert messages of missile launches; approach; destruction, and configure with radio menu commands. Various APIs available to configure the trainer. - -* [DETECTION](Moose Training/Documentation/Detection.html): Detect other units using the available sensors of the detection unit. The DETECTION_BASE derived classes will provide different methods how the sets of detected objects are built. - -## MOOSE AI Controlling Classes - -* [AI_BALANCER](Documentation/AI_Balancer.html): Compensate in a multi player mission the abscence of players with dynamically spawned AI air units. When players join CLIENTS, the AI will either be destroyed, or will fly back to the home or nearest friendly airbase. - -* [AI_PATROLZONE](Documentation/AI_PatrolZone.html): Make an alive AI Group patrol a zone derived from the ZONE_BASE class. Manage out-of-fuel events and set altitude and speed ranges for the patrol. - -* [FAC](Moose Training/Documentation/Fac.html): Using the DETECTION_BASE derived classes, detected objects can be reported in different ways to a set of clients (SET_CLIENT). FAC_BASE derived classes will provide target detection reporting and control using the radio menu. - -* [FOLLOW](Moose Training/Documentation/Follow.html): Build large air formations using the FOLLOW class. - -# MOOSE Tutorials and Examples - -You can download [test missions](https://github.com/FlightControl-Master/MOOSE/tree/master/Test%20Missions) to have examples and learn the syntax and usage of the MOOSE classes. - -There are [Video Tutorials](https://www.youtube.com/channel/UCjrA9j5LQoWsG4SpS8i79Qg) on my YOUTUBE channel on which you can learn some coding aspects with mission execution demos, as well as some of the tooling and internal mechanisms within MOOSE. - - -In the triggers section, there is a flag (9999) that will decide how MOOSE will be loaded. When flag 9999 is set, MOOSE will be dynamically loaded. When flag 9999 is off, MOOSE will be loaded embedded. Note that when loaded embedded, **your mission must include the last Moose_Embedded.lua file**. So, ensure that the last file is included in the DO SCRIPT section when MOOSE got an update! - -# Credits - -Note that the framework is based on code i've written myself, but some of it is also based on code that i've seen as great scripting code and ideas, and which i've revised. I see this framework evolving towards a broader public, and the ownership may dissapear (or parts of it). Consider this code public domain. Therefore a list of credits to all who have or are contributing (this list will increase over time): Grimes, Prof_Hilactic, xcom, the 476 virtual squadron team, ... - -You'll notice that within this framework, there are functions used from mist. I've taken the liberty to copy those atomic mist functions that are very nice and useful, and used those. - -**Grimes** -Without the effort of Grimes with MIST and his continuous documentation, the development of MOOSE would not have been possible. MOOSE is not replacing MIST, but is compensating it. - -**Prof_hilactic** -SEAD Defenses. I've taken the script, and reworded it to fit within MOOSE. The script within MOOSE is hardly recognizable anymore from the original. Find here the posts: http://forums.eagle.ru/showpost.php?...59&postcount=1 - -**xcom** -His contribution is related to the Event logging system. I've analyzed and studied his scripts, and reworked it a bit to use it also within the framework (I've also tweaked it a bit). Find his post here: http://forums.eagle.ru/showpost.php?...73&postcount=1 - -**Dutch_Baron (James)** -Working together with James has resulted in the creation of the AIBALANCER class. James has shared his ideas on balancing AI with air units, and together we made a first design which you can use now :-) - -**Stuka (Danny)** -Working together with Danny has resulted in the MISSILETRAINER class. Stuka has shared his ideas and together we made a design. Together with the 476 virtual team, we tested this CLASS, and got much positive feedback! - -**Mechanic (G�bor)** -Worked together with G�bor to create the concept of the DETECTION and FAC classes. Mechanic shared his ideas and concepts to group detected targets into sets within detection zones... Will continue to work with G�bor to workout the DETECTION and FAC classes. - -**Shadoh** -Interacted on the eagle dynamics forum to build the FOLLOW class to build large WWII airplane formations. - -For the rest I also would like to thank the numerous feedback and help and assistance of the moose community at SLACK.COM. -Note that there is a vast amount of other scripts out there. -I may contact you personally to ask for your contribution / permission if i can use your idea or script to tweak it to the framework. -Parts of these scripts will have to be redesigned to fit it into an OO framework. - -The rest of the framework functions and class definitions were my own developments, especially the core of MOOSE. -Trust I've spent hours and hours investigating, trying and writing and documenting code building this framework. -Hope you think the idea is great and useful. +[Click on this link to browse to the MOOSE main web page.](http://flightcontrol-master.github.io/MOOSE) diff --git a/docs/Communities.md b/docs/Communities.md new file mode 100644 index 000000000..e809396d1 --- /dev/null +++ b/docs/Communities.md @@ -0,0 +1,40 @@ +# 3) MOOSE framework support channels + +MOOSE is broadcasted, documented and supported through various social media channels. + +## 3.1) MOOSE broadcast channels on YouTube + +MOOSE has a [broadcast channel](https://www.youtube.com/channel/UCjrA9j5LQoWsG4SpS8i79Qg/playlists) on youtube. +These videos are grouped into playlists, which explain specific MOOSE capabilities, +and gradually build up the "understanding" and "what is possible" to do with the MOOSE framework. +I really, really encourage all to watch the explanation videos. + +Some mandatory videos to watch are: + + * [MOOSE Introduction](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl1JEtVcyf9sazUV5_fGICz4) + + * [MOOSE Setup](https://www.youtube.com/watch?v=-Hxae3mTCE8&t=159s&index=1&list=PL7ZUrU4zZUl0riB9ULVh-bZvFlw1_Wym2) + * [MOOSE Spawning](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl1jirWIo4t4YxqN-HxjqRkL) + * [MOOSE Tasking](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl3CgxN2iAViiGLTPpQ-Ajdg) + * [MOOSE Task Dispatching](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl3I6ieFM-cjey-rncF1ktNI) + +## 3.2) MOOSE on Eagle Dynamics forums + +This is a default thread at the Eagle Dynamics forums where the MOOSE framework can be discussed and supported. +The thread is called [MOOSE - Mission Object Oriented Scripting Framework](https://forums.eagle.ru/showthread.php?t=138043). + +## 3.3) MOOSE on GITHUB. + +I encourage that you create also a user at GITHUB. +On the MOOSE framework GITHUB site, you can register issues, feedback and comments in the issues section of the site. +This allows to track this feedback and issues, in order to provide a structured support and create a milestone plan. +In other words, treat this development as a project. + +## 3.4) MOOSE on slack.com + +Slack is a team community site. It is a great environment to discuss online the framework. +Various channels are allocated in the environment to discuss specific topics. +A channel exists per MOOSE class, so that a focused discuss is possible. + +![Slack](Communities/Slack.JPG) + diff --git a/docs/Communities/Slack.JPG b/docs/Communities/Slack.JPG new file mode 100644 index 000000000..73e799328 Binary files /dev/null and b/docs/Communities/Slack.JPG differ diff --git a/docs/Documentation/AI_Balancer.html b/docs/Documentation/AI_Balancer.html index 048dbfbc2..02a4952eb 100644 --- a/docs/Documentation/AI_Balancer.html +++ b/docs/Documentation/AI_Balancer.html @@ -18,6 +18,9 @@ +

1.5) All objects derived from BASE can have "States"

+ +

A mechanism is in place in MOOSE, that allows to let the objects administer states. +States are essentially properties of objects, which are identified by a Key and a Value. +The method BASE.SetState() can be used to set a Value with a reference Key to the object. +To read or retrieve a state Value based on a Key, use the BASE.GetState method. +These two methods provide a very handy way to keep state at long lasting processes. +Values can be stored within the objects, and later retrieved or changed when needed. +There is one other important thing to note, the BASE.SetState() and BASE.GetState methods +receive as the first parameter the object for which the state needs to be set. +Thus, if the state is to be set for the same object as the object for which the method is used, then provide the same +object name to the method.

+

1.10) BASE Inheritance (tree) support

The following methods are available to support inheritance:

@@ -518,9 +533,9 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added

- BASE:GetState(Object, StateName) + BASE:GetState(Object, Key, Value) - +

Get a Value given a Key from the Object.

@@ -542,9 +557,9 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added

- BASE:SetState(Object, StateName, State) + BASE:SetState(Object, Key, Value) - +

Set a state or property of the Object given a Key and a Value.

@@ -1744,26 +1759,42 @@ is the Child class from which the Parent class needs to be retrieved.

-BASE:GetState(Object, StateName) +BASE:GetState(Object, Key, Value)
+

Get a Value given a Key from the Object.

+ +

Note that if the Object is destroyed, nillified or garbage collected, then the Values and Keys will also be gone.

Parameters

  • -

    Object :

    +

    Object : +The object that holds the Value set by the Key.

  • -

    StateName :

    +

    Key : +The key that is used to retrieve the value. Note that the key can be a #string, but it can also be any other type!

    + +
  • +
  • + +

    Value : +The value to is stored in the Object.

+

Return value

+ + +

The Value retrieved.

+
@@ -1837,31 +1868,52 @@ Child

-BASE:SetState(Object, StateName, State) +BASE:SetState(Object, Key, Value)
+

Set a state or property of the Object given a Key and a Value.

+ +

Note that if the Object is destroyed, nillified or garbage collected, then the Values and Keys will also be gone.

Parameters

  • -

    Object :

    +

    Object : +The object that will hold the Value set by the Key.

  • -

    StateName :

    +

    Key : +The key that is used as a reference of the value. Note that the key can be a #string, but it can also be any other type!

  • -

    State :

    +

    Value : +The value to is stored in the object.

+

Return values

+
    +
  1. + + +

    The Value set.

    + +
  2. +
  3. + +

    #nil: +The Key was not found and thus the Value could not be retrieved.

    + +
  4. +
diff --git a/docs/Documentation/Cargo.html b/docs/Documentation/Cargo.html index e142ea3ea..749df60ca 100644 --- a/docs/Documentation/Cargo.html +++ b/docs/Documentation/Cargo.html @@ -18,6 +18,9 @@

Return value

@@ -3097,6 +3190,8 @@ If WayPoints is given, then use the route.

Type DCSStopCondition

+

Type list

+ diff --git a/docs/Documentation/Database.html b/docs/Documentation/Database.html index 1f2bacb64..cd538dd3f 100644 --- a/docs/Documentation/Database.html +++ b/docs/Documentation/Database.html @@ -18,6 +18,9 @@
  • AI_Balancer
  • +
  • AI_Cap
  • +
  • AI_Cas
  • +
  • AI_Patrol
  • Account
  • Airbase
  • AirbasePolice
  • @@ -41,7 +44,6 @@
  • MissileTrainer
  • Mission
  • Object
  • -
  • Patrol
  • Point
  • Positionable
  • Process_JTAC
  • @@ -238,7 +240,7 @@ Processing will just continue. Synchronous Event Trigger methods are useful to c

    The following example provides a little demonstration on the difference between synchronous and asynchronous Event Triggering.

      function FSM:OnAfterEvent( From, Event, To, Amount )
    -    self:E( { Amount = Amount } ) 
    +    self:T( { Amount = Amount } ) 
       end
     
       local Amount = 1
    @@ -290,7 +292,7 @@ The next code implements this through the event handling method OnAfterS
     

    Transition Flow

     function FsmDemo:OnAfterSwitch( From, Event, To, FsmUnit )
    -   self:E( { From, Event, To, FsmUnit } )
    +   self:T( { From, Event, To, FsmUnit } )
     
        if From == "Green" then
          FsmUnit:Flare(FLARECOLOR.Green)
    @@ -315,7 +317,7 @@ and one additional parameter that was given when the event was triggered, which
     
     

    For debugging reasons the received parameters are traced within the DCS.log.

    -
        self:E( { From, Event, To, FsmUnit } )
    +
        self:T( { From, Event, To, FsmUnit } )
     

    The method will check if the From state received is either "Green" or "Red" and will flare the respective color from the FsmUnit.

    @@ -733,12 +735,6 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added

    Type FSM_PROCESS

    - - - -
    FSM_PROCESS:AddScore(State, ScoreText, Score) -

    Adds a score for the FSM_PROCESS to be achieved.

    -
    FSM_PROCESS:Assign(Task, ProcessUnit)

    Assign the process to a Unit and activate the process.

    @@ -1486,7 +1482,7 @@ A string defining the start state.

    - + #string FSM._StartState @@ -1780,7 +1776,6 @@ A string defining the start state.

    - FSM.current @@ -1999,45 +1994,6 @@ Finite State Machine Table

    - -FSM_PROCESS:AddScore(State, ScoreText, Score) - -
    -
    - -

    Adds a score for the FSM_PROCESS to be achieved.

    - -

    Parameters

    -
      -
    • - -

      #string State : -is the state of the process when the score needs to be given. (See the relevant state descriptions of the process).

      - -
    • -
    • - -

      #string ScoreText : -is a text describing the score that is given according the status.

      - -
    • -
    • - -

      #number Score : -is a number providing the score of the status.

      - -
    • -
    -

    Return value

    - -

    #FSM_PROCESS: -self

    - -
    -
    -
    -
    - FSM_PROCESS:Assign(Task, ProcessUnit) diff --git a/docs/Documentation/Group.html b/docs/Documentation/Group.html index 6dcce1c17..9feadfaf4 100644 --- a/docs/Documentation/Group.html +++ b/docs/Documentation/Group.html @@ -18,6 +18,9 @@

    1.2) GROUP task methods

    -

    Several group task methods are available that help you to prepare tasks. -These methods return a string consisting of the task description, which can then be given to either a
    -Wrapper.Controllable#CONTROLLABLE.PushTask or Wrapper.Controllable#CONTROLLABLE.SetTask method to assign the task to the GROUP. -Tasks are specific for the category of the GROUP, more specific, for AIR, GROUND or AIR and GROUND. -Each task description where applicable indicates for which group category the task is valid. -There are 2 main subdivisions of tasks: Assigned tasks and EnRoute tasks.

    -

    1.2.1) Assigned task methods

    - -

    Assigned task methods make the group execute the task where the location of the (possible) targets of the task are known before being detected. -This is different from the EnRoute tasks, where the targets of the task need to be detected before the task can be executed.

    - -

    Find below a list of the assigned task methods:

    - - - -

    1.2.2) EnRoute task methods

    - -

    EnRoute tasks require the targets of the task need to be detected by the group (using its sensors) before the task can be executed:

    - - - -

    1.2.3) Preparation task methods

    - -

    There are certain task methods that allow to tailor the task behaviour:

    - - +

    A GROUP is a Controllable. See the Controllable task methods section for a description of the task methods.

    1.2.4) Obtain the mission from group templates

    @@ -176,53 +117,15 @@ This is different from the EnRoute tasks, where the targets of the task need to

    1.3) GROUP Command methods

    -

    Group command methods prepare the execution of commands using the Wrapper.Controllable#CONTROLLABLE.SetCommand method:

    - +

    A GROUP is a Controllable. See the Controllable command methods section for a description of the command methods.

    -

    1.4) GROUP Option methods

    -

    Group Option methods change the behaviour of the Group while being alive.

    +

    1.4) GROUP option methods

    -

    1.4.1) Rule of Engagement:

    - - - -

    To check whether an ROE option is valid for a specific group, use:

    - - - -

    1.4.2) Rule on thread:

    - - - -

    To test whether an ROT option is valid for a specific group, use:

    - - +

    A GROUP is a Controllable. See the Controllable option methods section for a description of the option methods.

    1.5) GROUP Zone validation methods

    +

    The group can be validated whether it is completely, partly or not within a Zone. Use the following Zone validation methods on the group:

    @@ -234,6 +137,51 @@ Use the following Zone validation methods on the group:

    The zone can be of any Zone class derived from Core.Zone#ZONE_BASE. So, these methods are polymorphic to the zones tested on.

    +

    1.6) GROUP AI methods

    + +

    A GROUP has AI methods to control the AI activation.

    + + + +
    + +

    API CHANGE HISTORY

    + +

    The underlying change log documents the API changes. Please read this carefully. The following notation is used:

    + +
      +
    • Added parts are expressed in bold type face.
    • +
    • Removed parts are expressed in italic type face.
    • +
    + +

    Hereby the change log:

    + +

    2017-01-24: GROUP:SetAIOnOff( AIOnOff ) added.

    + +

    2017-01-24: GROUP:SetAIOn() added.

    + +

    2017-01-24: GROUP:SetAIOff() added.

    + +
    + +

    AUTHORS and CONTRIBUTIONS

    + +

    Contributions:

    + +
      +
    • Entropy, Afinegan: Came up with the requirement for AIOnOff().
    • +
    + +

    Authors:

    + +
      +
    • FlightControl: Design & Programming
    • +
    +

    Global(s)

    @@ -366,6 +314,12 @@ Use the following Zone validation methods on the group:

    + + + + @@ -402,12 +356,6 @@ Use the following Zone validation methods on the group:

    - - - - @@ -426,6 +374,12 @@ Use the following Zone validation methods on the group:

    + + + + @@ -480,6 +434,12 @@ Use the following Zone validation methods on the group:

    + + + + @@ -492,6 +452,24 @@ Use the following Zone validation methods on the group:

    + + + + + + + + + + + + @@ -963,6 +941,34 @@ Minimum height found.

    + +GROUP:GetPositionVec3() + +
    +
    + +

    Returns the Dcs.DCSTypes#Position3 position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission.

    + +

    Return values

    +
      +
    1. + +

      Dcs.DCSTypes#Position: +The 3D position vectors of the POSITIONABLE.

      + +
    2. +
    3. + +

      #nil: +The POSITIONABLE is not existing or alive.

      + +
    4. +
    +
    +
    +
    +
    + GROUP:GetSize() @@ -1086,24 +1092,6 @@ The UNIT wrapper class.

    - -GROUP:GetUnits() - -
    -
    - -

    Returns the UNITs wrappers of the DCS Units of the DCS Group.

    - -

    Return value

    - -

    #table: -The UNITs wrappers.

    - -
    -
    -
    -
    - GROUP:GetVec2() @@ -1154,6 +1142,34 @@ Current Vec3 of the first DCS Unit of the GROUP.

    + +GROUP:InAir() + +
    +
    + +

    Returns true if the first unit of the GROUP is in the air.

    + +

    Return values

    +
      +
    1. + +

      #boolean: +true if in the first unit of the group is in the air.

      + +
    2. +
    3. + +

      #nil: +The GROUP is not existing or not alive.

      + +
    4. +
    +
    +
    +
    +
    + GROUP:IsAir() @@ -1349,6 +1365,27 @@ true if DCS Group contains Ships.

    + +GROUP:OnReSpawn(ReSpawnFunction) + +
    +
    + + + +

    Parameter

    +
      +
    • + +

      ReSpawnFunction :

      + +
    • +
    +
    +
    +
    +
    + GROUP:Register(GroupName) @@ -1420,6 +1457,69 @@ The template of the Group retrieved with GROUP:GetTemplate()

    + +GROUP:SetAIOff() + +
    +
    + +

    Turns the AI Off for the GROUP.

    + +

    Return value

    + +

    #GROUP: +The GROUP.

    + +
    +
    +
    +
    + + +GROUP:SetAIOn() + +
    +
    + +

    Turns the AI On for the GROUP.

    + +

    Return value

    + +

    #GROUP: +The GROUP.

    + +
    +
    +
    +
    + + +GROUP:SetAIOnOff(AIOnOff) + +
    +
    + +

    Turns the AI On or Off for the GROUP.

    + +

    Parameter

    +
      +
    • + +

      #boolean AIOnOff : +The value true turns the AI On, the value false turns the AI Off.

      + +
    • +
    +

    Return value

    + +

    #GROUP: +The GROUP.

    + +
    +
    +
    +
    + GROUP:SetTemplateCoalition(CoalitionID, Template) diff --git a/docs/Documentation/Identifiable.html b/docs/Documentation/Identifiable.html index 75ff60cd9..4f55a41e4 100644 --- a/docs/Documentation/Identifiable.html +++ b/docs/Documentation/Identifiable.html @@ -18,6 +18,9 @@
    GROUP:GetMinHeight()

    Returns the current minimum height of the group.

    +
    GROUP:GetPositionVec3() +

    Returns the Dcs.DCSTypes#Position3 position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission.

    GROUP:GetUnit(UnitNumber)

    Returns the UNIT wrapper class with number UnitNumber.

    -
    GROUP:GetUnits() -

    Returns the UNITs wrappers of the DCS Units of the DCS Group.

    GROUP.GroupName

    The name of the group.

    +
    GROUP:InAir() +

    Returns true if the first unit of the GROUP is in the air.

    GROUP:IsShip()

    Returns if the DCS Group contains Ships.

    +
    GROUP:OnReSpawn(ReSpawnFunction) +
    GROUP:Respawn(Template)

    Respawn the GROUP using a (tweaked) template of the Group.

    +
    GROUP:SetAIOff() +

    Turns the AI Off for the GROUP.

    +
    GROUP:SetAIOn() +

    Turns the AI On for the GROUP.

    +
    GROUP:SetAIOnOff(AIOnOff) +

    Turns the AI On or Off for the GROUP.

    + + + +
    POINT_VEC3.RoutePointAction.FromParkingArea +

    "From Parking Area"

    +
    POINT_VEC3.RoutePointAction.TurningPoint

    "Turning Point"

    @@ -561,6 +569,12 @@ In order to keep the credibility of the the author, I want to emphasize that the

    Type POINT_VEC3.RoutePointType

    + + + + + + + + @@ -223,7 +231,7 @@ - + @@ -425,6 +433,34 @@ The POSITIONABLE is not existing or alive.

    + +POSITIONABLE:GetPointVec3() + +
    +
    + +

    Returns a POINT_VEC3 object indicating the point in 3D of the POSITIONABLE within the mission.

    + +

    Return values

    +
      +
    1. + +

      Core.Point#POINT_VEC3: +The 3D point vector of the POSITIONABLE.

      + +
    2. +
    3. + +

      #nil: +The POSITIONABLE is not existing or alive.

      + +
    4. +
    +
    +
    +
    +
    + POSITIONABLE:GetPositionVec3() @@ -609,6 +645,9 @@ The POSITIONABLE is not existing or alive.

    Returns true if the POSITIONABLE is in the air.

    + +

    Polymorphic, is overridden in GROUP and UNIT.

    +

    Return values

    1. @@ -812,7 +851,7 @@ The client object receiving the message.

      -POSITIONABLE:MessageToCoalition(Message, Duration, Name, MessageCoalition) +POSITIONABLE:MessageToCoalition(Message, Duration, MessageCoalition, Name)
      @@ -838,13 +877,14 @@ The duration of the message.

    2. -

      #string Name : -(optional) The Name of the sender. If not provided, the Name is the type of the Positionable.

      +

      Dcs.DCScoalition#coalition MessageCoalition : +The Coalition receiving the message.

    3. -

      MessageCoalition :

      +

      #string Name : +(optional) The Name of the sender. If not provided, the Name is the type of the Positionable.

    4. diff --git a/docs/Documentation/Process_JTAC.html b/docs/Documentation/Process_JTAC.html index b838cdfb0..194cee4de 100644 --- a/docs/Documentation/Process_JTAC.html +++ b/docs/Documentation/Process_JTAC.html @@ -18,6 +18,9 @@

      1.3) SPAWN spawning methods

      @@ -195,97 +200,40 @@ A coding example is provided at the description of the SPAWN.InitRandomizeUnits( RandomizeUnits, OuterRadius, InnerRadius ). -
    5. A new parameter RandomizeGroup to reflect the randomization of the starting position of the Spawned Group.
    6. - -

      2016-08-14: SPAWN.SpawnFromVec3( Vec3, SpawnIndex ) replaces SpawnFromVec3( Vec3, RandomizeUnits, OuterRadius, InnerRadius, SpawnIndex ):

      -
        -
      • The RandomizeUnits, OuterRadius and InnerRadius have been replaced with a new method SPAWN.InitRandomizeUnits( RandomizeUnits, OuterRadius, InnerRadius ).
      • -
      • A new parameter RandomizeGroup to reflect the randomization of the starting position of the Spawned Group.
      • -
      -

      2016-08-14: SPAWN.SpawnFromVec2( Vec2, SpawnIndex ) replaces SpawnFromVec2( Vec2, RandomizeUnits, OuterRadius, InnerRadius, SpawnIndex ):

      -
        -
      • The RandomizeUnits, OuterRadius and InnerRadius have been replaced with a new method SPAWN.InitRandomizeUnits( RandomizeUnits, OuterRadius, InnerRadius ).
      • -
      • A new parameter RandomizeGroup to reflect the randomization of the starting position of the Spawned Group.
      • -
      -

      2016-08-14: SPAWN.SpawnFromUnit( SpawnUnit, SpawnIndex ) replaces SpawnFromUnit( SpawnUnit, RandomizeUnits, OuterRadius, InnerRadius, SpawnIndex ):

      -
        -
      • The RandomizeUnits, OuterRadius and InnerRadius have been replaced with a new method SPAWN.InitRandomizeUnits( RandomizeUnits, OuterRadius, InnerRadius ).
      • -
      • A new parameter RandomizeGroup to reflect the randomization of the starting position of the Spawned Group.
      • -
      -

      2016-08-14: SPAWN.SpawnFromUnit( SpawnUnit, SpawnIndex ) replaces SpawnFromStatic( SpawnStatic, RandomizeUnits, OuterRadius, InnerRadius, SpawnIndex ):

      -
        -
      • The RandomizeUnits, OuterRadius and InnerRadius have been replaced with a new method SPAWN.InitRandomizeUnits( RandomizeUnits, OuterRadius, InnerRadius ).
      • -
      • A new parameter RandomizeGroup to reflect the randomization of the starting position of the Spawned Group.
      • -
      -

      2016-08-14: SPAWN.InitRandomizeUnits( RandomizeUnits, OuterRadius, InnerRadius ) added:

      -
        -
      • This method enables the randomization of units at the first route point in a radius band at a spawn event.
      • -
      -

      2016-08-14: SPAWN.InitLimit( SpawnMaxUnitsAlive, SpawnMaxGroups ) replaces SPAWN.Limit( SpawnMaxUnitsAlive, SpawnMaxGroups ):

      -
        -
      • Want to ensure that the methods starting with Init are the first called methods before any Spawn method is called!
      • -
      • This notation makes it now more clear which methods are initialization methods and which methods are Spawn enablement methods.
      • -
      -

      2016-08-14: SPAWN.InitArray( SpawnAngle, SpawnWidth, SpawnDeltaX, SpawnDeltaY ) replaces SPAWN.Array( SpawnAngle, SpawnWidth, SpawnDeltaX, SpawnDeltaY ).

      -
        -
      • Want to ensure that the methods starting with Init are the first called methods before any Spawn method is called!
      • -
      • This notation makes it now more clear which methods are initialization methods and which methods are Spawn enablement methods.
      • -
      -

      2016-08-14: SPAWN.InitRandomizeRoute( SpawnStartPoint, SpawnEndPoint, SpawnRadius, SpawnHeight ) replaces SPAWN.RandomizeRoute( SpawnStartPoint, SpawnEndPoint, SpawnRadius, SpawnHeight ).

      -
        -
      • Want to ensure that the methods starting with Init are the first called methods before any Spawn method is called!
      • -
      • This notation makes it now more clear which methods are initialization methods and which methods are Spawn enablement methods.
      • -
      -

      2016-08-14: SPAWN.InitRandomizeTemplate( SpawnTemplatePrefixTable ) replaces SPAWN.RandomizeTemplate( SpawnTemplatePrefixTable ).

      -
        -
      • Want to ensure that the methods starting with Init are the first called methods before any Spawn method is called!
      • -
      • This notation makes it now more clear which methods are initialization methods and which methods are Spawn enablement methods.
      • -
      -

      2016-08-14: SPAWN.InitUnControlled() replaces SPAWN.UnControlled().

      -
        -
      • Want to ensure that the methods starting with Init are the first called methods before any Spawn method is called!
      • -
      • This notation makes it now more clear which methods are initialization methods and which methods are Spawn enablement methods.
      • -
      -

      AUTHORS and CONTRIBUTIONS

      @@ -294,6 +242,7 @@ A coding example is provided at the description of the Entropy, Afinegan: Came up with the requirement for AIOnOff().

      Authors:

      @@ -315,6 +264,12 @@ A coding example is provided at the description of the Type SPAWN
    POINT_VEC3.RoutePointType.TakeOffParking +

    "TakeOffParking"

    +
    POINT_VEC3.RoutePointType.TurningPoint

    "Turning Point"

    @@ -2097,6 +2111,19 @@ The new calculated POINT_VEC3.

    + +POINT_VEC3.RoutePointAction.FromParkingArea + +
    +
    + +

    "From Parking Area"

    + +
    +
    +
    +
    + POINT_VEC3.RoutePointAction.TurningPoint @@ -2135,6 +2162,19 @@ The new calculated POINT_VEC3.

    + +POINT_VEC3.RoutePointType.TakeOffParking + +
    +
    + +

    "TakeOffParking"

    + +
    +
    +
    +
    + POINT_VEC3.RoutePointType.TurningPoint diff --git a/docs/Documentation/Positionable.html b/docs/Documentation/Positionable.html index 64e64762c..a438b42a0 100644 --- a/docs/Documentation/Positionable.html +++ b/docs/Documentation/Positionable.html @@ -18,6 +18,9 @@
    POSITIONABLE:GetPointVec2()

    Returns a POINT_VEC2 object indicating the point in 2D of the POSITIONABLE within the mission.

    +
    POSITIONABLE:GetPointVec3() +

    Returns a POINT_VEC3 object indicating the point in 3D of the POSITIONABLE within the mission.

    POSITIONABLE:MessageToCoalition(Message, Duration, Name, MessageCoalition)POSITIONABLE:MessageToCoalition(Message, Duration, MessageCoalition, Name)

    Send a message to a coalition.

    + + + + + + + + + + + + + + + + @@ -881,6 +854,23 @@ A coding example is provided at the description of the
    + #boolean + +SPAWN.AIOnOff + +
    +
    + + + + +

    The AI is on by default when spawning a group.

    + +
    + +
    +
    + #number SPAWN.AliveUnits @@ -1096,6 +1086,63 @@ end
    + +SPAWN:InitAIOff() + +
    +
    + +

    Turns the AI Off for the Group when spawning.

    + +

    Return value

    + +

    #SPAWN: +The SPAWN object

    + +
    +
    +
    +
    + + +SPAWN:InitAIOn() + +
    +
    + +

    Turns the AI On for the Group when spawning.

    + +

    Return value

    + +

    #SPAWN: +The SPAWN object

    + +
    +
    +
    +
    + + +SPAWN:InitAIOnOff(AIOnOff) + +
    +
    + + + +

    Parameter

    +
      +
    • + +

      AIOnOff :

      + +
    • +
    +
    +
    +
    +
    + SPAWN:InitArray(SpawnAngle, SpawnWidth, SpawnDeltaX, SpawnDeltaY) @@ -1692,6 +1739,9 @@ The group that was spawned. You can use this group for further actions.

    + +

    Don't repeat the group from Take-Off till Landing and back Take-Off by ReSpawning.

    +
    diff --git a/docs/Documentation/Static.html b/docs/Documentation/Static.html index a59aa4a26..4be12f0c8 100644 --- a/docs/Documentation/Static.html +++ b/docs/Documentation/Static.html @@ -18,6 +18,9 @@
    - + + + + + @@ -649,7 +657,7 @@ Use the method TASK.AddScore() to add scores whe - + @@ -2309,8 +2317,8 @@ self

    - -TASK:onenterAborted(Event, From, To) + +TASK:onafterReplan(From, Event, To)
    @@ -2321,16 +2329,47 @@ self

    • +

      #string From :

      + +
    • +
    • +

      #string Event :

    • +

      #string To :

      + +
    • +
    +
    +
    +
    +
    + + +TASK:onenterAborted(From, Event, To) + +
    +
    + +

    FSM function for a TASK

    + +

    Parameters

    +
    + + + + @@ -292,6 +300,12 @@ If you want to obtain the complete 3D position including ori� + + + + @@ -996,6 +1010,24 @@ The DCS Unit is not existing or alive.

    + +UNIT:GetUnits() + +
    +
    + +

    Returns the UNIT in a UNIT list of one element.

    + +

    Return value

    + +

    #list: +Wrapper.Unit#UNIT> The UNITs wrappers.

    + +
    +
    +
    +
    + UNIT:HasSEAD() @@ -1060,6 +1092,34 @@ The DCS Unit is not existing or alive.

    + +UNIT:InAir() + +
    +
    + +

    Returns true if the UNIT is in the air.

    + +

    Return values

    +
      +
    1. + +

      #boolean: +true if in the air.

      + +
    2. +
    3. + +

      #nil: +The UNIT is not existing or alive.

      + +
    4. +
    +
    +
    +
    +
    + UNIT:IsActive() @@ -1505,6 +1565,8 @@ The name of the DCS unit.

    +

    Type list

    + diff --git a/docs/Documentation/Utils.html b/docs/Documentation/Utils.html index 257221207..e0be30322 100644 --- a/docs/Documentation/Utils.html +++ b/docs/Documentation/Utils.html @@ -18,6 +18,9 @@
    + + + + + + + + + + + + @@ -107,7 +167,7 @@ @@ -210,12 +270,6 @@ - - - - diff --git a/docs/Documentation/routines.html b/docs/Documentation/routines.html index 01e4bbccc..f59f1eb4f 100644 --- a/docs/Documentation/routines.html +++ b/docs/Documentation/routines.html @@ -18,6 +18,9 @@
    • AI_Balancer
    • +
    • AI_Cap
    • +
    • AI_Cas
    • +
    • AI_Patrol
    • Account
    • Airbase
    • AirbasePolice
    • @@ -41,7 +44,6 @@
    • MissileTrainer
    • Mission
    • Object
    • -
    • Patrol
    • Point
    • Positionable
    • Process_JTAC
    • diff --git a/docs/Installation.md b/docs/Installation.md new file mode 100644 index 000000000..61fb78ce9 --- /dev/null +++ b/docs/Installation.md @@ -0,0 +1,81 @@ +# 2) Installation of the MOOSE Environment. + +This document describes how to install your MOOSE development environment, enhancing the mission design experience for your missions in DCS World. + +## 2.1) Install Eclipse LDT, a lua advanced editor + +Install [Eclipse LDT](https://eclipse.org/ldt) on your Windows 64 bit system. +This is a free lua editor based on the Eclipse ecosystem. +The advantage of LDT is that it greatly enhances your lua development environment with intellisense, better search capabilities etc. +You may have to install [java](https://www.java.com/en/download) first. +Ensure you install the **64-bit versions** of both Eclipse LDT and java! + +## 2.2) Get your MOOSE repository installed on your PC and linked with GITHUB + +### 2.2.1) Install GITHUB desktop + +Install [GITHUB](https://desktop.github.com) desktop. +We use GITHUB desktop to sync the moose repository to your system. + +### 2.2.2) Link the MOOSE repository + +Link the MOOSE repository on GITHUB to your freshly installed GITHUB desktop. +Do this by browing to the MOOSE repository at GITHUB, and select the green button **Clone or Download** -> **Open in Desktop**. +Specify a local directory on your PC where you want to store the MOOSE repository contents. +Sync the MOOSE repository to a defined local MOOSE directory on your PC using GITHUB desktop (press the sync button). + +### 2.2.3) Sync the Dcs folder in the MOOSE repository + +On your local MOOSE directory, execute the batch file [DCS_Folder_Sync.bat](https://github.com/FlightControl-Master/MOOSE/blob/master/DCS_Folder_Sync.bat). +This will sync the dcs folder in the MOOSE repository from the submodule DCS API. +The Dcs folder is what we call a GITHUB submodule, which needs to be synced separately. +You will be notified when you need to re-sync the Dcs folder through GITHUB channels. + +** As a result, you have installed the MOOSE repository on your PC, and it is fully synced. ** + +## 2.3) Configuration of the Eclipse LDT to work with MOOSE and activate your intellisense etc. + +The section explains how to setup your Eclipse LDT environment, link it with the MOOSE respository. +This will enable you to start developing mission scripts in lua, which will be fully intellisense enabled!!! + +### 2.3.1) Create a new **Workspace** in LDT. + +The LDT editor has a concept of "workspaces", this contains all your settings of your editing environment, like views, menu options etc. +I suggest you create a workspace at your user id, the default location when you first start LDT. + +1. Open Eclipse LDT. +2. Select the workspace to be stored at your user id. + +### 2.3.2) Create a new **Project** in LDT. + +Here we will create a new project called "Moose_Framework" in your LDT environment. +The project details are already defined within the MOOSE framework repository, which is installed on your local MOOSE directory on your PC. +We will link into that directory and load the Project properties. + +1. Select from the Menu: File -> New -> Lua Project. + +![LDT_New_Project](Installation/LDT_New_Project.JPG) + +2. A "New Project" dialog box is shown. + +![LDT_Project](Installation/LDT_Project.JPG) + +3. Type the Project Name: **Moose_Framework**. +4. In the sub-box "Project Contents", select the option Create Project at existing location (from existing source). +5. Browse to the local MOOSE directory (press on the Browse button) and select the root directory of your local MO.OSE directory on your PC. Press OK. +6. You're back at the "New Project" dialog box. Press the **Next** button below the dialog box. +__(All the other settings are by default ok)__. +7. You should see now a dialog box with the following properties. +Note that the Moose Development/Moose directory is flagged as the **Source Directory*. (It is listed totally on top.) +This is important because it will search in the files in this directory and sub directories for lua documentator enabled lua files. +This will enable the intellisense of the MOOSE repository! + +![LDT Finish](Installation/LDT_Moose_Framework_Finish.JPG) + +8. Press the **Finish** button. + +As a result, when you browse to the Script Explorer, you'll see the following: + +![LDT_Script_Explorer](Installation/LDT_Script_Explorer.JPG) + +**Congratulations! You have now setup your Moose_Framework project LDT environment!** diff --git a/docs/Installation/LDT_Moose_Framework_Finish.JPG b/docs/Installation/LDT_Moose_Framework_Finish.JPG new file mode 100644 index 000000000..a97887e29 Binary files /dev/null and b/docs/Installation/LDT_Moose_Framework_Finish.JPG differ diff --git a/docs/Installation/LDT_New_Project.JPG b/docs/Installation/LDT_New_Project.JPG new file mode 100644 index 000000000..fb9894a01 Binary files /dev/null and b/docs/Installation/LDT_New_Project.JPG differ diff --git a/docs/Installation/LDT_Project.JPG b/docs/Installation/LDT_Project.JPG new file mode 100644 index 000000000..2faedee6b Binary files /dev/null and b/docs/Installation/LDT_Project.JPG differ diff --git a/docs/Installation/LDT_Project_Source_Directory.JPG b/docs/Installation/LDT_Project_Source_Directory.JPG new file mode 100644 index 000000000..142616a14 Binary files /dev/null and b/docs/Installation/LDT_Project_Source_Directory.JPG differ diff --git a/docs/Installation/LDT_Script_Explorer.JPG b/docs/Installation/LDT_Script_Explorer.JPG new file mode 100644 index 000000000..fc58d0582 Binary files /dev/null and b/docs/Installation/LDT_Script_Explorer.JPG differ diff --git a/docs/Installation/Originals/LDT_Moose_Framework_Finish.JPG b/docs/Installation/Originals/LDT_Moose_Framework_Finish.JPG new file mode 100644 index 000000000..b433f392c Binary files /dev/null and b/docs/Installation/Originals/LDT_Moose_Framework_Finish.JPG differ diff --git a/docs/Installation/Originals/LDT_New_Project.JPG b/docs/Installation/Originals/LDT_New_Project.JPG new file mode 100644 index 000000000..0d0fe94e7 Binary files /dev/null and b/docs/Installation/Originals/LDT_New_Project.JPG differ diff --git a/docs/Installation/Originals/LDT_Project.JPG b/docs/Installation/Originals/LDT_Project.JPG new file mode 100644 index 000000000..ac36141e4 Binary files /dev/null and b/docs/Installation/Originals/LDT_Project.JPG differ diff --git a/docs/Installation/Originals/LDT_Project_Source_Directory.JPG b/docs/Installation/Originals/LDT_Project_Source_Directory.JPG new file mode 100644 index 000000000..abb1e78ad Binary files /dev/null and b/docs/Installation/Originals/LDT_Project_Source_Directory.JPG differ diff --git a/docs/Installation/Originals/LDT_Script_Explorer.JPG b/docs/Installation/Originals/LDT_Script_Explorer.JPG new file mode 100644 index 000000000..67df16696 Binary files /dev/null and b/docs/Installation/Originals/LDT_Script_Explorer.JPG differ diff --git a/docs/Installation/README.md b/docs/Installation/README.md new file mode 100644 index 000000000..0a27f5bf4 --- /dev/null +++ b/docs/Installation/README.md @@ -0,0 +1,266 @@ +# Context + + +MOOSE is a **M**ission **O**bject **O**riented **S**cripting **E**nvironment, and is meant for mission designers and mission hosters. +It allows to quickly setup complex missions using pre-scripted scenarios using the available classes within the MOOSE Framework. +MOOSE is designed to work with DCS world 1.5. and 2.0. + +![Banner](Presentations\MOOSE\Dia1.JPG) + +# Goals + +The goal of MOOSE is to allow mission designers to enhance their scripting with mission orchestration objects, which can be instantiated from defined classes within the framework. This will allow to write mission scripts with minimal code embedded. Of course, the richness of the framework will determine the richness of the misson scenarios. We can expect that MOOSE will evolve over time, as more missions will be designed within the framework. + +## GitHub Repository + +You can find the source of [MOOSE on GITHUB](https://github.com/FlightControl-Master/MOOSE/). It is free for download. + +# Installation of tools and sync the MOOSE repository. + +1. Install [Eclipse LDT](https://eclipse.org/ldt) on your Windows 64 bit system. This is a free lua editor based on the Eclipse ecosystem. The advantage of LDT is that it greatly enhances your lua development environment with intellisense, better search capabilities etc. You may have to install [java](https://www.java.com/en/download) first. Ensure you install the **64-bit versions** of both Eclipse LDT and java! +2. Install [GITHUB](https://desktop.github.com) desktop. We use GITHUB desktop to sync the moose repository to your system. +3. Link the MOOSE repository on GITHUB to your freshly installed GITHUB desktop. Do this by browing to the MOOSE repository at GITHUB, and select the green button **Clone or Download** -> **Open in Desktop**. +4. Specify a local directory on your PC where you want to store the MOOSE repository contents. +5. Sync the MOOSE repository to a defined local MOOSE directory on your PC using GITHUB desktop (press the sync button). +6. On your local MOOOSE directory, execute the batch file [DCS_Folder_Sync.bat](https://github.com/FlightControl-Master/MOOSE/blob/master/DCS_Folder_Sync.bat). This will sync the dcs folder in the MOOSE repository from the submodule DCS API. + +As a result, you have installed the MOOSE repository on your PC, and it is fully synced. + +# Setup Eclipse LDT to work with MOOSE and activate your intellisense etc. + +1. Open Eclipse LDT. +2. Select the workspace to be stored at your user id. +3. Select from the Menu: File -> New -> Lua Project. + +![LDT_New_Project](Setup/LDT_New_Project.JPG) + +4. A dialog box is shown. + +![LDT_Project](Setup/LDT_Project.JPG) + +5. Type the Project Name: Moose_Framework +6. In the sub-box Project Contents, select the option Create Project at existing location (from existing source). Browse to the local MOOSE directory and select the root directory of MOOSE. +7. Select the Next button. +8. You should see now a dialog box with the following properties. Note that the Moose_Framework/Moose Development/Moose directory is flagged as the **Source Directory*. This is important because it will search in the files in this directory and sub directories for lua documentator enabled lua files. It will make the intellisense work! + +![LDT Finish](Setup/LDT_Moose_Framework_Finish.JPG) + +9. Press the Finish button. + +As a result, when you browse to the Script Explorer, you'll see the following: + +![LDT_Script_Explorer](Setup/LDT_Script_Explorer.JPG) + +## YouTube Broadcast Channel + +MOOSE has a [broadcast channel](https://www.youtube.com/channel/UCjrA9j5LQoWsG4SpS8i79Qg/playlists) on youtube. +These videos are grouped into playlists, which explain specific MOOSE capabilities, +and gradually build up the "understanding" and "what is possible" to do with the MOOSE framework. +I really, really encourage all to watch the explanation videos. + +Some mandatory videos to watch are: + + * [MOOSE Introduction](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl1JEtVcyf9sazUV5_fGICz4) + + * [MOOSE Setup](https://www.youtube.com/watch?v=-Hxae3mTCE8&t=159s&index=1&list=PL7ZUrU4zZUl0riB9ULVh-bZvFlw1_Wym2) + * [MOOSE Spawning](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl1jirWIo4t4YxqN-HxjqRkL) + * [MOOSE Tasking](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl3CgxN2iAViiGLTPpQ-Ajdg) + * [MOOSE Task Dispatching](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl3I6ieFM-cjey-rncF1ktNI) + +## MOOSE community + +There is a MOOSE community at various places out there. The main community can be found at slack.com. +Various channels and people are helping each other out using the framework. +If you would like to join, please contact me on skype: FlightControl_Skype. + + +## Test Missions + +The framework comes with [Test Missions](https://github.com/FlightControl-Master/MOOSE/tree/master/Moose%20Test%20Missions), that you can try out and helps you to code. +You can copy/paste code the code snippets into your missions, as it accellerates your mission developments. + +These exact test missions are demonstrated at the demo videos in the YouTube channel. + +Note: MOOSE is complementary to [MIST](https://github.com/mrSkortch/MissionScriptingTools/releases), so if you use MIST in parallel with MOOSE objects, this should work. + +# MOOSE Directory Structure + +As you can see at the GitHub site, the MOOSE framework is devided into a couple of directories: + +* Moose Development: Contains the collection of lua files that define the MOOSE classes. You can use this directory to build the dynamic luadoc documentation intellisense in your eclipse development environment. +* Moose Mission Setup: Contains the Moose.lua file to be included in your scripts when using MOOSE classes (see below the point Mission Design with Moose). +* Moose Test Missions: Contains a directory structure with Moose Test Missions and examples. In each directory, you will find a miz file and a lua file containing the main mission script. +* Moose Training: Contains the documentation of Moose generated with luadoc from the Moose source code. The presentations used during the videos in my [youtube channel](https://www.youtube.com/channel/UCjrA9j5LQoWsG4SpS8i79Qg), are also to be found here. + +# Mission Design with Moose + +In order to create a mission using MOOSE, you'll have to include a file named **Moose.lua**: + +1. Create a new mission in the DCS World Mission Editor. +2. In the mission editor, create a new trigger. +3. Name the trigger Moose Load and let it execute only at MISSION START. +4. Add an action DO SCRIPT FILE (without a condition, so the middle column must be empty). +5. In the action, browse to the **[Moose.lua](https://github.com/FlightControl-Master/MOOSE/tree/master/Moose%20Mission%20Setup)** file in the **Moose Mission Setup** directory, and include this file within your mission. +6. Make sure that the "Moose Load" trigger is completely at the top of your mission. + +Voila, MOOSE is now included in your mission. During the execution of this mission, all MOOSE classes will be loaded, and all MOOSE initializations will be exectuted before any other mission action is executed. + +IMPORTANT NOTE: When a new version of MOOSE is released, you'll have to UPDATE the Moose.lua file in EACH OF YOUR MISSION. +This can be a tedious task, and for this purpose, a tool has been developed that will update the Moose.lua files automatically within your missions. +Refer to the tool at [Moose Mission Setup\Moose Mission Update](https://github.com/FlightControl-Master/MOOSE/tree/master/Moose%20Mission%20Setup/Moose%20Mission%20Update) directory for further information included in the [READ.ME]() file. + +# MOOSE Classes + +The following classes are currently embedded within MOOSE and can be included within your mission scripts: + +![Classes](Presentations\MOOSE\Dia2.JPG) + +## MOOSE Core Classes + +These classes define the base building blocks of the MOOSE framework. These classes are heavily used within the MOOSE framework. + +* [BASE](Documentation/Base.html): The main class from which all MOOSE classes are derived from. The BASE class contains essential functions to support inheritance and MOOSE object execution tracing (logging within the DCS.log file in the saved games folder of the user). + +* [DATABASE](Documentation/Database.html): Creates a collection of GROUPS[], UNITS[], CLIENTS[] and managed these sets automatically. Provides an API set to retrieve a GROUP, UNIT or CLIENT instance from the _DATABASE object using defined APIs. The collections are maintained dynamically during the execution of the mission, so when players join, leave, when units are created or destroyed, the collections are dynamically updated. + +* [EVENT](Documentation/Event.html): Provides the Event Dispatcher base class to handle DCS Events, being fired upon registered events within the DCS simulator. Note that EVENT is used by BASE, exposing OnEvent() methods to catch these DCS events. + +* [FSM](Documentation/Fsm.html): The main FSM class can be used to build a Finite State Machine. The derived FSM_ classes provide Finite State Machine building capability for CONTROLLABLEs, ACT_ (Task Actions) classes, TASKs and SETs. + +* [MENU](Documentation/Menu.html): Set Menu options (F10) for All Players, Coalitions, Groups, Clients. MENU also manages the recursive removal of menus, which is a big asset! + +* [SETS](Documentation/Set.html): Create SETs of MOOSE objects. SETs can be created for GROUPs, UNITs, AIRBASEs, ... +The SET can be filtered with defined filter criteria. +Iterators are available that iterate through the GROUPSET, calling a function for each object within the SET. + +* [MESSAGE](Documentation/Message.html): A message publishing system, displaying messages to Clients, Coalitions or All players. + +* [POINTS](Documentation/Point.html): A set of point classes to manage the 2D or 3D simulation space, through an extensive method library. +The POINT_VEC3 class manages the 3D simulation space, while the POINT_VEC2 class manages the 2D simulation space. + +* [ZONES](Documentation/Zone.html): A set of zone classes that provide the functionality to validate the presence of GROUPS, UNITS, CLIENTS, STATICS within a certain ZONE. The zones can take various forms and can be movable. + +* [SCHEDULER](Documentation/Scheduler.html): This class implements a timer scheduler that will call at optional specified intervals repeatedly or just one time a scheduled function. + + +## MOOSE Wrapper Classes + +MOOSE Wrapper Classes provide an object oriented hierarchical mechanism to manage the DCS objects within the simulator. +Wrapper classes provide another easier mechanism to control Groups, Units, Statics, Airbases and other objects. + +* **[OBJECT](Documentation/Object.html)**: This class provides the base for MOOSE objects. + +* **[IDENTIFIABLE](Documentation/Identifiable.html)**: This class provides the base for MOOSE identifiable objects, which is every object within the simulator :-). + +* **[POSITIONABLE](Documentation/Positionable.html)**: This class provides the base for MOOSE positionable objects. These are AIRBASEs, STATICs, GROUPs, UNITs ... + +* **[CONTROLLABLE](Documentation/Controllable.html)**: This class provides the base for MOOSE controllable objects. These are GROUPs, UNITs, CLIENTs. + +* **[AIRBASE](Documentation/Airbase.html)**: This class wraps a DCS Airbase object within the simulator. + +* **[GROUP](Documentation/Group.html)**: This class wraps a DCS Group objects within the simulator, which are currently alive. +It provides a more extensive API set. +It takes an abstraction of the complexity to give tasks, commands and set various options to DCS Groups. +Additionally, the GROUP class provides a much richer API to identify various properties of the DCS Group. +For each DCS Group created object within a running mission, a GROUP object will be created automatically, beging managed within the DATABASE. + +* **[UNIT](Documentation/Unit.html)**: This class wraps a DCS Unit object within the simulator, which are currently alive. It provides a more extensive API set, as well takes an abstraction of the complexity to give commands and set various options to DCS Units. Additionally, the UNIT class provides a much richer API to identify various properties of the DCS Unit. For each DCS Unit object created within a running mission, a UNIT object will be created automatically, that is stored within the DATABASE, under the _DATABASE object. +the UNIT class provides a more extensive API set, taking an abstraction of the complexity to give tasks, commands and set various options to DCS Units. +For each DCS Unit created object within a running mission, a UNIT object will be created automatically, beging managed within the DATABASE. + +* **[CLIENT](Documentation/Client.html)**: This class wraps a DCS Unit object within the simulator, which has a skill Client or Player. +The CLIENT class derives from the UNIT class, thus contains the complete UNIT API set, and additionally, the CLIENT class provides an API set to manage players joining or leaving clients, sending messages to players, and manage the state of units joined by players. For each DCS Unit object created within a running mission that can be joined by a player, a CLIENT object will be created automatically, that is stored within the DATABASE, under the _DATABASE object. + +* **[STATIC](Documentation/Static.html)**: This class wraps a DCS StaticObject object within the simulator. +The STATIC class derives from the POSITIONABLE class, thus contains also the position API set. + + +## MOOSE Functional Classes + +MOOSE Functional Classes provide various functions that are useful in mission design. + +* [SPAWN](Documentation/Spawn.html): Spawn new groups (and units) during mission execution. + +* [ESCORT](Moose Training/Documentation/Escort.html): Makes groups consisting of helicopters, airplanes, ground troops or ships within a mission joining your flight. You can control these groups through the ratio menu during your flight. Available commands are around: Navigation, Position Hold, Reporting (Target Detection), Attacking, Assisted Attacks, ROE, Evasion, Mission Execution and more ... + +* [MISSILETRAINER](Moose Training/Documentation/MissileTrainer.html): Missile trainer, it destroys missiles when they are within a certain range of player airplanes, displays tracking and alert messages of missile launches; approach; destruction, and configure with radio menu commands. Various APIs available to configure the trainer. + +* [DETECTION](Moose Training/Documentation/Detection.html): Detect other units using the available sensors of the detection unit. The DETECTION_BASE derived classes will provide different methods how the sets of detected objects are built. + +## MOOSE AI Controlling Classes + +MOOSE AI Controlling Classes provide mechanisms to control AI over long lasting processes. +These AI Controlling Classes are based on FSM (Finite State Machine) Classes, and provided an encapsulated way to make AI behave or execute an activity. + +* [AI_BALANCER](Documentation/AI_Balancer.html): Compensate in a multi player mission the abscence of players with dynamically spawned AI air units. When players join CLIENTS, the AI will either be destroyed, or will fly back to the home or nearest friendly airbase. + +* [AI_PATROLZONE](Documentation/AI_PatrolZone.html): Make an alive AI Group patrol a zone derived from the ZONE_BASE class. Manage out-of-fuel events and set altitude and speed ranges for the patrol. + +* [AI_CARGO](Documentation/AI_Cargo.html): Make AI behave as cargo. Various CARGO types exist. + +## MOOSE Tasking Classes + +MOOSE Tasking Classes provide a comprehensive Mission Orchestration System. +Through COMMANDCENTERs, multiple logical MISSIONs can be orchestrated for coalitions. +Within each MISSION, various TASKs can be defined. +Each TASK has a TASK ACTION flow, which is the flow that a player (hosted by a UNIT) within the simulator needs to follow and accomplish. + +* [COMMANDCENTER](Documentation/CommandCenter.html): Orchestrates various logical MISSIONs for a coalition. + +* [MISSION](Documentation/Mission.html): Each MISSION has various TASKs to be executed and accomplished by players. + +* [TASK](Documentation/Task.html): Each TASK has a status, and has a TASK ACTION flow for each Player acting and executing the TASK. + +* [TASK_SEAD](Documentation/Task_SEAD.html): Models a SEAD Task, where a Player is routed towards an attack zone, and various SEADing targets need to be eliminated. + +* [TASK_A2G](Documentation/Task_A2G.html): Models a A2G Task, where a Player is routed towards an attack zone, and various A2G targets need to be eliminated. + +## MOOSE Action Classes + +MOOSE Action Classes are task action sub-flows, that can be used and combined, to quickly define a comprehensive end-to-end task action flow. +For example, for the SEAD Task, the task action flow combines the actions ASSIGN, ROUTE, ACCOUNT and ASSIST task action sub-flows. + +* [ACT_ASSIGN](Documentation/Assign.html): Mechanism to accept a TASK by a player. For example, assign the task only after the player accepts the task using the menu. + +* [ACT_ROUTE](Documentation/Route.html): Mechanisms to route players to zones or any other positionable coordinate. For example, route a player towards a zone. + +* [ACT_ACCOUNT](Documentation/Account.html): Mechanisms to account various events within the simulator. For example, account the dead events, accounting dead units within a Target SET within a ZONE. + +* [ACT_ASSIST](Documentation/Assist.html): Mechanisms to assist players executing a task. For example, acquire targets through smoking them. + + +# Credits + +Note that the framework is based on code i've written myself, but some of it is also based on code that i've seen as great scripting code and ideas, and which i've revised. I see this framework evolving towards a broader public, and the ownership may dissapear (or parts of it). Consider this code public domain. Therefore a list of credits to all who have or are contributing (this list will increase over time): Grimes, Prof_Hilactic, xcom, the 476 virtual squadron team, ... + +You'll notice that within this framework, there are functions used from mist. I've taken the liberty to copy those atomic mist functions that are very nice and useful, and used those. + +**Grimes** +Without the effort of Grimes with MIST and his continuous documentation, the development of MOOSE would not have been possible. MOOSE is not replacing MIST, but is compensating it. + +**Prof_hilactic** +SEAD Defenses. I've taken the script, and reworded it to fit within MOOSE. The script within MOOSE is hardly recognizable anymore from the original. Find here the posts: http://forums.eagle.ru/showpost.php?...59&postcount=1 + +**xcom** +His contribution is related to the Event logging system. I've analyzed and studied his scripts, and reworked it a bit to use it also within the framework (I've also tweaked it a bit). Find his post here: http://forums.eagle.ru/showpost.php?...73&postcount=1 + +**Dutch_Baron (James)** +Working together with James has resulted in the creation of the AIBALANCER class. James has shared his ideas on balancing AI with air units, and together we made a first design which you can use now :-) + +**Stuka (Danny)** +Working together with Danny has resulted in the MISSILETRAINER class. Stuka has shared his ideas and together we made a design. Together with the 476 virtual team, we tested this CLASS, and got much positive feedback! + +**Mechanic (Gabor)** +Worked together with Gabor to create the concept of the DETECTION and FAC classes. Mechanic shared his ideas and concepts to group detected targets into sets within detection zones... Will continue to work with G�bor to workout the DETECTION and FAC classes. + +**Shadoh** +Interacted on the eagle dynamics forum to build the FOLLOW class to build large WWII airplane formations. + +For the rest I also would like to thank the numerous feedback and help and assistance of the moose community at SLACK.COM. +Note that there is a vast amount of other scripts out there. +I may contact you personally to ask for your contribution / permission if i can use your idea or script to tweak it to the framework. +Parts of these scripts will have to be redesigned to fit it into an OO framework. + +The rest of the framework functions and class definitions were my own developments, especially the core of MOOSE. +Trust I've spent hours and hours investigating, trying and writing and documenting code building this framework. +Hope you think the idea is great and useful. \ No newline at end of file diff --git a/docs/Presentations/AI_CAP/Dia1.JPG b/docs/Presentations/AI_CAP/Dia1.JPG new file mode 100644 index 000000000..7b1c0d8dc Binary files /dev/null and b/docs/Presentations/AI_CAP/Dia1.JPG differ diff --git a/docs/Presentations/AI_CAP/Dia10.JPG b/docs/Presentations/AI_CAP/Dia10.JPG new file mode 100644 index 000000000..c49f26545 Binary files /dev/null and b/docs/Presentations/AI_CAP/Dia10.JPG differ diff --git a/docs/Presentations/AI_CAP/Dia11.JPG b/docs/Presentations/AI_CAP/Dia11.JPG new file mode 100644 index 000000000..0e7e53142 Binary files /dev/null and b/docs/Presentations/AI_CAP/Dia11.JPG differ diff --git a/docs/Presentations/AI_CAP/Dia12.JPG b/docs/Presentations/AI_CAP/Dia12.JPG new file mode 100644 index 000000000..b9c42741b Binary files /dev/null and b/docs/Presentations/AI_CAP/Dia12.JPG differ diff --git a/docs/Presentations/AI_CAP/Dia13.JPG b/docs/Presentations/AI_CAP/Dia13.JPG new file mode 100644 index 000000000..efedca7b0 Binary files /dev/null and b/docs/Presentations/AI_CAP/Dia13.JPG differ diff --git a/docs/Presentations/AI_CAP/Dia14.JPG b/docs/Presentations/AI_CAP/Dia14.JPG new file mode 100644 index 000000000..2913091b7 Binary files /dev/null and b/docs/Presentations/AI_CAP/Dia14.JPG differ diff --git a/docs/Presentations/AI_CAP/Dia2.JPG b/docs/Presentations/AI_CAP/Dia2.JPG new file mode 100644 index 000000000..1b1492d6c Binary files /dev/null and b/docs/Presentations/AI_CAP/Dia2.JPG differ diff --git a/docs/Presentations/AI_CAP/Dia3.JPG b/docs/Presentations/AI_CAP/Dia3.JPG new file mode 100644 index 000000000..f32e036c0 Binary files /dev/null and b/docs/Presentations/AI_CAP/Dia3.JPG differ diff --git a/docs/Presentations/AI_CAP/Dia4.JPG b/docs/Presentations/AI_CAP/Dia4.JPG new file mode 100644 index 000000000..f3015fbeb Binary files /dev/null and b/docs/Presentations/AI_CAP/Dia4.JPG differ diff --git a/docs/Presentations/AI_CAP/Dia5.JPG b/docs/Presentations/AI_CAP/Dia5.JPG new file mode 100644 index 000000000..1fd33de78 Binary files /dev/null and b/docs/Presentations/AI_CAP/Dia5.JPG differ diff --git a/docs/Presentations/AI_CAP/Dia6.JPG b/docs/Presentations/AI_CAP/Dia6.JPG new file mode 100644 index 000000000..c5024ddbf Binary files /dev/null and b/docs/Presentations/AI_CAP/Dia6.JPG differ diff --git a/docs/Presentations/AI_CAP/Dia7.JPG b/docs/Presentations/AI_CAP/Dia7.JPG new file mode 100644 index 000000000..fbf9987ad Binary files /dev/null and b/docs/Presentations/AI_CAP/Dia7.JPG differ diff --git a/docs/Presentations/AI_CAP/Dia8.JPG b/docs/Presentations/AI_CAP/Dia8.JPG new file mode 100644 index 000000000..ee0b36aba Binary files /dev/null and b/docs/Presentations/AI_CAP/Dia8.JPG differ diff --git a/docs/Presentations/AI_CAP/Dia9.JPG b/docs/Presentations/AI_CAP/Dia9.JPG new file mode 100644 index 000000000..0c4760538 Binary files /dev/null and b/docs/Presentations/AI_CAP/Dia9.JPG differ diff --git a/docs/Presentations/AI_CAS/Dia1.JPG b/docs/Presentations/AI_CAS/Dia1.JPG new file mode 100644 index 000000000..0bf4c1e92 Binary files /dev/null and b/docs/Presentations/AI_CAS/Dia1.JPG differ diff --git a/docs/Presentations/AI_CAS/Dia10.JPG b/docs/Presentations/AI_CAS/Dia10.JPG new file mode 100644 index 000000000..6e5096863 Binary files /dev/null and b/docs/Presentations/AI_CAS/Dia10.JPG differ diff --git a/docs/Presentations/AI_CAS/Dia11.JPG b/docs/Presentations/AI_CAS/Dia11.JPG new file mode 100644 index 000000000..a236d65e2 Binary files /dev/null and b/docs/Presentations/AI_CAS/Dia11.JPG differ diff --git a/docs/Presentations/AI_CAS/Dia12.JPG b/docs/Presentations/AI_CAS/Dia12.JPG new file mode 100644 index 000000000..bcf6d85ff Binary files /dev/null and b/docs/Presentations/AI_CAS/Dia12.JPG differ diff --git a/docs/Presentations/AI_CAS/Dia13.JPG b/docs/Presentations/AI_CAS/Dia13.JPG new file mode 100644 index 000000000..797dcbaf8 Binary files /dev/null and b/docs/Presentations/AI_CAS/Dia13.JPG differ diff --git a/docs/Presentations/AI_CAS/Dia2.JPG b/docs/Presentations/AI_CAS/Dia2.JPG new file mode 100644 index 000000000..574ed5b9b Binary files /dev/null and b/docs/Presentations/AI_CAS/Dia2.JPG differ diff --git a/docs/Presentations/AI_CAS/Dia3.JPG b/docs/Presentations/AI_CAS/Dia3.JPG new file mode 100644 index 000000000..9bcc78a57 Binary files /dev/null and b/docs/Presentations/AI_CAS/Dia3.JPG differ diff --git a/docs/Presentations/AI_CAS/Dia4.JPG b/docs/Presentations/AI_CAS/Dia4.JPG new file mode 100644 index 000000000..2cd22e14a Binary files /dev/null and b/docs/Presentations/AI_CAS/Dia4.JPG differ diff --git a/docs/Presentations/AI_CAS/Dia5.JPG b/docs/Presentations/AI_CAS/Dia5.JPG new file mode 100644 index 000000000..22f923f5c Binary files /dev/null and b/docs/Presentations/AI_CAS/Dia5.JPG differ diff --git a/docs/Presentations/AI_CAS/Dia6.JPG b/docs/Presentations/AI_CAS/Dia6.JPG new file mode 100644 index 000000000..668413e95 Binary files /dev/null and b/docs/Presentations/AI_CAS/Dia6.JPG differ diff --git a/docs/Presentations/AI_CAS/Dia7.JPG b/docs/Presentations/AI_CAS/Dia7.JPG new file mode 100644 index 000000000..04d4abd9a Binary files /dev/null and b/docs/Presentations/AI_CAS/Dia7.JPG differ diff --git a/docs/Presentations/AI_CAS/Dia8.JPG b/docs/Presentations/AI_CAS/Dia8.JPG new file mode 100644 index 000000000..c1aebf592 Binary files /dev/null and b/docs/Presentations/AI_CAS/Dia8.JPG differ diff --git a/docs/Presentations/AI_CAS/Dia9.JPG b/docs/Presentations/AI_CAS/Dia9.JPG new file mode 100644 index 000000000..47845f382 Binary files /dev/null and b/docs/Presentations/AI_CAS/Dia9.JPG differ diff --git a/docs/Presentations/AI_PATROL/Dia1.JPG b/docs/Presentations/AI_PATROL/Dia1.JPG new file mode 100644 index 000000000..26bc14fe0 Binary files /dev/null and b/docs/Presentations/AI_PATROL/Dia1.JPG differ diff --git a/docs/Presentations/AI_PATROL/Dia10.JPG b/docs/Presentations/AI_PATROL/Dia10.JPG new file mode 100644 index 000000000..63cee3a04 Binary files /dev/null and b/docs/Presentations/AI_PATROL/Dia10.JPG differ diff --git a/docs/Presentations/AI_PATROL/Dia11.JPG b/docs/Presentations/AI_PATROL/Dia11.JPG new file mode 100644 index 000000000..cae7f2722 Binary files /dev/null and b/docs/Presentations/AI_PATROL/Dia11.JPG differ diff --git a/docs/Presentations/AI_PATROL/Dia12.JPG b/docs/Presentations/AI_PATROL/Dia12.JPG new file mode 100644 index 000000000..851e5f161 Binary files /dev/null and b/docs/Presentations/AI_PATROL/Dia12.JPG differ diff --git a/docs/Presentations/AI_PATROL/Dia2.JPG b/docs/Presentations/AI_PATROL/Dia2.JPG new file mode 100644 index 000000000..0227de5ed Binary files /dev/null and b/docs/Presentations/AI_PATROL/Dia2.JPG differ diff --git a/docs/Presentations/AI_PATROL/Dia3.JPG b/docs/Presentations/AI_PATROL/Dia3.JPG new file mode 100644 index 000000000..f32e036c0 Binary files /dev/null and b/docs/Presentations/AI_PATROL/Dia3.JPG differ diff --git a/docs/Presentations/AI_PATROL/Dia4.JPG b/docs/Presentations/AI_PATROL/Dia4.JPG new file mode 100644 index 000000000..f3015fbeb Binary files /dev/null and b/docs/Presentations/AI_PATROL/Dia4.JPG differ diff --git a/docs/Presentations/AI_PATROL/Dia5.JPG b/docs/Presentations/AI_PATROL/Dia5.JPG new file mode 100644 index 000000000..1fd33de78 Binary files /dev/null and b/docs/Presentations/AI_PATROL/Dia5.JPG differ diff --git a/docs/Presentations/AI_PATROL/Dia6.JPG b/docs/Presentations/AI_PATROL/Dia6.JPG new file mode 100644 index 000000000..a41920d1c Binary files /dev/null and b/docs/Presentations/AI_PATROL/Dia6.JPG differ diff --git a/docs/Presentations/AI_PATROL/Dia7.JPG b/docs/Presentations/AI_PATROL/Dia7.JPG new file mode 100644 index 000000000..55ee1a64b Binary files /dev/null and b/docs/Presentations/AI_PATROL/Dia7.JPG differ diff --git a/docs/Presentations/AI_PATROL/Dia8.JPG b/docs/Presentations/AI_PATROL/Dia8.JPG new file mode 100644 index 000000000..8c9155db4 Binary files /dev/null and b/docs/Presentations/AI_PATROL/Dia8.JPG differ diff --git a/docs/Presentations/AI_PATROL/Dia9.JPG b/docs/Presentations/AI_PATROL/Dia9.JPG new file mode 100644 index 000000000..0c4760538 Binary files /dev/null and b/docs/Presentations/AI_PATROL/Dia9.JPG differ diff --git a/docs/README.md b/docs/README.md index 237b1e2ea..8c2da4509 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,64 +1,99 @@ -# Context - +# 1) MOOSE framework MOOSE is a **M**ission **O**bject **O**riented **S**cripting **E**nvironment, and is meant for mission designers and mission hosters. It allows to quickly setup complex missions using pre-scripted scenarios using the available classes within the MOOSE Framework. -MOOSE is designed to work with DCS world 1.5. and 2.0. +MOOSE works with DCS world 1.5. and 2.0. -![Banner](Presentations\MOOSE\Dia1.JPG) +![MOOSE Banner](Presentations\MOOSE\Dia1.JPG) -# Goals +MOOSE is an Object Oriented framework and defines **Classes**, which are components that combine **Methods** and **Variables**/**Properties** as one encapsulated structure (table). +Mission Designers can **instantiate objects** from these MOOSE classes, which declares a variable that contains a reference to the instantiated object from the MOOSE Class. +So, you can use that variable to use its methods and properties to build your logic. Note that in OO lua, a methods are addressed using the ":" notation, +because a "self" variable is passed that contains the object reference to that function! -The goal of MOOSE is to allow mission designers to enhance their scripting with mission orchestration objects, which can be instantiated from defined classes within the framework. This will allow to write mission scripts with minimal code embedded. Of course, the richness of the framework will determine the richness of the misson scenarios. We can expect that MOOSE will evolve over time, as more missions will be designed within the framework. +An example of what this means is shortly explained using the SPAWN class of MOOSE, which you can use to spawn new groups into your running mission. +The SPAWN class simplifies the process of spawning, and it has many methods that you can use to create variations how you want your spawn object to spawn new groups. -## GitHub Repository +```lua +local SpawnObject = SPAWN:New( "GroupName" ) -- This creates a new SpawnObject from the SPAWN class, using the :New method constructor to instantiate a new SPAWN object searching for the GroupName as the late activated group defined within your Mission Editor. +-- Nothing is spawned yet..., so let's use now the SpawnObject to spawn a new GROUP. -You can find the source of [MOOSE on GITHUB](https://github.com/FlightControl-Master/MOOSE/). It is free for download. +local SpawnGroup = SpawnObject:Spawn() -- Here we use the :Spawn() method of the SPAWN class. This method creates a new group from the GroupName template as defined within the Mission Editor. +``` -## YouTube Broadcast Channel +## 1.1) MOOSE framework goal -MOOSE has a [broadcast channel](https://www.youtube.com/channel/UCjrA9j5LQoWsG4SpS8i79Qg/playlists) on youtube. -These videos are grouped into playlists, which explain specific MOOSE capabilities, -and gradually build up the "understanding" and "what is possible" to do with the MOOSE framework. -I really, really encourage all to watch the explanation videos. +The goal of MOOSE is to allow mission designers to enhance their scripting with mission orchestration objects, which can be instantiated from defined classes within the framework. This will allow to write mission scripts with minimal code embedded. Of course, the richness of the framework will determine the richness of the misson scenarios. +The MOOSE is a service that is produced while being consumed ... , it will evolve further as more classes are developed for the framework, and as more users are using it. -Some mandatory videos to watch are: +MOOSE is NOT meant to be a one-man show, it is meant to evolve within a growing community around the framework. - * [MOOSE in 5 Minutes](https://www.youtube.com/watch?v=Sb4nmobV8Vk) +Within the community, key users will start supporting, documenting, explaining and even creating new classes for the framework. +It is the ambition to grow this framework as a de-facto standard for mission designers to use. - * [MOOSE Introduction and Setup](https://www.youtube.com/watch?v=-Hxae3mTCE8&t=159s&index=1&list=PL7ZUrU4zZUl0riB9ULVh-bZvFlw1_Wym2) - * [MOOSE Spawning](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl1jirWIo4t4YxqN-HxjqRkL) - * [MOOSE Tasking](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl3CgxN2iAViiGLTPpQ-Ajdg) - * [MOOSE Task Dispatching](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl3I6ieFM-cjey-rncF1ktNI) +## 1.2) MOOSE framework at GITHUB -## MOOSE community +You can find the source of [MOOSE framework on GITHUB](https://github.com/FlightControl-Master/MOOSE/). +It is free for download and usage, but it is under license of the GNU 3.0 open source license policy. +The MOOSE development uses the GITHUB service to enforce and control a structured development within a growing community. +GITHUB enforces a structured approval process, release and change management, and a communicative distribution and deployment. +The MOOSE framework development is considered an open source project, where contributors are welcome to contribute on the development. +Some key users have already started with this process. Contact me if you're interested to contribute. -There is a MOOSE community at various places out there. The main community can be found at slack.com. -Various channels and people are helping each other out using the framework. -If you would like to join, please contact me on skype: FlightControl_Skype. +## 1.3) Eclipse LDT +MOOSE utilizes the Eclipse Lua Development Tools. As a result, the MOOSE framework is documented using the luadocumentor standard. +Every class, method and variable is documented within the source, and mission designers can write mission script lua code that is **intellisense**(-ed) ... +What that means is that while you are coding your mission, your object and variables (derived from MOOSE classes) will list the methods and properties of that class interactively while coding ... -## Test Missions +![Intellisense](Usage/Intellisense.JPG) -The framework comes with [Test Missions](https://github.com/FlightControl-Master/MOOSE/tree/master/Moose%20Test%20Missions), that you can try out and helps you to code. -You can copy/paste code the code snippets into your missions, as it accellerates your mission developments. +## 1.4) LUA training -These exact test missions are demonstrated at the demo videos in the YouTube channel. +In order to efficiently use the MOOSE framework, it is highly recommended that you learn a couple of basic principles of lua. +I recommend you learn the basic lua principles following this [lua tutorial](https://www.tutorialspoint.com/lua). +We're not asking you to become an expert in lua, leave that to the experts, but, you'll need to have some basic lua coding +knowledge to "understand" the code, and also, to understand the syntax. -Note: MOOSE is complementary to [MIST](https://github.com/mrSkortch/MissionScriptingTools/releases), so if you use MIST in parallel with MOOSE objects, this should work. +**Therefore, I suggest you walk through this [lua quick guide](https://www.tutorialspoint.com/lua/lua_quick_guide.htm)**. +Ignore the lua environment setup. DCS comes with a pre-defined lua environment. -# MOOSE Directory Structure +# 2) Installation -As you can see at the GitHub site, the MOOSE framework is devided into a couple of directories: +There is a complete installation guide as part of this documentation. + +[Click here for the installation guide of the MOOSE framework](Installation.html). + +# 3) Support Channels + +MOOSE is broadcasted, documented and supported through various social media channels. + +[Click here for the communities guide of the MOOSE framework](Communities.html). + +# 4) Demonstration Missions + +The framework comes with [Test Missions](https://github.com/FlightControl-Master/MOOSE/tree/master/Moose%20Test%20Missions), +that you can try out and helps you to code. These test missions provide examples of defined use cases how the MOOSE +framework can be utilized. Each test mission is located in a separate directory, which contains at least one .lua file and .miz file. +The .lua file contains the mission script file that shows how the use case was implemented. +You can copy/paste code the code snippets from this .lua file into your missions, as it will accellerate your mission developments. +You will learn, see, and understand how the different MOOSE classes need to be applied, and how you can create +more complex mission scenarios by combining these MOOSE classes into a complex but powerful mission engine. + +These exact test missions are also demonstrated at the demo videos in the YouTube channel. + +# 5) MOOSE Directory Structure + +The MOOSE framework is devided into a couple of directories: * Moose Development: Contains the collection of lua files that define the MOOSE classes. You can use this directory to build the dynamic luadoc documentation intellisense in your eclipse development environment. * Moose Mission Setup: Contains the Moose.lua file to be included in your scripts when using MOOSE classes (see below the point Mission Design with Moose). * Moose Test Missions: Contains a directory structure with Moose Test Missions and examples. In each directory, you will find a miz file and a lua file containing the main mission script. * Moose Training: Contains the documentation of Moose generated with luadoc from the Moose source code. The presentations used during the videos in my [youtube channel](https://www.youtube.com/channel/UCjrA9j5LQoWsG4SpS8i79Qg), are also to be found here. -# Mission Design with Moose +# 6) Mission Design with MOOSE -In order to create a mission using MOOSE, you'll have to include a file named **Moose.lua**: +In order to create or design a mission using MOOSE, you'll have to include a file named **Moose.lua**: 1. Create a new mission in the DCS World Mission Editor. 2. In the mission editor, create a new trigger. @@ -73,13 +108,32 @@ IMPORTANT NOTE: When a new version of MOOSE is released, you'll have to UPDATE t This can be a tedious task, and for this purpose, a tool has been developed that will update the Moose.lua files automatically within your missions. Refer to the tool at [Moose Mission Setup\Moose Mission Update](https://github.com/FlightControl-Master/MOOSE/tree/master/Moose%20Mission%20Setup/Moose%20Mission%20Update) directory for further information included in the [READ.ME]() file. -# MOOSE Classes +# 7) MOOSE Framework -The following classes are currently embedded within MOOSE and can be included within your mission scripts: +The following classes are currently embedded within MOOSE framework and can be included within your mission scripts: -![Classes](Presentations\MOOSE\Dia2.JPG) +![MOOSE framework](Presentations\MOOSE\Dia2.JPG) -## MOOSE Core Classes +MOOSE is an Object Oriented framework and defines **Classes**, which are components that combine **Methods** and **Variables**/**Properties** as one encapsulated structure (table). +Mission Designers can what we call **instantiate objects** from these MOOSE classes. + +An example of what this means is shortly explained using the SPAWN class of MOOSE, which you can use to spawn new groups into your running mission. +The SPAWN class simplifies the process of spawning, and it has many methods that you can use to create variations how you want your spawn object to spawn new groups. + +```lua +local SpawnObject = SPAWN:New( "GroupName" ) -- This creates a new SpawnObject from the SPAWN class, using the :New method constructor to instantiate a new SPAWN object searching for the GroupName as the late activated group defined within your Mission Editor. +-- Nothing is spawned yet..., so let's use now the SpawnObject to spawn a new GROUP. + +local SpawnGroup = SpawnObject:Spawn() -- Here we use the :Spawn() method of the SPAWN class. This method creates a new group from the GroupName template as defined within the Mission Editor. +``` + +MOOSE Classes derive or inherit from each other, that means, within MOOSE there is an **Inheritance** structure where **inherited MOOSE Classes** are re-using properties and methods from the **Parent MOOSE Class**. +This powerful concept is used everywhere within the MOOSE framework. The main (Parent) Class in the MOOSE framework is the BASE class. Every MOOSE Class is derived from this top BASE Class. +So is also the SPAWN class derived from the BASE class. The BASE class provides powerful methods for debugging, event handling and implements the class handling logic. +As a normal MOOSE user, you won't implement any code using inheritance but just know that the inheritance structure is omni present in the intellisense and documentation. +You'll need to browse to the right MOOSE Class within the inheritance tree structure to identify which methods are properties are defined for which class. + +## 7.1) MOOSE Core Classes These classes define the base building blocks of the MOOSE framework. These classes are heavily used within the MOOSE framework. @@ -107,7 +161,7 @@ The POINT_VEC3 class manages the 3D simulation space, while the POINT_VEC2 class * [SCHEDULER](Documentation/Scheduler.html): This class implements a timer scheduler that will call at optional specified intervals repeatedly or just one time a scheduled function. -## MOOSE Wrapper Classes +## 7.2) MOOSE Wrapper Classes MOOSE Wrapper Classes provide an object oriented hierarchical mechanism to manage the DCS objects within the simulator. Wrapper classes provide another easier mechanism to control Groups, Units, Statics, Airbases and other objects. @@ -139,7 +193,7 @@ The CLIENT class derives from the UNIT class, thus contains the complete UNIT AP The STATIC class derives from the POSITIONABLE class, thus contains also the position API set. -## MOOSE Functional Classes +## 7.3) MOOSE Functional Classes MOOSE Functional Classes provide various functions that are useful in mission design. @@ -151,7 +205,7 @@ MOOSE Functional Classes provide various functions that are useful in mission de * [DETECTION](Moose Training/Documentation/Detection.html): Detect other units using the available sensors of the detection unit. The DETECTION_BASE derived classes will provide different methods how the sets of detected objects are built. -## MOOSE AI Controlling Classes +## 7.4) MOOSE AI Controlling Classes MOOSE AI Controlling Classes provide mechanisms to control AI over long lasting processes. These AI Controlling Classes are based on FSM (Finite State Machine) Classes, and provided an encapsulated way to make AI behave or execute an activity. @@ -162,7 +216,7 @@ These AI Controlling Classes are based on FSM (Finite State Machine) Classes, an * [AI_CARGO](Documentation/AI_Cargo.html): Make AI behave as cargo. Various CARGO types exist. -## MOOSE Tasking Classes +## 7.5) MOOSE Human Tasking Classes MOOSE Tasking Classes provide a comprehensive Mission Orchestration System. Through COMMANDCENTERs, multiple logical MISSIONs can be orchestrated for coalitions. @@ -179,7 +233,7 @@ Each TASK has a TASK ACTION flow, which is the flow that a player (hosted by a U * [TASK_A2G](Documentation/Task_A2G.html): Models a A2G Task, where a Player is routed towards an attack zone, and various A2G targets need to be eliminated. -## MOOSE Action Classes +## 7.6) MOOSE Action Classes MOOSE Action Classes are task action sub-flows, that can be used and combined, to quickly define a comprehensive end-to-end task action flow. For example, for the SEAD Task, the task action flow combines the actions ASSIGN, ROUTE, ACCOUNT and ASSIST task action sub-flows. @@ -193,23 +247,22 @@ For example, for the SEAD Task, the task action flow combines the actions ASSIGN * [ACT_ASSIST](Documentation/Assist.html): Mechanisms to assist players executing a task. For example, acquire targets through smoking them. -# MOOSE Tutorials and Examples +# 8) Credits -You can download [test missions](https://github.com/FlightControl-Master/MOOSE/tree/master/Test%20Missions) to have examples and learn the syntax and usage of the MOOSE classes. - -There are [Video Tutorials](https://www.youtube.com/channel/UCjrA9j5LQoWsG4SpS8i79Qg) on my YOUTUBE channel on which you can learn some coding aspects with mission execution demos, as well as some of the tooling and internal mechanisms within MOOSE. - - -In the triggers section, there is a flag (9999) that will decide how MOOSE will be loaded. When flag 9999 is set, MOOSE will be dynamically loaded. When flag 9999 is off, MOOSE will be loaded embedded. Note that when loaded embedded, **your mission must include the last Moose_Embedded.lua file**. So, ensure that the last file is included in the DO SCRIPT section when MOOSE got an update! - -# Credits - -Note that the framework is based on code i've written myself, but some of it is also based on code that i've seen as great scripting code and ideas, and which i've revised. I see this framework evolving towards a broader public, and the ownership may dissapear (or parts of it). Consider this code public domain. Therefore a list of credits to all who have or are contributing (this list will increase over time): Grimes, Prof_Hilactic, xcom, the 476 virtual squadron team, ... +Note that most of the framework is based on code i've written myself, +but some code of it is also based on code that i've seen as great scripting code and ideas, +and which has been revised and/or reworked to fit into the MOOSE framework. +I see this framework evolving towards a broader public, and the ownership may dissapear (or parts of it). Consider this code public domain. +Therefore a list of credits to all who have or are contributing (this list will increase over time). You'll notice that within this framework, there are functions used from mist. I've taken the liberty to copy those atomic mist functions that are very nice and useful, and used those. **Grimes** -Without the effort of Grimes with MIST and his continuous documentation, the development of MOOSE would not have been possible. MOOSE is not replacing MIST, but is compensating it. +Without the effort of Grimes with MIST and his continuous documentation of the DCS API, the development of MOOSE would not have been possible. +MOOSE is complementary to [MIST](https://github.com/mrSkortch/MissionScriptingTools/releases), so if you use MIST in parallel with MOOSE objects, this should work. +The documentation of the [DCS API] is the work of Grimes. Please consult his documentation in case of any question concerning the DCS API level. + + **Prof_hilactic** SEAD Defenses. I've taken the script, and reworded it to fit within MOOSE. The script within MOOSE is hardly recognizable anymore from the original. Find here the posts: http://forums.eagle.ru/showpost.php?...59&postcount=1 @@ -223,8 +276,8 @@ Working together with James has resulted in the creation of the AIBALANCER class **Stuka (Danny)** Working together with Danny has resulted in the MISSILETRAINER class. Stuka has shared his ideas and together we made a design. Together with the 476 virtual team, we tested this CLASS, and got much positive feedback! -**Mechanic (G�bor)** -Worked together with G�bor to create the concept of the DETECTION and FAC classes. Mechanic shared his ideas and concepts to group detected targets into sets within detection zones... Will continue to work with G�bor to workout the DETECTION and FAC classes. +**Mechanic (Gabor)** +Worked together with Gabor to create the concept of the DETECTION and FAC classes. Mechanic shared his ideas and concepts to group detected targets into sets within detection zones... Will continue to work with G�bor to workout the DETECTION and FAC classes. **Shadoh** Interacted on the eagle dynamics forum to build the FOLLOW class to build large WWII airplane formations. @@ -236,4 +289,7 @@ Parts of these scripts will have to be redesigned to fit it into an OO framework The rest of the framework functions and class definitions were my own developments, especially the core of MOOSE. Trust I've spent hours and hours investigating, trying and writing and documenting code building this framework. -Hope you think the idea is great and useful. \ No newline at end of file +Hope you think the idea is great and useful. + +Thank you! +FC \ No newline at end of file diff --git a/docs/Usage/Intellisense.JPG b/docs/Usage/Intellisense.JPG new file mode 100644 index 000000000..203140e5e Binary files /dev/null and b/docs/Usage/Intellisense.JPG differ
    SPAWN.AIOnOff + +
    SPAWN.AliveUnits @@ -360,6 +315,24 @@ A coding example is provided at the description of the SPAWN:GetSpawnIndexFromGroup(SpawnGroup)

    Get the index from a given group.

    +
    SPAWN:InitAIOff() +

    Turns the AI Off for the Group when spawning.

    +
    SPAWN:InitAIOn() +

    Turns the AI On for the Group when spawning.

    +
    SPAWN:InitAIOnOff(AIOnOff) +
    TASK:onenterAborted(Event, From, To)TASK:onafterReplan(From, Event, To) +

    FSM function for a TASK

    +
    TASK:onenterAborted(From, Event, To)

    FSM function for a TASK

    TASK:onenterFailed(Event, From, To)TASK:onenterFailed(From, Event, To)

    FSM function for a TASK

    UNIT:GetThreatLevel()

    Returns the Unit's A2G threat level on a scale from 1 to 10 ...

    +
    UNIT:GetUnits() +

    Returns the UNIT in a UNIT list of one element.

    UNIT:HasSensors(...)

    Returns if the unit has sensors of a certain type.

    +
    UNIT:InAir() +

    Returns true if the UNIT is in the air.

    AI_Balancer -

    SP:N MP:Y AI:Y HU:N TYP:A -- This module contains the AI_BALANCER class.

    +

    Single-Player:No / Mulit-Player:Yes / AI:Yes / Human:No / Types:All -- AI Balancing will replace in multi player missions +non-occupied human slots with AI groups, in order to provide an engaging simulation environment, +even when there are hardly any players in the mission.

    + +

    Banner Image

    + + +
    + +

    1) AI.AIBalancer#AIBALANCER class, extends Core.Fsm#FSM_SET

    + +

    The AI.AIBalancer#AIBALANCER class monitors and manages as many replacement AI groups as there are +CLIENTS in a SET_CLIENT collection, which are not occupied by human players.

    +
    AI_Cap +

    Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Air -- Execute Combat Air Patrol (CAP).

    + +

    Banner Image

    + + +
    + +

    1) #AICAPZONE class, extends AI.AICAP#AIPATROL_ZONE

    + +

    The #AICAPZONE class implements the core functions to patrol a Zone by an AI Controllable or Group +and automatically engage any airborne enemies that are within a certain range or within a certain zone.

    +
    AI_Cas +

    Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Air -- Provide Close Air Support to friendly ground troops.

    + +

    Banner Image

    + + +
    + +

    1) #AICASZONE class, extends AI.AIPatrol#AIPATROL_ZONE

    + +

    #AICASZONE derives from the AI.AIPatrol#AIPATROL_ZONE, inheriting its methods and behaviour.

    +
    AI_Patrol +

    Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Air -- Air Patrolling or Staging.

    + +

    Banner Image

    + + +
    + +

    1) #AIPATROLZONE class, extends Core.Fsm#FSM_CONTROLLABLE

    + +

    The #AIPATROLZONE class implements the core functions to patrol a Zone by an AI Controllable or Group.

    Cargo -

    Management of logical cargo objects, that can be transported from and to transportation carriers.

    +

    Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Ground -- Management of logical cargo objects, that can be transported from and to transportation carriers.

    Object

    This module contains the OBJECT class.

    -
    Patrol -

    (AI) (FSM) Make AI patrol routes or zones.