Module AI_A2A_Cap

AI -- (R2.2) - Models the process of Combat Air Patrol (CAP) for airplanes.

This is a class used in the AI.AI_A2A_Dispatcher.


Author: FlightControl


Global(s)

AI_A2A_CAP

AIA2ACAP class, extends AI_CAP#AI_PATROL_ZONE

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

Type AI_A2A_CAP

AI_A2A_CAP:Abort()

Synchronous Event Trigger for Event Abort.

AI_A2A_CAP:Accomplish()

Synchronous Event Trigger for Event Accomplish.

AI_A2A_CAP.Accomplished
AI_A2A_CAP.AttackRoute(AICap, Fsm)
AI_A2A_CAP.AttackSetUnit
AI_A2A_CAP:Destroy()

Synchronous Event Trigger for Event Destroy.

AI_A2A_CAP:Engage()

Synchronous Event Trigger for Event Engage.

AI_A2A_CAP.EngageMaxSpeed
AI_A2A_CAP.EngageMinSpeed
AI_A2A_CAP.EngageRange
AI_A2A_CAP.EngageZone
AI_A2A_CAP.Engaging
AI_A2A_CAP:Fired()

Synchronous Event Trigger for Event Fired.

AI_A2A_CAP:New(AICap, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, EngageMinSpeed, EngageMaxSpeed, PatrolAltType)

Creates a new AIA2ACAP object

AI_A2A_CAP:OnAfterAbort(AICap, From, Event, To)

OnAfter Transition Handler for Event Abort.

AI_A2A_CAP:OnAfterAccomplish(AICap, From, Event, To)

OnAfter Transition Handler for Event Accomplish.

AI_A2A_CAP:OnAfterDestroy(AICap, From, Event, To)

OnAfter Transition Handler for Event Destroy.

AI_A2A_CAP:OnAfterEngage(AICap, From, Event, To)

OnAfter Transition Handler for Event Engage.

AI_A2A_CAP:OnAfterFired(AICap, From, Event, To)

OnAfter Transition Handler for Event Fired.

AI_A2A_CAP:OnBeforeAbort(AICap, From, Event, To)

OnBefore Transition Handler for Event Abort.

AI_A2A_CAP:OnBeforeAccomplish(AICap, From, Event, To)

OnBefore Transition Handler for Event Accomplish.

AI_A2A_CAP:OnBeforeDestroy(AICap, From, Event, To)

OnBefore Transition Handler for Event Destroy.

AI_A2A_CAP:OnBeforeEngage(AICap, From, Event, To)

OnBefore Transition Handler for Event Engage.

AI_A2A_CAP:OnBeforeFired(AICap, From, Event, To)

OnBefore Transition Handler for Event Fired.

AI_A2A_CAP:OnEnterEngaging(AICap, From, Event, To)

OnEnter Transition Handler for State Engaging.

AI_A2A_CAP:OnEventDead(EventData)
AI_A2A_CAP:OnLeaveEngaging(AICap, From, Event, To)

OnLeave Transition Handler for State Engaging.

AI_A2A_CAP.Resume(AICap)
AI_A2A_CAP:SetEngageRange(EngageRange)

Set the Engage Range when the AI will engage with airborne enemies.

AI_A2A_CAP:SetEngageZone(EngageZone)

Set the Engage Zone which defines where the AI will engage bogies.

AI_A2A_CAP:__Abort(Delay)

Asynchronous Event Trigger for Event Abort.

AI_A2A_CAP:__Accomplish(Delay)

Asynchronous Event Trigger for Event Accomplish.

AI_A2A_CAP:__Destroy(Delay)

Asynchronous Event Trigger for Event Destroy.

AI_A2A_CAP:__Engage(Delay)

Asynchronous Event Trigger for Event Engage.

AI_A2A_CAP:__Fired(Delay)

Asynchronous Event Trigger for Event Fired.

AI_A2A_CAP:onafterAbort(AICap, From, Event, To)
AI_A2A_CAP:onafterAccomplish(AICap, From, Event, To)
AI_A2A_CAP:onafterDestroy(AICap, From, Event, To, EventData)
AI_A2A_CAP:onafterEngage(AICap, From, Event, To, AttackSetUnit)
AI_A2A_CAP:onafterPatrol(AICap, From, Event, To)

