Module Zone
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 defines by a zone around a Unit#UNIT with a radius.
- Zone#ZONE_GROUP: The ZONE_GROUP class defines by a zone around a Group#GROUP with a radius.
- Zone#ZONE_POLYGON: The ZONE_POLYGON class defines by a sequence of Group#GROUP waypoints within the Mission Editor, forming a polygon.
Each zone implements two polymorphic functions defined in Zone#ZONE_BASE:
- ZONE_BASE.IsPointVec2InZone: Returns if a location is within the zone.
- ZONE_BASE.IsPointVec3InZone: Returns if a point is within the zone.
1) Zone#ZONE_BASE class, extends Base#BASE
The ZONE_BASE class defining the base for all other zone classes.
2) Zone#ZONE_RADIUS class, extends Zone#ZONE_BASE
The ZONE_RADIUS class defined by a zone name, a location and a radius.
3) Zone#ZONE class, extends Zone#ZONE_RADIUS
The ZONE class, defined by the zone name as defined within the Mission Editor.
4) Zone#ZONE_UNIT class, extends Zone#ZONE_RADIUS
The ZONE_UNIT class defined by a zone around a Unit#UNIT with a radius.
5) Zone#ZONE_GROUP class, extends Zone#ZONE_RADIUS
The ZONE_GROUP class defines by a zone around a Group#GROUP with a radius. The current leader of the group defines the center of the zone.
6) Zone#ZONE_POLYGON class, extends Zone#ZONE_BASE
The ZONE_POLYGON class defined by a sequence of Group#GROUP waypoints within the Mission Editor, forming a polygon.
Global(s)
| ZONE | |
| ZONE_BASE | |
| ZONE_GROUP | |
| ZONE_POLYGON | |
| ZONE_POLYGON_BASE | |
| 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:GetBoundingSquare() |
Get the bounding square the zone. |
| ZONE_BASE:GetRandomVec2() |
Define a random DCSTypes#Vec2 within the zone. |
| ZONE_BASE:IsPointVec2InZone(PointVec2) |
Returns if a location is within the zone. |
| ZONE_BASE:IsPointVec3InZone(PointVec3) |
Returns if a point is within the zone. |
| ZONE_BASE:New(ZoneName) |
ZONE_BASE constructor |
| ZONE_BASE:SmokeZone(SmokeColor) |
Smokes the zone boundaries in a color. |
| ZONE_BASE.ZoneName |
Name of the zone. |
Type ZONE_BASE.BoundingSquare
| ZONE_BASE.BoundingSquare.x1 |
The lower x coordinate (left down) |
| ZONE_BASE.BoundingSquare.x2 |
The higher x coordinate (right up) |
| ZONE_BASE.BoundingSquare.y1 |
The lower y coordinate (left down) |
| ZONE_BASE.BoundingSquare.y2 |
The higher y coordinate (right up) |
Type ZONE_GROUP
| ZONE_GROUP.ClassName | |
| ZONE_GROUP:GetPointVec2() |
Returns the current location of the Group. |
| ZONE_GROUP:GetRandomVec2() |
Returns a random location within the zone of the Group. |
| ZONE_GROUP:New(ZoneName, ZoneGROUP, Radius) |
Constructor to create a ZONE_GROUP instance, taking the zone name, a zone Group#GROUP and a radius. |
| ZONE_GROUP.ZoneGROUP |
Type ZONE_POLYGON
| ZONE_POLYGON.ClassName | |
| 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_POLYGON_BASE
| ZONE_POLYGON_BASE.ClassName | |
| ZONE_POLYGON_BASE:Flush() |
Flush polygon coordinates as a table in DCS.log. |
| ZONE_POLYGON_BASE:GetBoundingSquare() |
Get the bounding square the zone. |
| ZONE_POLYGON_BASE:GetRandomVec2() |
Define a random DCSTypes#Vec2 within the zone. |
| ZONE_POLYGON_BASE:IsPointVec2InZone(PointVec2) |
Returns if a location is within the zone. |
| ZONE_POLYGON_BASE:New(ZoneName, PointsArray) |
Constructor to create a ZONEPOLYGONBASE instance, taking the zone name and an array of DCSTypes#Vec2, forming a polygon. |
| ZONE_POLYGON_BASE.Polygon |
The polygon defined by an array of DCSTypes#Vec2. |
| ZONE_POLYGON_BASE:SmokeZone(SmokeColor) |
Smokes the zone boundaries in a color. |
Type ZONE_RADIUS
| ZONE_RADIUS.ClassName | |
| ZONE_RADIUS:FlareZone(FlareColor, Points, Azimuth) |
Flares the zone boundaries in a color. |
| 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:GetRandomVec2() |
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(ZoneName, PointVec2, Radius) |
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. |
| ZONE_RADIUS:SmokeZone(SmokeColor, Points) |
Smokes the zone boundaries in a color. |
Type ZONE_UNIT
| ZONE_UNIT.ClassName | |
| ZONE_UNIT:GetPointVec2() |
Returns the current location of the Unit#UNIT. |
| ZONE_UNIT:GetRandomVec2() |
Returns a random location within the zone. |
| 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)
Type Zone
Type POINT_VEC3.FlareColor
Type POINT_VEC3.SmokeColor
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
-
Type ZONE_BASE
The ZONE_BASE class
Field(s)
- #string ZONE_BASE.ClassName
- ZONE_BASE:GetBoundingSquare()
-
Get the bounding square the zone.
Return value
#ZONE_BASE.BoundingSquare: The bounding square.
- ZONE_BASE:GetRandomVec2()
-
Define a random DCSTypes#Vec2 within the zone.
Return value
DCSTypes#Vec2: The Vec2 coordinates.
- ZONE_BASE:IsPointVec2InZone(PointVec2)
-
Returns if a location is within the zone.
Parameter
-
DCSTypes#Vec2 PointVec2: The location to test.
Return value
#boolean: true if the location is within the zone.
-
- ZONE_BASE:IsPointVec3InZone(PointVec3)
-
Returns if a point is within the zone.
Parameter
-
DCSTypes#Vec3 PointVec3: The point to test.
Return value
#boolean: true if the point is within the zone.
-
- ZONE_BASE:New(ZoneName)
-
ZONE_BASE constructor
Parameter
-
#string ZoneName: Name of the zone.
Return value
#ZONE_BASE: self
-
- ZONE_BASE:SmokeZone(SmokeColor)
-
Smokes the zone boundaries in a color.
Parameter
-
SmokeColor: The smoke color.
-
- #string ZONE_BASE.ZoneName
-
Name of the zone.
Type ZONE_BASE.BoundingSquare
The ZONE_BASE.BoundingSquare
Field(s)
- DCSTypes#Distance ZONE_BASE.BoundingSquare.x1
-
The lower x coordinate (left down)
- DCSTypes#Distance ZONE_BASE.BoundingSquare.x2
-
The higher x coordinate (right up)
- DCSTypes#Distance ZONE_BASE.BoundingSquare.y1
-
The lower y coordinate (left down)
- DCSTypes#Distance ZONE_BASE.BoundingSquare.y2
-
The higher y coordinate (right up)
Type ZONE_GROUP
The ZONE_GROUP class defined by a zone around a Group, taking the average center point of all the units within the Group, with a radius.
Field(s)
- #string ZONE_GROUP.ClassName
- ZONE_GROUP:GetPointVec2()
-
Returns the current location of the Group.
Return value
DCSTypes#Vec2: The location of the zone based on the Group location.
- ZONE_GROUP:GetRandomVec2()
-
Returns a random location within the zone of the Group.
Return value
DCSTypes#Vec2: The random location of the zone based on the Group location.
- ZONE_GROUP:New(ZoneName, ZoneGROUP, Radius)
-
Constructor to create a ZONE_GROUP instance, taking the zone name, a zone Group#GROUP and a radius.
Parameters
-
#string ZoneName: Name of the zone. -
Group#GROUP ZoneGROUP: The Group as the center of the zone. -
DCSTypes#Distance Radius: The radius of the zone.
Return value
#ZONE_GROUP: self
-
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: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_POLYGON_BASE
The ZONEPOLYGONBASE class defined by an array of DCSTypes#Vec2, forming a polygon.
Field(s)
- #string ZONE_POLYGON_BASE.ClassName
- ZONE_POLYGON_BASE:Flush()
-
Flush polygon coordinates as a table in DCS.log.
Return value
#ZONEPOLYGONBASE: self
- ZONE_POLYGON_BASE:GetBoundingSquare()
-
Get the bounding square the zone.
Return value
#ZONEPOLYGONBASE.BoundingSquare: The bounding square.
- ZONE_POLYGON_BASE:GetRandomVec2()
-
Define a random DCSTypes#Vec2 within the zone.
Return value
DCSTypes#Vec2: The Vec2 coordinate.
- ZONE_POLYGON_BASE:IsPointVec2InZone(PointVec2)
-
Returns if a location is within the zone.
Source learned and taken from: https://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
Parameter
-
DCSTypes#Vec2 PointVec2: The location to test.
Return value
#boolean: true if the location is within the zone.
-
- ZONE_POLYGON_BASE:New(ZoneName, PointsArray)
-
Constructor to create a ZONEPOLYGONBASE instance, taking the zone name and an array of DCSTypes#Vec2, forming a polygon.
The Group#GROUP waypoints define the polygon corners. The first and the last point are automatically connected.
Parameters
-
#string ZoneName: Name of the zone. -
#ZONEPOLYGONBASE.ListVec2 PointsArray: An array of DCSTypes#Vec2, forming a polygon..
Return value
#ZONEPOLYGONBASE: self
-
- #ZONE_POLYGON_BASE.ListVec2 ZONE_POLYGON_BASE.Polygon
-
The polygon defined by an array of DCSTypes#Vec2.
- ZONE_POLYGON_BASE:SmokeZone(SmokeColor)
-
Smokes the zone boundaries in a color.
Parameter
-
#POINT_VEC3.SmokeColor SmokeColor: The smoke color.
Return value
#ZONEPOLYGONBASE: self
-
Type ZONE_POLYGON_BASE.BoundingSquare
Type ZONE_POLYGON_BASE.ListVec2
A points array.
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:FlareZone(FlareColor, Points, Azimuth)
-
Flares the zone boundaries in a color.
Parameters
-
#POINT_VEC3.FlareColor FlareColor: The flare color. -
#number Points: (optional) The amount of points in the circle. -
DCSTypes#Azimuth Azimuth: (optional) Azimuth The azimuth of the flare.
Return value
#ZONE_RADIUS: self
-
- 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:GetRandomVec2()
-
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
-
DCSTypes#Vec2 PointVec2: The location to test.
Return value
#boolean: true if the location is within the zone.
-
- ZONE_RADIUS:IsPointVec3InZone(PointVec3)
-
Returns if a point is within the zone.
Parameter
-
DCSTypes#Vec3 PointVec3: The point to test.
Return value
#boolean: true if the point is within the zone.
-
- ZONE_RADIUS:New(ZoneName, PointVec2, Radius)
-
Constructor of ZONE_RADIUS, taking the zone name, the zone location and a radius.
Parameters
-
#string ZoneName: Name of the zone. -
DCSTypes#Vec2 PointVec2: The location of the zone. -
DCSTypes#Distance Radius: The radius of the zone.
Return value
#ZONE_RADIUS: self
-
- 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
-
DCSTypes#Vec2 PointVec2: The new location of the zone.
Return value
DCSTypes#Vec2: The new location of the zone.
-
- ZONE_RADIUS:SetRadius(Radius)
-
Sets the radius of the zone.
Parameter
-
DCSTypes#Distance Radius: The radius of the zone.
Return value
DCSTypes#Distance: The radius of the zone.
-
- ZONE_RADIUS:SmokeZone(SmokeColor, Points)
-
Smokes the zone boundaries in a color.
Parameters
-
#POINT_VEC3.SmokeColor SmokeColor: The smoke color. -
#number Points: (optional) The amount of points in the circle.
Return value
#ZONE_RADIUS: self
-
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:GetRandomVec2()
-
Returns a random location within the zone.
Return value
DCSTypes#Vec2: The random location within the zone.
- 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
-