mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Fixed for A2G. Default parameters and proper amount of spawnings. Now also altitude is added for engage. And RTB has min and max speed set. Defaults of speed between 50% and 75% of maximum speed of group. And altitude defaults to 1000 and 1500 meters.
This commit is contained in:
parent
6c4bde4ceb
commit
e91a744bd9
@ -33,6 +33,8 @@ AI_A2G_BAI = {
|
|||||||
-- @param Wrapper.Group#GROUP AIGroup
|
-- @param Wrapper.Group#GROUP AIGroup
|
||||||
-- @param DCS#Speed EngageMinSpeed The minimum speed of the @{Wrapper.Group} in km/h when engaging a target.
|
-- @param DCS#Speed EngageMinSpeed The minimum speed of the @{Wrapper.Group} in km/h when engaging a target.
|
||||||
-- @param DCS#Speed EngageMaxSpeed The maximum speed of the @{Wrapper.Group} in km/h when engaging a target.
|
-- @param DCS#Speed EngageMaxSpeed The maximum speed of the @{Wrapper.Group} in km/h when engaging a target.
|
||||||
|
-- @param DCS#Altitude EngageFloorAltitude The lowest altitude in meters where to execute the engagement.
|
||||||
|
-- @param DCS#Altitude EngageCeilingAltitude The highest altitude in meters where to execute the engagement.
|
||||||
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
|
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
|
||||||
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
||||||
@ -40,10 +42,10 @@ AI_A2G_BAI = {
|
|||||||
-- @param DCS#Speed PatrolMaxSpeed The maximum speed of the @{Wrapper.Group} in km/h.
|
-- @param DCS#Speed PatrolMaxSpeed The maximum speed of the @{Wrapper.Group} in km/h.
|
||||||
-- @param DCS#AltitudeType PatrolAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to RADIO
|
-- @param DCS#AltitudeType PatrolAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to RADIO
|
||||||
-- @return #AI_A2G_BAI
|
-- @return #AI_A2G_BAI
|
||||||
function AI_A2G_BAI:New( AIGroup, EngageMinSpeed, EngageMaxSpeed, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
|
function AI_A2G_BAI:New( AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
|
||||||
|
|
||||||
-- Inherits from BASE
|
-- Inherits from BASE
|
||||||
local self = BASE:Inherit( self, AI_A2G_PATROL:New( AIGroup, EngageMinSpeed, EngageMaxSpeed, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType ) ) -- #AI_A2G_BAI
|
local self = BASE:Inherit( self, AI_A2G_PATROL:New( AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType ) ) -- #AI_A2G_BAI
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@ -72,8 +74,11 @@ function AI_A2G_BAI:onafterEngage( DefenderGroup, From, Event, To, AttackSetUnit
|
|||||||
-- If it is less than 10km, then attack without a route.
|
-- If it is less than 10km, then attack without a route.
|
||||||
-- Otherwise perform a route attack.
|
-- Otherwise perform a route attack.
|
||||||
|
|
||||||
local DefenderCoord = DefenderGroup:GetCoordinate()
|
local DefenderCoord = DefenderGroup:GetPointVec3()
|
||||||
local TargetCoord = self.AttackSetUnit:GetFirst():GetCoordinate()
|
DefenderCoord:SetY( math.random( self.EngageFloorAltitude, self.EngageCeilingAltitude ) ) -- Ground targets don't have an altitude.
|
||||||
|
|
||||||
|
local TargetCoord = self.AttackSetUnit:GetFirst():GetPointVec3()
|
||||||
|
TargetCoord:SetY( math.random( self.EngageFloorAltitude, self.EngageCeilingAltitude ) ) -- Ground targets don't have an altitude.
|
||||||
|
|
||||||
local TargetDistance = DefenderCoord:Get2DDistance( TargetCoord )
|
local TargetDistance = DefenderCoord:Get2DDistance( TargetCoord )
|
||||||
|
|
||||||
@ -84,7 +89,7 @@ function AI_A2G_BAI:onafterEngage( DefenderGroup, From, Event, To, AttackSetUnit
|
|||||||
--- Calculate the target route point.
|
--- Calculate the target route point.
|
||||||
|
|
||||||
local FromWP = DefenderCoord:WaypointAir(
|
local FromWP = DefenderCoord:WaypointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType or "RADIO",
|
||||||
POINT_VEC3.RoutePointType.TurningPoint,
|
POINT_VEC3.RoutePointType.TurningPoint,
|
||||||
POINT_VEC3.RoutePointAction.TurningPoint,
|
POINT_VEC3.RoutePointAction.TurningPoint,
|
||||||
ToTargetSpeed,
|
ToTargetSpeed,
|
||||||
@ -100,7 +105,7 @@ function AI_A2G_BAI:onafterEngage( DefenderGroup, From, Event, To, AttackSetUnit
|
|||||||
|
|
||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
local ToWP = ToCoord:Translate( 10000, FromEngageAngle ):WaypointAir(
|
local ToWP = ToCoord:Translate( 10000, FromEngageAngle ):WaypointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType or "RADIO",
|
||||||
POINT_VEC3.RoutePointType.TurningPoint,
|
POINT_VEC3.RoutePointType.TurningPoint,
|
||||||
POINT_VEC3.RoutePointAction.TurningPoint,
|
POINT_VEC3.RoutePointAction.TurningPoint,
|
||||||
ToTargetSpeed,
|
ToTargetSpeed,
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
|
|
||||||
--- @type AI_A2G_CAS
|
--- @type AI_A2G_CAS
|
||||||
-- @extends AI.AI_A2G_Engage#AI_A2G_Engage
|
-- @extends AI.AI_A2G_Patrol#AI_A2G_PATROL
|
||||||
|
|
||||||
|
|
||||||
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
|
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
|
||||||
@ -33,6 +33,8 @@ AI_A2G_CAS = {
|
|||||||
-- @param Wrapper.Group#GROUP AIGroup
|
-- @param Wrapper.Group#GROUP AIGroup
|
||||||
-- @param DCS#Speed EngageMinSpeed The minimum speed of the @{Wrapper.Group} in km/h when engaging a target.
|
-- @param DCS#Speed EngageMinSpeed The minimum speed of the @{Wrapper.Group} in km/h when engaging a target.
|
||||||
-- @param DCS#Speed EngageMaxSpeed The maximum speed of the @{Wrapper.Group} in km/h when engaging a target.
|
-- @param DCS#Speed EngageMaxSpeed The maximum speed of the @{Wrapper.Group} in km/h when engaging a target.
|
||||||
|
-- @param DCS#Altitude EngageFloorAltitude The lowest altitude in meters where to execute the engagement.
|
||||||
|
-- @param DCS#Altitude EngageCeilingAltitude The highest altitude in meters where to execute the engagement.
|
||||||
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
|
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
|
||||||
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
||||||
@ -40,10 +42,14 @@ AI_A2G_CAS = {
|
|||||||
-- @param DCS#Speed PatrolMaxSpeed The maximum speed of the @{Wrapper.Group} in km/h.
|
-- @param DCS#Speed PatrolMaxSpeed The maximum speed of the @{Wrapper.Group} in km/h.
|
||||||
-- @param DCS#AltitudeType PatrolAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to RADIO
|
-- @param DCS#AltitudeType PatrolAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to RADIO
|
||||||
-- @return #AI_A2G_CAS
|
-- @return #AI_A2G_CAS
|
||||||
function AI_A2G_CAS:New( AIGroup, EngageMinSpeed, EngageMaxSpeed, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
|
function AI_A2G_CAS:New( AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
|
||||||
|
|
||||||
-- Inherits from BASE
|
-- Inherits from BASE
|
||||||
local self = BASE:Inherit( self, AI_A2G_PATROL:New( AIGroup, EngageMinSpeed, EngageMaxSpeed, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType ) ) -- #AI_A2G_CAS
|
local self = BASE:Inherit( self, AI_A2G_PATROL:New( AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType ) ) -- #AI_A2G_CAS
|
||||||
|
|
||||||
|
local RTBSpeedMax = AIGroup:GetSpeedMax()
|
||||||
|
|
||||||
|
self:SetRTBSpeed( RTBSpeedMax * 0.50, RTBSpeedMax * 0.75 )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@ -72,8 +78,11 @@ function AI_A2G_CAS:onafterEngage( DefenderGroup, From, Event, To, AttackSetUnit
|
|||||||
-- If it is less than 10km, then attack without a route.
|
-- If it is less than 10km, then attack without a route.
|
||||||
-- Otherwise perform a route attack.
|
-- Otherwise perform a route attack.
|
||||||
|
|
||||||
local DefenderCoord = DefenderGroup:GetCoordinate()
|
local DefenderCoord = DefenderGroup:GetPointVec3()
|
||||||
local TargetCoord = self.AttackSetUnit:GetFirst():GetCoordinate()
|
DefenderCoord:SetY( math.random( self.EngageFloorAltitude, self.EngageCeilingAltitude ) ) -- Ground targets don't have an altitude.
|
||||||
|
|
||||||
|
local TargetCoord = self.AttackSetUnit:GetFirst():GetPointVec3()
|
||||||
|
TargetCoord:SetY( math.random( self.EngageFloorAltitude, self.EngageCeilingAltitude ) ) -- Ground targets don't have an altitude.
|
||||||
|
|
||||||
local TargetDistance = DefenderCoord:Get2DDistance( TargetCoord )
|
local TargetDistance = DefenderCoord:Get2DDistance( TargetCoord )
|
||||||
|
|
||||||
@ -84,7 +93,7 @@ function AI_A2G_CAS:onafterEngage( DefenderGroup, From, Event, To, AttackSetUnit
|
|||||||
--- Calculate the target route point.
|
--- Calculate the target route point.
|
||||||
|
|
||||||
local FromWP = DefenderCoord:WaypointAir(
|
local FromWP = DefenderCoord:WaypointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType or "RADIO",
|
||||||
POINT_VEC3.RoutePointType.TurningPoint,
|
POINT_VEC3.RoutePointType.TurningPoint,
|
||||||
POINT_VEC3.RoutePointAction.TurningPoint,
|
POINT_VEC3.RoutePointAction.TurningPoint,
|
||||||
ToTargetSpeed,
|
ToTargetSpeed,
|
||||||
@ -93,16 +102,15 @@ function AI_A2G_CAS:onafterEngage( DefenderGroup, From, Event, To, AttackSetUnit
|
|||||||
|
|
||||||
EngageRoute[#EngageRoute+1] = FromWP
|
EngageRoute[#EngageRoute+1] = FromWP
|
||||||
|
|
||||||
local ToCoord = self.AttackSetUnit:GetFirst():GetCoordinate()
|
self:SetTargetDistance( TargetCoord ) -- For RTB status check
|
||||||
self:SetTargetDistance( ToCoord ) -- For RTB status check
|
|
||||||
|
|
||||||
local FromEngageAngle = ToCoord:GetAngleDegrees( ToCoord:GetDirectionVec3( DefenderCoord ) )
|
local FromEngageAngle = TargetCoord:GetAngleDegrees( TargetCoord:GetDirectionVec3( DefenderCoord ) )
|
||||||
|
|
||||||
local EngageDistance = ( DefenderGroup:IsHelicopter() and 5000 ) or ( DefenderGroup:IsAirPlane() and 10000 )
|
local EngageDistance = ( DefenderGroup:IsHelicopter() and 5000 ) or ( DefenderGroup:IsAirPlane() and 10000 )
|
||||||
|
|
||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
local ToWP = ToCoord:Translate( EngageDistance, FromEngageAngle ):WaypointAir(
|
local ToWP = TargetCoord:Translate( EngageDistance, FromEngageAngle ):WaypointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType or "RADIO",
|
||||||
POINT_VEC3.RoutePointType.TurningPoint,
|
POINT_VEC3.RoutePointType.TurningPoint,
|
||||||
POINT_VEC3.RoutePointAction.TurningPoint,
|
POINT_VEC3.RoutePointAction.TurningPoint,
|
||||||
ToTargetSpeed,
|
ToTargetSpeed,
|
||||||
|
|||||||
@ -1656,8 +1656,10 @@ do -- AI_A2G_DISPATCHER
|
|||||||
---
|
---
|
||||||
-- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
-- @param #string SquadronName The squadron name.
|
-- @param #string SquadronName The squadron name.
|
||||||
-- @param #number EngageMinSpeed The minimum speed at which the SEAD task can be executed.
|
-- @param #number EngageMinSpeed (optional, default = 50% of max speed) The minimum speed at which the SEAD task can be executed.
|
||||||
-- @param #number EngageMaxSpeed The maximum speed at which the SEAD task can be executed.
|
-- @param #number EngageMaxSpeed (optional, default = 75% of max speed) The maximum speed at which the SEAD task can be executed.
|
||||||
|
-- @param DCS#Altitude EngageFloorAltitude (optional, default = 1000m ) The lowest altitude in meters where to execute the engagement.
|
||||||
|
-- @param DCS#Altitude EngageCeilingAltitude (optional, default = 1500m ) The highest altitude in meters where to execute the engagement.
|
||||||
-- @usage
|
-- @usage
|
||||||
--
|
--
|
||||||
-- -- SEAD Squadron execution.
|
-- -- SEAD Squadron execution.
|
||||||
@ -1666,7 +1668,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
-- A2GDispatcher:SetSquadronSead( "Maykop", 900, 1200 )
|
-- A2GDispatcher:SetSquadronSead( "Maykop", 900, 1200 )
|
||||||
--
|
--
|
||||||
-- @return #AI_A2G_DISPATCHER
|
-- @return #AI_A2G_DISPATCHER
|
||||||
function AI_A2G_DISPATCHER:SetSquadronSead( SquadronName, EngageMinSpeed, EngageMaxSpeed )
|
function AI_A2G_DISPATCHER:SetSquadronSead( SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude )
|
||||||
|
|
||||||
local DefenderSquadron = self:GetSquadron( SquadronName )
|
local DefenderSquadron = self:GetSquadron( SquadronName )
|
||||||
|
|
||||||
@ -1676,6 +1678,8 @@ do -- AI_A2G_DISPATCHER
|
|||||||
Sead.Name = SquadronName
|
Sead.Name = SquadronName
|
||||||
Sead.EngageMinSpeed = EngageMinSpeed
|
Sead.EngageMinSpeed = EngageMinSpeed
|
||||||
Sead.EngageMaxSpeed = EngageMaxSpeed
|
Sead.EngageMaxSpeed = EngageMaxSpeed
|
||||||
|
Sead.EngageFloorAltitude = EngageFloorAltitude
|
||||||
|
Sead.EngageCeilingAltitude = EngageCeilingAltitude
|
||||||
Sead.Defend = true
|
Sead.Defend = true
|
||||||
|
|
||||||
self:F( { Sead = Sead } )
|
self:F( { Sead = Sead } )
|
||||||
@ -1706,12 +1710,12 @@ do -- AI_A2G_DISPATCHER
|
|||||||
-- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
-- @param #string SquadronName The squadron name.
|
-- @param #string SquadronName The squadron name.
|
||||||
-- @param Core.Zone#ZONE_BASE Zone The @{Zone} object derived from @{Core.Zone#ZONE_BASE} that defines the zone wherein the Patrol will be executed.
|
-- @param Core.Zone#ZONE_BASE Zone The @{Zone} object derived from @{Core.Zone#ZONE_BASE} that defines the zone wherein the Patrol will be executed.
|
||||||
-- @param #number FloorAltitude The minimum altitude at which the cap can be executed.
|
-- @param #number FloorAltitude (optional, default = 1000m ) The minimum altitude at which the cap can be executed.
|
||||||
-- @param #number CeilingAltitude the maximum altitude at which the cap can be executed.
|
-- @param #number CeilingAltitude (optional, default = 1500m ) The maximum altitude at which the cap can be executed.
|
||||||
-- @param #number PatrolMinSpeed The minimum speed at which the cap can be executed.
|
-- @param #number PatrolMinSpeed (optional, default = 50% of max speed) The minimum speed at which the cap can be executed.
|
||||||
-- @param #number PatrolMaxSpeed The maximum speed at which the cap can be executed.
|
-- @param #number PatrolMaxSpeed (optional, default = 75% of max speed) The maximum speed at which the cap can be executed.
|
||||||
-- @param #number EngageMinSpeed The minimum speed at which the engage can be executed.
|
-- @param #number EngageMinSpeed (optional, default = 50% of max speed) The minimum speed at which the engage can be executed.
|
||||||
-- @param #number EngageMaxSpeed The maximum speed at which the engage can be executed.
|
-- @param #number EngageMaxSpeed (optional, default = 75% of max speed) The maximum speed at which the engage can be executed.
|
||||||
-- @param #number AltType The altitude type, which is a string "BARO" defining Barometric or "RADIO" defining radio controlled altitude.
|
-- @param #number AltType The altitude type, which is a string "BARO" defining Barometric or "RADIO" defining radio controlled altitude.
|
||||||
-- @return #AI_A2G_DISPATCHER
|
-- @return #AI_A2G_DISPATCHER
|
||||||
-- @usage
|
-- @usage
|
||||||
@ -1729,8 +1733,10 @@ do -- AI_A2G_DISPATCHER
|
|||||||
local SeadPatrol = DefenderSquadron.SEAD
|
local SeadPatrol = DefenderSquadron.SEAD
|
||||||
SeadPatrol.Name = SquadronName
|
SeadPatrol.Name = SquadronName
|
||||||
SeadPatrol.Zone = Zone
|
SeadPatrol.Zone = Zone
|
||||||
SeadPatrol.FloorAltitude = FloorAltitude
|
SeadPatrol.PatrolFloorAltitude = FloorAltitude
|
||||||
SeadPatrol.CeilingAltitude = CeilingAltitude
|
SeadPatrol.PatrolCeilingAltitude = CeilingAltitude
|
||||||
|
SeadPatrol.EngageFloorAltitude = FloorAltitude
|
||||||
|
SeadPatrol.EngageCeilingAltitude = CeilingAltitude
|
||||||
SeadPatrol.PatrolMinSpeed = PatrolMinSpeed
|
SeadPatrol.PatrolMinSpeed = PatrolMinSpeed
|
||||||
SeadPatrol.PatrolMaxSpeed = PatrolMaxSpeed
|
SeadPatrol.PatrolMaxSpeed = PatrolMaxSpeed
|
||||||
SeadPatrol.EngageMinSpeed = EngageMinSpeed
|
SeadPatrol.EngageMinSpeed = EngageMinSpeed
|
||||||
@ -1747,8 +1753,10 @@ do -- AI_A2G_DISPATCHER
|
|||||||
---
|
---
|
||||||
-- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
-- @param #string SquadronName The squadron name.
|
-- @param #string SquadronName The squadron name.
|
||||||
-- @param #number EngageMinSpeed The minimum speed at which the CAS task can be executed.
|
-- @param #number EngageMinSpeed (optional, default = 50% of max speed) The minimum speed at which the CAS task can be executed.
|
||||||
-- @param #number EngageMaxSpeed The maximum speed at which the CAS task can be executed.
|
-- @param #number EngageMaxSpeed (optional, default = 75% of max speed) The maximum speed at which the CAS task can be executed.
|
||||||
|
-- @param DCS#Altitude EngageFloorAltitude (optional, default = 1000m ) The lowest altitude in meters where to execute the engagement.
|
||||||
|
-- @param DCS#Altitude EngageCeilingAltitude (optional, default = 1500m ) The highest altitude in meters where to execute the engagement.
|
||||||
-- @usage
|
-- @usage
|
||||||
--
|
--
|
||||||
-- -- CAS Squadron execution.
|
-- -- CAS Squadron execution.
|
||||||
@ -1757,7 +1765,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
-- A2GDispatcher:SetSquadronCas( "Maykop", 900, 1200 )
|
-- A2GDispatcher:SetSquadronCas( "Maykop", 900, 1200 )
|
||||||
--
|
--
|
||||||
-- @return #AI_A2G_DISPATCHER
|
-- @return #AI_A2G_DISPATCHER
|
||||||
function AI_A2G_DISPATCHER:SetSquadronCas( SquadronName, EngageMinSpeed, EngageMaxSpeed )
|
function AI_A2G_DISPATCHER:SetSquadronCas( SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude )
|
||||||
|
|
||||||
local DefenderSquadron = self:GetSquadron( SquadronName )
|
local DefenderSquadron = self:GetSquadron( SquadronName )
|
||||||
|
|
||||||
@ -1767,6 +1775,8 @@ do -- AI_A2G_DISPATCHER
|
|||||||
Cas.Name = SquadronName
|
Cas.Name = SquadronName
|
||||||
Cas.EngageMinSpeed = EngageMinSpeed
|
Cas.EngageMinSpeed = EngageMinSpeed
|
||||||
Cas.EngageMaxSpeed = EngageMaxSpeed
|
Cas.EngageMaxSpeed = EngageMaxSpeed
|
||||||
|
Cas.EngageFloorAltitude = EngageFloorAltitude
|
||||||
|
Cas.EngageCeilingAltitude = EngageCeilingAltitude
|
||||||
Cas.Defend = true
|
Cas.Defend = true
|
||||||
|
|
||||||
self:F( { Cas = Cas } )
|
self:F( { Cas = Cas } )
|
||||||
@ -1798,12 +1808,12 @@ do -- AI_A2G_DISPATCHER
|
|||||||
-- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
-- @param #string SquadronName The squadron name.
|
-- @param #string SquadronName The squadron name.
|
||||||
-- @param Core.Zone#ZONE_BASE Zone The @{Zone} object derived from @{Core.Zone#ZONE_BASE} that defines the zone wherein the Patrol will be executed.
|
-- @param Core.Zone#ZONE_BASE Zone The @{Zone} object derived from @{Core.Zone#ZONE_BASE} that defines the zone wherein the Patrol will be executed.
|
||||||
-- @param #number FloorAltitude The minimum altitude at which the cap can be executed.
|
-- @param #number FloorAltitude (optional, default = 1000m ) The minimum altitude at which the cap can be executed.
|
||||||
-- @param #number CeilingAltitude the maximum altitude at which the cap can be executed.
|
-- @param #number CeilingAltitude (optional, default = 1500m ) The maximum altitude at which the cap can be executed.
|
||||||
-- @param #number PatrolMinSpeed The minimum speed at which the cap can be executed.
|
-- @param #number PatrolMinSpeed (optional, default = 50% of max speed) The minimum speed at which the cap can be executed.
|
||||||
-- @param #number PatrolMaxSpeed The maximum speed at which the cap can be executed.
|
-- @param #number PatrolMaxSpeed (optional, default = 75% of max speed) The maximum speed at which the cap can be executed.
|
||||||
-- @param #number EngageMinSpeed The minimum speed at which the engage can be executed.
|
-- @param #number EngageMinSpeed (optional, default = 50% of max speed) The minimum speed at which the engage can be executed.
|
||||||
-- @param #number EngageMaxSpeed The maximum speed at which the engage can be executed.
|
-- @param #number EngageMaxSpeed (optional, default = 75% of max speed) The maximum speed at which the engage can be executed.
|
||||||
-- @param #number AltType The altitude type, which is a string "BARO" defining Barometric or "RADIO" defining radio controlled altitude.
|
-- @param #number AltType The altitude type, which is a string "BARO" defining Barometric or "RADIO" defining radio controlled altitude.
|
||||||
-- @return #AI_A2G_DISPATCHER
|
-- @return #AI_A2G_DISPATCHER
|
||||||
-- @usage
|
-- @usage
|
||||||
@ -1821,8 +1831,10 @@ do -- AI_A2G_DISPATCHER
|
|||||||
local CasPatrol = DefenderSquadron.CAS
|
local CasPatrol = DefenderSquadron.CAS
|
||||||
CasPatrol.Name = SquadronName
|
CasPatrol.Name = SquadronName
|
||||||
CasPatrol.Zone = Zone
|
CasPatrol.Zone = Zone
|
||||||
CasPatrol.FloorAltitude = FloorAltitude
|
CasPatrol.PatrolFloorAltitude = FloorAltitude
|
||||||
CasPatrol.CeilingAltitude = CeilingAltitude
|
CasPatrol.PatrolCeilingAltitude = CeilingAltitude
|
||||||
|
CasPatrol.EngageFloorAltitude = FloorAltitude
|
||||||
|
CasPatrol.EngageCeilingAltitude = CeilingAltitude
|
||||||
CasPatrol.PatrolMinSpeed = PatrolMinSpeed
|
CasPatrol.PatrolMinSpeed = PatrolMinSpeed
|
||||||
CasPatrol.PatrolMaxSpeed = PatrolMaxSpeed
|
CasPatrol.PatrolMaxSpeed = PatrolMaxSpeed
|
||||||
CasPatrol.EngageMinSpeed = EngageMinSpeed
|
CasPatrol.EngageMinSpeed = EngageMinSpeed
|
||||||
@ -1839,8 +1851,10 @@ do -- AI_A2G_DISPATCHER
|
|||||||
---
|
---
|
||||||
-- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
-- @param #string SquadronName The squadron name.
|
-- @param #string SquadronName The squadron name.
|
||||||
-- @param #number EngageMinSpeed The minimum speed at which the BAI task can be executed.
|
-- @param #number EngageMinSpeed (optional, default = 50% of max speed) The minimum speed at which the BAI task can be executed.
|
||||||
-- @param #number EngageMaxSpeed The maximum speed at which the BAI task can be executed.
|
-- @param #number EngageMaxSpeed (optional, default = 75% of max speed) The maximum speed at which the BAI task can be executed.
|
||||||
|
-- @param DCS#Altitude EngageFloorAltitude (optional, default = 1000m ) The lowest altitude in meters where to execute the engagement.
|
||||||
|
-- @param DCS#Altitude EngageCeilingAltitude (optional, default = 1500m ) The highest altitude in meters where to execute the engagement.
|
||||||
-- @usage
|
-- @usage
|
||||||
--
|
--
|
||||||
-- -- BAI Squadron execution.
|
-- -- BAI Squadron execution.
|
||||||
@ -1849,7 +1863,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
-- A2GDispatcher:SetSquadronBai( "Maykop", 900, 1200 )
|
-- A2GDispatcher:SetSquadronBai( "Maykop", 900, 1200 )
|
||||||
--
|
--
|
||||||
-- @return #AI_A2G_DISPATCHER
|
-- @return #AI_A2G_DISPATCHER
|
||||||
function AI_A2G_DISPATCHER:SetSquadronBai( SquadronName, EngageMinSpeed, EngageMaxSpeed )
|
function AI_A2G_DISPATCHER:SetSquadronBai( SquadronName, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude )
|
||||||
|
|
||||||
local DefenderSquadron = self:GetSquadron( SquadronName )
|
local DefenderSquadron = self:GetSquadron( SquadronName )
|
||||||
|
|
||||||
@ -1859,6 +1873,8 @@ do -- AI_A2G_DISPATCHER
|
|||||||
Bai.Name = SquadronName
|
Bai.Name = SquadronName
|
||||||
Bai.EngageMinSpeed = EngageMinSpeed
|
Bai.EngageMinSpeed = EngageMinSpeed
|
||||||
Bai.EngageMaxSpeed = EngageMaxSpeed
|
Bai.EngageMaxSpeed = EngageMaxSpeed
|
||||||
|
Bai.EngageFloorAltitude = EngageFloorAltitude
|
||||||
|
Bai.EngageCeilingAltitude = EngageCeilingAltitude
|
||||||
Bai.Defend = true
|
Bai.Defend = true
|
||||||
|
|
||||||
self:F( { Bai = Bai } )
|
self:F( { Bai = Bai } )
|
||||||
@ -1888,12 +1904,12 @@ do -- AI_A2G_DISPATCHER
|
|||||||
-- @param #AI_A2G_DISPATCHER self
|
-- @param #AI_A2G_DISPATCHER self
|
||||||
-- @param #string SquadronName The squadron name.
|
-- @param #string SquadronName The squadron name.
|
||||||
-- @param Core.Zone#ZONE_BASE Zone The @{Zone} object derived from @{Core.Zone#ZONE_BASE} that defines the zone wherein the Patrol will be executed.
|
-- @param Core.Zone#ZONE_BASE Zone The @{Zone} object derived from @{Core.Zone#ZONE_BASE} that defines the zone wherein the Patrol will be executed.
|
||||||
-- @param #number FloorAltitude The minimum altitude at which the cap can be executed.
|
-- @param #number FloorAltitude (optional, default = 1000m ) The minimum altitude at which the cap can be executed.
|
||||||
-- @param #number CeilingAltitude the maximum altitude at which the cap can be executed.
|
-- @param #number CeilingAltitude (optional, default = 1500m ) The maximum altitude at which the cap can be executed.
|
||||||
-- @param #number PatrolMinSpeed The minimum speed at which the cap can be executed.
|
-- @param #number PatrolMinSpeed (optional, default = 50% of max speed) The minimum speed at which the cap can be executed.
|
||||||
-- @param #number PatrolMaxSpeed The maximum speed at which the cap can be executed.
|
-- @param #number PatrolMaxSpeed (optional, default = 75% of max speed) The maximum speed at which the cap can be executed.
|
||||||
-- @param #number EngageMinSpeed The minimum speed at which the engage can be executed.
|
-- @param #number EngageMinSpeed (optional, default = 50% of max speed) The minimum speed at which the engage can be executed.
|
||||||
-- @param #number EngageMaxSpeed The maximum speed at which the engage can be executed.
|
-- @param #number EngageMaxSpeed (optional, default = 75% of max speed) The maximum speed at which the engage can be executed.
|
||||||
-- @param #number AltType The altitude type, which is a string "BARO" defining Barometric or "RADIO" defining radio controlled altitude.
|
-- @param #number AltType The altitude type, which is a string "BARO" defining Barometric or "RADIO" defining radio controlled altitude.
|
||||||
-- @return #AI_A2G_DISPATCHER
|
-- @return #AI_A2G_DISPATCHER
|
||||||
-- @usage
|
-- @usage
|
||||||
@ -1911,8 +1927,10 @@ do -- AI_A2G_DISPATCHER
|
|||||||
local BaiPatrol = DefenderSquadron.BAI
|
local BaiPatrol = DefenderSquadron.BAI
|
||||||
BaiPatrol.Name = SquadronName
|
BaiPatrol.Name = SquadronName
|
||||||
BaiPatrol.Zone = Zone
|
BaiPatrol.Zone = Zone
|
||||||
BaiPatrol.FloorAltitude = FloorAltitude
|
BaiPatrol.PatrolFloorAltitude = FloorAltitude
|
||||||
BaiPatrol.CeilingAltitude = CeilingAltitude
|
BaiPatrol.PatrolCeilingAltitude = CeilingAltitude
|
||||||
|
BaiPatrol.EngageFloorAltitude = FloorAltitude
|
||||||
|
BaiPatrol.EngageCeilingAltitude = CeilingAltitude
|
||||||
BaiPatrol.PatrolMinSpeed = PatrolMinSpeed
|
BaiPatrol.PatrolMinSpeed = PatrolMinSpeed
|
||||||
BaiPatrol.PatrolMaxSpeed = PatrolMaxSpeed
|
BaiPatrol.PatrolMaxSpeed = PatrolMaxSpeed
|
||||||
BaiPatrol.EngageMinSpeed = EngageMinSpeed
|
BaiPatrol.EngageMinSpeed = EngageMinSpeed
|
||||||
@ -2761,7 +2779,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
-- Count the total of defenders on the battlefield.
|
-- Count the total of defenders on the battlefield.
|
||||||
--local DefenderSize = Defender:GetInitialSize()
|
--local DefenderSize = Defender:GetInitialSize()
|
||||||
if DefenderTask.Target then
|
if DefenderTask.Target then
|
||||||
if DefenderTask.Fsm:Is( "Engaging" ) then
|
--if DefenderTask.Fsm:Is( "Engaging" ) then
|
||||||
self:F( "Defender Group Name: " .. Defender:GetName() .. ", Size: " .. DefenderSize )
|
self:F( "Defender Group Name: " .. Defender:GetName() .. ", Size: " .. DefenderSize )
|
||||||
DefendersTotal = DefendersTotal + DefenderSize
|
DefendersTotal = DefendersTotal + DefenderSize
|
||||||
if DefenderTaskTarget and DefenderTaskTarget.Index == AttackerDetection.Index then
|
if DefenderTaskTarget and DefenderTaskTarget.Index == AttackerDetection.Index then
|
||||||
@ -2775,7 +2793,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
DefendersEngaged = 0
|
DefendersEngaged = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
--end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -2923,7 +2941,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
|
|
||||||
local AI_A2G_PATROL = { SEAD = AI_A2G_SEAD, BAI = AI_A2G_BAI, CAS = AI_A2G_CAS }
|
local AI_A2G_PATROL = { SEAD = AI_A2G_SEAD, BAI = AI_A2G_BAI, CAS = AI_A2G_CAS }
|
||||||
|
|
||||||
local Fsm = AI_A2G_PATROL[DefenseTaskType]:New( DefenderPatrol, Patrol.EngageMinSpeed, Patrol.EngageMaxSpeed, Patrol.Zone, Patrol.FloorAltitude, Patrol.CeilingAltitude, Patrol.PatrolMinSpeed, Patrol.PatrolMaxSpeed, Patrol.AltType )
|
local Fsm = AI_A2G_PATROL[DefenseTaskType]:New( DefenderPatrol, Patrol.EngageMinSpeed, Patrol.EngageMaxSpeed, Patrol.EngageFloorAltitude, Patrol.EngageCeilingAltitude, Patrol.Zone, Patrol.PatrolFloorAltitude, Patrol.PatrolCeilingAltitude, Patrol.PatrolMinSpeed, Patrol.PatrolMaxSpeed, Patrol.AltType )
|
||||||
Fsm:SetDispatcher( self )
|
Fsm:SetDispatcher( self )
|
||||||
Fsm:SetHomeAirbase( DefenderSquadron.Airbase )
|
Fsm:SetHomeAirbase( DefenderSquadron.Airbase )
|
||||||
Fsm:SetFuelThreshold( DefenderSquadron.FuelThreshold or self.DefenderDefault.FuelThreshold, 60 )
|
Fsm:SetFuelThreshold( DefenderSquadron.FuelThreshold or self.DefenderDefault.FuelThreshold, 60 )
|
||||||
@ -3115,7 +3133,7 @@ do -- AI_A2G_DISPATCHER
|
|||||||
|
|
||||||
local AI_A2G_ENGAGE = { SEAD = AI_A2G_SEAD, BAI = AI_A2G_BAI, CAS = AI_A2G_CAS }
|
local AI_A2G_ENGAGE = { SEAD = AI_A2G_SEAD, BAI = AI_A2G_BAI, CAS = AI_A2G_CAS }
|
||||||
|
|
||||||
local Fsm = AI_A2G_ENGAGE[DefenseTaskType]:New( DefenderGroup, Defense.EngageMinSpeed, Defense.EngageMaxSpeed ) -- AI.AI_A2G_ENGAGE
|
local Fsm = AI_A2G_ENGAGE[DefenseTaskType]:New( DefenderGroup, Defense.EngageMinSpeed, Defense.EngageMaxSpeed, Defense.EngageFloorAltitude, Defense.EngageCeilingAltitude ) -- AI.AI_A2G_ENGAGE
|
||||||
Fsm:SetDispatcher( self )
|
Fsm:SetDispatcher( self )
|
||||||
Fsm:SetHomeAirbase( DefenderSquadron.Airbase )
|
Fsm:SetHomeAirbase( DefenderSquadron.Airbase )
|
||||||
Fsm:SetFuelThreshold( DefenderSquadron.FuelThreshold or self.DefenderDefault.FuelThreshold, 60 )
|
Fsm:SetFuelThreshold( DefenderSquadron.FuelThreshold or self.DefenderDefault.FuelThreshold, 60 )
|
||||||
|
|||||||
@ -81,8 +81,12 @@ AI_A2G_ENGAGE = {
|
|||||||
--- Creates a new AI_A2G_ENGAGE object
|
--- Creates a new AI_A2G_ENGAGE object
|
||||||
-- @param #AI_A2G_ENGAGE self
|
-- @param #AI_A2G_ENGAGE self
|
||||||
-- @param Wrapper.Group#GROUP AIGroup
|
-- @param Wrapper.Group#GROUP AIGroup
|
||||||
|
-- @param DCS#Speed EngageMinSpeed (optional, default = 50% of max speed) The minimum speed of the @{Wrapper.Group} in km/h when engaging a target.
|
||||||
|
-- @param DCS#Speed EngageMaxSpeed (optional, default = 75% of max speed) The maximum speed of the @{Wrapper.Group} in km/h when engaging a target.
|
||||||
|
-- @param DCS#Altitude EngageFloorAltitude (optional, default = 1000m ) The lowest altitude in meters where to execute the engagement.
|
||||||
|
-- @param DCS#Altitude EngageCeilingAltitude (optional, default = 1500m ) The highest altitude in meters where to execute the engagement.
|
||||||
-- @return #AI_A2G_ENGAGE
|
-- @return #AI_A2G_ENGAGE
|
||||||
function AI_A2G_ENGAGE:New( AIGroup, EngageMinSpeed, EngageMaxSpeed )
|
function AI_A2G_ENGAGE:New( AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude )
|
||||||
|
|
||||||
-- Inherits from BASE
|
-- Inherits from BASE
|
||||||
local self = BASE:Inherit( self, AI_A2G:New( AIGroup ) ) -- #AI_A2G_ENGAGE
|
local self = BASE:Inherit( self, AI_A2G:New( AIGroup ) ) -- #AI_A2G_ENGAGE
|
||||||
@ -90,12 +94,12 @@ function AI_A2G_ENGAGE:New( AIGroup, EngageMinSpeed, EngageMaxSpeed )
|
|||||||
self.Accomplished = false
|
self.Accomplished = false
|
||||||
self.Engaging = false
|
self.Engaging = false
|
||||||
|
|
||||||
self.EngageMinSpeed = EngageMinSpeed
|
local SpeedMax = AIGroup:GetSpeedMax()
|
||||||
self.EngageMaxSpeed = EngageMaxSpeed
|
|
||||||
self.PatrolMinSpeed = EngageMinSpeed
|
|
||||||
self.PatrolMaxSpeed = EngageMaxSpeed
|
|
||||||
|
|
||||||
self.PatrolAltType = "RADIO"
|
self.EngageMinSpeed = EngageMinSpeed or SpeedMax * 0.5
|
||||||
|
self.EngageMaxSpeed = EngageMaxSpeed or SpeedMax * 0.75
|
||||||
|
self.EngageFloorAltitude = EngageFloorAltitude or 1000
|
||||||
|
self.EngageCeilingAltitude = EngageCeilingAltitude or 1500
|
||||||
|
|
||||||
self:AddTransition( { "Started", "Engaging", "Returning", "Airborne", "Patrolling" }, "Engage", "Engaging" ) -- FSM_CONTROLLABLE Transition for type #AI_A2G_ENGAGE.
|
self:AddTransition( { "Started", "Engaging", "Returning", "Airborne", "Patrolling" }, "Engage", "Engaging" ) -- FSM_CONTROLLABLE Transition for type #AI_A2G_ENGAGE.
|
||||||
|
|
||||||
|
|||||||
@ -99,26 +99,31 @@ AI_A2G_PATROL = {
|
|||||||
|
|
||||||
--- Creates a new AI_A2G_PATROL object
|
--- Creates a new AI_A2G_PATROL object
|
||||||
-- @param #AI_A2G_PATROL self
|
-- @param #AI_A2G_PATROL self
|
||||||
-- @param Wrapper.Group#GROUP AIPatrol
|
-- @param Wrapper.Group#GROUP AIGroup
|
||||||
-- @param DCS#Speed EngageMinSpeed The minimum speed of the @{Wrapper.Group} in km/h when engaging a target.
|
-- @param DCS#Speed EngageMinSpeed (optional, default = 50% of max speed) The minimum speed of the @{Wrapper.Group} in km/h when engaging a target.
|
||||||
-- @param DCS#Speed EngageMaxSpeed The maximum speed of the @{Wrapper.Group} in km/h when engaging a target.
|
-- @param DCS#Speed EngageMaxSpeed (optional, default = 75% of max speed) The maximum speed of the @{Wrapper.Group} in km/h when engaging a target.
|
||||||
|
-- @param DCS#Altitude EngageFloorAltitude (optional, default = 1000m ) The lowest altitude in meters where to execute the engagement.
|
||||||
|
-- @param DCS#Altitude EngageCeilingAltitude (optional, default = 1500m ) The highest altitude in meters where to execute the engagement.
|
||||||
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
|
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
|
||||||
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolFloorAltitude (optional, default = 1000m ) The lowest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolCeilingAltitude (optional, default = 1500m ) The highest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Group} in km/h.
|
-- @param DCS#Speed PatrolMinSpeed (optional, default = 50% of max speed) The minimum speed of the @{Wrapper.Group} in km/h.
|
||||||
-- @param DCS#Speed PatrolMaxSpeed The maximum speed of the @{Wrapper.Group} in km/h.
|
-- @param DCS#Speed PatrolMaxSpeed (optional, default = 75% of max speed) The maximum speed of the @{Wrapper.Group} in km/h.
|
||||||
-- @param DCS#AltitudeType PatrolAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to RADIO
|
-- @param DCS#AltitudeType PatrolAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to RADIO.
|
||||||
-- @return #AI_A2G_PATROL
|
-- @return #AI_A2G_PATROL
|
||||||
function AI_A2G_PATROL:New( AIPatrol, EngageMinSpeed, EngageMaxSpeed, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
|
function AI_A2G_PATROL:New( AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
|
||||||
|
|
||||||
-- Inherits from BASE
|
-- Inherits from BASE
|
||||||
local self = BASE:Inherit( self, AI_A2G_ENGAGE:New( AIPatrol, EngageMinSpeed, EngageMaxSpeed ) ) -- #AI_A2G_PATROL
|
local self = BASE:Inherit( self, AI_A2G_ENGAGE:New( AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude ) ) -- #AI_A2G_PATROL
|
||||||
|
|
||||||
|
local SpeedMax = AIGroup:GetSpeedMax()
|
||||||
|
|
||||||
self.PatrolZone = PatrolZone
|
self.PatrolZone = PatrolZone
|
||||||
self.PatrolFloorAltitude = PatrolFloorAltitude
|
|
||||||
self.PatrolCeilingAltitude = PatrolCeilingAltitude
|
self.PatrolFloorAltitude = PatrolFloorAltitude or 1000
|
||||||
self.PatrolMinSpeed = PatrolMinSpeed
|
self.PatrolCeilingAltitude = PatrolCeilingAltitude or 1500
|
||||||
self.PatrolMaxSpeed = PatrolMaxSpeed
|
self.PatrolMinSpeed = PatrolMinSpeed or SpeedMax * 0.5
|
||||||
|
self.PatrolMaxSpeed = PatrolMaxSpeed or SpeedMax * 0.75
|
||||||
|
|
||||||
-- defafult PatrolAltType to "RADIO" if not specified
|
-- defafult PatrolAltType to "RADIO" if not specified
|
||||||
self.PatrolAltType = PatrolAltType or "RADIO"
|
self.PatrolAltType = PatrolAltType or "RADIO"
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
|
|
||||||
--- @type AI_A2G_SEAD
|
--- @type AI_A2G_SEAD
|
||||||
-- @extends AI.AI_A2G_Engage#AI_A2G_Engage
|
-- @extends AI.AI_A2G_Patrol#AI_A2G_PATROL
|
||||||
|
|
||||||
|
|
||||||
--- Implements the core functions to SEAD intruders. Use the Engage trigger to intercept intruders.
|
--- Implements the core functions to SEAD intruders. Use the Engage trigger to intercept intruders.
|
||||||
@ -83,6 +83,8 @@ AI_A2G_SEAD = {
|
|||||||
-- @param Wrapper.Group#GROUP AIGroup
|
-- @param Wrapper.Group#GROUP AIGroup
|
||||||
-- @param DCS#Speed EngageMinSpeed The minimum speed of the @{Wrapper.Group} in km/h when engaging a target.
|
-- @param DCS#Speed EngageMinSpeed The minimum speed of the @{Wrapper.Group} in km/h when engaging a target.
|
||||||
-- @param DCS#Speed EngageMaxSpeed The maximum speed of the @{Wrapper.Group} in km/h when engaging a target.
|
-- @param DCS#Speed EngageMaxSpeed The maximum speed of the @{Wrapper.Group} in km/h when engaging a target.
|
||||||
|
-- @param DCS#Altitude EngageFloorAltitude The lowest altitude in meters where to execute the engagement.
|
||||||
|
-- @param DCS#Altitude EngageCeilingAltitude The highest altitude in meters where to execute the engagement.
|
||||||
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
|
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
|
||||||
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
||||||
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
||||||
@ -90,10 +92,10 @@ AI_A2G_SEAD = {
|
|||||||
-- @param DCS#Speed PatrolMaxSpeed The maximum speed of the @{Wrapper.Group} in km/h.
|
-- @param DCS#Speed PatrolMaxSpeed The maximum speed of the @{Wrapper.Group} in km/h.
|
||||||
-- @param DCS#AltitudeType PatrolAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to RADIO
|
-- @param DCS#AltitudeType PatrolAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to RADIO
|
||||||
-- @return #AI_A2G_SEAD
|
-- @return #AI_A2G_SEAD
|
||||||
function AI_A2G_SEAD:New( AIGroup, EngageMinSpeed, EngageMaxSpeed, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
|
function AI_A2G_SEAD:New( AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
|
||||||
|
|
||||||
-- Inherits from BASE
|
-- Inherits from BASE
|
||||||
local self = BASE:Inherit( self, AI_A2G_PATROL:New( AIGroup, EngageMinSpeed, EngageMaxSpeed, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType ) ) -- #AI_A2G_SEAD
|
local self = BASE:Inherit( self, AI_A2G_PATROL:New( AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType ) ) -- #AI_A2G_SEAD
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@ -123,8 +125,11 @@ function AI_A2G_SEAD:onafterEngage( DefenderGroup, From, Event, To, AttackSetUni
|
|||||||
-- If it is less than 50km, then attack without a route.
|
-- If it is less than 50km, then attack without a route.
|
||||||
-- Otherwise perform a route attack.
|
-- Otherwise perform a route attack.
|
||||||
|
|
||||||
local DefenderCoord = DefenderGroup:GetCoordinate()
|
local DefenderCoord = DefenderGroup:GetPointVec3()
|
||||||
local TargetCoord = self.AttackSetUnit:GetFirst():GetCoordinate()
|
DefenderCoord:SetY( math.random( self.EngageFloorAltitude, self.EngageCeilingAltitude ) ) -- Ground targets don't have an altitude.
|
||||||
|
|
||||||
|
local TargetCoord = self.AttackSetUnit:GetFirst():GetPointVec3()
|
||||||
|
TargetCoord:SetY( math.random( self.EngageFloorAltitude, self.EngageCeilingAltitude ) ) -- Ground targets don't have an altitude.
|
||||||
|
|
||||||
local TargetDistance = DefenderCoord:Get2DDistance( TargetCoord )
|
local TargetDistance = DefenderCoord:Get2DDistance( TargetCoord )
|
||||||
|
|
||||||
@ -137,7 +142,7 @@ function AI_A2G_SEAD:onafterEngage( DefenderGroup, From, Event, To, AttackSetUni
|
|||||||
--- Calculate the target route point.
|
--- Calculate the target route point.
|
||||||
|
|
||||||
local FromWP = DefenderCoord:WaypointAir(
|
local FromWP = DefenderCoord:WaypointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType or "RADIO",
|
||||||
POINT_VEC3.RoutePointType.TurningPoint,
|
POINT_VEC3.RoutePointType.TurningPoint,
|
||||||
POINT_VEC3.RoutePointAction.TurningPoint,
|
POINT_VEC3.RoutePointAction.TurningPoint,
|
||||||
ToTargetSpeed,
|
ToTargetSpeed,
|
||||||
@ -153,7 +158,7 @@ function AI_A2G_SEAD:onafterEngage( DefenderGroup, From, Event, To, AttackSetUni
|
|||||||
|
|
||||||
--- Create a route point of type air, 50km from the center of the attack point.
|
--- Create a route point of type air, 50km from the center of the attack point.
|
||||||
local ToWP = ToCoord:Translate( 50000, FromEngageAngle ):WaypointAir(
|
local ToWP = ToCoord:Translate( 50000, FromEngageAngle ):WaypointAir(
|
||||||
self.PatrolAltType,
|
self.PatrolAltType or "RADIO",
|
||||||
POINT_VEC3.RoutePointType.TurningPoint,
|
POINT_VEC3.RoutePointType.TurningPoint,
|
||||||
POINT_VEC3.RoutePointAction.TurningPoint,
|
POINT_VEC3.RoutePointAction.TurningPoint,
|
||||||
ToTargetSpeed,
|
ToTargetSpeed,
|
||||||
|
|||||||
@ -298,6 +298,19 @@ function AI_AIR:SetSpeed( PatrolMinSpeed, PatrolMaxSpeed )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Sets (modifies) the minimum and maximum RTB speed of the patrol.
|
||||||
|
-- @param #AI_AIR self
|
||||||
|
-- @param DCS#Speed RTBMinSpeed The minimum speed of the @{Wrapper.Controllable} in km/h.
|
||||||
|
-- @param DCS#Speed RTBMaxSpeed The maximum speed of the @{Wrapper.Controllable} in km/h.
|
||||||
|
-- @return #AI_AIR self
|
||||||
|
function AI_AIR:SetRTBSpeed( RTBMinSpeed, RTBMaxSpeed )
|
||||||
|
self:F2( { RTBMinSpeed, RTBMaxSpeed } )
|
||||||
|
|
||||||
|
self.RTBMinSpeed = RTBMinSpeed
|
||||||
|
self.RTBMaxSpeed = RTBMaxSpeed
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Sets the floor and ceiling altitude of the patrol.
|
--- Sets the floor and ceiling altitude of the patrol.
|
||||||
-- @param #AI_AIR self
|
-- @param #AI_AIR self
|
||||||
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
||||||
@ -511,7 +524,7 @@ function AI_AIR:onafterStatus()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if not self:Is("Home") then
|
if not self:Is("Home") then
|
||||||
self:__Status( 30 )
|
self:__Status( 10 )
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -562,7 +575,7 @@ function AI_AIR:onafterRTB( AIGroup, From, Event, To )
|
|||||||
|
|
||||||
local CurrentCoord = AIGroup:GetCoordinate()
|
local CurrentCoord = AIGroup:GetCoordinate()
|
||||||
local ToTargetCoord = self.HomeAirbase:GetCoordinate()
|
local ToTargetCoord = self.HomeAirbase:GetCoordinate()
|
||||||
local ToTargetSpeed = math.random( self.PatrolMinSpeed, self.PatrolMaxSpeed )
|
local ToTargetSpeed = math.random( self.RTBMinSpeed, self.RTBMaxSpeed )
|
||||||
local ToAirbaseAngle = CurrentCoord:GetAngleDegrees( CurrentCoord:GetDirectionVec3( ToTargetCoord ) )
|
local ToAirbaseAngle = CurrentCoord:GetAngleDegrees( CurrentCoord:GetDirectionVec3( ToTargetCoord ) )
|
||||||
|
|
||||||
local Distance = CurrentCoord:Get2DDistance( ToTargetCoord )
|
local Distance = CurrentCoord:Get2DDistance( ToTargetCoord )
|
||||||
@ -582,9 +595,6 @@ function AI_AIR:onafterRTB( AIGroup, From, Event, To )
|
|||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
self:F( { Angle = ToAirbaseAngle, ToTargetSpeed = ToTargetSpeed } )
|
|
||||||
self:T2( { self.MinSpeed, self.MaxSpeed, ToTargetSpeed } )
|
|
||||||
|
|
||||||
EngageRoute[#EngageRoute+1] = ToRTBRoutePoint
|
EngageRoute[#EngageRoute+1] = ToRTBRoutePoint
|
||||||
EngageRoute[#EngageRoute+1] = ToRTBRoutePoint
|
EngageRoute[#EngageRoute+1] = ToRTBRoutePoint
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user