onafter State Transition for Event Patrol.

AI_A2A_CAP:onafterStart(AICap, From, Event, To)

onafter State Transition for Event Patrol.

AI_A2A_CAP:onbeforeEngage(AICap, From, Event, To)

Global(s)

#AI_A2A_CAP AI_A2A_CAP

AIA2ACAP class, extends AI_CAP#AI_PATROL_ZONE

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

Process

The AIA2ACAP is assigned a Group and this must be done before the AIA2ACAP process can be started using the Start event.

Process

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

This cycle will continue.

Process

During the patrol, the AI will detect enemy targets, which are reported through the Detected event.

Process

When enemies are detected, the AI will automatically engage the enemy.

Process

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

1. AIA2ACAP constructor

2. AIA2ACAP is a FSM

Process

2.1 AIA2ACAP 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..

2.2 AIA2ACAP Events

3. Set the Range of Engagement

Range

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_CAP#AI_A2A_CAP.SetEngageRange() to define that range.

4. Set the Zone of Engagement

Zone

An optional Zone can be set, that will define when the AI will engage with the detected airborne enemy targets. Use the method AI_Cap#AI_A2A_CAP.SetEngageZone() to define that Zone.


Type AI_A2A_Cap

Type AI_A2A

Type AI_A2A_CAP

Extends AI.AI_A2A_Patrol#AI_A2A_PATROL

Field(s)

AI_A2A_CAP:Abort()

Synchronous Event Trigger for Event Abort.

AI_A2A_CAP:Accomplish()

Synchronous Event Trigger for Event Accomplish.

#boolean AI_A2A_CAP.Accomplished
AI_A2A_CAP.AttackRoute(AICap, Fsm)

Parameters

Core.Set#SET_UNIT AI_A2A_CAP.AttackSetUnit
AI_A2A_CAP:Destroy()

Synchronous Event Trigger for Event Destroy.

AI_A2A_CAP:Engage()

Synchronous Event Trigger for Event Engage.

AI_A2A_CAP.EngageMaxSpeed
AI_A2A_CAP.EngageMinSpeed
AI_A2A_CAP.EngageRange
AI_A2A_CAP.EngageZone
#boolean AI_A2A_CAP.Engaging
AI_A2A_CAP:Fired()

Synchronous Event Trigger for Event Fired.

AI_A2A_CAP:New(AICap, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, EngageMinSpeed, EngageMaxSpeed, PatrolAltType)

Creates a new AIA2ACAP object

Parameters

Return value

#AI_A2A_CAP:

AI_A2A_CAP:OnAfterAbort(AICap, From, Event, To)

OnAfter Transition Handler for Event Abort.

Parameters

  • Wrapper.Group#GROUP AICap : The Group Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

AI_A2A_CAP:OnAfterAccomplish(AICap, From, Event, To)

OnAfter Transition Handler for Event Accomplish.

Parameters

  • Wrapper.Group#GROUP AICap : The Group Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

AI_A2A_CAP:OnAfterDestroy(AICap, From, Event, To)

OnAfter Transition Handler for Event Destroy.

Parameters

  • Wrapper.Group#GROUP AICap : The Group Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

AI_A2A_CAP:OnAfterEngage(AICap, From, Event, To)

OnAfter Transition Handler for Event Engage.

Parameters

  • Wrapper.Group#GROUP AICap : The Group Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

AI_A2A_CAP:OnAfterFired(AICap, From, Event, To)

OnAfter Transition Handler for Event Fired.

Parameters

  • Wrapper.Group#GROUP AICap : The Group Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

AI_A2A_CAP:OnBeforeAbort(AICap, From, Event, To)

OnBefore Transition Handler for Event Abort.

Parameters

  • Wrapper.Group#GROUP AICap : The Group Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

Return value

#boolean: Return false to cancel Transition.

AI_A2A_CAP:OnBeforeAccomplish(AICap, From, Event, To)

OnBefore Transition Handler for Event Accomplish.

