Module Airbase

This module contains the AIRBASE classes.


1) Airbase#AIRBASE class, extends Positionable#POSITIONABLE

The AIRBASE class is a wrapper class to handle the DCS Airbase objects:

  • Support all DCS Airbase APIs.
  • Enhance with Airbase specific APIs not in the DCS Airbase API set.

1.1) AIRBASE reference methods

For each DCS Airbase object alive within a running mission, a AIRBASE wrapper object (instance) will be created within the _DATABASE object. This is done at the beginning of the mission (when the mission starts).

The AIRBASE class does not contain a :New() method, rather it provides :Find() methods to retrieve the object reference using the DCS Airbase or the DCS AirbaseName.

Another thing to know is that AIRBASE objects do not "contain" the DCS Airbase object. The AIRBASE methods will reference the DCS Airbase object by name when it is needed during API execution. If the DCS Airbase object does not exist or is nil, the AIRBASE methods will return nil and log an exception in the DCS.log file.

The AIRBASE class provides the following functions to retrieve quickly the relevant AIRBASE instance:

  • AIRBASE.Find(): Find a AIRBASE instance from the _DATABASE object using a DCS Airbase object.
  • AIRBASE.FindByName(): Find a AIRBASE instance from the _DATABASE object using a DCS Airbase name.

IMPORTANT: ONE SHOULD NEVER SANATIZE these AIRBASE OBJECT REFERENCES! (make the AIRBASE object references nil).

1.2) DCS AIRBASE APIs

The DCS Airbase APIs are used extensively within MOOSE. The AIRBASE class has for each DCS Airbase API a corresponding method. To be able to distinguish easily in your code the difference between a AIRBASE API call and a DCS Airbase API call, the first letter of the method is also capitalized. So, by example, the DCS Airbase method DCSAirbase#Airbase.getName() is implemented in the AIRBASE class as AIRBASE.GetName().

More functions will be added

During the MOOSE development, more functions will be added.

Global(s)

AIRBASE

Type AIRBASE

AIRBASE.CategoryName
AIRBASE.ClassName
AIRBASE:Find(DCSAirbase)

Finds a AIRBASE from the _DATABASE using a DCSAirbase object.

AIRBASE:FindByName(AirbaseName)

Find a AIRBASE in the _DATABASE using the name of an existing DCS Airbase.

AIRBASE:GetCallSign()

Returns the Airbase's callsign - the localized string.

AIRBASE:GetCategory()

Returns the DCS Airbase category as defined within the DCS Airbase Descriptor.

AIRBASE:GetCategoryName()

Returns the DCS Airbase category name as defined within the DCS Airbase Descriptor.

AIRBASE:GetCoalition()

Returns coalition of the Airbase.

AIRBASE:GetCountry()

Returns country of the Airbase.

AIRBASE:GetDCSAirbase()
AIRBASE:GetDesc()

Returns unit descriptor.

AIRBASE:GetID()

Returns the unit's unique identifier.

AIRBASE:GetName()

Returns DCS Airbase object name.

AIRBASE:GetPointVec2()

Returns the DCSTypes#Vec2 vector indicating the point in 2D of the DCS Airbase within the mission.

AIRBASE:GetTypeName()

Returns the type name of the DCS Airbase.

AIRBASE:IsAlive()

Returns if the airbase is alive.

AIRBASE:Register(AirbaseName)

Create a new AIRBASE from DCSAirbase.

Global(s)

#AIRBASE AIRBASE

Type Airbase

Type AIRBASE

The AIRBASE class

Field(s)

AIRBASE.CategoryName
#string AIRBASE.ClassName
AIRBASE:Find(DCSAirbase)

Finds a AIRBASE from the _DATABASE using a DCSAirbase object.

Parameter

Return value

Airbase#AIRBASE: self

AIRBASE:FindByName(AirbaseName)

Find a AIRBASE in the _DATABASE using the name of an existing DCS Airbase.

Parameter

  • #string AirbaseName : The Airbase Name.

Return value

Airbase#AIRBASE: self

AIRBASE:GetCallSign()

Returns the Airbase's callsign - the localized string.

Return values

  1. #string: The Callsign of the Airbase.

  2. #nil: The DCS Airbase is not existing or alive.

AIRBASE:GetCategory()

Returns the DCS Airbase category as defined within the DCS Airbase Descriptor.

Return value

DCSAirbase#Airbase.Category: The DCS Airbase Category

AIRBASE:GetCategoryName()

Returns the DCS Airbase category name as defined within the DCS Airbase Descriptor.

Return value

#string: The DCS Airbase Category Name

AIRBASE:GetCoalition()

Returns coalition of the Airbase.

Return values

  1. DCSCoalitionObject#coalition.side: The side of the coalition.

  2. #nil: The DCS Airbase is not existing or alive.

AIRBASE:GetCountry()

Returns country of the Airbase.

Return values

  1. DCScountry#country.id: The country identifier.

  2. #nil: The DCS Airbase is not existing or alive.

AIRBASE:GetDCSAirbase()
AIRBASE:GetDesc()

Returns unit descriptor.

Descriptor type depends on unit category.

Return values

  1. DCSAirbase#Airbase.Desc: The Airbase descriptor.

  2. #nil: The DCS Airbase is not existing or alive.

AIRBASE:GetID()

Returns the unit's unique identifier.

Return values

  1. DCSAirbase#Airbase.ID: Airbase ID

  2. #nil: The DCS Airbase is not existing or alive.

AIRBASE:GetName()

Returns DCS Airbase object name.

The function provides access to non-activated units too.

Return values

  1. #string: The name of the DCS Airbase.

  2. #nil: The DCS Airbase is not existing or alive.

AIRBASE:GetPointVec2()

Returns the DCSTypes#Vec2 vector indicating the point in 2D of the DCS Airbase within the mission.

Return values

  1. DCSTypes#Vec2: The 2D point vector of the DCS Airbase.

  2. #nil: The DCS Airbase is not existing or alive.

AIRBASE:GetTypeName()

Returns the type name of the DCS Airbase.

Return values

  1. #string: The type name of the DCS Airbase.

  2. #nil: The DCS Airbase is not existing or alive.

AIRBASE:IsAlive()

Returns if the airbase is alive.

Return values

  1. #boolean: true if Airbase is alive.

  2. #nil: The DCS Airbase is not existing or alive.

AIRBASE:Register(AirbaseName)

Create a new AIRBASE from DCSAirbase.

Parameter

  • #string AirbaseName : The name of the airbase.

Return value

Airbase#AIRBASE: