Banner Image

Module Functional.ZoneGoalCargo

Functional (WIP) -- Base class that models processes to achieve goals involving a Zone and Cargo.


ZONE_GOAL_CARGO models processes that have a Goal with a defined achievement involving a Zone and Cargo.
Derived classes implement the ways how the achievements can be realized.


Author: FlightControl


Global(s)

Global ZONE_GOAL_CARGO

Models processes that have a Goal with a defined achievement involving a Zone and Cargo.

#ZONE_GOAL_CARGO ZONE_GOAL_CARGO

Models processes that have a Goal with a defined achievement involving a Zone and Cargo.

Derived classes implement the ways how the achievements can be realized.

1. ZONE_GOAL_CARGO constructor

2. ZONE_GOAL_CARGO is a finite state machine (FSM).

2.1 ZONE_GOAL_CARGO States

  • Deployed: The Zone has been captured by an other coalition.
  • Airborne: The Zone is currently intruded by an other coalition. There are units of the owning coalition and an other coalition in the Zone.
  • Loaded: The Zone is guarded by the owning coalition. There is no other unit of an other coalition in the Zone.
  • Empty: The Zone is empty. There is not valid unit in the Zone.

2.2 ZONE_GOAL_CARGO Events

  • Capture: The Zone has been captured by an other coalition.
  • Attack: The Zone is currently intruded by an other coalition. There are units of the owning coalition and an other coalition in the Zone.
  • Guard: The Zone is guarded by the owning coalition. There is no other unit of an other coalition in the Zone.
  • Empty: The Zone is empty. There is not valid unit in the Zone.

2.3 ZONE_GOAL_CARGO State Machine

Type(s)

Fields and Methods inherited from ZONE_GOAL_CARGO Description

ZONE_GOAL_CARGO:Attack()

Attack Trigger for ZONE_GOAL_CARGO

ZONE_GOAL_CARGO:Capture()

Capture Trigger for ZONE_GOAL_CARGO

ZONE_GOAL_CARGO.Coalition

ZONE_GOAL_CARGO:Empty()

Empty Trigger for ZONE_GOAL_CARGO

ZONE_GOAL_CARGO:GetCoalition()

Get the owning coalition of the zone.

ZONE_GOAL_CARGO:GetCoalitionName()

Get the owning coalition name of the zone.

ZONE_GOAL_CARGO:Guard()

Guard Trigger for ZONE_GOAL_CARGO

ZONE_GOAL_CARGO:IsAttacked()

ZONE_GOAL_CARGO:IsCaptured()

ZONE_GOAL_CARGO:IsEmpty()

ZONE_GOAL_CARGO:IsGuarded()

ZONE_GOAL_CARGO:Mark()

Mark.

ZONE_GOAL_CARGO.MarkBlue

ZONE_GOAL_CARGO.MarkRed

ZONE_GOAL_CARGO:New(Zone, Coalition)

ZONE_GOAL_CARGO Constructor.

ZONE_GOAL_CARGO:OnAfterAttack(From, Event, To)

Attack Handler OnAfter for ZONE_GOAL_CARGO

ZONE_GOAL_CARGO:OnAfterCapture(From, Event, To)

Capture Handler OnAfter for ZONE_GOAL_CARGO

ZONE_GOAL_CARGO:OnAfterEmpty(From, Event, To)

Empty Handler OnAfter for ZONE_GOAL_CARGO

ZONE_GOAL_CARGO:OnAfterGuard(From, Event, To)

Guard Handler OnAfter for ZONE_GOAL_CARGO

ZONE_GOAL_CARGO:OnBeforeAttack(From, Event, To)

Attack Handler OnBefore for ZONE_GOAL_CARGO

ZONE_GOAL_CARGO:OnBeforeCapture(From, Event, To)

Capture Handler OnBefore for ZONE_GOAL_CARGO

ZONE_GOAL_CARGO:OnBeforeEmpty(From, Event, To)

Empty Handler OnBefore for ZONE_GOAL_CARGO

ZONE_GOAL_CARGO:OnBeforeGuard(From, Event, To)

Guard Handler OnBefore for ZONE_GOAL_CARGO

ZONE_GOAL_CARGO.ScheduleStatusZone

ZONE_GOAL_CARGO:SetCoalition(Coalition)

Set the owning coalition of the zone.

ZONE_GOAL_CARGO.SmokeScheduler