Parameters

  • Wrapper.Group#GROUP AICap : The Group Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

Return value

#boolean: Return false to cancel Transition.

AI_A2A_CAP:OnBeforeDestroy(AICap, From, Event, To)

OnBefore Transition Handler for Event Destroy.

Parameters

  • Wrapper.Group#GROUP AICap : The Group Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

Return value

#boolean: Return false to cancel Transition.

AI_A2A_CAP:OnBeforeEngage(AICap, From, Event, To)

OnBefore Transition Handler for Event Engage.

Parameters

  • Wrapper.Group#GROUP AICap : The Group Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

Return value

#boolean: Return false to cancel Transition.

AI_A2A_CAP:OnBeforeFired(AICap, From, Event, To)

OnBefore Transition Handler for Event Fired.

Parameters

  • Wrapper.Group#GROUP AICap : The Group Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

Return value

#boolean: Return false to cancel Transition.

AI_A2A_CAP:OnEnterEngaging(AICap, From, Event, To)

OnEnter Transition Handler for State Engaging.

Parameters

  • Wrapper.Group#GROUP AICap : The Group Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

AI_A2A_CAP:OnEventDead(EventData)

Parameter

AI_A2A_CAP:OnLeaveEngaging(AICap, From, Event, To)

OnLeave Transition Handler for State Engaging.

Parameters

  • Wrapper.Group#GROUP AICap : The Group Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

Return value

#boolean: Return false to cancel Transition.

AI_A2A_CAP.Resume(AICap)

Parameter

AI_A2A_CAP:SetEngageRange(EngageRange)

Set the Engage Range when the AI will engage with airborne enemies.

Parameter

  • #number EngageRange : The Engage Range.

Return value

#AI_A2A_CAP: self

AI_A2A_CAP:SetEngageZone(EngageZone)

Set the Engage Zone which defines where the AI will engage bogies.

Parameter

  • Core.Zone#ZONE EngageZone : The zone where the AI is performing CAP.

Return value

#AI_A2A_CAP: self

AI_A2A_CAP:__Abort(Delay)

Asynchronous Event Trigger for Event Abort.

Parameter

  • #number Delay : The delay in seconds.

AI_A2A_CAP:__Accomplish(Delay)

Asynchronous Event Trigger for Event Accomplish.

Parameter

  • #number Delay : The delay in seconds.

AI_A2A_CAP:__Destroy(Delay)

Asynchronous Event Trigger for Event Destroy.

Parameter

  • #number Delay : The delay in seconds.

AI_A2A_CAP:__Engage(Delay)

Asynchronous Event Trigger for Event Engage.

Parameter

  • #number Delay : The delay in seconds.

AI_A2A_CAP:__Fired(Delay)

Asynchronous Event Trigger for Event Fired.

Parameter

  • #number Delay : The delay in seconds.

AI_A2A_CAP:onafterAbort(AICap, From, Event, To)

Parameters

  • Wrapper.Group#GROUP AICap : The AI Group managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

AI_A2A_CAP:onafterAccomplish(AICap, From, Event, To)

Parameters

  • Wrapper.Group#GROUP AICap : The Group Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

AI_A2A_CAP:onafterDestroy(AICap, From, Event, To, EventData)

Parameters

  • Wrapper.Group#GROUP AICap : The Group Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

  • Core.Event#EVENTDATA EventData :

AI_A2A_CAP:onafterEngage(AICap, From, Event, To, AttackSetUnit)

Parameters

  • Wrapper.Group#GROUP AICap : The AICap Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

  • AttackSetUnit :

AI_A2A_CAP:onafterPatrol(AICap, From, Event, To)

onafter State Transition for Event Patrol.

Parameters

  • Wrapper.Group#GROUP AICap : The AI Group managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

AI_A2A_CAP:onafterStart(AICap, From, Event, To)

onafter State Transition for Event Patrol.

Parameters

  • Wrapper.Group#GROUP AICap : The AI Group managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

AI_A2A_CAP:onbeforeEngage(AICap, From, Event, To)

Parameters

  • Wrapper.Group#GROUP AICap : The Group Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

Type AI_A2A_GCI