mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-07-20 22:03:25 +00:00
xx
This commit is contained in:
@@ -3,8 +3,6 @@
|
||||
-- ## Features:
|
||||
--
|
||||
-- * Provides a COORDINATE class, which allows to manage points in 3D space and perform various operations on it.
|
||||
-- * Provides a POINT\_VEC2 class, which is derived from COORDINATE, and allows to manage points in 3D space, but from a Lat/Lon and Altitude perspective.
|
||||
-- * Provides a POINT\_VEC3 class, which is derived from COORDINATE, and allows to manage points in 3D space, but from a X, Z and Y vector perspective.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
@@ -3876,170 +3874,4 @@ do -- COORDINATE
|
||||
|
||||
end
|
||||
|
||||
do
|
||||
|
||||
--- 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 COORDINATE 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 #COORDINATE
|
||||
|
||||
|
||||
--- Defines a 3D point in the simulator and with its methods, you can use or manipulate the point in 3D space.
|
||||
--
|
||||
-- **DEPRECATED - PLEASE USE COORDINATE!**
|
||||
--
|
||||
-- **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 @{DCS#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"
|
||||
|
||||
--- RoutePoint Types
|
||||
-- @type POINT_VEC3.RoutePointType
|
||||
-- @field TakeOffParking "TakeOffParking"
|
||||
-- @field TurningPoint "Turning Point"
|
||||
|
||||
--- RoutePoint Actions
|
||||
-- @type POINT_VEC3.RoutePointAction
|
||||
-- @field FromParkingArea "From Parking Area"
|
||||
-- @field TurningPoint "Turning Point"
|
||||
|
||||
-- Constructor.
|
||||
|
||||
--- Create a new POINT_VEC3 object.
|
||||
-- @param #POINT_VEC3 self
|
||||
-- @param DCS#Distance x The x coordinate of the Vec3 point, pointing to the North.
|
||||
-- @param DCS#Distance y The y coordinate of the Vec3 point, pointing Upwards.
|
||||
-- @param DCS#Distance z The z coordinate of the Vec3 point, pointing to the Right.
|
||||
-- @return Core.Point#POINT_VEC3
|
||||
function POINT_VEC3:New( x, y, z )
|
||||
|
||||
local self = BASE:Inherit( self, COORDINATE:New( x, y, z ) ) -- Core.Point#POINT_VEC3
|
||||
self:F2( self )
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
do
|
||||
|
||||
--- @type POINT_VEC2
|
||||
-- @field DCS#Distance x The x coordinate in meters.
|
||||
-- @field DCS#Distance y the y coordinate in meters.
|
||||
-- @extends Core.Point#COORDINATE
|
||||
|
||||
--- Defines a 2D point in the simulator. The height coordinate (if needed) will be the land height + an optional added height specified.
|
||||
--
|
||||
-- **DEPRECATED - PLEASE USE COORDINATE!**
|
||||
--
|
||||
-- ## POINT_VEC2 constructor
|
||||
--
|
||||
-- A new POINT_VEC2 instance can be created with:
|
||||
--
|
||||
-- * @{Core.Point#POINT_VEC2.New}(): a 2D point, taking an additional height parameter.
|
||||
-- * @{Core.Point#POINT_VEC2.NewFromVec2}(): a 2D point created from a @{DCS#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.
|
||||
-- @param #POINT_VEC2 self
|
||||
-- @param DCS#Distance x The x coordinate of the Vec3 point, pointing to the North.
|
||||
-- @param DCS#Distance y The y coordinate of the Vec3 point, pointing to the Right.
|
||||
-- @param DCS#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.
|
||||
-- @return Core.Point#POINT_VEC2
|
||||
function POINT_VEC2:New( x, y, LandHeightAdd )
|
||||
|
||||
local LandHeight = land.getHeight( { ["x"] = x, ["y"] = y } )
|
||||
|
||||
LandHeightAdd = LandHeightAdd or 0
|
||||
LandHeight = LandHeight + LandHeightAdd
|
||||
|
||||
local self = BASE:Inherit( self, COORDINATE:New( x, LandHeight, y ) ) -- Core.Point#POINT_VEC2
|
||||
self:F2( self )
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -193,7 +193,7 @@ ESCORT = {
|
||||
function ESCORT:New( EscortClient, EscortGroup, EscortName, EscortBriefing )
|
||||
|
||||
local self = BASE:Inherit( self, BASE:New() ) -- #ESCORT
|
||||
self:F( { EscortClient, EscortGroup, EscortName } )
|
||||
--self:F( { EscortClient, EscortGroup, EscortName } )
|
||||
|
||||
self.EscortClient = EscortClient -- Wrapper.Client#CLIENT
|
||||
self.EscortGroup = EscortGroup -- Wrapper.Group#GROUP
|
||||
@@ -202,7 +202,7 @@ function ESCORT:New( EscortClient, EscortGroup, EscortName, EscortBriefing )
|
||||
|
||||
self.EscortSetGroup = SET_GROUP:New()
|
||||
self.EscortSetGroup:AddObject( self.EscortGroup )
|
||||
self.EscortSetGroup:Flush()
|
||||
--self.EscortSetGroup:Flush()
|
||||
self.Detection = DETECTION_UNITS:New( self.EscortSetGroup, 15000 )
|
||||
|
||||
self.EscortGroup.Detection = self.Detection
|
||||
@@ -242,12 +242,11 @@ function ESCORT:New( EscortClient, EscortGroup, EscortName, EscortBriefing )
|
||||
self.CT1 = 0
|
||||
self.GT1 = 0
|
||||
|
||||
self.FollowScheduler, self.FollowSchedule = SCHEDULER:New( self, self._FollowScheduler, {}, 1, .5, .01 )
|
||||
self.FollowScheduler, self.FollowSchedule = SCHEDULER:New( self, self._FollowScheduler, {}, 1, 2, .01 )
|
||||
self.FollowScheduler:Stop( self.FollowSchedule )
|
||||
|
||||
self.EscortMode = ESCORT.MODE.MISSION
|
||||
|
||||
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -273,12 +272,11 @@ function ESCORT:TestSmokeDirectionVector( SmokeDirection )
|
||||
self.SmokeDirectionVector = ( SmokeDirection == true ) and true or false
|
||||
end
|
||||
|
||||
|
||||
--- Defines the default menus
|
||||
-- @param #ESCORT self
|
||||
-- @return #ESCORT
|
||||
-- @return #ESCORT self
|
||||
function ESCORT:Menus()
|
||||
self:F()
|
||||
--self:F()
|
||||
|
||||
self:MenuFollowAt( 100 )
|
||||
self:MenuFollowAt( 200 )
|
||||
@@ -299,19 +297,16 @@ function ESCORT:Menus()
|
||||
self:MenuEvasion()
|
||||
self:MenuResumeMission()
|
||||
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
|
||||
--- Defines a menu slot to let the escort Join and Follow you at a certain distance.
|
||||
-- This menu will appear under **Navigation**.
|
||||
-- @param #ESCORT self
|
||||
-- @param DCS#Distance Distance The distance in meters that the escort needs to follow the client.
|
||||
-- @return #ESCORT
|
||||
-- @return #ESCORT self
|
||||
function ESCORT:MenuFollowAt( Distance )
|
||||
self:F(Distance)
|
||||
--self:F(Distance)
|
||||
|
||||
if self.EscortGroup:IsAir() then
|
||||
if not self.EscortMenuReportNavigation then
|
||||
@@ -336,10 +331,10 @@ end
|
||||
-- @param DCS#Distance Height Optional parameter that sets the height in meters to let the escort orbit at the current location. The default value is 30 meters.
|
||||
-- @param DCS#Time Seconds Optional parameter that lets the escort orbit at the current position for a specified time. (not implemented yet). The default value is 0 seconds, meaning, that the escort will orbit forever until a sequent command is given.
|
||||
-- @param #string MenuTextFormat Optional parameter that shows the menu option text. The text string is formatted, and should contain two %d tokens in the string. The first for the Height, the second for the Time (if given). If no text is given, the default text will be displayed.
|
||||
-- @return #ESCORT
|
||||
-- @return #ESCORT self
|
||||
-- TODO: Implement Seconds parameter. Challenge is to first develop the "continue from last activity" function.
|
||||
function ESCORT:MenuHoldAtEscortPosition( Height, Seconds, MenuTextFormat )
|
||||
self:F( { Height, Seconds, MenuTextFormat } )
|
||||
--self:F( { Height, Seconds, MenuTextFormat } )
|
||||
|
||||
if self.EscortGroup:IsAir() then
|
||||
|
||||
@@ -390,17 +385,16 @@ function ESCORT:MenuHoldAtEscortPosition( Height, Seconds, MenuTextFormat )
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Defines a menu slot to let the escort hold at the client position and stay low with a specified height during a specified time in seconds.
|
||||
-- This menu will appear under **Navigation**.
|
||||
-- @param #ESCORT self
|
||||
-- @param DCS#Distance Height Optional parameter that sets the height in meters to let the escort orbit at the current location. The default value is 30 meters.
|
||||
-- @param DCS#Time Seconds Optional parameter that lets the escort orbit at the current position for a specified time. (not implemented yet). The default value is 0 seconds, meaning, that the escort will orbit forever until a sequent command is given.
|
||||
-- @param #string MenuTextFormat Optional parameter that shows the menu option text. The text string is formatted, and should contain one or two %d tokens in the string. The first for the Height, the second for the Time (if given). If no text is given, the default text will be displayed.
|
||||
-- @return #ESCORT
|
||||
-- @return #ESCORT self
|
||||
-- TODO: Implement Seconds parameter. Challenge is to first develop the "continue from last activity" function.
|
||||
function ESCORT:MenuHoldAtLeaderPosition( Height, Seconds, MenuTextFormat )
|
||||
self:F( { Height, Seconds, MenuTextFormat } )
|
||||
--self:F( { Height, Seconds, MenuTextFormat } )
|
||||
|
||||
if self.EscortGroup:IsAir() then
|
||||
|
||||
@@ -458,9 +452,9 @@ end
|
||||
-- @param DCS#Distance Height Optional parameter that sets the height in meters to let the escort orbit at the current location. The default value is 30 meters.
|
||||
-- @param DCS#Time Seconds Optional parameter that lets the escort orbit at the current position for a specified time. (not implemented yet). The default value is 0 seconds, meaning, that the escort will orbit forever until a sequent command is given.
|
||||
-- @param #string MenuTextFormat Optional parameter that shows the menu option text. The text string is formatted, and should contain one or two %d tokens in the string. The first for the Height, the second for the Time (if given). If no text is given, the default text will be displayed.
|
||||
-- @return #ESCORT
|
||||
-- @return #ESCORT self
|
||||
function ESCORT:MenuScanForTargets( Height, Seconds, MenuTextFormat )
|
||||
self:F( { Height, Seconds, MenuTextFormat } )
|
||||
--self:F( { Height, Seconds, MenuTextFormat } )
|
||||
|
||||
if self.EscortGroup:IsAir() then
|
||||
if not self.EscortMenuScan then
|
||||
@@ -508,16 +502,14 @@ function ESCORT:MenuScanForTargets( Height, Seconds, MenuTextFormat )
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
|
||||
--- Defines a menu slot to let the escort disperse a flare in a certain color.
|
||||
-- This menu will appear under **Navigation**.
|
||||
-- The flare will be fired from the first unit in the group.
|
||||
-- @param #ESCORT self
|
||||
-- @param #string MenuTextFormat Optional parameter that shows the menu option text. If no text is given, the default text will be displayed.
|
||||
-- @return #ESCORT
|
||||
-- @return #ESCORT self
|
||||
function ESCORT:MenuFlare( MenuTextFormat )
|
||||
self:F()
|
||||
----self:F()
|
||||
|
||||
if not self.EscortMenuReportNavigation then
|
||||
self.EscortMenuReportNavigation = MENU_GROUP:New( self.EscortClient:GetGroup(), "Navigation", self.EscortMenu )
|
||||
@@ -547,9 +539,9 @@ end
|
||||
-- The smoke will be fired from the first unit in the group.
|
||||
-- @param #ESCORT self
|
||||
-- @param #string MenuTextFormat Optional parameter that shows the menu option text. If no text is given, the default text will be displayed.
|
||||
-- @return #ESCORT
|
||||
-- @return #ESCORT self
|
||||
function ESCORT:MenuSmoke( MenuTextFormat )
|
||||
self:F()
|
||||
----self:F()
|
||||
|
||||
if not self.EscortGroup:IsAir() then
|
||||
if not self.EscortMenuReportNavigation then
|
||||
@@ -581,9 +573,9 @@ end
|
||||
-- Note that if a report targets menu is not specified, no targets will be detected by the escort, and the attack and assisted attack menus will not be displayed.
|
||||
-- @param #ESCORT self
|
||||
-- @param DCS#Time Seconds Optional parameter that lets the escort report their current detected targets after specified time interval in seconds. The default time is 30 seconds.
|
||||
-- @return #ESCORT
|
||||
-- @return #ESCORT self
|
||||
function ESCORT:MenuReportTargets( Seconds )
|
||||
self:F( { Seconds } )
|
||||
--self:F( { Seconds } )
|
||||
|
||||
if not self.EscortMenuReportNearbyTargets then
|
||||
self.EscortMenuReportNearbyTargets = MENU_GROUP:New( self.EscortClient:GetGroup(), "Report targets", self.EscortMenu )
|
||||
@@ -601,7 +593,6 @@ function ESCORT:MenuReportTargets( Seconds )
|
||||
-- Attack Targets
|
||||
self.EscortMenuAttackNearbyTargets = MENU_GROUP:New( self.EscortClient:GetGroup(), "Attack targets", self.EscortMenu )
|
||||
|
||||
|
||||
self.ReportTargetsScheduler, self.ReportTargetsSchedulerID = SCHEDULER:New( self, self._ReportTargetsScheduler, {}, 1, Seconds )
|
||||
|
||||
return self
|
||||
@@ -611,9 +602,9 @@ end
|
||||
-- This menu will appear under **Request assistance from**.
|
||||
-- Note that this method needs to be preceded with the method MenuReportTargets.
|
||||
-- @param #ESCORT self
|
||||
-- @return #ESCORT
|
||||
-- @return #ESCORT self
|
||||
function ESCORT:MenuAssistedAttack()
|
||||
self:F()
|
||||
--self:F()
|
||||
|
||||
-- Request assistance from other escorts.
|
||||
-- This is very useful to let f.e. an escorting ship attack a target detected by an escorting plane...
|
||||
@@ -625,9 +616,9 @@ end
|
||||
--- Defines a menu to let the escort set its rules of engagement.
|
||||
-- All rules of engagement will appear under the menu **ROE**.
|
||||
-- @param #ESCORT self
|
||||
-- @return #ESCORT
|
||||
-- @return #ESCORT self
|
||||
function ESCORT:MenuROE( MenuTextFormat )
|
||||
self:F( MenuTextFormat )
|
||||
--self:F( MenuTextFormat )
|
||||
|
||||
if not self.EscortMenuROE then
|
||||
-- Rules of Engagement
|
||||
@@ -649,13 +640,12 @@ function ESCORT:MenuROE( MenuTextFormat )
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Defines a menu to let the escort set its evasion when under threat.
|
||||
-- All rules of engagement will appear under the menu **Evasion**.
|
||||
-- @param #ESCORT self
|
||||
-- @return #ESCORT
|
||||
-- @return #ESCORT self
|
||||
function ESCORT:MenuEvasion( MenuTextFormat )
|
||||
self:F( MenuTextFormat )
|
||||
--self:F( MenuTextFormat )
|
||||
|
||||
if self.EscortGroup:IsAir() then
|
||||
if not self.EscortMenuEvasion then
|
||||
@@ -682,9 +672,9 @@ end
|
||||
--- Defines a menu to let the escort resume its mission from a waypoint on its route.
|
||||
-- All rules of engagement will appear under the menu **Resume mission from**.
|
||||
-- @param #ESCORT self
|
||||
-- @return #ESCORT
|
||||
-- @return #ESCORT self
|
||||
function ESCORT:MenuResumeMission()
|
||||
self:F()
|
||||
--self:F()
|
||||
|
||||
if not self.EscortMenuResumeMission then
|
||||
-- Mission Resume Menu Root
|
||||
@@ -694,7 +684,8 @@ function ESCORT:MenuResumeMission()
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- @param #ESCORT self
|
||||
-- @param #MENUPARAM MenuParam
|
||||
function ESCORT:_HoldPosition( OrbitGroup, OrbitHeight, OrbitSeconds )
|
||||
|
||||
@@ -735,6 +726,8 @@ function ESCORT:_HoldPosition( OrbitGroup, OrbitHeight, OrbitSeconds )
|
||||
|
||||
end
|
||||
|
||||
---
|
||||
-- @param #ESCORT self
|
||||
-- @param #MENUPARAM MenuParam
|
||||
function ESCORT:_JoinUpAndFollow( Distance )
|
||||
|
||||
@@ -752,7 +745,7 @@ end
|
||||
-- @param Wrapper.Client#CLIENT EscortClient
|
||||
-- @param DCS#Distance Distance
|
||||
function ESCORT:JoinUpAndFollow( EscortGroup, EscortClient, Distance )
|
||||
self:F( { EscortGroup, EscortClient, Distance } )
|
||||
--self:F( { EscortGroup, EscortClient, Distance } )
|
||||
|
||||
self.FollowScheduler:Stop( self.FollowSchedule )
|
||||
|
||||
@@ -768,6 +761,8 @@ function ESCORT:JoinUpAndFollow( EscortGroup, EscortClient, Distance )
|
||||
EscortGroup:MessageToClient( "Rejoining and Following at " .. Distance .. "!", 30, EscortClient )
|
||||
end
|
||||
|
||||
---
|
||||
-- @param #ESCORT self
|
||||
-- @param #MENUPARAM MenuParam
|
||||
function ESCORT:_Flare( Color, Message )
|
||||
|
||||
@@ -778,6 +773,8 @@ function ESCORT:_Flare( Color, Message )
|
||||
EscortGroup:MessageToClient( Message, 10, EscortClient )
|
||||
end
|
||||
|
||||
---
|
||||
-- @param #ESCORT self
|
||||
-- @param #MENUPARAM MenuParam
|
||||
function ESCORT:_Smoke( Color, Message )
|
||||
|
||||
@@ -788,7 +785,8 @@ function ESCORT:_Smoke( Color, Message )
|
||||
EscortGroup:MessageToClient( Message, 10, EscortClient )
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- @param #ESCORT self
|
||||
-- @param #MENUPARAM MenuParam
|
||||
function ESCORT:_ReportNearbyTargetsNow()
|
||||
|
||||
@@ -799,6 +797,8 @@ function ESCORT:_ReportNearbyTargetsNow()
|
||||
|
||||
end
|
||||
|
||||
---
|
||||
-- @param #ESCORT self
|
||||
function ESCORT:_SwitchReportNearbyTargets( ReportTargets )
|
||||
|
||||
local EscortGroup = self.EscortGroup
|
||||
@@ -816,6 +816,8 @@ function ESCORT:_SwitchReportNearbyTargets( ReportTargets )
|
||||
end
|
||||
end
|
||||
|
||||
---
|
||||
-- @param #ESCORT self
|
||||
-- @param #MENUPARAM MenuParam
|
||||
function ESCORT:_ScanTargets( ScanDuration )
|
||||
|
||||
@@ -846,24 +848,27 @@ function ESCORT:_ScanTargets( ScanDuration )
|
||||
|
||||
end
|
||||
|
||||
---
|
||||
-- @param #ESCORT self
|
||||
-- @param Wrapper.Group#GROUP EscortGroup
|
||||
function _Resume( EscortGroup )
|
||||
env.info( '_Resume' )
|
||||
--env.info( '_Resume' )
|
||||
|
||||
local Escort = EscortGroup:GetState( EscortGroup, "Escort" )
|
||||
env.info( "EscortMode = " .. Escort.EscortMode )
|
||||
--env.info( "EscortMode = " .. Escort.EscortMode )
|
||||
if Escort.EscortMode == ESCORT.MODE.FOLLOW then
|
||||
Escort:JoinUpAndFollow( EscortGroup, Escort.EscortClient, Escort.Distance )
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
---
|
||||
-- @param #ESCORT self
|
||||
-- @param Functional.Detection#DETECTION_BASE.DetectedItem DetectedItem
|
||||
function ESCORT:_AttackTarget( DetectedItem )
|
||||
|
||||
local EscortGroup = self.EscortGroup -- Wrapper.Group#GROUP
|
||||
self:F( EscortGroup )
|
||||
--self:F( EscortGroup )
|
||||
|
||||
local EscortClient = self.EscortClient
|
||||
|
||||
@@ -983,6 +988,8 @@ function ESCORT:_AssistTarget( EscortGroupAttack, DetectedItem )
|
||||
|
||||
end
|
||||
|
||||
---
|
||||
-- @param #ESCORT self
|
||||
-- @param #MENUPARAM MenuParam
|
||||
function ESCORT:_ROE( EscortROEFunction, EscortROEMessage )
|
||||
|
||||
@@ -993,6 +1000,8 @@ function ESCORT:_ROE( EscortROEFunction, EscortROEMessage )
|
||||
EscortGroup:MessageToClient( EscortROEMessage, 10, EscortClient )
|
||||
end
|
||||
|
||||
---
|
||||
-- @param #ESCORT self
|
||||
-- @param #MENUPARAM MenuParam
|
||||
function ESCORT:_ROT( EscortROTFunction, EscortROTMessage )
|
||||
|
||||
@@ -1003,6 +1012,8 @@ function ESCORT:_ROT( EscortROTFunction, EscortROTMessage )
|
||||
EscortGroup:MessageToClient( EscortROTMessage, 10, EscortClient )
|
||||
end
|
||||
|
||||
---
|
||||
-- @param #ESCORT self
|
||||
-- @param #MENUPARAM MenuParam
|
||||
function ESCORT:_ResumeMission( WayPoint )
|
||||
|
||||
@@ -1027,7 +1038,7 @@ end
|
||||
-- @param #ESCORT self
|
||||
-- @return #table
|
||||
function ESCORT:RegisterRoute()
|
||||
self:F()
|
||||
--self:F()
|
||||
|
||||
local EscortGroup = self.EscortGroup -- Wrapper.Group#GROUP
|
||||
|
||||
@@ -1038,9 +1049,11 @@ function ESCORT:RegisterRoute()
|
||||
return TaskPoints
|
||||
end
|
||||
|
||||
---
|
||||
-- @param #ESCORT self
|
||||
-- @param Functional.Escort#ESCORT self
|
||||
function ESCORT:_FollowScheduler()
|
||||
self:F( { self.FollowDistance } )
|
||||
--self:F( { self.FollowDistance } )
|
||||
|
||||
self:T( {self.EscortClient.UnitName, self.EscortGroup.GroupName } )
|
||||
if self.EscortGroup:IsAlive() and self.EscortClient:IsAlive() then
|
||||
@@ -1146,11 +1159,10 @@ function ESCORT:_FollowScheduler()
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
--- Report Targets Scheduler.
|
||||
-- @param #ESCORT self
|
||||
function ESCORT:_ReportTargetsScheduler()
|
||||
self:F( self.EscortGroup:GetName() )
|
||||
--self:F( self.EscortGroup:GetName() )
|
||||
|
||||
if self.EscortGroup:IsAlive() and self.EscortClient:IsAlive() then
|
||||
|
||||
@@ -1163,7 +1175,7 @@ function ESCORT:_ReportTargetsScheduler()
|
||||
end
|
||||
|
||||
local DetectedItems = self.Detection:GetDetectedItems()
|
||||
self:F( DetectedItems )
|
||||
--self:F( DetectedItems )
|
||||
|
||||
local DetectedTargets = false
|
||||
|
||||
@@ -1175,7 +1187,7 @@ function ESCORT:_ReportTargetsScheduler()
|
||||
--local EscortUnit = EscortGroupData:GetUnit( 1 )
|
||||
|
||||
for DetectedItemIndex, DetectedItem in pairs( DetectedItems ) do
|
||||
self:F( { DetectedItemIndex, DetectedItem } )
|
||||
--self:F( { DetectedItemIndex, DetectedItem } )
|
||||
-- Remove the sub menus of the Attack menu of the Escort for the EscortGroup.
|
||||
|
||||
local DetectedItemReportSummary = self.Detection:DetectedItemReportSummary( DetectedItem, EscortGroupData.EscortGroup, _DATABASE:GetPlayerSettings( self.EscortClient:GetPlayerName() ) )
|
||||
@@ -1216,7 +1228,7 @@ function ESCORT:_ReportTargetsScheduler()
|
||||
|
||||
end
|
||||
end
|
||||
self:F( DetectedMsgs )
|
||||
--self:F( DetectedMsgs )
|
||||
if DetectedTargets then
|
||||
self.EscortGroup:MessageToClient( "Reporting detected targets:\n" .. table.concat( DetectedMsgs, "\n" ), 20, self.EscortClient )
|
||||
else
|
||||
|
||||
@@ -4302,7 +4302,16 @@ function OPSGROUP:_UpdateTask(Task, Mission)
|
||||
Mission=Mission or self:GetMissionByTaskID(self.taskcurrent)
|
||||
|
||||
if Task.dcstask.id==AUFTRAG.SpecialTask.FORMATION then
|
||||
|
||||
|
||||
if Mission.Type == AUFTRAG.Type.RESCUEHELO then
|
||||
local param=Task.dcstask.params
|
||||
local followUnit=UNIT:FindByName(param.unitname)
|
||||
local helogroupname = self:GetGroup():GetName()
|
||||
Task.formation = RESCUEHELO:New(followUnit,helogroupname)
|
||||
-- Start formation FSM.
|
||||
Task.formation:Start()
|
||||
else
|
||||
|
||||
-- Set of group(s) to follow Mother.
|
||||
local followSet=SET_GROUP:New():AddGroup(self.group)
|
||||
|
||||
@@ -4324,7 +4333,9 @@ function OPSGROUP:_UpdateTask(Task, Mission)
|
||||
|
||||
-- Start formation FSM.
|
||||
Task.formation:Start()
|
||||
|
||||
|
||||
end
|
||||
|
||||
elseif Task.dcstask.id==AUFTRAG.SpecialTask.PATROLZONE then
|
||||
|
||||
---
|
||||
|
||||
@@ -870,15 +870,24 @@ function RESCUEHELO:onafterStart(From, Event, To)
|
||||
|
||||
-- Delay before formation is started.
|
||||
local delay=120
|
||||
|
||||
-- Spawn helo. We need to introduce an alias in case this class is used twice. This would confuse the spawn routine.
|
||||
local Spawn=SPAWN:NewWithAlias(self.helogroupname, self.alias)
|
||||
|
||||
-- Set modex for spawn.
|
||||
Spawn:InitModex(self.modex)
|
||||
|
||||
local UsesAliveGroup=false
|
||||
local Spawn = GROUP:FindByName(self.helogroupname)
|
||||
if Spawn and Spawn:IsAlive() then
|
||||
self.helo=Spawn
|
||||
UsesAliveGroup = true
|
||||
else
|
||||
|
||||
-- Spawn helo. We need to introduce an alias in case this class is used twice. This would confuse the spawn routine.
|
||||
local Spawn=SPAWN:NewWithAlias(self.helogroupname, self.alias)
|
||||
|
||||
-- Set modex for spawn.
|
||||
Spawn:InitModex(self.modex)
|
||||
|
||||
end
|
||||
|
||||
-- Spawn in air or at airbase.
|
||||
if self.takeoff==SPAWN.Takeoff.Air then
|
||||
if UsesAliveGroup==false and self.takeoff==SPAWN.Takeoff.Air then
|
||||
|
||||
-- Carrier heading
|
||||
local hdg=self.carrier:GetHeading()
|
||||
@@ -898,7 +907,7 @@ function RESCUEHELO:onafterStart(From, Event, To)
|
||||
-- Start formation in 1 seconds
|
||||
delay=1
|
||||
|
||||
else
|
||||
elseif UsesAliveGroup==false then
|
||||
|
||||
-- Check if an uncontrolled helo group was requested.
|
||||
if self.uncontrolledac then
|
||||
|
||||
Reference in New Issue
Block a user