ZONE_GOAL_CARGO.States

ZONE_GOAL_CARGO:StatusZone()

Check status Coalition ownership.

ZONE_GOAL_CARGO:__Attack(Delay)

Attack Asynchronous Trigger for ZONE_GOAL_CARGO

ZONE_GOAL_CARGO:__Capture(Delay)

Capture Asynchronous Trigger for ZONE_GOAL_CARGO

ZONE_GOAL_CARGO:__Empty(Delay)

Empty Asynchronous Trigger for ZONE_GOAL_CARGO

ZONE_GOAL_CARGO:__Guard(Delay)

Guard Asynchronous Trigger for ZONE_GOAL_CARGO

ZONE_GOAL_CARGO:onafterGuard()

When started, check the Coalition status.

ZONE_GOAL_CARGO:onenterAttacked()

ZONE_GOAL_CARGO:onenterCaptured()

ZONE_GOAL_CARGO:onenterEmpty()

ZONE_GOAL_CARGO:onenterGuarded()

Bound.

Fields and Methods inherited from ZONE_GOAL Description

ZONE_GOAL_CARGO.ClassName

Name of the class.

ZONE_GOAL_CARGO:DestroyedUnit()

DestroyedUnit event.

ZONE_GOAL_CARGO:Flare(FlareColor)

Flare the zone boundary.

ZONE_GOAL_CARGO:GetZone()

Get the Zone.

ZONE_GOAL_CARGO:GetZoneName()

Get the name of the Zone.

ZONE_GOAL_CARGO.Goal

The goal object.

ZONE_GOAL_CARGO:MonitorDestroyedUnits()

Activate the event UnitDestroyed to be fired when a unit is destroyed in the zone.

ZONE_GOAL_CARGO:New(Zone)

ZONE_GOAL Constructor.

ZONE_GOAL_CARGO:OnAfterDestroyedUnit(From, Event, To, DestroyedUnit, PlayerName)

DestroyedUnit Handler OnAfter for ZONE_GOAL

ZONE_GOAL_CARGO:SetSmokeZone(switch)

Activate smoking of zone with the color or the current owner.

ZONE_GOAL_CARGO:Smoke(SmokeColor)

Set the smoke color.

ZONE_GOAL_CARGO.SmokeColor

Color of the smoke.

ZONE_GOAL_CARGO.SmokeScheduler

Scheduler responsible for smoking the zone.

ZONE_GOAL_CARGO.SmokeTime

Time stamp in seconds when the last smoke of the zone was triggered.

ZONE_GOAL_CARGO.SmokeZone

If true, smoke zone.

ZONE_GOAL_CARGO:StatusSmoke()

Check status Smoke.

ZONE_GOAL_CARGO:__Destroyed(EventData)

ZONE_GOAL_CARGO:__DestroyedUnit(delay)

DestroyedUnit delayed event

ZONE_GOAL_CARGO:onafterGuard()

When started, check the Smoke and the Zone status.

Fields and Methods inherited from ZONE_RADIUS Description

ZONE_GOAL_CARGO:BoundZone(Points, CountryID, UnBound)

Bounds the zone with tires.

ZONE_GOAL_CARGO:CheckScannedCoalition(Coalition)

Check if a certain coalition is inside a scanned zone.

ZONE_GOAL_CARGO:CountScannedCoalitions()

Count the number of different coalitions inside the zone.

ZONE_GOAL_CARGO:FlareZone(FlareColor, Points, Azimuth, AddHeight)

Flares the zone boundaries in a color.

ZONE_GOAL_CARGO:GetRadius()

Returns the radius of the zone.

ZONE_GOAL_CARGO:GetRandomCoordinate(inner, outer)

Returns a Core.Point#COORDINATE object reflecting a random 3D location within the zone.

ZONE_GOAL_CARGO:GetRandomPointVec2(inner, outer)

Returns a Core.Point#POINT_VEC2 object reflecting a random 2D location within the zone.

ZONE_GOAL_CARGO:GetRandomPointVec3(inner, outer)

Returns a Core.Point#POINT_VEC3 object reflecting a random 3D location within the zone.

ZONE_GOAL_CARGO:GetRandomVec2(inner, outer)

Returns a random Vec2 location within the zone.

ZONE_GOAL_CARGO:GetRandomVec3(inner, outer)

