Module Functional.ZoneGoal
Functional - Base class that models processes to achieve goals involving a Zone.
ZONE_GOAL models processes that have a Goal with a defined achievement involving a Zone. Derived classes implement the ways how the achievements can be realized.
Author: FlightControl
Contributions: funkyfranky, Applevangelist
Global(s)
Global ZONE_GOAL |
Models processes that have a Goal with a defined achievement involving a Zone. |
Models processes that have a Goal with a defined achievement involving a Zone.
Derived classes implement the ways how the achievements can be realized.
1. ZONE_GOAL constructor
- ZONE_GOAL.New(): Creates a new ZONE_GOAL object.
2. ZONE_GOAL is a finite state machine (FSM).
2.1 ZONE_GOAL States
- None: Initial State
2.2 ZONE_GOAL Events
- DestroyedUnit: A Wrapper.Unit is destroyed in the Zone. The event will only get triggered if the method ZONE_GOAL.MonitorDestroyedUnits() is used.
Type(s)
Fields and Methods inherited from ZONE_GOAL | Description |
---|---|
Name of the class. |
|
DestroyedUnit event. |
|
Flare the zone boundary. |
|
Get the Zone. |
|
Get the name of the Zone. |
|
The goal object. |
|
Activate the event UnitDestroyed to be fired when a unit is destroyed in the zone. |
|
ZONE_GOAL Constructor. |
|
ZONE_GOAL:OnAfterDestroyedUnit(From, Event, To, DestroyedUnit, PlayerName) |
DestroyedUnit Handler OnAfter for ZONE_GOAL |
Activate smoking of zone with the color or the current owner. |
|
Set the smoke color. |
|
Color of the smoke. |
|
Scheduler responsible for smoking the zone. |
|
Time stamp in seconds when the last smoke of the zone was triggered. |
|
If true, smoke zone. |
|
Check status Smoke. |
|
DestroyedUnit delayed event |
|
When started, check the Smoke and the Zone status. |
Fields and Methods inherited from ZONE_RADIUS | Description |
---|---|
Bounds the zone with tires. |
|
Check if a certain coalition is inside a scanned zone. |
|
Count the number of different coalitions inside the zone. |
|
ZONE_GOAL:DrawZone(Coalition, Color, Alpha, FillColor, FillAlpha, LineType, ReadOnly) |
Draw the zone circle on the F10 map. |
Flares the zone boundaries in a color. |
|
Returns the radius of the zone. |
|
Returns a Core.Point#COORDINATE object reflecting a random 3D location within the zone. |
|
ZONE_GOAL:GetRandomCoordinateWithoutBuildings(inner, outer, distance, markbuildings, markfinal) |
Returns a Core.Point#COORDINATE object reflecting a random location within the zone where there are no map objects of type "Building". |
Returns a Core.Point#POINT_VEC2 object reflecting a random 2D location within the zone. |
|
Returns a Core.Point#POINT_VEC3 object reflecting a random 3D location within the zone. |
|
Returns a random Vec2 location within the zone. |
|
Returns Returns a random Vec3 location within the zone. |
|
Get Coalitions of the units in the Zone, or Check if there are units of the given Coalition in the Zone. |
|
Get scanned scenery table |
|
Get table of scanned scenery objects |
|
Get scanned scenery type |
|
Get a set of scanned groups. |
|
Get set of scanned scenery objects |
|
Get a set of scanned units. |
|
Get a table of scanned units. |
|
Returns the DCS#Vec2 of the zone. |
|
Returns the DCS#Vec3 of the ZONE_RADIUS. |
|
Is All in Zone of Coalition? |
|
Is All in Zone of Other Coalition? |
|
Is None in Zone? |
|
Is None in Zone of Coalition? |
|
Is Some in Zone of Coalition? |
|
Returns if a location is within the zone. |
|
Returns if a point is within the zone. |
|
Mark the zone with markers on the F10 map. |
|
Constructor of #ZONE_RADIUS, taking the zone name, the zone location and a radius. |
|
The radius of the zone. |
|
Remove junk inside the zone using the |
|
Scan the zone for the presence of units of the given ObjectCategories. |
|
Searches the zone |
|
Sets the radius of the zone. |
|
Sets the DCS#Vec2 of the zone. |
|
ZONE_GOAL:SmokeZone(SmokeColor, Points, AddHeight, AddOffSet, AngleOffset) |
Smokes the zone boundaries in a color. |
Update zone from a 2D vector. |
|
Update zone from a 2D vector. |
|
The current location of the zone. |
Field(s)
Name of the class.
Color of the smoke.
Time stamp in seconds when the last smoke of the zone was triggered.
If true, smoke zone.
Function(s)
Flare the zone boundary.
Activate the event UnitDestroyed to be fired when a unit is destroyed in the zone.
Defined in:
ZONE_GOAL
ZONE_GOAL Constructor.
Defined in:
ZONE_GOAL
Parameter:
A Core.Zone object with the goal to be achieved. Alternatively, can be handed as the name of late activated group describing a ZONE_POLYGON with its waypoints.
Return value:
DestroyedUnit Handler OnAfter for ZONE_GOAL
Defined in:
ZONE_GOAL
Parameters:
#string From
#string Event
#string To
Wrapper.Unit#UNIT DestroyedUnit
The destroyed unit.
#string PlayerName
The name of the player.
Activate smoking of zone with the color or the current owner.
Defined in:
ZONE_GOAL
Parameter:
#boolean switch
If true or nil activate smoke. If false or nil, no smoke.
Return value:
Set the smoke color.
DestroyedUnit delayed event
Defined in:
ZONE_GOAL
Parameter:
#number delay
Delay in seconds.
Field(s)
Name of the class.
Color of the smoke.
Time stamp in seconds when the last smoke of the zone was triggered.
If true, smoke zone.
Function(s)
Bounds the zone with tires.
Defined in:
Parameters:
#number Points
(optional) The amount of points in the circle. Default 360.
DCS#country.id CountryID
The country id of the tire objects, e.g. country.id.USA for blue or country.id.RUSSIA for red.
#boolean UnBound
(Optional) If true the tyres will be destroyed.
Return value:
self
Check if a certain coalition is inside a scanned zone.
Defined in:
Parameter:
#number Coalition
The coalition id, e.g. coalition.side.BLUE.
Return value:
#boolean:
If true, the coalition is inside the zone.
Count the number of different coalitions inside the zone.
Draw the zone circle on the F10 map.
Defined in:
Parameters:
#number Coalition
Coalition: All=-1, Neutral=0, Red=1, Blue=2. Default -1=All.
#table Color
RGB color table {r, g, b}, e.g. {1,0,0} for red.
#number Alpha
Transparency [0,1]. Default 1.
#table FillColor
RGB color table {r, g, b}, e.g. {1,0,0} for red. Default is same as Color
value.
#number FillAlpha
Transparency [0,1]. Default 0.15.
#number LineType
Line type: 0=No line, 1=Solid, 2=Dashed, 3=Dotted, 4=Dot dash, 5=Long dash, 6=Two dash. Default 1=Solid.
#boolean ReadOnly
(Optional) Mark is readonly and cannot be removed by users. Default false.
Return value:
self
Flares the zone boundaries in a color.
Defined in:
Parameters:
Utilities.Utils#FLARECOLOR FlareColor
The flare color.
#number Points
(optional) The amount of points in the circle.
DCS#Azimuth Azimuth
(optional) Azimuth The azimuth of the flare.
#number AddHeight
(optional) The height to be added for the smoke.
Return value:
self
Returns the radius of the zone.
Returns a Core.Point#COORDINATE object reflecting a random 3D location within the zone.
Defined in:
Parameters:
#number inner
(Optional) Minimal distance from the center of the zone in meters. Default is 0 m.
#number outer
(Optional) Maximal distance from the outer edge of the zone in meters. Default is the radius of the zone.
#table surfacetypes
(Optional) Table of surface types. Can also be a single surface type. We will try max 100 times to find the right type!
Return value:
The random coordinate.
Returns a Core.Point#COORDINATE object reflecting a random location within the zone where there are no map objects of type "Building".
Does not find statics you might have placed there. Note This might be quite CPU intensive, use with care.
Defined in:
Parameters:
#number inner
(Optional) Minimal distance from the center of the zone in meters. Default is 0m.
#number outer
(Optional) Maximal distance from the outer edge of the zone in meters. Default is the radius of the zone.
#number distance
(Optional) Minimum distance from any building coordinate. Defaults to 100m.
#boolean markbuildings
(Optional) Place markers on found buildings (if any).
#boolean markfinal
(Optional) Place marker on the final coordinate (if any).
Return value:
The random coordinate or nil
if cannot be found in 1000 iterations.
Returns a Core.Point#POINT_VEC2 object reflecting a random 2D location within the zone.
Note that this is actually a Core.Point#COORDINATE type object, and not a simple Vec2 table.
Defined in:
Parameters:
#number inner
(optional) Minimal distance from the center of the zone. Default is 0.
#number outer
(optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone.
Return value:
The Core.Point#POINT_VEC2 object reflecting the random 3D location within the zone.
Returns a Core.Point#POINT_VEC3 object reflecting a random 3D location within the zone.
Note that this is actually a Core.Point#COORDINATE type object, and not a simple Vec3 table.
Defined in:
Parameters:
#number inner
(optional) Minimal distance from the center of the zone. Default is 0.
#number outer
(optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone.
Return value:
The Core.Point#POINT_VEC3 object reflecting the random 3D location within the zone.
Returns a random Vec2 location within the zone.
Defined in:
Parameters:
#number inner
(Optional) Minimal distance from the center of the zone. Default is 0.
#number outer
(Optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone.
#table surfacetypes
(Optional) Table of surface types. Can also be a single surface type. We will try max 100 times to find the right type!
Return value:
The random location within the zone.
Returns Returns a random Vec3 location within the zone.
Defined in:
Parameters:
#number inner
(optional) Minimal distance from the center of the zone. Default is 0.
#number outer
(optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone.
Return value:
The random location within the zone.
Get Coalitions of the units in the Zone, or Check if there are units of the given Coalition in the Zone.
Returns nil if there are none to two Coalitions in the zone! Returns one Coalition if there are only Units of one Coalition in the Zone. Returns the Coalition for the given Coalition if there are units of the Coalition in the Zone.
Get scanned scenery table
Defined in:
Return value:
#table:
Structured object table: [type].[name].SCENERY
Get table of scanned scenery objects
Get scanned scenery type
Defined in:
Parameter:
SceneryType
Return value:
#table:
Table of DCS scenery type objects.
Get a set of scanned groups.
Get set of scanned scenery objects
Defined in:
Return value:
#table:
Table of Wrapper.Scenery#SCENERY scenery objects.
Get a set of scanned units.
Defined in:
Return value:
Set of units and statics inside the zone.
Get a table of scanned units.
Defined in:
Return value:
#table:
Table of DCS units and DCS statics inside the zone.
Returns the DCS#Vec2 of the zone.
Returns the DCS#Vec3 of the ZONE_RADIUS.
Defined in:
Parameter:
DCS#Distance Height
The height to add to the land height where the center of the zone is located.
Return value:
The point of the zone.
Is All in Zone of Coalition?
Check if only the specified coalition is inside the zone and no one else.
Defined in:
Parameter:
#number Coalition
Coalition ID of the coalition which is checked to be the only one in the zone.
Return value:
#boolean:
True, if only that coalition is inside the zone and no one else.
Usage:
self.Zone:Scan()
local IsGuarded = self.Zone:IsAllInZoneOfCoalition( self.Coalition )
Is All in Zone of Other Coalition?
Check if only one coalition is inside the zone and the specified coalition is not the one. You first need to use the ZONE_RADIUS.Scan method to scan the zone before it can be evaluated! Note that once a zone has been scanned, multiple evaluations can be done on the scan result set.
Defined in:
Parameter:
#number Coalition
Coalition ID of the coalition which is not supposed to be in the zone.
Return value:
#boolean:
True, if and only if only one coalition is inside the zone and the specified coalition is not it.
Usage:
self.Zone:Scan()
local IsCaptured = self.Zone:IsAllInZoneOfOtherCoalition( self.Coalition )
Is None in Zone?
You first need to use the ZONE_RADIUS.Scan method to scan the zone before it can be evaluated! Note that once a zone has been scanned, multiple evaluations can be done on the scan result set.
Defined in:
Return value:
#boolean:
Usage:
self.Zone:Scan()
local IsEmpty = self.Zone:IsNoneInZone()
Is None in Zone of Coalition?
You first need to use the ZONE_RADIUS.Scan method to scan the zone before it can be evaluated! Note that once a zone has been scanned, multiple evaluations can be done on the scan result set.
Defined in:
Parameter:
Coalition
Return value:
#boolean:
Usage:
self.Zone:Scan()
local IsOccupied = self.Zone:IsNoneInZoneOfCoalition( self.Coalition )
Is Some in Zone of Coalition?
Check if more than one coalition is inside the zone and the specified coalition is one of them. You first need to use the ZONE_RADIUS.Scan method to scan the zone before it can be evaluated! Note that once a zone has been scanned, multiple evaluations can be done on the scan result set.
Defined in:
Parameter:
#number Coalition
ID of the coalition which is checked to be inside the zone.
Return value:
#boolean:
True if more than one coalition is inside the zone and the specified coalition is one of them.
Usage:
self.Zone:Scan()
local IsAttacked = self.Zone:IsSomeInZoneOfCoalition( self.Coalition )
Returns if a location is within the zone.
Defined in:
Parameter:
DCS#Vec2 Vec2
The location to test.
Return value:
#boolean:
true if the location is within the zone.
Returns if a point is within the zone.
Defined in:
Parameter:
DCS#Vec3 Vec3
The point to test.
Return value:
#boolean:
true if the point is within the zone.
Mark the zone with markers on the F10 map.
Defined in:
Parameter:
#number Points
(Optional) The amount of points in the circle. Default 360.
Return value:
self
Constructor of #ZONE_RADIUS, taking the zone name, the zone location and a radius.
Defined in:
Parameters:
#string ZoneName
Name of the zone.
DCS#Vec2 Vec2
The location of the zone.
DCS#Distance Radius
The radius of the zone.
DCS#Boolean DoNotRegisterZone
Determines if the Zone should not be registered in the _Database Table. Default=false
Return value:
self
Remove junk inside the zone using the world.removeJunk
function.
Scan the zone for the presence of units of the given ObjectCategories.
Note that only after a zone has been scanned, the zone can be evaluated by:
- Core.Zone#ZONE_RADIUS.IsAllInZoneOfCoalition(): Scan the presence of units in the zone of a coalition.
- Core.Zone#ZONE_RADIUS.IsAllInZoneOfOtherCoalition(): Scan the presence of units in the zone of an other coalition.
- Core.Zone#ZONE_RADIUS.IsSomeInZoneOfCoalition(): Scan if there is some presence of units in the zone of the given coalition.
- Core.Zone#ZONE_RADIUS.IsNoneInZoneOfCoalition(): Scan if there isn't any presence of units in the zone of an other coalition than the given one.
- Core.Zone#ZONE_RADIUS.IsNoneInZone(): Scan if the zone is empty.
Defined in:
Parameters:
ObjectCategories
An array of categories of the objects to find in the zone. E.g. {Object.Category.UNIT}
UnitCategories
An array of unit categories of the objects to find in the zone. E.g. {Unit.Category.GROUND_UNIT,Unit.Category.SHIP}
Usage:
myzone:Scan({Object.Category.UNIT},{Unit.Category.GROUND_UNIT})
local IsAttacked = myzone:IsSomeInZoneOfCoalition( self.Coalition )
Searches the zone
Defined in:
Parameters:
ObjectCategories
A list of categories, which are members of Object.Category
EvaluateFunction
Sets the radius of the zone.
Defined in:
Parameter:
DCS#Distance Radius
The radius of the zone.
Return value:
The radius of the zone.
Sets the DCS#Vec2 of the zone.
Defined in:
Parameter:
DCS#Vec2 Vec2
The new location of the zone.
Return value:
The new location of the zone.
Smokes the zone boundaries in a color.
Defined in:
Parameters:
Utilities.Utils#SMOKECOLOR SmokeColor
The smoke color.
#number Points
(optional) The amount of points in the circle.
#number AddHeight
(optional) The height to be added for the smoke.
#number AddOffSet
(optional) The angle to be added for the smoking start position.
AngleOffset
Return value:
self
Update zone from a 2D vector.
Defined in:
Parameters:
DCS#Vec2 Vec2
The location of the zone.
DCS#Distance Radius
The radius of the zone.
Return value:
self
Update zone from a 2D vector.
Defined in:
Parameters:
DCS#Vec3 Vec3
The location of the zone.
DCS#Distance Radius
The radius of the zone.
Return value:
self