diff --git a/Moose Development/Moose/Core/Point.lua b/Moose Development/Moose/Core/Point.lua
index 9c6628980..35cd570c9 100644
--- a/Moose Development/Moose/Core/Point.lua
+++ b/Moose Development/Moose/Core/Point.lua
@@ -54,227 +54,114 @@
-- @module Point
---- @type COORDINATE
--- @extends Core.Base#BASE
---- # COORDINATE class, extends @{Base#BASE}
---
--- The COORDINATE class defines a 2D coordinate in the simulator. The height coordinate (if needed) will be the land height + an optional added height specified.
--- A COORDINATE can be expressed in LL or in MGRS.
---
--- ## COORDINATE constructor
---
--- A new COORDINATE instance can be created with:
---
--- * @{Point#COORDINATE.New}(): a 2D point, taking an additional height parameter.
--- * @{Point#COORDINATE.NewFromVec2}(): a 2D point created from a @{DCSTypes#Vec2}.
---
--- ## Manupulate the X, Altitude, Y coordinates of the 2D point
---
--- A COORDINATE class works in 2D space, with an altitude setting. It contains internally an X, Altitude, Y coordinate.
--- Methods exist to manupulate these coordinates.
---
--- The current X, Altitude, Y axis can be retrieved with the methods @{#COORDINATE.GetX}(), @{#COORDINATE.GetAlt}(), @{#COORDINATE.GetY}() respectively.
--- The methods @{#COORDINATE.SetX}(), @{#COORDINATE.SetAlt}(), @{#COORDINATE.SetY}() change the respective axis with a new value.
--- The current Lat(itude), Alt(itude), Lon(gitude) values can also be retrieved with the methods @{#COORDINATE.GetLat}(), @{#COORDINATE.GetAlt}(), @{#COORDINATE.GetLon}() respectively.
--- The current axis values can be changed by using the methods @{#COORDINATE.AddX}(), @{#COORDINATE.AddAlt}(), @{#COORDINATE.AddY}()
--- to add or substract a value from the current respective axis value.
--- Note that the Set and Add methods return the current COORDINATE object, so these manipulation methods can be chained... For example:
---
--- local Vec2 = PointVec2:AddX( 100 ):AddY( 2000 ):GetVec2()
---
--- @field #COORDINATE
-COORDINATE = {
- ClassName = "COORDINATE",
-}
-
---- The POINT_VEC3 class
--- @type POINT_VEC3
--- @field #number x The x coordinate in 3D space.
--- @field #number y The y coordinate in 3D space.
--- @field #number z The z coordiante in 3D space.
--- @field Utilities.Utils#SMOKECOLOR SmokeColor
--- @field Utilities.Utils#FLARECOLOR FlareColor
--- @field #POINT_VEC3.RoutePointAltType RoutePointAltType
--- @field #POINT_VEC3.RoutePointType RoutePointType
--- @field #POINT_VEC3.RoutePointAction RoutePointAction
--- @extends Core.Point#COORDINATE
-
-
---- # POINT_VEC3 class, extends @{Point#COORDINATE}
---
--- POINT_VEC3 defines a 3D point in the simulator and with its methods, you can use or manipulate the point in 3D space.
---
--- **Important Note:** Most of the functions in this section were taken from MIST, and reworked to OO concepts.
--- In order to keep the credibility of the the author,
--- I want to emphasize that the formulas embedded in the MIST framework were created by Grimes or previous authors,
--- who you can find on the Eagle Dynamics Forums.
---
---
--- ## POINT_VEC3 constructor
---
--- A new POINT_VEC3 object can be created with:
---
--- * @{#POINT_VEC3.New}(): a 3D point.
--- * @{#POINT_VEC3.NewFromVec3}(): a 3D point created from a @{DCSTypes#Vec3}.
---
---
--- ## Manupulate the X, Y, Z coordinates of the POINT_VEC3
---
--- A POINT_VEC3 class works in 3D space. It contains internally an X, Y, Z coordinate.
--- Methods exist to manupulate these coordinates.
---
--- The current X, Y, Z axis can be retrieved with the methods @{#POINT_VEC3.GetX}(), @{#POINT_VEC3.GetY}(), @{#POINT_VEC3.GetZ}() respectively.
--- The methods @{#POINT_VEC3.SetX}(), @{#POINT_VEC3.SetY}(), @{#POINT_VEC3.SetZ}() change the respective axis with a new value.
--- The current axis values can be changed by using the methods @{#POINT_VEC3.AddX}(), @{#POINT_VEC3.AddY}(), @{#POINT_VEC3.AddZ}()
--- to add or substract a value from the current respective axis value.
--- Note that the Set and Add methods return the current POINT_VEC3 object, so these manipulation methods can be chained... For example:
---
--- local Vec3 = PointVec3:AddX( 100 ):AddZ( 150 ):GetVec3()
---
---
--- ## Create waypoints for routes
---
--- A POINT_VEC3 can prepare waypoints for Ground and Air groups to be embedded into a Route.
---
--- * @{#POINT_VEC3.RoutePointAir}(): Build an air route point.
--- * @{#POINT_VEC3.RoutePointGround}(): Build a ground route point.
---
--- Route points can be used in the Route methods of the @{Group#GROUP} class.
---
---
--- ## Smoke, flare, explode, illuminate
---
--- At the point a smoke, flare, explosion and illumination bomb can be triggered. Use the following methods:
---
--- ### Smoke
---
--- * @{#POINT_VEC3.Smoke}(): To smoke the point in a certain color.
--- * @{#POINT_VEC3.SmokeBlue}(): To smoke the point in blue.
--- * @{#POINT_VEC3.SmokeRed}(): To smoke the point in red.
--- * @{#POINT_VEC3.SmokeOrange}(): To smoke the point in orange.
--- * @{#POINT_VEC3.SmokeWhite}(): To smoke the point in white.
--- * @{#POINT_VEC3.SmokeGreen}(): To smoke the point in green.
---
--- ### Flare
---
--- * @{#POINT_VEC3.Flare}(): To flare the point in a certain color.
--- * @{#POINT_VEC3.FlareRed}(): To flare the point in red.
--- * @{#POINT_VEC3.FlareYellow}(): To flare the point in yellow.
--- * @{#POINT_VEC3.FlareWhite}(): To flare the point in white.
--- * @{#POINT_VEC3.FlareGreen}(): To flare the point in green.
---
--- ### Explode
---
--- * @{#POINT_VEC3.Explosion}(): To explode the point with a certain intensity.
---
--- ### Illuminate
---
--- * @{#POINT_VEC3.IlluminationBomb}(): To illuminate the point.
---
---
--- ## 3D calculation methods
---
--- Various calculation methods exist to use or manipulate 3D space. Find below a short description of each method:
---
--- ### Distance
---
--- * @{#POINT_VEC3.Get3DDistance}(): Obtain the distance from the current 3D point to the provided 3D point in 3D space.
--- * @{#POINT_VEC3.Get2DDistance}(): Obtain the distance from the current 3D point to the provided 3D point in 2D space.
---
--- ### Angle
---
--- * @{#POINT_VEC3.GetAngleDegrees}(): Obtain the angle in degrees from the current 3D point with the provided 3D direction vector.
--- * @{#POINT_VEC3.GetAngleRadians}(): Obtain the angle in radians from the current 3D point with the provided 3D direction vector.
--- * @{#POINT_VEC3.GetDirectionVec3}(): Obtain the 3D direction vector from the current 3D point to the provided 3D point.
---
--- ### Translation
---
--- * @{#POINT_VEC3.Translate}(): Translate the current 3D point towards an other 3D point using the given Distance and Angle.
---
--- ### Get the North correction of the current location
---
--- * @{#POINT_VEC3.GetNorthCorrection}(): Obtains the north correction at the current 3D point.
---
---
--- ## Point Randomization
---
--- Various methods exist to calculate random locations around a given 3D point.
---
--- * @{#POINT_VEC3.GetRandomPointVec2InRadius}(): Provides a random 2D point around the current 3D point, in the given inner to outer band.
--- * @{#POINT_VEC3.GetRandomPointVec3InRadius}(): Provides a random 3D point around the current 3D point, in the given inner to outer band.
--- * @{#POINT_VEC3.GetRandomVec2InRadius}(): Provides a random 2D vector around the current 3D point, in the given inner to outer band.
--- * @{#POINT_VEC3.GetRandomVec3InRadius}(): Provides a random 3D vector around the current 3D point, in the given inner to outer band.
---
---
--- ## Metric system
---
--- * @{#POINT_VEC3.IsMetric}(): Returns if the 3D point is Metric or Nautical Miles.
--- * @{#POINT_VEC3.SetMetric}(): Sets the 3D point to Metric or Nautical Miles.
---
---
--- ## Coorinate text generation
---
--- * @{#POINT_VEC3.ToStringBR}(): Generates a Bearing & Range text in the format of DDD for DI where DDD is degrees and DI is distance.
--- * @{#POINT_VEC3.ToStringLL}(): Generates a Latutude & Longutude text.
---
--- @field #POINT_VEC3
-POINT_VEC3 = {
- ClassName = "POINT_VEC3",
- Metric = true,
- RoutePointAltType = {
- BARO = "BARO",
- },
- RoutePointType = {
- TakeOffParking = "TakeOffParking",
- TurningPoint = "Turning Point",
- },
- RoutePointAction = {
- FromParkingArea = "From Parking Area",
- TurningPoint = "Turning Point",
- },
-}
-
---- @type POINT_VEC2
--- @field Dcs.DCSTypes#Distance x The x coordinate in meters.
--- @field Dcs.DCSTypes#Distance y the y coordinate in meters.
--- @extends Core.Point#COORDINATE
-
-
-
---- # POINT_VEC2 class, extends @{Point#COORDINATE}
---
--- The @{Point#POINT_VEC2} class defines a 2D point in the simulator. The height coordinate (if needed) will be the land height + an optional added height specified.
---
--- ## POINT_VEC2 constructor
---
--- A new POINT_VEC2 instance can be created with:
---
--- * @{Point#POINT_VEC2.New}(): a 2D point, taking an additional height parameter.
--- * @{Point#POINT_VEC2.NewFromVec2}(): a 2D point created from a @{DCSTypes#Vec2}.
---
--- ## Manupulate the X, Altitude, Y coordinates of the 2D point
---
--- A POINT_VEC2 class works in 2D space, with an altitude setting. It contains internally an X, Altitude, Y coordinate.
--- Methods exist to manupulate these coordinates.
---
--- The current X, Altitude, Y axis can be retrieved with the methods @{#POINT_VEC2.GetX}(), @{#POINT_VEC2.GetAlt}(), @{#POINT_VEC2.GetY}() respectively.
--- The methods @{#POINT_VEC2.SetX}(), @{#POINT_VEC2.SetAlt}(), @{#POINT_VEC2.SetY}() change the respective axis with a new value.
--- The current Lat(itude), Alt(itude), Lon(gitude) values can also be retrieved with the methods @{#POINT_VEC2.GetLat}(), @{#POINT_VEC2.GetAlt}(), @{#POINT_VEC2.GetLon}() respectively.
--- The current axis values can be changed by using the methods @{#POINT_VEC2.AddX}(), @{#POINT_VEC2.AddAlt}(), @{#POINT_VEC2.AddY}()
--- to add or substract a value from the current respective axis value.
--- Note that the Set and Add methods return the current POINT_VEC2 object, so these manipulation methods can be chained... For example:
---
--- local Vec2 = PointVec2:AddX( 100 ):AddY( 2000 ):GetVec2()
---
--- @field #POINT_VEC2
-POINT_VEC2 = {
- ClassName = "POINT_VEC2",
-}
do -- COORDINATE
+ --- @type COORDINATE
+ -- @extends Core.Base#BASE
+
+ --- # COORDINATE class, extends @{Base#BASE}
+ --
+ -- COORDINATE defines a 3D point in the simulator and with its methods, you can use or manipulate the point in 3D space.
+ --
+ -- ## COORDINATE constructor
+ --
+ -- A new COORDINATE object can be created with:
+ --
+ -- * @{#COORDINATE.New}(): a 3D point.
+ -- * @{#COORDINATE.NewFromVec2}(): a 2D point created from a @{DCSTypes#Vec2}.
+ -- * @{#COORDINATE.NewFromVec3}(): a 3D point created from a @{DCSTypes#Vec3}.
+ --
+ -- ## Create waypoints for routes
+ --
+ -- A COORDINATE can prepare waypoints for Ground and Air groups to be embedded into a Route.
+ --
+ -- * @{#COORDINATE.RoutePointAir}(): Build an air route point.
+ -- * @{#COORDINATE.RoutePointGround}(): Build a ground route point.
+ --
+ -- Route points can be used in the Route methods of the @{Group#GROUP} class.
+ --
+ --
+ -- ## Smoke, flare, explode, illuminate
+ --
+ -- At the point a smoke, flare, explosion and illumination bomb can be triggered. Use the following methods:
+ --
+ -- ### Smoke
+ --
+ -- * @{#COORDINATE.Smoke}(): To smoke the point in a certain color.
+ -- * @{#COORDINATE.SmokeBlue}(): To smoke the point in blue.
+ -- * @{#COORDINATE.SmokeRed}(): To smoke the point in red.
+ -- * @{#COORDINATE.SmokeOrange}(): To smoke the point in orange.
+ -- * @{#COORDINATE.SmokeWhite}(): To smoke the point in white.
+ -- * @{#COORDINATE.SmokeGreen}(): To smoke the point in green.
+ --
+ -- ### Flare
+ --
+ -- * @{#COORDINATE.Flare}(): To flare the point in a certain color.
+ -- * @{#COORDINATE.FlareRed}(): To flare the point in red.
+ -- * @{#COORDINATE.FlareYellow}(): To flare the point in yellow.
+ -- * @{#COORDINATE.FlareWhite}(): To flare the point in white.
+ -- * @{#COORDINATE.FlareGreen}(): To flare the point in green.
+ --
+ -- ### Explode
+ --
+ -- * @{#COORDINATE.Explosion}(): To explode the point with a certain intensity.
+ --
+ -- ### Illuminate
+ --
+ -- * @{#COORDINATE.IlluminationBomb}(): To illuminate the point.
+ --
+ --
+ -- ## 3D calculation methods
+ --
+ -- Various calculation methods exist to use or manipulate 3D space. Find below a short description of each method:
+ --
+ -- ### Distance
+ --
+ -- * @{#COORDINATE.Get3DDistance}(): Obtain the distance from the current 3D point to the provided 3D point in 3D space.
+ -- * @{#COORDINATE.Get2DDistance}(): Obtain the distance from the current 3D point to the provided 3D point in 2D space.
+ --
+ -- ### Angle
+ --
+ -- * @{#COORDINATE.GetAngleDegrees}(): Obtain the angle in degrees from the current 3D point with the provided 3D direction vector.
+ -- * @{#COORDINATE.GetAngleRadians}(): Obtain the angle in radians from the current 3D point with the provided 3D direction vector.
+ -- * @{#COORDINATE.GetDirectionVec3}(): Obtain the 3D direction vector from the current 3D point to the provided 3D point.
+ --
+ -- ### Translation
+ --
+ -- * @{#COORDINATE.Translate}(): Translate the current 3D point towards an other 3D point using the given Distance and Angle.
+ --
+ -- ### Get the North correction of the current location
+ --
+ -- * @{#COORDINATE.GetNorthCorrection}(): Obtains the north correction at the current 3D point.
+ --
+ --
+ -- ## Point Randomization
+ --
+ -- Various methods exist to calculate random locations around a given 3D point.
+ --
+ -- * @{#COORDINATE.GetRandomVec2InRadius}(): Provides a random 2D vector around the current 3D point, in the given inner to outer band.
+ -- * @{#COORDINATE.GetRandomVec3InRadius}(): Provides a random 3D vector around the current 3D point, in the given inner to outer band.
+ --
+ --
+ -- ## Metric system
+ --
+ -- * @{#COORDINATE.IsMetric}(): Returns if the 3D point is Metric or Nautical Miles.
+ -- * @{#COORDINATE.SetMetric}(): Sets the 3D point to Metric or Nautical Miles.
+ --
+ --
+ -- ## Coorinate text generation
+ --
+ -- * @{#COORDINATE.ToStringBR}(): Generates a Bearing & Range text in the format of DDD for DI where DDD is degrees and DI is distance.
+ -- * @{#COORDINATE.ToStringLL}(): Generates a Latutude & Longutude text.
+ --
+ -- @field #COORDINATE
+ COORDINATE = {
+ ClassName = "COORDINATE",
+ }
+
--- COORDINATE constructor.
-- @param #COORDINATE self
-- @param Dcs.DCSTypes#Distance x The x coordinate of the Vec3 point, pointing to the North.
@@ -288,8 +175,6 @@ do -- COORDINATE
self.y = y
self.z = z
- self:SetModeA2G()
-
return self
end
@@ -342,7 +227,83 @@ do -- COORDINATE
function COORDINATE:GetVec2()
return { x = self.x, y = self.z }
end
-
+
+ --TODO: check this to replace
+ --- Calculate the distance from a reference @{DCSTypes#Vec2}.
+ -- @param #COORDINATE self
+ -- @param Dcs.DCSTypes#Vec2 Vec2Reference The reference @{DCSTypes#Vec2}.
+ -- @return Dcs.DCSTypes#Distance The distance from the reference @{DCSTypes#Vec2} in meters.
+ function COORDINATE:DistanceFromVec2( Vec2Reference )
+ self:F2( Vec2Reference )
+
+ local Distance = ( ( Vec2Reference.x - self.x ) ^ 2 + ( Vec2Reference.y - self.z ) ^2 ) ^0.5
+
+ self:T2( Distance )
+ return Distance
+ end
+
+
+ --- Add a Distance in meters from the COORDINATE orthonormal plane, with the given angle, and calculate the new COORDINATE.
+ -- @param #COORDINATE self
+ -- @param Dcs.DCSTypes#Distance Distance The Distance to be added in meters.
+ -- @param Dcs.DCSTypes#Angle Angle The Angle in degrees.
+ -- @return #COORDINATE The new calculated COORDINATE.
+ function COORDINATE:Translate( Distance, Angle )
+ local SX = self.x
+ local SY = self.z
+ local Radians = Angle / 180 * math.pi
+ local TX = Distance * math.cos( Radians ) + SX
+ local TY = Distance * math.sin( Radians ) + SY
+
+ return COORDINATE:NewFromVec2( { x = TX, y = TY } )
+ end
+
+ --- Return a random Vec2 within an Outer Radius and optionally NOT within an Inner Radius of the COORDINATE.
+ -- @param #COORDINATE self
+ -- @param Dcs.DCSTypes#Distance OuterRadius
+ -- @param Dcs.DCSTypes#Distance InnerRadius
+ -- @return Dcs.DCSTypes#Vec2 Vec2
+ function COORDINATE:GetRandomVec2InRadius( OuterRadius, InnerRadius )
+ self:F2( { OuterRadius, InnerRadius } )
+
+ local Theta = 2 * math.pi * math.random()
+ local Radials = math.random() + math.random()
+ if Radials > 1 then
+ Radials = 2 - Radials
+ end
+
+ local RadialMultiplier
+ if InnerRadius and InnerRadius <= OuterRadius then
+ RadialMultiplier = ( OuterRadius - InnerRadius ) * Radials + InnerRadius
+ else
+ RadialMultiplier = OuterRadius * Radials
+ end
+
+ local RandomVec2
+ if OuterRadius > 0 then
+ RandomVec2 = { x = math.cos( Theta ) * RadialMultiplier + self.x, y = math.sin( Theta ) * RadialMultiplier + self.z }
+ else
+ RandomVec2 = { x = self.x, y = self.z }
+ end
+
+ return RandomVec2
+ end
+
+
+ --- Return a random Vec3 within an Outer Radius and optionally NOT within an Inner Radius of the COORDINATE.
+ -- @param #COORDINATE self
+ -- @param Dcs.DCSTypes#Distance OuterRadius
+ -- @param Dcs.DCSTypes#Distance InnerRadius
+ -- @return Dcs.DCSTypes#Vec3 Vec3
+ function COORDINATE:GetRandomVec3InRadius( OuterRadius, InnerRadius )
+
+ local RandomVec2 = self:GetRandomVec2InRadius( OuterRadius, InnerRadius )
+ local y = self.y + math.random( InnerRadius, OuterRadius )
+ local RandomVec3 = { x = RandomVec2.x, y = y, z = RandomVec2.y }
+
+ return RandomVec3
+ end
+
function COORDINATE:SetHeading( Heading )
self.Heading = Heading
@@ -706,7 +667,7 @@ do -- COORDINATE
self:Flare( FLARECOLOR.Red, Azimuth )
end
- --- Returns if a Coordinate has Line of Sight (LOS) with the ToPointVec3.
+ --- Returns if a Coordinate has Line of Sight (LOS) with the ToCoordinate.
-- @param #COORDINATE self
-- @param #COORDINATE ToCoordinate
-- @return #boolean true If the ToCoordinate has LOS with the Coordinate, otherwise false.
@@ -725,35 +686,6 @@ do -- COORDINATE
end
- --- Set the mode to A2G
- -- @param #COORDINATE self
- -- @return #COORDINATE
- function COORDINATE:SetModeA2G()
- self.Mode = "A2G"
- end
-
- --- Is the mode to A2G
- -- @param #COORDINATE self
- -- @return #boolean
- function COORDINATE:IsModeA2G()
- return self.Mode == "A2G"
- end
-
- --- Set the mode to A2A
- -- @param #COORDINATE self
- -- @return #COORDINATE
- function COORDINATE:SetModeA2A()
- self.Mode = "A2A"
- end
-
- --- Is the mode to A2A
- -- @param #COORDINATE self
- -- @return #boolean
- function COORDINATE:IsModeA2A()
- return self.Mode == "A2A"
- end
-
-
--- Return a BR string from a COORDINATE to the COORDINATE.
-- @param #COORDINATE self
-- @param #COORDINATE TargetCoordinate The target COORDINATE.
@@ -859,19 +791,16 @@ do -- COORDINATE
if IsAir then
if Settings:IsA2A_BRA() then
local Coordinate = Controllable:GetCoordinate()
- Coordinate:SetModeA2A()
return self:ToStringBRA( Coordinate, Settings )
end
if Settings:IsA2A_BULLS() then
local Coordinate = Controllable:GetCoordinate()
- Coordinate:SetModeA2A()
return self:ToStringBULLS( Coordinate, Settings )
end
else
if Settings:IsA2G_BRA() then
local Coordinate = Controllable:GetCoordinate()
- Coordinate:SetModeA2A()
return Controllable and self:ToStringBR( Coordinate, Settings ) or self:ToStringMGRS( Settings )
end
if Settings:IsA2G_LL() then
@@ -890,6 +819,80 @@ end
do -- POINT_VEC3
+ --- The POINT_VEC3 class
+ -- @type POINT_VEC3
+ -- @field #number x The x coordinate in 3D space.
+ -- @field #number y The y coordinate in 3D space.
+ -- @field #number z The z coordiante in 3D space.
+ -- @field Utilities.Utils#SMOKECOLOR SmokeColor
+ -- @field Utilities.Utils#FLARECOLOR FlareColor
+ -- @field #POINT_VEC3.RoutePointAltType RoutePointAltType
+ -- @field #POINT_VEC3.RoutePointType RoutePointType
+ -- @field #POINT_VEC3.RoutePointAction RoutePointAction
+ -- @extends Core.Point#COORDINATE
+
+
+ --- # POINT_VEC3 class, extends @{Point#COORDINATE}
+ --
+ -- POINT_VEC3 defines a 3D point in the simulator and with its methods, you can use or manipulate the point in 3D space.
+ --
+ -- **Important Note:** Most of the functions in this section were taken from MIST, and reworked to OO concepts.
+ -- In order to keep the credibility of the the author,
+ -- I want to emphasize that the formulas embedded in the MIST framework were created by Grimes or previous authors,
+ -- who you can find on the Eagle Dynamics Forums.
+ --
+ --
+ -- ## POINT_VEC3 constructor
+ --
+ -- A new POINT_VEC3 object can be created with:
+ --
+ -- * @{#POINT_VEC3.New}(): a 3D point.
+ -- * @{#POINT_VEC3.NewFromVec3}(): a 3D point created from a @{DCSTypes#Vec3}.
+ --
+ --
+ -- ## Manupulate the X, Y, Z coordinates of the POINT_VEC3
+ --
+ -- A POINT_VEC3 class works in 3D space. It contains internally an X, Y, Z coordinate.
+ -- Methods exist to manupulate these coordinates.
+ --
+ -- The current X, Y, Z axis can be retrieved with the methods @{#POINT_VEC3.GetX}(), @{#POINT_VEC3.GetY}(), @{#POINT_VEC3.GetZ}() respectively.
+ -- The methods @{#POINT_VEC3.SetX}(), @{#POINT_VEC3.SetY}(), @{#POINT_VEC3.SetZ}() change the respective axis with a new value.
+ -- The current axis values can be changed by using the methods @{#POINT_VEC3.AddX}(), @{#POINT_VEC3.AddY}(), @{#POINT_VEC3.AddZ}()
+ -- to add or substract a value from the current respective axis value.
+ -- Note that the Set and Add methods return the current POINT_VEC3 object, so these manipulation methods can be chained... For example:
+ --
+ -- local Vec3 = PointVec3:AddX( 100 ):AddZ( 150 ):GetVec3()
+ --
+ --
+ -- ## 3D calculation methods
+ --
+ -- Various calculation methods exist to use or manipulate 3D space. Find below a short description of each method:
+ --
+ --
+ -- ## Point Randomization
+ --
+ -- Various methods exist to calculate random locations around a given 3D point.
+ --
+ -- * @{#POINT_VEC3.GetRandomPointVec3InRadius}(): Provides a random 3D point around the current 3D point, in the given inner to outer band.
+ --
+ --
+ -- @field #POINT_VEC3
+ POINT_VEC3 = {
+ ClassName = "POINT_VEC3",
+ Metric = true,
+ RoutePointAltType = {
+ BARO = "BARO",
+ },
+ RoutePointType = {
+ TakeOffParking = "TakeOffParking",
+ TurningPoint = "Turning Point",
+ },
+ RoutePointAction = {
+ FromParkingArea = "From Parking Area",
+ TurningPoint = "Turning Point",
+ },
+ }
+
--- RoutePoint AltTypes
-- @type POINT_VEC3.RoutePointAltType
-- @field BARO "BARO"
@@ -916,7 +919,7 @@ do -- POINT_VEC3
local self = BASE:Inherit( self, COORDINATE:New( x, y, z ) ) -- Core.Point#POINT_VEC3
self:F2( self )
-
+
return self
end
@@ -942,7 +945,7 @@ do -- POINT_VEC3
local self = BASE:Inherit( self, COORDINATE:NewFromVec3( Vec3 ) ) -- Core.Point#POINT_VEC3
self:F2( self )
-
+
return self
end
@@ -1023,20 +1026,6 @@ do -- POINT_VEC3
return self
end
- --- Return a random Vec3 within an Outer Radius and optionally NOT within an Inner Radius of the POINT_VEC3.
- -- @param #POINT_VEC3 self
- -- @param Dcs.DCSTypes#Distance OuterRadius
- -- @param Dcs.DCSTypes#Distance InnerRadius
- -- @return Dcs.DCSTypes#Vec3 Vec3
- function POINT_VEC3:GetRandomVec3InRadius( OuterRadius, InnerRadius )
-
- local RandomVec2 = self:GetRandomVec2InRadius( OuterRadius, InnerRadius )
- local y = self:GetY() + math.random( InnerRadius, OuterRadius )
- local RandomVec3 = { x = RandomVec2.x, y = y, z = RandomVec2.y }
-
- return RandomVec3
- end
-
--- Return a random POINT_VEC3 within an Outer Radius and optionally NOT within an Inner Radius of the POINT_VEC3.
-- @param #POINT_VEC3 self
-- @param Dcs.DCSTypes#Distance OuterRadius
@@ -1051,6 +1040,41 @@ end
do -- POINT_VEC2
+ --- @type POINT_VEC2
+ -- @field Dcs.DCSTypes#Distance x The x coordinate in meters.
+ -- @field Dcs.DCSTypes#Distance y the y coordinate in meters.
+ -- @extends Core.Point#COORDINATE
+
+ --- # POINT_VEC2 class, extends @{Point#COORDINATE}
+ --
+ -- The @{Point#POINT_VEC2} class defines a 2D point in the simulator. The height coordinate (if needed) will be the land height + an optional added height specified.
+ --
+ -- ## POINT_VEC2 constructor
+ --
+ -- A new POINT_VEC2 instance can be created with:
+ --
+ -- * @{Point#POINT_VEC2.New}(): a 2D point, taking an additional height parameter.
+ -- * @{Point#POINT_VEC2.NewFromVec2}(): a 2D point created from a @{DCSTypes#Vec2}.
+ --
+ -- ## Manupulate the X, Altitude, Y coordinates of the 2D point
+ --
+ -- A POINT_VEC2 class works in 2D space, with an altitude setting. It contains internally an X, Altitude, Y coordinate.
+ -- Methods exist to manupulate these coordinates.
+ --
+ -- The current X, Altitude, Y axis can be retrieved with the methods @{#POINT_VEC2.GetX}(), @{#POINT_VEC2.GetAlt}(), @{#POINT_VEC2.GetY}() respectively.
+ -- The methods @{#POINT_VEC2.SetX}(), @{#POINT_VEC2.SetAlt}(), @{#POINT_VEC2.SetY}() change the respective axis with a new value.
+ -- The current Lat(itude), Alt(itude), Lon(gitude) values can also be retrieved with the methods @{#POINT_VEC2.GetLat}(), @{#POINT_VEC2.GetAlt}(), @{#POINT_VEC2.GetLon}() respectively.
+ -- The current axis values can be changed by using the methods @{#POINT_VEC2.AddX}(), @{#POINT_VEC2.AddAlt}(), @{#POINT_VEC2.AddY}()
+ -- to add or substract a value from the current respective axis value.
+ -- Note that the Set and Add methods return the current POINT_VEC2 object, so these manipulation methods can be chained... For example:
+ --
+ -- local Vec2 = PointVec2:AddX( 100 ):AddY( 2000 ):GetVec2()
+ --
+ -- @field #POINT_VEC2
+ POINT_VEC2 = {
+ ClassName = "POINT_VEC2",
+ }
+
--- POINT_VEC2 constructor.
@@ -1083,7 +1107,7 @@ do -- POINT_VEC2
LandHeightAdd = LandHeightAdd or 0
LandHeight = LandHeight + LandHeightAdd
- local self = BASE:Inherit( self, COORDINATE:New( Vec2.x, LandHeight, Vec2.y ) ) -- Core.Point#POINT_VEC2
+ local self = BASE:Inherit( self, COORDINATE:NewFromVec2( Vec2, LandHeightAdd ) ) -- Core.Point#POINT_VEC2
self:F2( self )
return self
@@ -1210,36 +1234,6 @@ do -- POINT_VEC2
return self
end
- --- Return a random Vec2 within an Outer Radius and optionally NOT within an Inner Radius of the POINT_VEC2.
- -- @param #POINT_VEC2 self
- -- @param Dcs.DCSTypes#Distance OuterRadius
- -- @param Dcs.DCSTypes#Distance InnerRadius
- -- @return Dcs.DCSTypes#Vec2 Vec2
- function POINT_VEC2:GetRandomVec2InRadius( OuterRadius, InnerRadius )
- self:F2( { OuterRadius, InnerRadius } )
-
- local Theta = 2 * math.pi * math.random()
- local Radials = math.random() + math.random()
- if Radials > 1 then
- Radials = 2 - Radials
- end
-
- local RadialMultiplier
- if InnerRadius and InnerRadius <= OuterRadius then
- RadialMultiplier = ( OuterRadius - InnerRadius ) * Radials + InnerRadius
- else
- RadialMultiplier = OuterRadius * Radials
- end
-
- local RandomVec2
- if OuterRadius > 0 then
- RandomVec2 = { x = math.cos( Theta ) * RadialMultiplier + self:GetX(), y = math.sin( Theta ) * RadialMultiplier + self:GetZ() }
- else
- RandomVec2 = { x = self:GetX(), y = self:GetZ() }
- end
-
- return RandomVec2
- end
--- Return a random POINT_VEC2 within an Outer Radius and optionally NOT within an Inner Radius of the POINT_VEC2.
-- @param #POINT_VEC2 self
@@ -1252,8 +1246,7 @@ do -- POINT_VEC2
return POINT_VEC2:NewFromVec2( self:GetRandomVec2InRadius( OuterRadius, InnerRadius ) )
end
-
--- TODO: Check this to replace
+ -- TODO: Check this to replace
--- Calculate the distance from a reference @{#POINT_VEC2}.
-- @param #POINT_VEC2 self
-- @param #POINT_VEC2 PointVec2Reference The reference @{#POINT_VEC2}.
@@ -1261,43 +1254,12 @@ do -- POINT_VEC2
function POINT_VEC2:DistanceFromPointVec2( PointVec2Reference )
self:F2( PointVec2Reference )
- local Distance = ( ( PointVec2Reference:GetX() - self:GetX() ) ^ 2 + ( PointVec2Reference:GetY() - self:GetY() ) ^2 ) ^0.5
+ local Distance = ( ( PointVec2Reference.x - self.x ) ^ 2 + ( PointVec2Reference.z - self.z ) ^2 ) ^ 0.5
self:T2( Distance )
return Distance
end
---TODO: check this to replace
-
- --- Calculate the distance from a reference @{DCSTypes#Vec2}.
- -- @param #POINT_VEC2 self
- -- @param Dcs.DCSTypes#Vec2 Vec2Reference The reference @{DCSTypes#Vec2}.
- -- @return Dcs.DCSTypes#Distance The distance from the reference @{DCSTypes#Vec2} in meters.
- function POINT_VEC2:DistanceFromVec2( Vec2Reference )
- self:F2( Vec2Reference )
-
- local Distance = ( ( Vec2Reference.x - self:GetX() ) ^ 2 + ( Vec2Reference.y - self:GetY() ) ^2 ) ^0.5
-
- self:T2( Distance )
- return Distance
- end
-
-
- --- Add a Distance in meters from the POINT_VEC2 orthonormal plane, with the given angle, and calculate the new POINT_VEC2.
- -- @param #POINT_VEC2 self
- -- @param Dcs.DCSTypes#Distance Distance The Distance to be added in meters.
- -- @param Dcs.DCSTypes#Angle Angle The Angle in degrees.
- -- @return #POINT_VEC2 The new calculated POINT_VEC2.
- function POINT_VEC2:Translate( Distance, Angle )
- local SX = self:GetX()
- local SY = self:GetY()
- local Radians = Angle / 180 * math.pi
- local TX = Distance * math.cos( Radians ) + SX
- local TY = Distance * math.sin( Radians ) + SY
-
- return POINT_VEC2:New( TX, TY )
- end
-
end
diff --git a/Moose Development/Moose/Core/Radio.lua b/Moose Development/Moose/Core/Radio.lua
index 540c57fc9..bc6a8dd01 100644
--- a/Moose Development/Moose/Core/Radio.lua
+++ b/Moose Development/Moose/Core/Radio.lua
@@ -79,7 +79,7 @@
-- @field #string Subtitle Subtitle of the transmission
-- @field #number SubtitleDuration Duration of the Subtitle in seconds
-- @field #number Power Power of the antenna is Watts
--- @field #boolean Loop
+-- @field #boolean Loop (default true)
-- @extends Core.Base#BASE
RADIO = {
ClassName = "RADIO",
@@ -89,7 +89,7 @@ RADIO = {
Subtitle = "",
SubtitleDuration = 0,
Power = 100,
- Loop = 0,
+ Loop = true,
}
--- Create a new RADIO Object. This doesn't broadcast a transmission, though, use @{#RADIO.Broadcast} to actually broadcast
@@ -101,6 +101,7 @@ RADIO = {
function RADIO:New(Positionable)
local self = BASE:Inherit( self, BASE:New() ) -- Core.Radio#RADIO
+ self.Loop = true -- default Loop to true (not sure the above RADIO definition actually is working)
self:F(Positionable)
if Positionable:GetPointVec2() then -- It's stupid, but the only way I found to make sure positionable is valid
@@ -296,6 +297,7 @@ end
-- @return #RADIO self
function RADIO:Broadcast()
self:F()
+
-- If the POSITIONABLE is actually a UNIT or a GROUP, use the more complicated DCS command system
if self.Positionable.ClassName == "UNIT" or self.Positionable.ClassName == "GROUP" then
self:T2("Broadcasting from a UNIT or a GROUP")
diff --git a/Moose Development/Moose/Functional/Detection.lua b/Moose Development/Moose/Functional/Detection.lua
index 9d58528fe..8ece18ed5 100644
--- a/Moose Development/Moose/Functional/Detection.lua
+++ b/Moose Development/Moose/Functional/Detection.lua
@@ -512,7 +512,7 @@ do -- DETECTION_BASE
-- @param #string Event The Event string.
-- @param #string To The To State string.
function DETECTION_BASE:onafterDetect(From,Event,To)
- self:E( {From,Event,To})
+ self:E( { From, Event, To } )
local DetectDelay = 0.1
self.DetectionCount = 0
@@ -520,7 +520,7 @@ do -- DETECTION_BASE
self:UnIdentifyAllDetectedObjects() -- Resets the DetectedObjectsIdentified table
for DetectionGroupID, DetectionGroupData in pairs( self.DetectionSetGroup:GetSet() ) do
- self:E( {DetectionGroupData})
+ --self:E( { DetectionGroupData } )
self:__DetectionGroup( DetectDelay, DetectionGroupData ) -- Process each detection asynchronously.
self.DetectionCount = self.DetectionCount + 1
DetectDelay = DetectDelay + 0.1
@@ -533,7 +533,7 @@ do -- DETECTION_BASE
-- @param #string To The To State string.
-- @param Wrapper.Group#GROUP DetectionGroup The Group detecting.
function DETECTION_BASE:onafterDetectionGroup( From, Event, To, DetectionGroup )
- self:E( {From,Event,To})
+ self:E( { From, Event, To } )
self.DetectionRun = self.DetectionRun + 1
@@ -1563,7 +1563,7 @@ do -- DETECTION_UNITS
local DetectedUnit = DetectedUnitData -- Wrapper.Unit#UNIT
local DetectedObject = nil
- self:E( DetectedUnit )
+ --self:E( DetectedUnit )
if DetectedUnit:IsAlive() then
--self:E(DetectedUnit:GetName())
DetectedObject = self:GetDetectedObject( DetectedUnit:GetName() )
@@ -1924,8 +1924,8 @@ do -- DETECTION_TYPES
local DetectedItemCoordinate = DetectedItemUnit:GetCoordinate()
local DetectedItemCoordText = DetectedItemCoordinate:ToString( AttackGroup )
- self:E( { DetectedItemID,
- DetectedItemCoordText } )
+ --self:E( { DetectedItemID,
+ -- DetectedItemCoordText } )
local ReportSummary = string.format(
"%s - %s",
@@ -2365,7 +2365,7 @@ do -- DETECTION_AREAS
self:IdentifyDetectedObject( DetectedObject )
AreaExists = true
- DetectedItem.Zone:BoundZone( 12, self.CountryID, true)
+ --DetectedItem.Zone:BoundZone( 12, self.CountryID, true)
-- Assign the Unit as the new center unit of the detected area.
DetectedItem.Zone = ZONE_UNIT:New( DetectedUnit:GetName(), DetectedUnit, self.DetectionZoneRange )
@@ -2374,6 +2374,9 @@ do -- DETECTION_AREAS
-- We don't need to add the DetectedObject to the area set, because it is already there ...
break
+ else
+ DetectedSet:Remove( DetectedUnitName )
+ self:AddChangeUnit( DetectedItem, "RU", DetectedUnit:GetTypeName() )
end
end
end
@@ -2418,13 +2421,15 @@ do -- DETECTION_AREAS
end
end
else
- DetectedItem.Zone:BoundZone( 12, self.CountryID, true)
+ --DetectedItem.Zone:BoundZone( 12, self.CountryID, true)
self:RemoveDetectedItem( DetectedItemID )
self:AddChangeItem( DetectedItem, "RA" )
end
end
end
+
+
-- We iterated through the existing detection areas and:
-- - We checked which units are still detected in each detection area. Those units were flagged as Identified.
-- - We recentered the detection area to new center units where it was needed.
@@ -2488,11 +2493,14 @@ do -- DETECTION_AREAS
if DETECTION_AREAS._SmokeDetectedUnits or self._SmokeDetectedUnits then
DetectedZone.ZoneUNIT:SmokeRed()
end
+
+ --DetectedSet:Flush()
+
DetectedSet:ForEachUnit(
--- @param Wrapper.Unit#UNIT DetectedUnit
function( DetectedUnit )
if DetectedUnit:IsAlive() then
- self:T( "Detected Set #" .. DetectedItem.ItemID .. ":" .. DetectedUnit:GetName() )
+ --self:T( "Detected Set #" .. DetectedItem.ItemID .. ":" .. DetectedUnit:GetName() )
if DETECTION_AREAS._FlareDetectedUnits or self._FlareDetectedUnits then
DetectedUnit:FlareGreen()
end
diff --git a/Moose Development/Moose/Tasking/Task_A2A.lua b/Moose Development/Moose/Tasking/Task_A2A.lua
index c5cb49ebd..aa9092ab1 100644
--- a/Moose Development/Moose/Tasking/Task_A2A.lua
+++ b/Moose Development/Moose/Tasking/Task_A2A.lua
@@ -243,8 +243,6 @@ do -- TASK_A2A
-- @param Wrapper.Unit#UNIT TaskUnit
function TASK_A2A:SetTargetCoordinate( TargetCoordinate, TaskUnit )
- TargetCoordinate:SetModeA2A()
-
local ProcessUnit = self:GetUnitProcess( TaskUnit )
local ActRouteTarget = ProcessUnit:GetProcess( "Engaging", "RouteToTargetPoint" ) -- Actions.Act_Route#ACT_ROUTE_POINT
@@ -373,7 +371,6 @@ do -- TASK_A2A_INTERCEPT
)
local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate()
- TargetCoordinate:SetModeA2A()
self:SetInfo( "Coordinates", TargetCoordinate )
self:SetInfo( "ThreatLevel", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" )
@@ -421,7 +418,6 @@ do -- TASK_A2A_ENGAGE
)
local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate()
- TargetCoordinate:SetModeA2A()
self:SetInfo( "Coordinates", TargetCoordinate )
self:SetInfo( "ThreatLevel", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" )
diff --git a/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua b/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua
index 865189a69..ca0f56050 100644
--- a/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua
+++ b/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua
@@ -157,7 +157,7 @@ do -- TASK_A2A_DISPATCHER
-- @param #boolean DetectedItemID
-- @param #boolean DetectedItemChange
-- @return Tasking.Task#TASK
- function TASK_A2A_DISPATCHER:EvaluateRemoveTask( Mission, Task, Detection, DetectedItem, DetectedItemID, DetectedItemChanged )
+ function TASK_A2A_DISPATCHER:EvaluateRemoveTask( Mission, Task, Detection, DetectedItem, DetectedItemIndex, DetectedItemChanged )
if Task then
@@ -165,7 +165,7 @@ do -- TASK_A2A_DISPATCHER
local TaskName = Task:GetName()
local TaskType = TaskName:match( "(%u+)%.%d+" )
- self:E( { TaskType = TaskType } )
+ self:T2( { TaskType = TaskType } )
local Remove = false
@@ -181,11 +181,18 @@ do -- TASK_A2A_DISPATCHER
Remove = true
end
end
+
+ local DetectedSet = DetectedItem.Set -- Core.Set#SET_UNIT
+ --DetectedSet:Flush()
+ --self:E( { DetectedSetCount = DetectedSet:Count() } )
+ if DetectedSet:Count() == 0 then
+ Remove = true
+ end
if DetectedItemChanged == true or Remove then
- self:E( "Removing Tasking: " .. Task:GetTaskName() )
+ --self:E( "Removing Tasking: " .. Task:GetTaskName() )
Mission:RemoveTask( Task )
- self.Tasks[DetectedItemID] = nil
+ self.Tasks[DetectedItemIndex] = nil
end
end
end
@@ -221,7 +228,7 @@ do -- TASK_A2A_DISPATCHER
end
- self:E( { FriendliesCount = FriendliesCount } )
+ --self:E( { FriendliesCount = FriendliesCount } )
local FriendlyTypesReport = REPORT:New()
@@ -254,7 +261,7 @@ do -- TASK_A2A_DISPATCHER
for PlayerUnitName, PlayerUnitData in pairs( PlayersNearBy ) do
local PlayerUnit = PlayerUnitData -- Wrapper.Unit#UNIT
local PlayerName = PlayerUnit:GetPlayerName()
- self:E( { PlayerName = PlayerName, PlayerUnit = PlayerUnit } )
+ --self:E( { PlayerName = PlayerName, PlayerUnit = PlayerUnit } )
if PlayerUnit:IsAirPlane() and PlayerName ~= nil then
local FriendlyUnitThreatLevel = PlayerUnit:GetThreatLevel()
PlayersCount = PlayersCount + 1
@@ -267,7 +274,7 @@ do -- TASK_A2A_DISPATCHER
end
- self:E( { PlayersCount = PlayersCount } )
+ --self:E( { PlayersCount = PlayersCount } )
local PlayerTypesReport = REPORT:New()
@@ -300,25 +307,42 @@ do -- TASK_A2A_DISPATCHER
if Mission:IsIDLE() or Mission:IsENGAGED() then
local TaskReport = REPORT:New()
+
+ -- Checking the task queue for the dispatcher, and removing any obsolete task!
+ for TaskIndex, TaskData in pairs( self.Tasks ) do
+ local Task = TaskData -- Tasking.Task#TASK
+ if Task:IsStatePlanned() then
+ local DetectedItem = Detection:GetDetectedItem( TaskIndex )
+ if not DetectedItem then
+ local TaskText = Task:GetName()
+ for TaskGroupID, TaskGroup in pairs( self.SetGroup:GetSet() ) do
+ Mission:GetCommandCenter():MessageToGroup( string.format( "Obsolete A2A task %s for %s removed.", TaskText, Mission:GetName() ), TaskGroup )
+ end
+ Mission:RemoveTask( Task )
+ self.Tasks[TaskIndex] = nil
+ end
+ end
+ end
- --- First we need to the detected targets.
+ -- Now that all obsolete tasks are removed, loop through the detected targets.
for DetectedItemID, DetectedItem in pairs( Detection:GetDetectedItems() ) do
local DetectedItem = DetectedItem -- Functional.Detection#DETECTION_BASE.DetectedItem
local DetectedSet = DetectedItem.Set -- Core.Set#SET_UNIT
+ local DetectedCount = DetectedSet:Count()
local DetectedZone = DetectedItem.Zone
- self:E( { "Targets in DetectedItem", DetectedItem.ItemID, DetectedSet:Count(), tostring( DetectedItem ) } )
- DetectedSet:Flush()
+ --self:E( { "Targets in DetectedItem", DetectedItem.ItemID, DetectedSet:Count(), tostring( DetectedItem ) } )
+ --DetectedSet:Flush()
local DetectedID = DetectedItem.ID
- local DetectedIndex = DetectedItem.Index
+ local TaskIndex = DetectedItem.Index
local DetectedItemChanged = DetectedItem.Changed
- local Task = self.Tasks[DetectedID]
- Task = self:EvaluateRemoveTask( Mission, Task, Detection, DetectedItem, DetectedID, DetectedItemChanged ) -- Task will be removed if it is planned and changed.
+ local Task = self.Tasks[TaskIndex]
+ Task = self:EvaluateRemoveTask( Mission, Task, Detection, DetectedItem, TaskIndex, DetectedItemChanged ) -- Task will be removed if it is planned and changed.
-- Evaluate INTERCEPT
- if not Task then
+ if not Task and DetectedCount > 0 then
local TargetSetUnit = self:EvaluateENGAGE( DetectedItem ) -- Returns a SetUnit if there are targets to be INTERCEPTed...
if TargetSetUnit then
Task = TASK_A2A_ENGAGE:New( Mission, self.SetGroup, string.format( "ENGAGE.%03d", DetectedID ), TargetSetUnit )
@@ -330,7 +354,7 @@ do -- TASK_A2A_DISPATCHER
end
if Task then
- self.Tasks[DetectedID] = Task
+ self.Tasks[TaskIndex] = Task
Task:SetTargetZone( DetectedZone, DetectedSet:GetFirst():GetAltitude(), DetectedSet:GetFirst():GetHeading() )
Task:SetDispatcher( self )
Mission:AddTask( Task )
@@ -342,11 +366,12 @@ do -- TASK_A2A_DISPATCHER
end
- local FriendliesCount, FriendliesReport = self:GetFriendliesNearBy( DetectedItem )
- Task:SetInfo( "Friendlies", string.format( "%d ( %s )", FriendliesCount, FriendliesReport:Text( "," ) ) )
-
- local PlayersCount, PlayersReport = self:GetPlayerFriendliesNearBy( DetectedItem )
- Task:SetInfo( "Players", string.format( "%d ( %s )", PlayersCount, PlayersReport:Text( "," ) ) )
+ if Task then
+ local FriendliesCount, FriendliesReport = self:GetFriendliesNearBy( DetectedItem )
+ Task:SetInfo( "Friendlies", string.format( "%d ( %s )", FriendliesCount, FriendliesReport:Text( "," ) ) )
+ local PlayersCount, PlayersReport = self:GetPlayerFriendliesNearBy( DetectedItem )
+ Task:SetInfo( "Players", string.format( "%d ( %s )", PlayersCount, PlayersReport:Text( "," ) ) )
+ end
-- OK, so the tasking has been done, now delete the changes reported for the area.
Detection:AcceptChanges( DetectedItem )
diff --git a/Moose Development/Moose/Tasking/Task_A2G.lua b/Moose Development/Moose/Tasking/Task_A2G.lua
index 56c43d091..9ad9ca03e 100644
--- a/Moose Development/Moose/Tasking/Task_A2G.lua
+++ b/Moose Development/Moose/Tasking/Task_A2G.lua
@@ -381,7 +381,6 @@ do -- TASK_SEAD
)
local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate()
- TargetCoordinate:SetModeA2G()
self:SetInfo( "Coordinates", TargetCoordinate )
self:SetInfo( "ThreatLevel", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" )
@@ -424,7 +423,6 @@ do -- TASK_BAI
)
local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate()
- TargetCoordinate:SetModeA2G()
self:SetInfo( "Coordinates", TargetCoordinate )
self:SetInfo( "ThreatLevel", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" )
@@ -468,7 +466,6 @@ do -- TASK_CAS
)
local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate()
- TargetCoordinate:SetModeA2G()
self:SetInfo( "Coordinates", TargetCoordinate )
self:SetInfo( "ThreatLevel", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" )
diff --git a/Moose Development/Moose/Tasking/Task_A2G_Dispatcher.lua b/Moose Development/Moose/Tasking/Task_A2G_Dispatcher.lua
index 4d77cee7b..488c7a256 100644
--- a/Moose Development/Moose/Tasking/Task_A2G_Dispatcher.lua
+++ b/Moose Development/Moose/Tasking/Task_A2G_Dispatcher.lua
@@ -185,13 +185,13 @@ do -- TASK_A2G_DISPATCHER
-- @param #boolean DetectedItemID
-- @param #boolean DetectedItemChange
-- @return Tasking.Task#TASK
- function TASK_A2G_DISPATCHER:EvaluateRemoveTask( Mission, Task, DetectedItemID, DetectedItemChanged )
+ function TASK_A2G_DISPATCHER:EvaluateRemoveTask( Mission, Task, TaskIndex, DetectedItemChanged )
if Task then
if Task:IsStatePlanned() and DetectedItemChanged == true then
self:E( "Removing Tasking: " .. Task:GetTaskName() )
Mission:RemoveTask( Task )
- self.Tasks[DetectedItemID] = nil
+ self.Tasks[TaskIndex] = nil
end
end
@@ -216,6 +216,22 @@ do -- TASK_A2G_DISPATCHER
local TaskReport = REPORT:New()
+ -- Checking the task queue for the dispatcher, and removing any obsolete task!
+ for TaskIndex, TaskData in pairs( self.Tasks ) do
+ local Task = TaskData -- Tasking.Task#TASK
+ if Task:IsStatePlanned() then
+ local DetectedItem = Detection:GetDetectedItem( TaskIndex )
+ if not DetectedItem then
+ local TaskText = Task:GetName()
+ for TaskGroupID, TaskGroup in pairs( self.SetGroup:GetSet() ) do
+ Mission:GetCommandCenter():MessageToGroup( string.format( "Obsolete A2G task %s for %s removed.", TaskText, Mission:GetName() ), TaskGroup )
+ end
+ Mission:RemoveTask( Task )
+ self.Tasks[TaskIndex] = nil
+ end
+ end
+ end
+
--- First we need to the detected targets.
for DetectedItemID, DetectedItem in pairs( Detection:GetDetectedItems() ) do
@@ -226,11 +242,11 @@ do -- TASK_A2G_DISPATCHER
DetectedSet:Flush()
local DetectedItemID = DetectedItem.ID
- local DetectedItemIndex = DetectedItem.Index
+ local TaskIndex = DetectedItem.Index
local DetectedItemChanged = DetectedItem.Changed
- local Task = self.Tasks[DetectedItemID]
- Task = self:EvaluateRemoveTask( Mission, Task, DetectedItemID, DetectedItemChanged ) -- Task will be removed if it is planned and changed.
+ local Task = self.Tasks[TaskIndex]
+ Task = self:EvaluateRemoveTask( Mission, Task, TaskIndex, DetectedItemChanged ) -- Task will be removed if it is planned and changed.
-- Evaluate SEAD
if not Task then
@@ -256,11 +272,11 @@ do -- TASK_A2G_DISPATCHER
end
if Task then
- self.Tasks[DetectedItemID] = Task
+ self.Tasks[TaskIndex] = Task
Task:SetTargetZone( DetectedZone )
Task:SetDispatcher( self )
Task:SetInfo( "ThreatLevel", DetectedSet:CalculateThreatLevelA2G() )
- Task:SetInfo( "Detection", Detection:DetectedItemReportSummary( DetectedItemIndex ) )
+ Task:SetInfo( "Detection", Detection:DetectedItemReportSummary( TaskIndex ) )
Task:SetInfo( "Changes", Detection:GetChangeText( DetectedItem ) )
Mission:AddTask( Task )
else
diff --git a/Moose Development/Moose/Tasking/Task_CARGO.lua b/Moose Development/Moose/Tasking/Task_CARGO.lua
index 22a331949..86263764e 100644
--- a/Moose Development/Moose/Tasking/Task_CARGO.lua
+++ b/Moose Development/Moose/Tasking/Task_CARGO.lua
@@ -174,6 +174,7 @@ do -- TASK_CARGO
self.SetCargo = SetCargo
self.TaskType = TaskType
+ self.SmokeColor = SMOKECOLOR.Red
self.DeployZones = {} -- setmetatable( {}, { __mode = "v" } ) -- weak table on value
@@ -327,6 +328,13 @@ do -- TASK_CARGO
self:__RouteToDeploy( 1.0, DeployZone )
end
+
+
+ ---
+ --#TASK_CAROG_TRANSPORT self
+ --#Wrapper.Unit#UNIT
+
+
--- Route to Cargo
-- @param #FSM_PROCESS self
-- @param Wrapper.Unit#UNIT TaskUnit
@@ -347,16 +355,16 @@ do -- TASK_CARGO
end
+
---
-- @param #FSM_PROCESS self
-- @param Wrapper.Unit#UNIT TaskUnit
-- @param Tasking.Task_Cargo#TASK_CARGO Task
function Fsm:onafterArriveAtPickup( TaskUnit, Task )
self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } )
-
if self.Cargo:IsAlive() then
+ TaskUnit:Smoke( Task:GetSmokeColor(), 15 )
if TaskUnit:IsAir() then
- self.Cargo.CargoObject:GetUnit(1):SmokeRed()
self:__Land( -0.1, "Pickup" )
else
self:__SelectAction( -0.1 )
@@ -606,6 +614,26 @@ do -- TASK_CARGO
end
+
+ ---@param Color Might be SMOKECOLOR.Blue, SMOKECOLOR.Red SMOKECOLOR.Orange, SMOKECOLOR.White or SMOKECOLOR.Green
+ function TASK_CARGO:SetSmokeColor(SmokeColor)
+ -- Makes sure Coloe is set
+ if SmokeColor == nil then
+ self.SmokeColor = SMOKECOLOR.Red -- Make sure a default color is exist
+
+ elseif type(SmokeColor) == "number" then
+ self:F2(SmokeColor)
+ if SmokeColor > 0 and SmokeColor <=5 then -- Make sure number is within ragne, assuming first enum is one
+ self.SmokeColor = SMOKECOLOR.SmokeColor
+ end
+ end
+ end
+
+ --@return SmokeColor
+ function TASK_CARGO:GetSmokeColor()
+ return self.SmokeColor
+ end
+
--- @param #TASK_CARGO self
function TASK_CARGO:GetPlannedMenuText()
return self:GetStateString() .. " - " .. self:GetTaskName() .. " ( " .. self.TargetSetUnit:GetUnitTypesText() .. " )"
@@ -911,6 +939,11 @@ do -- TASK_CARGO_TRANSPORT
return CargoDeployed
end
+
+ ---
+
+
+
end
diff --git a/Utils/Slate Documentation Generator/bin/TreeHierarchy.csv b/Utils/Slate Documentation Generator/bin/TreeHierarchy.csv
index 94fc57631..c5a17961d 100644
--- a/Utils/Slate Documentation Generator/bin/TreeHierarchy.csv
+++ b/Utils/Slate Documentation Generator/bin/TreeHierarchy.csv
@@ -1,35 +1,41 @@
+@K=function, @M=Task_A2A, @N=onafterRouteToRendezVous, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_A2A.lua, @C=4756,
+@K=function, @M=Task_A2A, @N=OnAfterArriveAtRendezVous, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_A2A.lua, @C=5417,
+@K=function, @M=Task_A2A, @N=onafterEngage, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_A2A.lua, @C=5814,
+@K=function, @M=Task_A2A, @N=onafterRouteToTarget, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_A2A.lua, @C=6136,
+@K=function, @M=Task_A2A, @N=onafterRouteToTargets, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_A2A.lua, @C=7017,
@K=function, @M=Task_A2G, @N=onafterRouteToRendezVous, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_A2G.lua, @C=5157,
-@K=function, @M=Task_A2G, @N=OnAfterArriveAtRendezVous, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_A2G.lua, @C=5817,
-@K=function, @M=Task_A2G, @N=onafterEngage, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_A2G.lua, @C=6214,
-@K=function, @M=Task_A2G, @N=onafterRouteToTarget, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_A2G.lua, @C=6536,
-@K=function, @M=Task_A2G, @N=onafterRouteToTargets, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_A2G.lua, @C=7408,
-@K=function, @M=Task_Cargo, @N=onafterSelectAction, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=10439,
-@K=function, @M=Task_Cargo, @N=OnLeaveWaitingForCommand, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=13084,
-@K=function, @M=Task_Cargo, @N=onafterRouteToPickup, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=13860,
-@K=function, @M=Task_Cargo, @N=onafterArriveAtPickup, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=14479,
-@K=function, @M=Task_Cargo, @N=onafterRouteToDeploy, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=15020,
-@K=function, @M=Task_Cargo, @N=onafterArriveAtDeploy, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=15467,
-@K=function, @M=Task_Cargo, @N=onafterLand, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=15897,
-@K=function, @M=Task_Cargo, @N=onafterLanded, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=16856,
-@K=function, @M=Task_Cargo, @N=onafterPrepareBoarding, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=17622,
-@K=function, @M=Task_Cargo, @N=onafterBoard, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=18082,
-@K=function, @M=Task_Cargo, @N=onafterBoarded, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=19023,
-@K=function, @M=Task_Cargo, @N=onafterPrepareUnBoarding, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=19706,
-@K=function, @M=Task_Cargo, @N=onafterUnBoard, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=20666,
-@K=function, @M=Task_Cargo, @N=onafterUnBoarded, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=21541,
-@K=function, @M=Designate, @N=OnBeforeLaseOn, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=12232,
-@K=function, @M=Designate, @N=OnAfterLaseOn, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=12480,
-@K=function, @M=Designate, @N=LaseOn, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=12701,
-@K=function, @M=Designate, @N=__LaseOn, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=12824,
-@K=function, @M=Designate, @N=OnBeforeLaseOff, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=13114,
-@K=function, @M=Designate, @N=OnAfterLaseOff, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=13364,
-@K=function, @M=Designate, @N=LaseOff, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=13587,
-@K=function, @M=Designate, @N=__LaseOff, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=13712,
-@K=function, @M=Designate, @N=OnBeforeSmoke, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=13944,
-@K=function, @M=Designate, @N=OnAfterSmoke, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=14190,
-@K=function, @M=Designate, @N=Smoke, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=14409,
-@K=function, @M=Designate, @N=__Smoke, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=14530,
-@K=function, @M=Designate, @N=OnBeforeStatus, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=15628,
-@K=function, @M=Designate, @N=OnAfterStatus, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=15876,
-@K=function, @M=Designate, @N=Status, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=16097,
-@K=function, @M=Designate, @N=__Status, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=16220,
+@K=function, @M=Task_A2G, @N=OnAfterArriveAtRendezVous, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_A2G.lua, @C=5818,
+@K=function, @M=Task_A2G, @N=onafterEngage, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_A2G.lua, @C=6215,
+@K=function, @M=Task_A2G, @N=onafterRouteToTarget, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_A2G.lua, @C=6537,
+@K=function, @M=Task_A2G, @N=onafterRouteToTargets, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_A2G.lua, @C=7416,
+@K=function, @M=Task_Cargo, @N=onafterSelectAction, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=10673,
+@K=function, @M=Task_Cargo, @N=OnLeaveWaitingForCommand, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=13702,
+@K=function, @M=Task_Cargo, @N=onafterRouteToPickup, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=14474,
+@K=function, @M=Task_Cargo, @N=onafterArriveAtPickup, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=15093,
+@K=function, @M=Task_Cargo, @N=onafterCancelRouteToPickup, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=15634,
+@K=function, @M=Task_Cargo, @N=onafterRouteToDeploy, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=15971,
+@K=function, @M=Task_Cargo, @N=onafterArriveAtDeploy, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=16418,
+@K=function, @M=Task_Cargo, @N=onafterCancelRouteToDeploy, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=16846,
+@K=function, @M=Task_Cargo, @N=onafterLanded, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=18133,
+@K=function, @M=Task_Cargo, @N=onafterPrepareBoarding, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=18899,
+@K=function, @M=Task_Cargo, @N=onafterBoard, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=19359,
+@K=function, @M=Task_Cargo, @N=onafterBoarded, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=20300,
+@K=function, @M=Task_Cargo, @N=onafterPrepareUnBoarding, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=20983,
+@K=function, @M=Task_Cargo, @N=onafterUnBoard, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=21943,
+@K=function, @M=Task_Cargo, @N=onafterUnBoarded, @P=Fsm, @F=../../../MOOSE/Moose Development/Moose\Tasking\Task_CARGO.lua, @C=22962,
+@K=function, @M=Designate, @N=OnBeforeLaseOn, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=12218,
+@K=function, @M=Designate, @N=OnAfterLaseOn, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=12466,
+@K=function, @M=Designate, @N=LaseOn, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=12687,
+@K=function, @M=Designate, @N=__LaseOn, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=12810,
+@K=function, @M=Designate, @N=OnBeforeLaseOff, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=13094,
+@K=function, @M=Designate, @N=OnAfterLaseOff, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=13344,
+@K=function, @M=Designate, @N=LaseOff, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=13567,
+@K=function, @M=Designate, @N=__LaseOff, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=13692,
+@K=function, @M=Designate, @N=OnBeforeSmoke, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=13906,
+@K=function, @M=Designate, @N=OnAfterSmoke, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=14152,
+@K=function, @M=Designate, @N=Smoke, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=14371,
+@K=function, @M=Designate, @N=__Smoke, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=14492,
+@K=function, @M=Designate, @N=OnBeforeStatus, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=15578,
+@K=function, @M=Designate, @N=OnAfterStatus, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=15826,
+@K=function, @M=Designate, @N=Status, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=16047,
+@K=function, @M=Designate, @N=__Status, @P=DESIGNATE , @F=../../../MOOSE/Moose Development/Moose\Functional\Designate.lua, @C=16170,
diff --git a/docs/Documentation/AI_BAI.html b/docs/Documentation/AI_BAI.html
index a778055c0..5c91e2d34 100644
--- a/docs/Documentation/AI_BAI.html
+++ b/docs/Documentation/AI_BAI.html
@@ -75,6 +75,7 @@
Iterate the DATABASE and call an iterator function for each player who has joined the mission, providing the Unit of the player and optional parameters.
@@ -1385,6 +1418,11 @@ An example of how to use the method is shown below.
Detection:Start()
+
Detection of Friendlies Nearby
+
+
Use the method Detection#DETECTION_BASE.SetFriendliesRange() to set the range what will indicate when friendlies are nearby
+a DetectedItem. The default range is 6000 meters. For air detections, it is advisory to use about 30.000 meters.
+
DETECTION_BASE is a Finite State Machine
Various Events and State Transitions can be tailored using DETECTION_BASE.
Manupulate the X, Altitude, Y coordinates of the 2D point
+
Create waypoints for routes
-
A COORDINATE class works in 2D space, with an altitude setting. It contains internally an X, Altitude, Y coordinate.
-Methods exist to manupulate these coordinates.
+
A COORDINATE can prepare waypoints for Ground and Air groups to be embedded into a Route.
@@ -888,9 +982,9 @@ to add or substract a value from the current respective axis value.
Note that the Set and Add methods return the current POINT_VEC2 object, so these manipulation methods can be chained... For example:
local Vec2 = PointVec2:AddX( 100 ):AddY( 2000 ):GetVec2()
-
+
@@ -903,15 +997,15 @@ Note that the Set and Add methods return the current POINT_VEC2 object, so these
POINT_VEC3 defines a 3D point in the simulator and with its methods, you can use or manipulate the point in 3D space.
Important Note: Most of the functions in this section were taken from MIST, and reworked to OO concepts.
-In order to keep the credibility of the the author,
-I want to emphasize that the formulas embedded in the MIST framework were created by Grimes or previous authors,
+In order to keep the credibility of the the author,
+I want to emphasize that the formulas embedded in the MIST framework were created by Grimes or previous authors,
who you can find on the Eagle Dynamics Forums.
@@ -940,115 +1034,20 @@ Note that the Set and Add methods return the current POINT_VEC3 object, so these
-
Create waypoints for routes
-
-
A POINT_VEC3 can prepare waypoints for Ground and Air groups to be embedded into a Route.
TODO: check this to replace
+- Calculate the distance from a reference DCSTypes#Vec2.
+ @param #COORDINATE self
+ @param Dcs.DCSTypes#Vec2 Vec2Reference The reference DCSTypes#Vec2.
+ @return Dcs.DCSTypes#Distance The distance from the reference DCSTypes#Vec2 in meters.
@@ -1235,8 +1777,8 @@ The y coordinate of the Vec3 point, pointing to the Right.
-
Dcs.DCSTypes#Distance LandHeightAdd :
-(optional) The default height if required to be evaluated will be the land height of the x, y coordinate. You can specify an extra height to be added to the land height.
+
Dcs.DCSTypes#Distance z :
+The z coordinate of the Vec3 point, pointing to the Right.
Calculate the distance from a reference DCSTypes#Vec2.
+
TODO: Check this to replace
+- Calculate the distance from a reference #POINT_VEC2.
+ @param #POINTVEC2 self
+ @param #POINTVEC2 PointVec2Reference The reference #POINT_VEC2.
+ @return Dcs.DCSTypes#Distance The distance from the reference #POINT_VEC2 in meters.
@@ -232,6 +235,34 @@ local ScoringSecondMission = SCORING:New( "SecondMission" )
The above documents that 2 Scoring objects are created, ScoringFirstMission and ScoringSecondMission.
+
*IMPORTANT!!!
+
In order to allow DCS world to write CSV files, you need to adapt a configuration file in your DCS world installation on the server.
+For this, browse to the missionscripting.lua file in your DCS world installation folder.
+For me, this installation folder is in D:\Program Files\Eagle Dynamics\DCS World\Scripts.
+
+
Edit a few code lines in the MissionScripting.lua file. Comment out the lines os, io and lfs:
+
+
do
+ --sanitizeModule('os')
+ --sanitizeModule('io')
+ --sanitizeModule('lfs')
+ require = nil
+ loadlib = nil
+ end
+
+
+
When these lines are not sanitized, functions become available to check the time, and to write files to your system at the above specified location.
+Note that the MissionScripting.lua file provides a warning. So please beware of this warning as outlined by Eagle Dynamics!
+
+
--Sanitize Mission Scripting environment
+ --This makes unavailable some unsecure functions.
+ --Mission downloaded from server to client may contain potentialy harmful lua code that may use these functions.
+ --You can remove the code below and make availble these functions at your own risk.
+
+
+
The MOOSE designer cannot take any responsibility of any damage inflicted as a result of the de-sanitization.
+That being said, I hope that the SCORING class provides you with a great add-on to score your squad mates achievements.
+
1.9) Configure messages.
When players hit or destroy targets, messages are sent.
diff --git a/docs/Documentation/Sead.html b/docs/Documentation/Sead.html
index 7d90b36be..796e9884d 100644
--- a/docs/Documentation/Sead.html
+++ b/docs/Documentation/Sead.html
@@ -75,6 +75,7 @@
The #TASK_A2A class defines Air To Air tasks for a Set of Target Units,
+based on the tasking capabilities defined in Task#TASK.
+The TASK_A2A is implemented using a Statemachine#FSM_TASK, and has the following statuses:
+
+
+
None: Start of the process
+
Planned: The A2A task is planned.
+
Assigned: The A2A task is assigned to a Group#GROUP.
+
Success: The A2A task is successfully completed.
+
Failed: The A2A task has failed. This will happen if the player exists the task early, without communicating a possible cancellation to HQ.
+
+
+
1.1) Set the scoring of achievements in an A2A attack.
+
+
Scoring or penalties can be given in the following circumstances:
#number TargetDistance :
+The distance to Target when the Player is considered to have "arrived" at the engagement range.
+
+
+
+
+
Core.Zone#ZONE_BASE TargetZone :
+The target zone, if known.
+If the TargetZone parameter is specified, the player will be routed to the center of the zone where all the targets are assumed to be.
The #TASKA2ADISPATCHER class implements the dynamic dispatching of tasks upon groups of detected units determined a Set of EWR installation groups.
+The EWR will detect units, will group them, and will dispatch Tasks to groups. Depending on the type of target detected, different tasks will be dispatched.
+Find a summary below describing for which situation a task type is created:
+
+
+
INTERCEPT Task: Is created when the target is known, is detected and within a danger zone, and there is no friendly airborne in range.
+
SWEEP Task: Is created when the target is unknown, was detected and the last position is only known, and within a danger zone, and there is no friendly airborne in range.
+
ENGAGE Task: Is created when the target is known, is detected and within a danger zone, and there is a friendly airborne in range, that will receive this task.