Returns Returns a random Vec3 location within the zone.

ZONE_GOAL_CARGO:GetScannedCoalition(Coalition)

Get Coalitions of the units in the Zone, or Check if there are units of the given Coalition in the Zone.

ZONE_GOAL_CARGO:GetScannedScenery()

Get scanned scenery table

ZONE_GOAL_CARGO:GetScannedSceneryType(SceneryType)

Get scanned scenery type

ZONE_GOAL_CARGO:GetScannedSetUnit()

Get a set of scanned units.

ZONE_GOAL_CARGO:GetScannedUnits()

Count the number of different coalitions inside the zone.

ZONE_GOAL_CARGO:GetVec2()

Returns the DCS#Vec2 of the zone.

ZONE_GOAL_CARGO:GetVec3(Height)

Returns the DCS#Vec3 of the ZONE_RADIUS.

ZONE_GOAL_CARGO:IsAllInZoneOfCoalition(Coalition)

Is All in Zone of Coalition?

ZONE_GOAL_CARGO:IsAllInZoneOfOtherCoalition(Coalition)

Is All in Zone of Other Coalition?

ZONE_GOAL_CARGO:IsNoneInZone()

Is None in Zone?

ZONE_GOAL_CARGO:IsNoneInZoneOfCoalition(Coalition)

Is None in Zone of Coalition?

ZONE_GOAL_CARGO:IsSomeInZoneOfCoalition(Coalition)

Is Some in Zone of Coalition?

ZONE_GOAL_CARGO:IsVec2InZone(Vec2)

Returns if a location is within the zone.

ZONE_GOAL_CARGO:IsVec3InZone(Vec3)

Returns if a point is within the zone.

ZONE_GOAL_CARGO:MarkZone(Points)

Mark the zone with markers on the F10 map.

ZONE_GOAL_CARGO:New(ZoneName, Vec2, Radius)

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

ZONE_GOAL_CARGO.Radius

The radius of the zone.

ZONE_GOAL_CARGO:Scan(ObjectCategories, UnitCategories)

Scan the zone for the presence of units of the given ObjectCategories.

ZONE_GOAL_CARGO.ScanData

ZONE_GOAL_CARGO:SearchZone(ObjectCategories, EvaluateFunction)

Searches the zone

ZONE_GOAL_CARGO:SetRadius(Radius)

Sets the radius of the zone.

ZONE_GOAL_CARGO:SetVec2(Vec2)

Sets the DCS#Vec2 of the zone.

ZONE_GOAL_CARGO:SmokeZone(SmokeColor, Points, AddHeight, AddOffSet, AngleOffset)

Smokes the zone boundaries in a color.

ZONE_GOAL_CARGO.Vec2

The current location of the zone.

Field(s)

Function(s)

Attack Trigger for ZONE_GOAL_CARGO

Defined in:

ZONE_GOAL_CARGO

Capture Trigger for ZONE_GOAL_CARGO

Defined in:

ZONE_GOAL_CARGO

Empty Trigger for ZONE_GOAL_CARGO

Defined in:

ZONE_GOAL_CARGO

Get the owning coalition of the zone.

Defined in:

ZONE_GOAL_CARGO

Return value:

Get the owning coalition name of the zone.

Defined in:

ZONE_GOAL_CARGO

Return value:

#string:

Coalition name.

Guard Trigger for ZONE_GOAL_CARGO

Defined in:

ZONE_GOAL_CARGO

Defined in:

ZONE_GOAL_CARGO

Defined in:

ZONE_GOAL_CARGO

Defined in:

ZONE_GOAL_CARGO

Defined in:

ZONE_GOAL_CARGO

Mark.

Defined in:

ZONE_GOAL_CARGO

ZONE_GOAL_CARGO Constructor.

Defined in:

ZONE_GOAL_CARGO

Parameters:

A Zone object with the goal to be achieved.

The initial coalition owning the zone.

Return value:

Attack Handler OnAfter for ZONE_GOAL_CARGO

Defined in:

ZONE_GOAL_CARGO

Parameters:

#string From

#string Event

#string To

Capture Handler OnAfter for ZONE_GOAL_CARGO

Defined in:

ZONE_GOAL_CARGO

Parameters:

#string From

#string Event

#string To

Empty Handler OnAfter for ZONE_GOAL_CARGO

Defined in:

ZONE_GOAL_CARGO

Parameters:

