Module Zone

ZONE Classes

This module contains the ZONE classes, inherited from Zone#ZONE_BASE.

There are essentially two core functions that zones accomodate:

  • Test if an object is within the zone boundaries.
  • Provide the zone behaviour. Some zones are static, while others are moveable.

The object classes are using the zone classes to test the zone boundaries, which can take various forms:

  • Test if completely within the zone.
  • Test if partly within the zone (for Group#GROUP objects).
  • Test if not in the zone.
  • Distance to the nearest intersecting point of the zone.
  • Distance to the center of the zone.
  • ...

Each of these ZONE classes have a zone name, and specific parameters defining the zone type:

  • Zone#ZONE_BASE: The ZONE_BASE class defining the base for all other zone classes.
  • Zone#ZONE_RADIUS: The ZONE_RADIUS class defined by a zone name, a location and a radius.
  • Zone#ZONE: The ZONE class, defined by the zone name as defined within the Mission Editor.
  • Zone#ZONE_UNIT: The ZONE_UNIT class defined by a zone around a Unit#UNIT with a radius.
  • Zone#ZONE_POLYGON: The ZONE_POLYGON class defined by a sequence of Group#GROUP waypoints within the Mission Editor, forming a polygon.

Polymorphic methods

Each zone implements two polymorphic functions defined in Zone#ZONE_BASE:

Global(s)

ZONE
ZONE_BASE
ZONE_POLYGON
ZONE_RADIUS
ZONE_UNIT

Type ZONE

ZONE.ClassName
ZONE:New(ZoneName)

Constructor of ZONE, taking the zone name.

Type ZONE_BASE

ZONE_BASE.ClassName
ZONE_BASE:IsPointVec2InZone(PointVec2)
ZONE_BASE:IsPointVec3InZone(PointVec3)
ZONE_BASE:New(ZoneName)

Type ZONE_POLYGON

ZONE_POLYGON.ClassName
ZONE_POLYGON:IsPointVec2InZone(PointVec2)

Returns if a location is within the zone.

ZONE_POLYGON:New(ZoneName, ZoneGroup)

Constructor to create a ZONE_POLYGON instance, taking the zone name and the name of the Group#GROUP defined within the Mission Editor.

Type ZONE_RADIUS

ZONE_RADIUS.ClassName
ZONE_RADIUS:GetPointVec2()

Returns the location of the zone.

ZONE_RADIUS:GetPointVec3(Height)

Returns the point of the zone.

ZONE_RADIUS:GetRadius()

Returns the radius of the zone.

ZONE_RADIUS:GetRandomPointVec2()

Returns a random location within the zone.

ZONE_RADIUS:IsPointVec2InZone(PointVec2)

Returns if a location is within the zone.

ZONE_RADIUS:IsPointVec3InZone(PointVec3)

Returns if a point is within the zone.

ZONE_RADIUS:New(PointVec2, Radius, ZoneName)

Constructor of ZONE_RADIUS, taking the zone name, the zone location and a radius.

ZONE_RADIUS.PointVec2

The current location of the zone.

ZONE_RADIUS.Radius

The radius of the zone.

ZONE_RADIUS:SetPointVec2(PointVec2)

Sets the location of the zone.

ZONE_RADIUS:SetRadius(Radius)

Sets the radius of the zone.

Type ZONE_UNIT

ZONE_UNIT.ClassName
ZONE_UNIT:GetPointVec2()

Returns the current location of the Unit#UNIT.

ZONE_UNIT:New(ZoneName, ZoneUNIT, Radius)

Constructor to create a ZONE_UNIT instance, taking the zone name, a zone unit and a radius.

ZONE_UNIT.ZoneUNIT

Global(s)

#ZONE ZONE
#ZONE_BASE ZONE_BASE
#ZONE_POLYGON ZONE_POLYGON
#ZONE_RADIUS ZONE_RADIUS
#ZONE_UNIT ZONE_UNIT

Type Zone

Type ZONE

The ZONE class, defined by the zone name as defined within the Mission Editor.

The location and the radius are automatically collected from the mission settings.

Field(s)

#string ZONE.ClassName
ZONE:New(ZoneName)

Constructor of ZONE, taking the zone name.

Parameter

  • #string ZoneName : The name of the zone as defined within the mission editor.

Return value

#ZONE:

Type ZONE_BASE

The ZONE_BASE class

Field(s)

#string ZONE_BASE.ClassName
ZONE_BASE:IsPointVec2InZone(PointVec2)

Parameter

  • PointVec2 :

ZONE_BASE:IsPointVec3InZone(PointVec3)

Parameter

  • PointVec3 :

ZONE_BASE:New(ZoneName)

Parameter

  • ZoneName :

Type ZONE_POLYGON

The ZONE_POLYGON class defined by a sequence of Group#GROUP waypoints within the Mission Editor, forming a polygon.

Field(s)

#string ZONE_POLYGON.ClassName
ZONE_POLYGON:IsPointVec2InZone(PointVec2)

Returns if a location is within the zone.

Parameter

Return value

#boolean: true if the location is within the zone.

ZONE_POLYGON:New(ZoneName, ZoneGroup)

Constructor to create a ZONE_POLYGON instance, taking the zone name and the name of the Group#GROUP defined within the Mission Editor.

The Group#GROUP waypoints define the polygon corners. The first and the last point are automatically connected by ZONE_POLYGON.

Parameters

  • #string ZoneName : Name of the zone.

  • Group#GROUP ZoneGroup : The GROUP waypoints as defined within the Mission Editor define the polygon shape.

Return value

#ZONE_POLYGON: self

Type ZONE_RADIUS

The ZONE_RADIUS class, defined by a zone name, a location and a radius.

Field(s)

#string ZONE_RADIUS.ClassName
ZONE_RADIUS:GetPointVec2()

Returns the location of the zone.

Return value

DCSTypes#Vec2: The location of the zone.

ZONE_RADIUS:GetPointVec3(Height)

Returns the point of the zone.

Parameter

  • DCSTypes#Distance Height : The height to add to the land height where the center of the zone is located.

Return value

DCSTypes#Vec3: The point of the zone.

ZONE_RADIUS:GetRadius()

Returns the radius of the zone.

Return value

DCSTypes#Distance: The radius of the zone.

ZONE_RADIUS:GetRandomPointVec2()

Returns a random location within the zone.

Return value

DCSTypes#Vec2: The random location within the zone.

ZONE_RADIUS:IsPointVec2InZone(PointVec2)

Returns if a location is within the zone.

Parameter

Return value

#boolean: true if the location is within the zone.

ZONE_RADIUS:IsPointVec3InZone(PointVec3)

Returns if a point is within the zone.

Parameter

Return value

#boolean: true if the point is within the zone.

ZONE_RADIUS:New(PointVec2, Radius, ZoneName)

Constructor of ZONE_RADIUS, taking the zone name, the zone location and a radius.

Parameters

Return value

#ZONE_RADIUS:

DCSTypes#Vec2 ZONE_RADIUS.PointVec2

The current location of the zone.

DCSTypes#Distance ZONE_RADIUS.Radius

The radius of the zone.

ZONE_RADIUS:SetPointVec2(PointVec2)

Sets the location of the zone.

Parameter

Return value

DCSTypes#Vec2: The new location of the zone.

ZONE_RADIUS:SetRadius(Radius)

Sets the radius of the zone.

Parameter

Return value

DCSTypes#Distance: The radius of the zone.

Type ZONE_UNIT

The ZONE_UNIT class defined by a zone around a Unit#UNIT with a radius.

Field(s)

#string ZONE_UNIT.ClassName
ZONE_UNIT:GetPointVec2()

Returns the current location of the Unit#UNIT.

Return value

DCSTypes#Vec2: The location of the zone based on the Unit#UNITlocation.

ZONE_UNIT:New(ZoneName, ZoneUNIT, Radius)

Constructor to create a ZONE_UNIT instance, taking the zone name, a zone unit and a radius.

Parameters

  • #string ZoneName : Name of the zone.

  • Unit#UNIT ZoneUNIT : The unit as the center of the zone.

  • DCSTypes#Distance Radius : The radius of the zone.

Return value

#ZONE_UNIT: self

Unit#UNIT ZONE_UNIT.ZoneUNIT