#string From

#string Event

#string To

Guard Handler OnAfter for ZONE_GOAL_CARGO

Defined in:

ZONE_GOAL_CARGO

Parameters:

#string From

#string Event

#string To

Attack Handler OnBefore for ZONE_GOAL_CARGO

Defined in:

ZONE_GOAL_CARGO

Parameters:

#string From

#string Event

#string To

Return value:

#boolean:

Capture Handler OnBefore for ZONE_GOAL_CARGO

Defined in:

ZONE_GOAL_CARGO

Parameters:

#string From

#string Event

#string To

Return value:

#boolean:

Empty Handler OnBefore for ZONE_GOAL_CARGO

Defined in:

ZONE_GOAL_CARGO

Parameters:

#string From

#string Event

#string To

Return value:

#boolean:

Guard Handler OnBefore for ZONE_GOAL_CARGO

Defined in:

ZONE_GOAL_CARGO

Parameters:

#string From

#string Event

#string To

Return value:

#boolean:

Set the owning coalition of the zone.

Defined in:

ZONE_GOAL_CARGO

Parameter:

Check status Coalition ownership.

Defined in:

ZONE_GOAL_CARGO

Attack Asynchronous Trigger for ZONE_GOAL_CARGO

Defined in:

ZONE_GOAL_CARGO

Parameter:

#number Delay

Capture Asynchronous Trigger for ZONE_GOAL_CARGO

Defined in:

ZONE_GOAL_CARGO

Parameter:

#number Delay

Empty Asynchronous Trigger for ZONE_GOAL_CARGO

Defined in:

ZONE_GOAL_CARGO

Parameter:

#number Delay

Guard Asynchronous Trigger for ZONE_GOAL_CARGO

Defined in:

ZONE_GOAL_CARGO

Parameter:

#number Delay

When started, check the Coalition status.

Defined in:

ZONE_GOAL_CARGO

Defined in:

ZONE_GOAL_CARGO

Defined in:

ZONE_GOAL_CARGO

Defined in:

ZONE_GOAL_CARGO

Bound.

Defined in:

ZONE_GOAL_CARGO

Field(s)

Function(s)

Flare the zone boundary.

Defined in:

Parameter:

Get the Zone.

Defined in:

Return value:

Get the name of the Zone.

Defined in:

Return value:

#string:

Activate the event UnitDestroyed to be fired when a unit is destroyed in the zone.

ZONE_GOAL Constructor.

Defined in:

Parameter:

A Zone object with the goal to be achieved.

Return value:

DestroyedUnit Handler OnAfter for ZONE_GOAL

Defined in:

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:

Parameter:

#boolean switch

If true or nil activate smoke. If false or nil, no smoke.

Return value:

Set the smoke color.

Defined in:

Parameter:

DestroyedUnit delayed event

Defined in:

Parameter:

#number delay

Delay in seconds.

When started, check the Smoke and the Zone status.

Field(s)

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.

Defined in:

Return value:

#number:

Counted coalitions.

Flares the zone boundaries in a color.

Defined in:

Parameters:

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.

Defined in:

Return value:

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. Default is 0.

#number outer

(optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone.

Return value:

Returns a Core.Point#POINT_VEC2 object reflecting a random 2D 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 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.

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.

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.

Defined in:

Parameter:

Coalition

Return value:

#table:

Get scanned scenery table

Defined in:

Return value:

#table:

Table of DCS scenery objects.

Get scanned scenery type

Defined in:

Parameter:

SceneryType

Return value:

#table:

Table of DCS scenery type objects.

Get a set of scanned units.

Defined in:

Return value:

Set of units and statics inside the zone.

Count the number of different coalitions inside the zone.

Defined in:

Return value:

#table:

Table of DCS units and DCS statics inside the zone.

Returns the DCS#Vec2 of the zone.

Defined in:

Return value:

The location 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 specifed coalition is inside the zone and noone 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 coaltion is inside the zone and the specifed 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 coaliton 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.

Return value:

self

Scan the zone for the presence of units of the given ObjectCategories.

Note that after a zone has been scanned, the zone can be evaluated by:

Defined in:

Parameters:

ObjectCategories

An array of categories of the objects to find in the zone.

UnitCategories

An array of unit categories of the objects to find in the zone.

Usage:

   self.Zone:Scan()
   local IsAttacked = self.Zone: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:

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