Merge branch 'master' into develop

This commit is contained in:
Frank 2021-09-29 09:34:37 +02:00
commit b72e2b6bf9
14 changed files with 1493 additions and 1314 deletions

View File

@ -300,23 +300,23 @@ do -- Zones
for ZoneID, ZoneData in pairs(env.mission.triggers.zones) do for ZoneID, ZoneData in pairs(env.mission.triggers.zones) do
local ZoneName = ZoneData.name local ZoneName = ZoneData.name
-- Color -- Color
local color=ZoneData.color or {1, 0, 0, 0.15} local color=ZoneData.color or {1, 0, 0, 0.15}
-- Create new Zone -- Create new Zone
local Zone=nil --Core.Zone#ZONE_BASE local Zone=nil --Core.Zone#ZONE_BASE
if ZoneData.type==0 then if ZoneData.type==0 then
--- ---
-- Circular zone -- Circular zone
--- ---
self:I(string.format("Register ZONE: %s (Circular)", ZoneName)) self:I(string.format("Register ZONE: %s (Circular)", ZoneName))
Zone=ZONE:New(ZoneName) Zone=ZONE:New(ZoneName)
else else
--- ---
@ -324,51 +324,51 @@ do -- Zones
--- ---
self:I(string.format("Register ZONE: %s (Polygon, Quad)", ZoneName)) self:I(string.format("Register ZONE: %s (Polygon, Quad)", ZoneName))
Zone=ZONE_POLYGON_BASE:New(ZoneName, ZoneData.verticies) Zone=ZONE_POLYGON_BASE:New(ZoneName, ZoneData.verticies)
--for i,vec2 in pairs(ZoneData.verticies) do --for i,vec2 in pairs(ZoneData.verticies) do
-- local coord=COORDINATE:NewFromVec2(vec2) -- local coord=COORDINATE:NewFromVec2(vec2)
-- coord:MarkToAll(string.format("%s Point %d", ZoneName, i)) -- coord:MarkToAll(string.format("%s Point %d", ZoneName, i))
--end --end
end end
if Zone then if Zone then
-- Store color of zone. -- Store color of zone.
Zone.Color=color Zone.Color=color
-- Store in DB. -- Store in DB.
self.ZONENAMES[ZoneName] = ZoneName self.ZONENAMES[ZoneName] = ZoneName
-- Add zone. -- Add zone.
self:AddZone(ZoneName, Zone) self:AddZone(ZoneName, Zone)
end end
end end
-- Polygon zones defined by late activated groups. -- Polygon zones defined by late activated groups.
for ZoneGroupName, ZoneGroup in pairs( self.GROUPS ) do for ZoneGroupName, ZoneGroup in pairs( self.GROUPS ) do
if ZoneGroupName:match("#ZONE_POLYGON") then if ZoneGroupName:match("#ZONE_POLYGON") then
local ZoneName1 = ZoneGroupName:match("(.*)#ZONE_POLYGON") local ZoneName1 = ZoneGroupName:match("(.*)#ZONE_POLYGON")
local ZoneName2 = ZoneGroupName:match(".*#ZONE_POLYGON(.*)") local ZoneName2 = ZoneGroupName:match(".*#ZONE_POLYGON(.*)")
local ZoneName = ZoneName1 .. ( ZoneName2 or "" ) local ZoneName = ZoneName1 .. ( ZoneName2 or "" )
-- Debug output -- Debug output
self:I(string.format("Register ZONE: %s (Polygon)", ZoneName)) self:I(string.format("Register ZONE: %s (Polygon)", ZoneName))
-- Create a new polygon zone. -- Create a new polygon zone.
local Zone_Polygon = ZONE_POLYGON:New( ZoneName, ZoneGroup ) local Zone_Polygon = ZONE_POLYGON:New( ZoneName, ZoneGroup )
-- Set color. -- Set color.
Zone_Polygon:SetColor({1, 0, 0}, 0.15) Zone_Polygon:SetColor({1, 0, 0}, 0.15)
-- Store name in DB. -- Store name in DB.
self.ZONENAMES[ZoneName] = ZoneName self.ZONENAMES[ZoneName] = ZoneName
-- Add zone to DB. -- Add zone to DB.
self:AddZone( ZoneName, Zone_Polygon ) self:AddZone( ZoneName, Zone_Polygon )
end end

View File

@ -138,24 +138,24 @@ SPAWNSTATIC = {
-- @return #SPAWNSTATIC self -- @return #SPAWNSTATIC self
function SPAWNSTATIC:NewFromStatic(SpawnTemplateName, SpawnCountryID) function SPAWNSTATIC:NewFromStatic(SpawnTemplateName, SpawnCountryID)
local self = BASE:Inherit( self, BASE:New() ) -- #SPAWNSTATIC local self = BASE:Inherit( self, BASE:New() ) -- #SPAWNSTATIC
local TemplateStatic, CoalitionID, CategoryID, CountryID = _DATABASE:GetStaticGroupTemplate(SpawnTemplateName) local TemplateStatic, CoalitionID, CategoryID, CountryID = _DATABASE:GetStaticGroupTemplate(SpawnTemplateName)
if TemplateStatic then if TemplateStatic then
self.SpawnTemplatePrefix = SpawnTemplateName self.SpawnTemplatePrefix = SpawnTemplateName
self.TemplateStaticUnit = UTILS.DeepCopy(TemplateStatic.units[1]) self.TemplateStaticUnit = UTILS.DeepCopy(TemplateStatic.units[1])
self.CountryID = SpawnCountryID or CountryID self.CountryID = SpawnCountryID or CountryID
self.CategoryID = CategoryID self.CategoryID = CategoryID
self.CoalitionID = CoalitionID self.CoalitionID = CoalitionID
self.SpawnIndex = 0 self.SpawnIndex = 0
else else
error( "SPAWNSTATIC:New: There is no static declared in the mission editor with SpawnTemplatePrefix = '" .. tostring(SpawnTemplateName) .. "'" ) error( "SPAWNSTATIC:New: There is no static declared in the mission editor with SpawnTemplatePrefix = '" .. tostring(SpawnTemplateName) .. "'" )
end end
self:SetEventPriority( 5 ) self:SetEventPriority( 5 )
return self return self
end end
--- Creates the main object to spawn a @{Static} given a template table. --- Creates the main object to spawn a @{Static} given a template table.

View File

@ -498,8 +498,8 @@ end
-- --
-- @field #ZONE_RADIUS -- @field #ZONE_RADIUS
ZONE_RADIUS = { ZONE_RADIUS = {
ClassName="ZONE_RADIUS", ClassName="ZONE_RADIUS",
} }
--- Constructor of @{#ZONE_RADIUS}, taking the zone name, the zone location and a radius. --- Constructor of @{#ZONE_RADIUS}, taking the zone name, the zone location and a radius.
-- @param #ZONE_RADIUS self -- @param #ZONE_RADIUS self
@ -510,15 +510,15 @@ ZONE_RADIUS = {
function ZONE_RADIUS:New( ZoneName, Vec2, Radius ) function ZONE_RADIUS:New( ZoneName, Vec2, Radius )
-- Inherit ZONE_BASE. -- Inherit ZONE_BASE.
local self = BASE:Inherit( self, ZONE_BASE:New( ZoneName ) ) -- #ZONE_RADIUS local self = BASE:Inherit( self, ZONE_BASE:New( ZoneName ) ) -- #ZONE_RADIUS
self:F( { ZoneName, Vec2, Radius } ) self:F( { ZoneName, Vec2, Radius } )
self.Radius = Radius self.Radius = Radius
self.Vec2 = Vec2 self.Vec2 = Vec2
--self.Coordinate=COORDINATE:NewFromVec2(Vec2) --self.Coordinate=COORDINATE:NewFromVec2(Vec2)
return self return self
end end
--- Update zone from a 2D vector. --- Update zone from a 2D vector.
@ -746,11 +746,11 @@ end
-- @param #ZONE_RADIUS self -- @param #ZONE_RADIUS self
-- @return DCS#Vec2 The location of the zone. -- @return DCS#Vec2 The location of the zone.
function ZONE_RADIUS:GetVec2() function ZONE_RADIUS:GetVec2()
self:F2( self.ZoneName ) self:F2( self.ZoneName )
self:T2( { self.Vec2 } ) self:T2( { self.Vec2 } )
return self.Vec2 return self.Vec2
end end
--- Sets the @{DCS#Vec2} of the zone. --- Sets the @{DCS#Vec2} of the zone.
@ -1165,20 +1165,20 @@ end
-- @param #number outer (optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone. -- @param #number outer (optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone.
-- @return DCS#Vec2 The random location within the zone. -- @return DCS#Vec2 The random location within the zone.
function ZONE_RADIUS:GetRandomVec2( inner, outer ) function ZONE_RADIUS:GetRandomVec2( inner, outer )
self:F( self.ZoneName, inner, outer ) self:F( self.ZoneName, inner, outer )
local Point = {} local Point = {}
local Vec2 = self:GetVec2() local Vec2 = self:GetVec2()
local _inner = inner or 0 local _inner = inner or 0
local _outer = outer or self:GetRadius() local _outer = outer or self:GetRadius()
local angle = math.random() * math.pi * 2; local angle = math.random() * math.pi * 2;
Point.x = Vec2.x + math.cos( angle ) * math.random(_inner, _outer); Point.x = Vec2.x + math.cos( angle ) * math.random(_inner, _outer);
Point.y = Vec2.y + math.sin( angle ) * math.random(_inner, _outer); Point.y = Vec2.y + math.sin( angle ) * math.random(_inner, _outer);
self:T( { Point } ) self:T( { Point } )
return Point return Point
end end
--- Returns a @{Core.Point#POINT_VEC2} object reflecting a random 2D location within the zone. --- Returns a @{Core.Point#POINT_VEC2} object reflecting a random 2D location within the zone.

View File

@ -1,22 +1,22 @@
--- **Functional** -- Modular, Automatic and Network capable Targeting and Interception System for Air Defenses --- **Functional** -- Modular, Automatic and Network capable Targeting and Interception System for Air Defenses
-- --
-- === -- ===
-- --
-- **MANTIS** - Moose derived Modular, Automatic and Network capable Targeting and Interception System -- **MANTIS** - Moose derived Modular, Automatic and Network capable Targeting and Interception System
-- Controls a network of SAM sites. Use detection to switch on the AA site closest to the enemy -- Controls a network of SAM sites. Use detection to switch on the AA site closest to the enemy
-- Leverage evasiveness from SEAD -- Leverage evasiveness from SEAD
-- Leverage attack range setup added by DCS in 11/20 -- Leverage attack range setup added by DCS in 11/20
-- --
-- === -- ===
-- --
-- ## Missions: -- ## Missions:
-- --
-- ### [MANTIS - Modular, Automatic and Network capable Targeting and Interception System](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/MTS%20-%20Mantis/MTS-010%20-%20Basic%20Mantis%20Demo) -- ### [MANTIS - Modular, Automatic and Network capable Targeting and Interception System](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/MTS%20-%20Mantis/MTS-010%20-%20Basic%20Mantis%20Demo)
-- --
-- === -- ===
-- --
-- ### Author : **applevangelist ** -- ### Author : **applevangelist **
-- --
-- @module Functional.Mantis -- @module Functional.Mantis
-- @image Functional.Mantis.jpg -- @image Functional.Mantis.jpg
@ -59,10 +59,10 @@
-- @extends Core.Base#BASE -- @extends Core.Base#BASE
--- *The worst thing that can happen to a good cause is, not to be skillfully attacked, but to be ineptly defended.* - Frédéric Bastiat --- *The worst thing that can happen to a good cause is, not to be skillfully attacked, but to be ineptly defended.* - Frédéric Bastiat
-- --
-- Simple Class for a more intelligent Air Defense System -- Simple Class for a more intelligent Air Defense System
-- --
-- #MANTIS -- #MANTIS
-- Moose derived Modular, Automatic and Network capable Targeting and Interception System. -- Moose derived Modular, Automatic and Network capable Targeting and Interception System.
-- Controls a network of SAM sites. Use detection to switch on the AA site closest to the enemy. -- Controls a network of SAM sites. Use detection to switch on the AA site closest to the enemy.
@ -72,62 +72,62 @@
-- Set up your SAM sites in the mission editor. Name the groups with common prefix like "Red SAM". -- Set up your SAM sites in the mission editor. Name the groups with common prefix like "Red SAM".
-- Set up your EWR system in the mission editor. Name the groups with common prefix like "Red EWR". Can be e.g. AWACS or a combination of AWACS and Search Radars like e.g. EWR 1L13 etc. -- Set up your EWR system in the mission editor. Name the groups with common prefix like "Red EWR". Can be e.g. AWACS or a combination of AWACS and Search Radars like e.g. EWR 1L13 etc.
-- [optional] Set up your HQ. Can be any group, e.g. a command vehicle. -- [optional] Set up your HQ. Can be any group, e.g. a command vehicle.
-- --
-- # 1. Basic tactical considerations when setting up your SAM sites -- # 1. Basic tactical considerations when setting up your SAM sites
-- --
-- ## 1.1 Radar systems and AWACS -- ## 1.1 Radar systems and AWACS
-- --
-- Typically, your setup should consist of EWR (early warning) radars to detect and track targets, accompanied by AWACS if your scenario forsees that. Ensure that your EWR radars have a good coverage of the area you want to track. -- Typically, your setup should consist of EWR (early warning) radars to detect and track targets, accompanied by AWACS if your scenario forsees that. Ensure that your EWR radars have a good coverage of the area you want to track.
-- **Location** is of highest importantance here. Whilst AWACS in DCS has almost the "all seeing eye", EWR don't have that. Choose your location wisely, against a mountain backdrop or inside a valley even the best EWR system -- **Location** is of highest importantance here. Whilst AWACS in DCS has almost the "all seeing eye", EWR don't have that. Choose your location wisely, against a mountain backdrop or inside a valley even the best EWR system
-- doesn't work well. Prefer higher-up locations with a good view; use F7 in-game to check where you actually placed your EWR and have a look around. Apart from the obvious choice, do also consider other radar units -- doesn't work well. Prefer higher-up locations with a good view; use F7 in-game to check where you actually placed your EWR and have a look around. Apart from the obvious choice, do also consider other radar units
-- for this role, most have "SR" (search radar) or "STR" (search and track radar) in their names, use the encyclopedia to see what they actually do. -- for this role, most have "SR" (search radar) or "STR" (search and track radar) in their names, use the encyclopedia to see what they actually do.
-- --
-- ## 1.2 SAM sites -- ## 1.2 SAM sites
-- --
-- Typically your SAM should cover all attack ranges. The closer the enemy gets, the more systems you will need to deploy to defend your location. Use a combination of long-range systems like the SA-10/11, midrange like SA-6 and short-range like -- Typically your SAM should cover all attack ranges. The closer the enemy gets, the more systems you will need to deploy to defend your location. Use a combination of long-range systems like the SA-10/11, midrange like SA-6 and short-range like
-- SA-2 for defense (Patriot, Hawk, Gepard, Blindfire for the blue side). For close-up defense and defense against HARMs or low-flying aircraft, helicopters it is also advisable to deploy SA-15 TOR systems, Shilka, Strela and Tunguska units, as well as manpads (Think Gepard, Avenger, Chaparral, -- SA-2 for defense (Patriot, Hawk, Gepard, Blindfire for the blue side). For close-up defense and defense against HARMs or low-flying aircraft, helicopters it is also advisable to deploy SA-15 TOR systems, Shilka, Strela and Tunguska units, as well as manpads (Think Gepard, Avenger, Chaparral,
-- Linebacker, Roland systems for the blue side). If possible, overlap ranges for mutual coverage. -- Linebacker, Roland systems for the blue side). If possible, overlap ranges for mutual coverage.
-- --
-- ## 1.3 Typical problems -- ## 1.3 Typical problems
-- --
-- Often times, people complain because the detection cannot "see" oncoming targets and/or Mantis switches on too late. Three typial problems here are -- Often times, people complain because the detection cannot "see" oncoming targets and/or Mantis switches on too late. Three typial problems here are
-- --
-- * bad placement of radar units, -- * bad placement of radar units,
-- * overestimation how far units can "see" and -- * overestimation how far units can "see" and
-- * not taking into account that a SAM site will take (e.g for a SA-6) 30-40 seconds between switching to RED, acquiring the target and firing. -- * not taking into account that a SAM site will take (e.g for a SA-6) 30-40 seconds between switching to RED, acquiring the target and firing.
-- --
-- An attacker doing 350knots will cover ca 180meters/second or thus more than 6km until the SA-6 fires. Use triggers zones and the ruler in the missione editor to understand distances and zones. Take into account that the ranges given by the circles -- An attacker doing 350knots will cover ca 180meters/second or thus more than 6km until the SA-6 fires. Use triggers zones and the ruler in the missione editor to understand distances and zones. Take into account that the ranges given by the circles
-- in the mission editor are absolute maximum ranges; in-game this is rather 50-75% of that depending on the system. Fiddle with placement and options to see what works best for your scenario, and remember **everything in here is in meters**. -- in the mission editor are absolute maximum ranges; in-game this is rather 50-75% of that depending on the system. Fiddle with placement and options to see what works best for your scenario, and remember **everything in here is in meters**.
-- --
-- # 2. Start up your MANTIS with a basic setting -- # 2. Start up your MANTIS with a basic setting
-- --
-- `myredmantis = MANTIS:New("myredmantis","Red SAM","Red EWR",nil,"red",false)` -- `myredmantis = MANTIS:New("myredmantis","Red SAM","Red EWR",nil,"red",false)`
-- `myredmantis:Start()` -- `myredmantis:Start()`
-- --
-- [optional] Use -- [optional] Use
-- --
-- * `MANTIS:SetEWRGrouping(radius)` -- * `MANTIS:SetEWRGrouping(radius)`
-- * `MANTIS:SetEWRRange(radius)` -- * `MANTIS:SetEWRRange(radius)`
-- * `MANTIS:SetSAMRadius(radius)` -- * `MANTIS:SetSAMRadius(radius)`
-- * `MANTIS:SetDetectInterval(interval)` -- * `MANTIS:SetDetectInterval(interval)`
-- * `MANTIS:SetAutoRelocate(hq, ewr)` -- * `MANTIS:SetAutoRelocate(hq, ewr)`
-- --
-- before starting #MANTIS to fine-tune your setup. -- before starting #MANTIS to fine-tune your setup.
-- --
-- If you want to use a separate AWACS unit (default detection range: 250km) to support your EWR system, use e.g. the following setup: -- If you want to use a separate AWACS unit (default detection range: 250km) to support your EWR system, use e.g. the following setup:
-- --
-- `mybluemantis = MANTIS:New("bluemantis","Blue SAM","Blue EWR",nil,"blue",false,"Blue Awacs")` -- `mybluemantis = MANTIS:New("bluemantis","Blue SAM","Blue EWR",nil,"blue",false,"Blue Awacs")`
-- `mybluemantis:Start()` -- `mybluemantis:Start()`
-- --
-- # 3. Default settings -- # 3. Default settings
-- --
-- By default, the following settings are active: -- By default, the following settings are active:
-- --
-- * SAM_Templates_Prefix = "Red SAM" - SAM site group names in the mission editor begin with "Red SAM" -- * SAM_Templates_Prefix = "Red SAM" - SAM site group names in the mission editor begin with "Red SAM"
-- * EWR_Templates_Prefix = "Red EWR" - EWR group names in the mission editor begin with "Red EWR" - can also be combined with an AWACS unit -- * EWR_Templates_Prefix = "Red EWR" - EWR group names in the mission editor begin with "Red EWR" - can also be combined with an AWACS unit
-- * checkradius = 25000 (meters) - SAMs will engage enemy flights, if they are within a 25km around each SAM site - `MANTIS:SetSAMRadius(radius)` -- * checkradius = 25000 (meters) - SAMs will engage enemy flights, if they are within a 25km around each SAM site - `MANTIS:SetSAMRadius(radius)`
-- * grouping = 5000 (meters) - Detection (EWR) will group enemy flights to areas of 5km for tracking - `MANTIS:SetEWRGrouping(radius)` -- * grouping = 5000 (meters) - Detection (EWR) will group enemy flights to areas of 5km for tracking - `MANTIS:SetEWRGrouping(radius)`
-- * acceptrange = 80000 (meters) - Detection (EWR) will on consider flights inside a 80km radius - `MANTIS:SetEWRRange(radius)` -- * acceptrange = 80000 (meters) - Detection (EWR) will on consider flights inside a 80km radius - `MANTIS:SetEWRRange(radius)`
-- * detectinterval = 30 (seconds) - MANTIS will decide every 30 seconds which SAM to activate - `MANTIS:SetDetectInterval(interval)` -- * detectinterval = 30 (seconds) - MANTIS will decide every 30 seconds which SAM to activate - `MANTIS:SetDetectInterval(interval)`
-- * engagerange = 85 (percent) - SAMs will only fire if flights are inside of a 85% radius of their max firerange - `MANTIS:SetSAMRange(range)` -- * engagerange = 85 (percent) - SAMs will only fire if flights are inside of a 85% radius of their max firerange - `MANTIS:SetSAMRange(range)`
-- * dynamic = false - Group filtering is set to once, i.e. newly added groups will not be part of the setup by default - `MANTIS:New(name,samprefix,ewrprefix,hq,coaltion,dynamic)` -- * dynamic = false - Group filtering is set to once, i.e. newly added groups will not be part of the setup by default - `MANTIS:New(name,samprefix,ewrprefix,hq,coaltion,dynamic)`
@ -135,28 +135,28 @@
-- * debug = false - Debugging reports on screen are set to off - `MANTIS:Debug(onoff)` -- * debug = false - Debugging reports on screen are set to off - `MANTIS:Debug(onoff)`
-- --
-- # 4. Advanced Mode -- # 4. Advanced Mode
-- --
-- Advanced mode will *decrease* reactivity of MANTIS, if HQ and/or EWR network dies. Awacs is counted as one EWR unit. It will set SAMs to RED state if both are dead. Requires usage of an **HQ** object and the **dynamic** option. -- Advanced mode will *decrease* reactivity of MANTIS, if HQ and/or EWR network dies. Awacs is counted as one EWR unit. It will set SAMs to RED state if both are dead. Requires usage of an **HQ** object and the **dynamic** option.
-- --
-- E.g. `mymantis:SetAdvancedMode( true, 90 )` -- E.g. `mymantis:SetAdvancedMode( true, 90 )`
-- --
-- Use this option if you want to make use of or allow advanced SEAD tactics. -- Use this option if you want to make use of or allow advanced SEAD tactics.
-- --
-- # 5. Integrate SHORAD -- # 5. Integrate SHORAD
-- --
-- You can also choose to integrate Mantis with @{Functional.Shorad#SHORAD} for protection against HARMs and AGMs. When SHORAD detects a missile fired at one of MANTIS' SAM sites, it will activate SHORAD systems in -- You can also choose to integrate Mantis with @{Functional.Shorad#SHORAD} for protection against HARMs and AGMs. When SHORAD detects a missile fired at one of MANTIS' SAM sites, it will activate SHORAD systems in
-- the given defense checkradius around that SAM site. Create a SHORAD object first, then integrate with MANTIS like so: -- the given defense checkradius around that SAM site. Create a SHORAD object first, then integrate with MANTIS like so:
-- --
-- `local SamSet = SET_GROUP:New():FilterPrefixes("Blue SAM"):FilterCoalitions("blue"):FilterStart()` -- `local SamSet = SET_GROUP:New():FilterPrefixes("Blue SAM"):FilterCoalitions("blue"):FilterStart()`
-- `myshorad = SHORAD:New("BlueShorad", "Blue SHORAD", SamSet, 22000, 600, "blue")` -- `myshorad = SHORAD:New("BlueShorad", "Blue SHORAD", SamSet, 22000, 600, "blue")`
-- `-- now set up MANTIS` -- `-- now set up MANTIS`
-- `mymantis = MANTIS:New("BlueMantis","Blue SAM","Blue EWR",nil,"blue",false,"Blue Awacs")` -- `mymantis = MANTIS:New("BlueMantis","Blue SAM","Blue EWR",nil,"blue",false,"Blue Awacs")`
-- `mymantis:AddShorad(myshorad,720)` -- `mymantis:AddShorad(myshorad,720)`
-- `mymantis:Start()` -- `mymantis:Start()`
-- --
-- and (optionally) remove the link later on with -- and (optionally) remove the link later on with
-- --
-- `mymantis:RemoveShorad()` -- `mymantis:RemoveShorad()`
-- --
-- @field #MANTIS -- @field #MANTIS
MANTIS = { MANTIS = {
@ -222,31 +222,31 @@ do
--@param #string coaltion Coalition side of your setup, e.g. "blue", "red" or "neutral" --@param #string coaltion Coalition side of your setup, e.g. "blue", "red" or "neutral"
--@param #boolean dynamic Use constant (true) filtering or just filter once (false, default) (optional) --@param #boolean dynamic Use constant (true) filtering or just filter once (false, default) (optional)
--@param #string awacs Group name of your Awacs (optional) --@param #string awacs Group name of your Awacs (optional)
--@param #boolean EmOnOff Make MANTIS switch Emissions on and off instead of changing the alarm state between RED and GREEN (optional) --@param #boolean EmOnOff Make MANTIS switch Emissions on and off instead of changing the alarm state between RED and GREEN (optional)
--@param #number Padding For #SEAD - Extra number of seconds to add to radar switch-back-on time (optional) --@param #number Padding For #SEAD - Extra number of seconds to add to radar switch-back-on time (optional)
--@return #MANTIS self --@return #MANTIS self
--@usage Start up your MANTIS with a basic setting --@usage Start up your MANTIS with a basic setting
-- --
-- `myredmantis = MANTIS:New("myredmantis","Red SAM","Red EWR",nil,"red",false)` -- `myredmantis = MANTIS:New("myredmantis","Red SAM","Red EWR",nil,"red",false)`
-- `myredmantis:Start()` -- `myredmantis:Start()`
-- --
-- [optional] Use -- [optional] Use
-- --
-- * `MANTIS:SetEWRGrouping(radius)` -- * `MANTIS:SetEWRGrouping(radius)`
-- * `MANTIS:SetEWRRange(radius)` -- * `MANTIS:SetEWRRange(radius)`
-- * `MANTIS:SetSAMRadius(radius)` -- * `MANTIS:SetSAMRadius(radius)`
-- * `MANTIS:SetDetectInterval(interval)` -- * `MANTIS:SetDetectInterval(interval)`
-- * `MANTIS:SetAutoRelocate(hq, ewr)` -- * `MANTIS:SetAutoRelocate(hq, ewr)`
-- --
-- before starting #MANTIS to fine-tune your setup. -- before starting #MANTIS to fine-tune your setup.
-- --
-- If you want to use a separate AWACS unit (default detection range: 250km) to support your EWR system, use e.g. the following setup: -- If you want to use a separate AWACS unit (default detection range: 250km) to support your EWR system, use e.g. the following setup:
-- --
-- `mybluemantis = MANTIS:New("bluemantis","Blue SAM","Blue EWR",nil,"blue",false,"Blue Awacs")` -- `mybluemantis = MANTIS:New("bluemantis","Blue SAM","Blue EWR",nil,"blue",false,"Blue Awacs")`
-- `mybluemantis:Start()` -- `mybluemantis:Start()`
-- --
function MANTIS:New(name,samprefix,ewrprefix,hq,coaltion,dynamic,awacs, EmOnOff, Padding) function MANTIS:New(name,samprefix,ewrprefix,hq,coaltion,dynamic,awacs, EmOnOff, Padding)
-- DONE: Create some user functions for these -- DONE: Create some user functions for these
-- DONE: Make HQ useful -- DONE: Make HQ useful
-- DONE: Set SAMs to auto if EWR dies -- DONE: Set SAMs to auto if EWR dies
@ -269,7 +269,7 @@ do
self.autorelocateunits = { HQ = false, EWR = false} self.autorelocateunits = { HQ = false, EWR = false}
self.advanced = false self.advanced = false
self.adv_ratio = 100 self.adv_ratio = 100
self.adv_state = 0 self.adv_state = 0
self.verbose = false self.verbose = false
self.Adv_EWR_Group = nil self.Adv_EWR_Group = nil
self.AWACS_Prefix = awacs or nil self.AWACS_Prefix = awacs or nil
@ -284,27 +284,27 @@ do
self.SamStateTracker = {} -- table to hold alert states, so we don't trigger state changes twice in adv mode self.SamStateTracker = {} -- table to hold alert states, so we don't trigger state changes twice in adv mode
self.DLink = false self.DLink = false
self.Padding = Padding or 10 self.Padding = Padding or 10
if EmOnOff then if EmOnOff then
if EmOnOff == false then if EmOnOff == false then
self.UseEmOnOff = false self.UseEmOnOff = false
else else
self.UseEmOnOff = true self.UseEmOnOff = true
end end
end end
if type(awacs) == "string" then if type(awacs) == "string" then
self.advAwacs = true self.advAwacs = true
else else
self.advAwacs = false self.advAwacs = false
end end
-- Inherit everything from BASE class. -- Inherit everything from BASE class.
local self = BASE:Inherit(self, FSM:New()) -- #MANTIS local self = BASE:Inherit(self, FSM:New()) -- #MANTIS
-- Set the string id for output to DCS.log file. -- Set the string id for output to DCS.log file.
self.lid=string.format("MANTIS %s | ", self.name) self.lid=string.format("MANTIS %s | ", self.name)
-- Debug trace. -- Debug trace.
if self.debug then if self.debug then
BASE:TraceOnOff(true) BASE:TraceOnOff(true)
@ -312,7 +312,7 @@ do
--BASE:TraceClass("SEAD") --BASE:TraceClass("SEAD")
BASE:TraceLevel(1) BASE:TraceLevel(1)
end end
if self.dynamic then if self.dynamic then
-- Set SAM SET_GROUP -- Set SAM SET_GROUP
self.SAM_Group = SET_GROUP:New():FilterPrefixes(self.SAM_Templates_Prefix):FilterCoalitions(self.Coalition):FilterStart() self.SAM_Group = SET_GROUP:New():FilterPrefixes(self.SAM_Templates_Prefix):FilterCoalitions(self.Coalition):FilterStart()
@ -324,18 +324,18 @@ do
-- Set EWR SET_GROUP -- Set EWR SET_GROUP
self.EWR_Group = SET_GROUP:New():FilterPrefixes({self.SAM_Templates_Prefix,self.EWR_Templates_Prefix}):FilterCoalitions(self.Coalition):FilterOnce() self.EWR_Group = SET_GROUP:New():FilterPrefixes({self.SAM_Templates_Prefix,self.EWR_Templates_Prefix}):FilterCoalitions(self.Coalition):FilterOnce()
end end
-- set up CC -- set up CC
if self.HQ_Template_CC then if self.HQ_Template_CC then
self.HQ_CC = GROUP:FindByName(self.HQ_Template_CC) self.HQ_CC = GROUP:FindByName(self.HQ_Template_CC)
end end
-- @field #string version -- @field #string version
self.version="0.6.2" self.version="0.6.2"
self:I(string.format("***** Starting MANTIS Version %s *****", self.version)) self:I(string.format("***** Starting MANTIS Version %s *****", self.version))
--- FSM Functions --- --- FSM Functions ---
-- Start State. -- Start State.
self:SetStartState("Stopped") self:SetStartState("Stopped")
@ -349,11 +349,11 @@ do
self:AddTransition("*", "AdvStateChange", "*") -- MANTIS advanced mode state change. self:AddTransition("*", "AdvStateChange", "*") -- MANTIS advanced mode state change.
self:AddTransition("*", "ShoradActivated", "*") -- MANTIS woke up a connected SHORAD. self:AddTransition("*", "ShoradActivated", "*") -- MANTIS woke up a connected SHORAD.
self:AddTransition("*", "Stop", "Stopped") -- Stop FSM. self:AddTransition("*", "Stop", "Stopped") -- Stop FSM.
------------------------ ------------------------
--- Pseudo Functions --- --- Pseudo Functions ---
------------------------ ------------------------
--- Triggers the FSM event "Start". Starts the MANTIS. Initializes parameters and starts event handlers. --- Triggers the FSM event "Start". Starts the MANTIS. Initializes parameters and starts event handlers.
-- @function [parent=#MANTIS] Start -- @function [parent=#MANTIS] Start
-- @param #MANTIS self -- @param #MANTIS self
@ -379,7 +379,7 @@ do
-- @function [parent=#MANTIS] __Status -- @function [parent=#MANTIS] __Status
-- @param #MANTIS self -- @param #MANTIS self
-- @param #number delay Delay in seconds. -- @param #number delay Delay in seconds.
--- On After "Relocating" event. HQ and/or EWR moved. --- On After "Relocating" event. HQ and/or EWR moved.
-- @function [parent=#MANTIS] OnAfterRelocating -- @function [parent=#MANTIS] OnAfterRelocating
-- @param #MANTIS self -- @param #MANTIS self
@ -387,7 +387,7 @@ do
-- @param #string Event The Event -- @param #string Event The Event
-- @param #string To The To State -- @param #string To The To State
-- @return #MANTIS self -- @return #MANTIS self
--- On After "GreenState" event. A SAM group was switched to GREEN alert. --- On After "GreenState" event. A SAM group was switched to GREEN alert.
-- @function [parent=#MANTIS] OnAfterGreenState -- @function [parent=#MANTIS] OnAfterGreenState
-- @param #MANTIS self -- @param #MANTIS self
@ -396,7 +396,7 @@ do
-- @param #string To The To State -- @param #string To The To State
-- @param Wrapper.Group#GROUP Group The GROUP object whose state was changed -- @param Wrapper.Group#GROUP Group The GROUP object whose state was changed
-- @return #MANTIS self -- @return #MANTIS self
--- On After "RedState" event. A SAM group was switched to RED alert. --- On After "RedState" event. A SAM group was switched to RED alert.
-- @function [parent=#MANTIS] OnAfterRedState -- @function [parent=#MANTIS] OnAfterRedState
-- @param #MANTIS self -- @param #MANTIS self
@ -405,7 +405,7 @@ do
-- @param #string To The To State -- @param #string To The To State
-- @param Wrapper.Group#GROUP Group The GROUP object whose state was changed -- @param Wrapper.Group#GROUP Group The GROUP object whose state was changed
-- @return #MANTIS self -- @return #MANTIS self
--- On After "AdvStateChange" event. Advanced state changed, influencing detection speed. --- On After "AdvStateChange" event. Advanced state changed, influencing detection speed.
-- @function [parent=#MANTIS] OnAfterAdvStateChange -- @function [parent=#MANTIS] OnAfterAdvStateChange
-- @param #MANTIS self -- @param #MANTIS self
@ -416,7 +416,7 @@ do
-- @param #number Newstate New state - 0 = green, 1 = amber, 2 = red -- @param #number Newstate New state - 0 = green, 1 = amber, 2 = red
-- @param #number Interval Calculated detection interval based on state and advanced feature setting -- @param #number Interval Calculated detection interval based on state and advanced feature setting
-- @return #MANTIS self -- @return #MANTIS self
--- On After "ShoradActivated" event. Mantis has activated a SHORAD. --- On After "ShoradActivated" event. Mantis has activated a SHORAD.
-- @function [parent=#MANTIS] OnAfterShoradActivated -- @function [parent=#MANTIS] OnAfterShoradActivated
-- @param #MANTIS self -- @param #MANTIS self
@ -427,21 +427,21 @@ do
-- @param #number Radius Radius around the named group to find SHORAD groups -- @param #number Radius Radius around the named group to find SHORAD groups
-- @param #number Ontime Seconds the SHORAD will stay active -- @param #number Ontime Seconds the SHORAD will stay active
return self return self
end end
----------------------------------------------------------------------- -----------------------------------------------------------------------
-- MANTIS helper functions -- MANTIS helper functions
----------------------------------------------------------------------- -----------------------------------------------------------------------
--- [Internal] Function to get the self.SAM_Table --- [Internal] Function to get the self.SAM_Table
-- @param #MANTIS self -- @param #MANTIS self
-- @return #table table -- @return #table table
function MANTIS:_GetSAMTable() function MANTIS:_GetSAMTable()
self:T(self.lid .. "GetSAMTable") self:T(self.lid .. "GetSAMTable")
return self.SAM_Table return self.SAM_Table
end end
--- [Internal] Function to set the self.SAM_Table --- [Internal] Function to set the self.SAM_Table
-- @param #MANTIS self -- @param #MANTIS self
-- @return #MANTIS self -- @return #MANTIS self
@ -450,7 +450,7 @@ do
self.SAM_Table = table self.SAM_Table = table
return self return self
end end
--- Function to set the grouping radius of the detection in meters --- Function to set the grouping radius of the detection in meters
-- @param #MANTIS self -- @param #MANTIS self
-- @param #number radius Radius upon which detected objects will be grouped -- @param #number radius Radius upon which detected objects will be grouped
@ -470,17 +470,17 @@ do
self.acceptrange = radius self.acceptrange = radius
return self return self
end end
--- Function to set switch-on/off zone for the SAM sites in meters --- Function to set switch-on/off zone for the SAM sites in meters
-- @param #MANTIS self -- @param #MANTIS self
-- @param #number radius Radius of the firing zone -- @param #number radius Radius of the firing zone
function MANTIS:SetSAMRadius(radius) function MANTIS:SetSAMRadius(radius)
self:T(self.lid .. "SetSAMRadius") self:T(self.lid .. "SetSAMRadius")
local radius = radius or 25000 local radius = radius or 25000
self.checkradius = radius self.checkradius = radius
return self return self
end end
--- Function to set SAM firing engage range, 0-100 percent, e.g. 75 --- Function to set SAM firing engage range, 0-100 percent, e.g. 75
-- @param #MANTIS self -- @param #MANTIS self
-- @param #number range Percent of the max fire range -- @param #number range Percent of the max fire range
@ -493,7 +493,7 @@ do
self.engagerange = range self.engagerange = range
return self return self
end end
--- Function to set a new SAM firing engage range, use this method to adjust range while running MANTIS, e.g. for different setups day and night --- Function to set a new SAM firing engage range, use this method to adjust range while running MANTIS, e.g. for different setups day and night
-- @param #MANTIS self -- @param #MANTIS self
-- @param #number range Percent of the max fire range -- @param #number range Percent of the max fire range
@ -508,7 +508,7 @@ do
self.mysead.EngagementRange = range self.mysead.EngagementRange = range
return self return self
end end
--- Function to set switch-on/off the debug state --- Function to set switch-on/off the debug state
-- @param #MANTIS self -- @param #MANTIS self
-- @param #boolean onoff Set true to switch on -- @param #boolean onoff Set true to switch on
@ -526,7 +526,7 @@ do
end end
return self return self
end end
--- Function to get the HQ object for further use --- Function to get the HQ object for further use
-- @param #MANTIS self -- @param #MANTIS self
-- @return Wrapper.GROUP#GROUP The HQ #GROUP object or *nil* if it doesn't exist -- @return Wrapper.GROUP#GROUP The HQ #GROUP object or *nil* if it doesn't exist
@ -535,10 +535,10 @@ do
if self.HQ_CC then if self.HQ_CC then
return self.HQ_CC return self.HQ_CC
else else
return nil return nil
end end
end end
--- Function to set separate AWACS detection instance --- Function to set separate AWACS detection instance
-- @param #MANTIS self -- @param #MANTIS self
-- @param #string prefix Name of the AWACS group in the mission editor -- @param #string prefix Name of the AWACS group in the mission editor
@ -562,7 +562,7 @@ do
self.awacsrange = range self.awacsrange = range
return self return self
end end
--- Function to set the HQ object for further use --- Function to set the HQ object for further use
-- @param #MANTIS self -- @param #MANTIS self
-- @param Wrapper.GROUP#GROUP group The #GROUP object to be set as HQ -- @param Wrapper.GROUP#GROUP group The #GROUP object to be set as HQ
@ -580,7 +580,7 @@ do
end end
return self return self
end end
--- Function to set the detection interval --- Function to set the detection interval
-- @param #MANTIS self -- @param #MANTIS self
-- @param #number interval The interval in seconds -- @param #number interval The interval in seconds
@ -589,8 +589,8 @@ do
local interval = interval or 30 local interval = interval or 30
self.detectinterval = interval self.detectinterval = interval
return self return self
end end
--- Function to set Advanded Mode --- Function to set Advanded Mode
-- @param #MANTIS self -- @param #MANTIS self
-- @param #boolean onoff If true, will activate Advanced Mode -- @param #boolean onoff If true, will activate Advanced Mode
@ -615,7 +615,7 @@ do
end end
return self return self
end end
--- Set using Emissions on/off instead of changing alarm state --- Set using Emissions on/off instead of changing alarm state
-- @param #MANTIS self -- @param #MANTIS self
-- @param #boolean switch Decide if we are changing alarm state or Emission state -- @param #boolean switch Decide if we are changing alarm state or Emission state
@ -624,7 +624,7 @@ do
self.UseEmOnOff = switch or false self.UseEmOnOff = switch or false
return self return self
end end
--- Set using an #INTEL_DLINK object instead of #DETECTION --- Set using an #INTEL_DLINK object instead of #DETECTION
-- @param #MANTIS self -- @param #MANTIS self
-- @param Ops.Intelligence#INTEL_DLINK DLink The data link object to be used. -- @param Ops.Intelligence#INTEL_DLINK DLink The data link object to be used.
@ -635,7 +635,7 @@ do
self.DLTimeStamp = timer.getAbsTime() self.DLTimeStamp = timer.getAbsTime()
return self return self
end end
--- [Internal] Function to check if HQ is alive --- [Internal] Function to check if HQ is alive
-- @param #MANTIS self -- @param #MANTIS self
-- @return #boolean True if HQ is alive, else false -- @return #boolean True if HQ is alive, else false
@ -654,11 +654,11 @@ do
return true return true
else else
--self:T(self.lid.." HQ is dead!") --self:T(self.lid.." HQ is dead!")
return false return false
end end
end end
end end
return self return self
end end
--- [Internal] Function to check if EWR is (at least partially) alive --- [Internal] Function to check if EWR is (at least partially) alive
@ -690,7 +690,7 @@ do
return false return false
end end
end end
return self return self
end end
--- [Internal] Function to determine state of the advanced mode --- [Internal] Function to determine state of the advanced mode
@ -726,7 +726,7 @@ do
end end
return newinterval, currstate return newinterval, currstate
end end
--- Function to set autorelocation for HQ and EWR objects. Note: Units must be actually mobile in DCS! --- Function to set autorelocation for HQ and EWR objects. Note: Units must be actually mobile in DCS!
-- @param #MANTIS self -- @param #MANTIS self
-- @param #boolean hq If true, will relocate HQ object -- @param #boolean hq If true, will relocate HQ object
@ -742,8 +742,8 @@ do
--self:T({self.autorelocate, self.autorelocateunits}) --self:T({self.autorelocate, self.autorelocateunits})
end end
return self return self
end end
--- [Internal] Function to execute the relocation --- [Internal] Function to execute the relocation
-- @param #MANTIS self -- @param #MANTIS self
function MANTIS:_RelocateGroups() function MANTIS:_RelocateGroups()
@ -780,7 +780,7 @@ do
end end
return self return self
end end
--- [Internal] Function to check if any object is in the given SAM zone --- [Internal] Function to check if any object is in the given SAM zone
-- @param #MANTIS self -- @param #MANTIS self
-- @param #table dectset Table of coordinates of detected items -- @param #table dectset Table of coordinates of detected items
@ -796,12 +796,12 @@ do
local coord = _coord -- get current coord to check local coord = _coord -- get current coord to check
-- output for cross-check -- output for cross-check
local targetdistance = samcoordinate:DistanceFromPointVec2(coord) local targetdistance = samcoordinate:DistanceFromPointVec2(coord)
if self.verbose or self.debug then if self.verbose or self.debug then
local dectstring = coord:ToStringLLDMS() local dectstring = coord:ToStringLLDMS()
local samstring = samcoordinate:ToStringLLDMS() local samstring = samcoordinate:ToStringLLDMS()
local text = string.format("Checking SAM at % s - Distance %d m - Target %s", samstring, targetdistance, dectstring) local text = string.format("Checking SAM at % s - Distance %d m - Target %s", samstring, targetdistance, dectstring)
local m = MESSAGE:New(text,10,"Check"):ToAllIf(self.debug) local m = MESSAGE:New(text,10,"Check"):ToAllIf(self.debug)
self:I(self.lid..text) self:I(self.lid..text)
end end
-- end output to cross-check -- end output to cross-check
if targetdistance <= radius then if targetdistance <= radius then
@ -816,20 +816,20 @@ do
-- @return Functional.Detection #DETECTION_AREAS The running detection set -- @return Functional.Detection #DETECTION_AREAS The running detection set
function MANTIS:StartDetection() function MANTIS:StartDetection()
self:T(self.lid.."Starting Detection") self:T(self.lid.."Starting Detection")
-- start detection -- start detection
local groupset = self.EWR_Group local groupset = self.EWR_Group
local grouping = self.grouping or 5000 local grouping = self.grouping or 5000
local acceptrange = self.acceptrange or 80000 local acceptrange = self.acceptrange or 80000
local interval = self.detectinterval or 60 local interval = self.detectinterval or 60
--@param Functional.Detection #DETECTION_AREAS _MANTISdetection [Internal] The MANTIS detection object --@param Functional.Detection #DETECTION_AREAS _MANTISdetection [Internal] The MANTIS detection object
local MANTISdetection = DETECTION_AREAS:New( groupset, grouping ) --[Internal] Grouping detected objects to 5000m zones local MANTISdetection = DETECTION_AREAS:New( groupset, grouping ) --[Internal] Grouping detected objects to 5000m zones
MANTISdetection:FilterCategories({ Unit.Category.AIRPLANE, Unit.Category.HELICOPTER }) MANTISdetection:FilterCategories({ Unit.Category.AIRPLANE, Unit.Category.HELICOPTER })
MANTISdetection:SetAcceptRange(acceptrange) MANTISdetection:SetAcceptRange(acceptrange)
MANTISdetection:SetRefreshTimeInterval(interval) MANTISdetection:SetRefreshTimeInterval(interval)
MANTISdetection:Start() MANTISdetection:Start()
function MANTISdetection:OnAfterDetectedItem(From,Event,To,DetectedItem) function MANTISdetection:OnAfterDetectedItem(From,Event,To,DetectedItem)
--BASE:I( { From, Event, To, DetectedItem }) --BASE:I( { From, Event, To, DetectedItem })
local debug = false local debug = false
@ -838,30 +838,30 @@ do
local text = "MANTIS: Detection at "..Coordinate:ToStringLLDMS() local text = "MANTIS: Detection at "..Coordinate:ToStringLLDMS()
local m = MESSAGE:New(text,10,"MANTIS"):ToAllIf(self.debug) local m = MESSAGE:New(text,10,"MANTIS"):ToAllIf(self.debug)
end end
end end
return MANTISdetection return MANTISdetection
end end
--- [Internal] Function to start the detection via AWACS if defined as separate --- [Internal] Function to start the detection via AWACS if defined as separate
-- @param #MANTIS self -- @param #MANTIS self
-- @return Functional.Detection #DETECTION_AREAS The running detection set -- @return Functional.Detection #DETECTION_AREAS The running detection set
function MANTIS:StartAwacsDetection() function MANTIS:StartAwacsDetection()
self:T(self.lid.."Starting Awacs Detection") self:T(self.lid.."Starting Awacs Detection")
-- start detection -- start detection
local group = self.AWACS_Prefix local group = self.AWACS_Prefix
local groupset = SET_GROUP:New():FilterPrefixes(group):FilterCoalitions(self.Coalition):FilterStart() local groupset = SET_GROUP:New():FilterPrefixes(group):FilterCoalitions(self.Coalition):FilterStart()
local grouping = self.grouping or 5000 local grouping = self.grouping or 5000
--local acceptrange = self.acceptrange or 80000 --local acceptrange = self.acceptrange or 80000
local interval = self.detectinterval or 60 local interval = self.detectinterval or 60
--@param Functional.Detection #DETECTION_AREAS _MANTISdetection [Internal] The MANTIS detection object --@param Functional.Detection #DETECTION_AREAS _MANTISdetection [Internal] The MANTIS detection object
local MANTISAwacs = DETECTION_AREAS:New( groupset, grouping ) --[Internal] Grouping detected objects to 5000m zones local MANTISAwacs = DETECTION_AREAS:New( groupset, grouping ) --[Internal] Grouping detected objects to 5000m zones
MANTISAwacs:FilterCategories({ Unit.Category.AIRPLANE, Unit.Category.HELICOPTER }) MANTISAwacs:FilterCategories({ Unit.Category.AIRPLANE, Unit.Category.HELICOPTER })
MANTISAwacs:SetAcceptRange(self.awacsrange) --250km MANTISAwacs:SetAcceptRange(self.awacsrange) --250km
MANTISAwacs:SetRefreshTimeInterval(interval) MANTISAwacs:SetRefreshTimeInterval(interval)
MANTISAwacs:Start() MANTISAwacs:Start()
function MANTISAwacs:OnAfterDetectedItem(From,Event,To,DetectedItem) function MANTISAwacs:OnAfterDetectedItem(From,Event,To,DetectedItem)
--BASE:I( { From, Event, To, DetectedItem }) --BASE:I( { From, Event, To, DetectedItem })
local debug = false local debug = false
@ -870,10 +870,10 @@ do
local text = "Awacs Detection at "..Coordinate:ToStringLLDMS() local text = "Awacs Detection at "..Coordinate:ToStringLLDMS()
local m = MESSAGE:New(text,10,"MANTIS"):ToAllIf(self.debug) local m = MESSAGE:New(text,10,"MANTIS"):ToAllIf(self.debug)
end end
end end
return MANTISAwacs return MANTISAwacs
end end
--- [Internal] Function to set the SAM start state --- [Internal] Function to set the SAM start state
-- @param #MANTIS self -- @param #MANTIS self
-- @return #MANTIS self -- @return #MANTIS self
@ -912,7 +912,7 @@ do
self.mysead = mysead self.mysead = mysead
return self return self
end end
--- [Internal] Function to update SAM table and SEAD state --- [Internal] Function to update SAM table and SEAD state
-- @param #MANTIS self -- @param #MANTIS self
-- @return #MANTIS self -- @return #MANTIS self
@ -944,7 +944,7 @@ do
end end
return self return self
end end
--- Function to link up #MANTIS with a #SHORAD installation --- Function to link up #MANTIS with a #SHORAD installation
-- @param #MANTIS self -- @param #MANTIS self
-- @param Functional.Shorad#SHORAD Shorad The #SHORAD object -- @param Functional.Shorad#SHORAD Shorad The #SHORAD object
@ -961,7 +961,7 @@ do
end end
return self return self
end end
--- Function to unlink #MANTIS from a #SHORAD installation --- Function to unlink #MANTIS from a #SHORAD installation
-- @param #MANTIS self -- @param #MANTIS self
function MANTIS:RemoveShorad() function MANTIS:RemoveShorad()
@ -969,11 +969,11 @@ do
self.ShoradLink = false self.ShoradLink = false
return self return self
end end
----------------------------------------------------------------------- -----------------------------------------------------------------------
-- MANTIS main functions -- MANTIS main functions
----------------------------------------------------------------------- -----------------------------------------------------------------------
--- [Internal] Check detection function --- [Internal] Check detection function
-- @param #MANTIS self -- @param #MANTIS self
-- @param Functional.Detection#DETECTION_AREAS detection Detection object -- @param Functional.Detection#DETECTION_AREAS detection Detection object
@ -1024,7 +1024,7 @@ do
if self.verbose then self:I(self.lid..text) end if self.verbose then self:I(self.lid..text) end
end end
end --end alive end --end alive
else else
if samgroup:IsAlive() then if samgroup:IsAlive() then
-- switch off SAM -- switch off SAM
if self.UseEmOnOff then if self.UseEmOnOff then
@ -1035,7 +1035,7 @@ do
self:__GreenState(1,samgroup) self:__GreenState(1,samgroup)
self.SamStateTracker[name] = "GREEN" self.SamStateTracker[name] = "GREEN"
end end
if self.debug or self.verbose then if self.debug or self.verbose then
local text = string.format("SAM %s switched to alarm state GREEN!", name) local text = string.format("SAM %s switched to alarm state GREEN!", name)
local m=MESSAGE:New(text,10,"MANTIS"):ToAllIf(self.debug) local m=MESSAGE:New(text,10,"MANTIS"):ToAllIf(self.debug)
if self.verbose then self:I(self.lid..text) end if self.verbose then self:I(self.lid..text) end
@ -1044,8 +1044,8 @@ do
end --end check end --end check
end --for for loop end --for for loop
return self return self
end end
--- [Internal] Relocation relay function --- [Internal] Relocation relay function
-- @param #MANTIS self -- @param #MANTIS self
-- @return #MANTIS self -- @return #MANTIS self
@ -1054,7 +1054,7 @@ do
self:_RelocateGroups() self:_RelocateGroups()
return self return self
end end
--- [Internal] Check advanced state --- [Internal] Check advanced state
-- @param #MANTIS self -- @param #MANTIS self
-- @return #MANTIS self -- @return #MANTIS self
@ -1089,7 +1089,7 @@ do
end -- end newstate vs oldstate end -- end newstate vs oldstate
return self return self
end end
--- [Internal] Check DLink state --- [Internal] Check DLink state
-- @param #MANTIS self -- @param #MANTIS self
-- @return #MANTIS self -- @return #MANTIS self
@ -1103,7 +1103,7 @@ do
self:I(self.lid .. "Intel DLink not running - switching back to single detection!") self:I(self.lid .. "Intel DLink not running - switching back to single detection!")
end end
end end
--- [Internal] Function to set start state --- [Internal] Function to set start state
-- @param #MANTIS self -- @param #MANTIS self
-- @param #string From The From State -- @param #string From The From State
@ -1120,10 +1120,10 @@ do
if self.advAwacs then if self.advAwacs then
self.AWACS_Detection = self:StartAwacsDetection() self.AWACS_Detection = self:StartAwacsDetection()
end end
self:__Status(-math.random(1,10)) self:__Status(-math.random(1,10))
return self return self
end end
--- [Internal] Before status function for MANTIS --- [Internal] Before status function for MANTIS
-- @param #MANTIS self -- @param #MANTIS self
-- @param #string From The From State -- @param #string From The From State
@ -1141,7 +1141,7 @@ do
if self.advAwacs and not self.state2flag then if self.advAwacs and not self.state2flag then
self:_Check(self.AWACS_Detection) self:_Check(self.AWACS_Detection)
end end
-- relocate HQ and EWR -- relocate HQ and EWR
if self.autorelocate then if self.autorelocate then
local relointerval = self.relointerval local relointerval = self.relointerval
@ -1149,26 +1149,26 @@ do
local timepassed = thistime - self.TimeStamp local timepassed = thistime - self.TimeStamp
local halfintv = math.floor(timepassed / relointerval) local halfintv = math.floor(timepassed / relointerval)
--self:T({timepassed=timepassed, halfintv=halfintv}) --self:T({timepassed=timepassed, halfintv=halfintv})
if halfintv >= 1 then if halfintv >= 1 then
self.TimeStamp = timer.getAbsTime() self.TimeStamp = timer.getAbsTime()
self:_Relocate() self:_Relocate()
self:__Relocating(1) self:__Relocating(1)
end end
end end
-- advanced state check -- advanced state check
if self.advanced then if self.advanced then
self:_CheckAdvState() self:_CheckAdvState()
end end
-- check DLink state -- check DLink state
if self.DLink then if self.DLink then
self:_CheckDLinkState() self:_CheckDLinkState()
end end
return self return self
end end
@ -1191,7 +1191,7 @@ do
self:__Status(interval) self:__Status(interval)
return self return self
end end
--- [Internal] Function to stop MANTIS --- [Internal] Function to stop MANTIS
-- @param #MANTIS self -- @param #MANTIS self
-- @param #string From The From State -- @param #string From The From State
@ -1200,9 +1200,9 @@ do
-- @return #MANTIS self -- @return #MANTIS self
function MANTIS:onafterStop(From, Event, To) function MANTIS:onafterStop(From, Event, To)
self:T({From, Event, To}) self:T({From, Event, To})
return self return self
end end
--- [Internal] Function triggered by Event Relocating --- [Internal] Function triggered by Event Relocating
-- @param #MANTIS self -- @param #MANTIS self
-- @param #string From The From State -- @param #string From The From State
@ -1211,9 +1211,9 @@ do
-- @return #MANTIS self -- @return #MANTIS self
function MANTIS:onafterRelocating(From, Event, To) function MANTIS:onafterRelocating(From, Event, To)
self:T({From, Event, To}) self:T({From, Event, To})
return self return self
end end
--- [Internal] Function triggered by Event GreenState --- [Internal] Function triggered by Event GreenState
-- @param #MANTIS self -- @param #MANTIS self
-- @param #string From The From State -- @param #string From The From State
@ -1223,9 +1223,9 @@ do
-- @return #MANTIS self -- @return #MANTIS self
function MANTIS:onafterGreenState(From, Event, To, Group) function MANTIS:onafterGreenState(From, Event, To, Group)
self:T({From, Event, To, Group}) self:T({From, Event, To, Group})
return self return self
end end
--- [Internal] Function triggered by Event RedState --- [Internal] Function triggered by Event RedState
-- @param #MANTIS self -- @param #MANTIS self
-- @param #string From The From State -- @param #string From The From State
@ -1235,9 +1235,9 @@ do
-- @return #MANTIS self -- @return #MANTIS self
function MANTIS:onafterRedState(From, Event, To, Group) function MANTIS:onafterRedState(From, Event, To, Group)
self:T({From, Event, To, Group}) self:T({From, Event, To, Group})
return self return self
end end
--- [Internal] Function triggered by Event AdvStateChange --- [Internal] Function triggered by Event AdvStateChange
-- @param #MANTIS self -- @param #MANTIS self
-- @param #string From The From State -- @param #string From The From State
@ -1249,9 +1249,9 @@ do
-- @return #MANTIS self -- @return #MANTIS self
function MANTIS:onafterAdvStateChange(From, Event, To, Oldstate, Newstate, Interval) function MANTIS:onafterAdvStateChange(From, Event, To, Oldstate, Newstate, Interval)
self:T({From, Event, To, Oldstate, Newstate, Interval}) self:T({From, Event, To, Oldstate, Newstate, Interval})
return self return self
end end
--- [Internal] Function triggered by Event ShoradActivated --- [Internal] Function triggered by Event ShoradActivated
-- @param #MANTIS self -- @param #MANTIS self
-- @param #string From The From State -- @param #string From The From State
@ -1262,7 +1262,7 @@ do
-- @param #number Ontime Seconds the SHORAD will stay active -- @param #number Ontime Seconds the SHORAD will stay active
function MANTIS:onafterShoradActivated(From, Event, To, Name, Radius, Ontime) function MANTIS:onafterShoradActivated(From, Event, To, Name, Radius, Ontime)
self:T({From, Event, To, Name, Radius, Ontime}) self:T({From, Event, To, Name, Radius, Ontime})
return self return self
end end
end end
----------------------------------------------------------------------- -----------------------------------------------------------------------

View File

@ -1,28 +1,28 @@
--- **Functional** -- Train missile defence and deflection. --- **Functional** -- Train missile defence and deflection.
-- --
-- === -- ===
-- --
-- ## Features: -- ## Features:
-- --
-- * Track the missiles fired at you and other players, providing bearing and range information of the missiles towards the airplanes. -- * Track the missiles fired at you and other players, providing bearing and range information of the missiles towards the airplanes.
-- * Provide alerts of missile launches, including detailed information of the units launching, including bearing, range -- * Provide alerts of missile launches, including detailed information of the units launching, including bearing, range
-- * Provide alerts when a missile would have killed your aircraft. -- * Provide alerts when a missile would have killed your aircraft.
-- * Provide alerts when the missile self destructs. -- * Provide alerts when the missile self destructs.
-- * Enable / Disable and Configure the Missile Trainer using the various menu options. -- * Enable / Disable and Configure the Missile Trainer using the various menu options.
-- --
-- === -- ===
-- --
-- ## Missions: -- ## Missions:
-- --
-- [MIT - Missile Trainer](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/MIT%20-%20Missile%20Trainer) -- [MIT - Missile Trainer](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/MIT%20-%20Missile%20Trainer)
-- --
-- === -- ===
-- --
-- Uses the MOOSE messaging system to be alerted of any missiles fired, and when a missile would hit your aircraft, -- Uses the MOOSE messaging system to be alerted of any missiles fired, and when a missile would hit your aircraft,
-- the class will destroy the missile within a certain range, to avoid damage to your aircraft. -- the class will destroy the missile within a certain range, to avoid damage to your aircraft.
-- --
-- When running a mission where the missile trainer is used, the following radio menu structure ( 'Radio Menu' -> 'Other (F10)' -> 'MissileTrainer' ) options are available for the players: -- When running a mission where the missile trainer is used, the following radio menu structure ( 'Radio Menu' -> 'Other (F10)' -> 'MissileTrainer' ) options are available for the players:
-- --
-- * **Messages**: Menu to configure all messages. -- * **Messages**: Menu to configure all messages.
-- * **Messages On**: Show all messages. -- * **Messages On**: Show all messages.
-- * **Messages Off**: Disable all messages. -- * **Messages Off**: Disable all messages.
@ -45,23 +45,23 @@
-- * **Range Off**: Disable range information when a missile is fired to a target. -- * **Range Off**: Disable range information when a missile is fired to a target.
-- * **Bearing On**: Shows bearing information when a missile is fired to a target. -- * **Bearing On**: Shows bearing information when a missile is fired to a target.
-- * **Bearing Off**: Disable bearing information when a missile is fired to a target. -- * **Bearing Off**: Disable bearing information when a missile is fired to a target.
-- * **Distance**: Menu to configure the distance when a missile needs to be destroyed when near to a player, during tracking. This will improve/influence hit calculation accuracy, but has the risk of damaging the aircraft when the missile reaches the aircraft before the distance is measured. -- * **Distance**: Menu to configure the distance when a missile needs to be destroyed when near to a player, during tracking. This will improve/influence hit calculation accuracy, but has the risk of damaging the aircraft when the missile reaches the aircraft before the distance is measured.
-- * **50 meter**: Destroys the missile when the distance to the aircraft is below or equal to 50 meter. -- * **50 meter**: Destroys the missile when the distance to the aircraft is below or equal to 50 meter.
-- * **100 meter**: Destroys the missile when the distance to the aircraft is below or equal to 100 meter. -- * **100 meter**: Destroys the missile when the distance to the aircraft is below or equal to 100 meter.
-- * **150 meter**: Destroys the missile when the distance to the aircraft is below or equal to 150 meter. -- * **150 meter**: Destroys the missile when the distance to the aircraft is below or equal to 150 meter.
-- * **200 meter**: Destroys the missile when the distance to the aircraft is below or equal to 200 meter. -- * **200 meter**: Destroys the missile when the distance to the aircraft is below or equal to 200 meter.
-- --
-- === -- ===
-- --
-- ### Authors: **FlightControl** -- ### Authors: **FlightControl**
-- --
-- ### Contributions: -- ### Contributions:
-- --
-- * **Stuka (Danny)**: Who you can search on the Eagle Dynamics Forums. Working together with Danny has resulted in the MISSILETRAINER class. -- * **Stuka (Danny)**: Who you can search on the Eagle Dynamics Forums. Working together with Danny has resulted in the MISSILETRAINER class.
-- Danny has shared his ideas and together we made a design. -- Danny has shared his ideas and together we made a design.
-- Together with the **476 virtual team**, we tested the MISSILETRAINER class, and got much positive feedback! -- Together with the **476 virtual team**, we tested the MISSILETRAINER class, and got much positive feedback!
-- * **132nd Squadron**: Testing and optimizing the logic. -- * **132nd Squadron**: Testing and optimizing the logic.
-- --
-- === -- ===
-- --
-- @module Functional.MissileTrainer -- @module Functional.MissileTrainer
@ -76,7 +76,7 @@
--- ---
-- --
-- # Constructor: -- # Constructor:
-- --
-- Create a new MISSILETRAINER object with the @{#MISSILETRAINER.New} method: -- Create a new MISSILETRAINER object with the @{#MISSILETRAINER.New} method:
-- --
-- * @{#MISSILETRAINER.New}: Creates a new MISSILETRAINER object taking the maximum distance to your aircraft to evaluate when a missile needs to be destroyed. -- * @{#MISSILETRAINER.New}: Creates a new MISSILETRAINER object taking the maximum distance to your aircraft to evaluate when a missile needs to be destroyed.
@ -84,7 +84,7 @@
-- MISSILETRAINER will collect each unit declared in the mission with a skill level "Client" and "Player", and will monitor the missiles shot at those. -- MISSILETRAINER will collect each unit declared in the mission with a skill level "Client" and "Player", and will monitor the missiles shot at those.
-- --
-- # Initialization: -- # Initialization:
-- --
-- A MISSILETRAINER object will behave differently based on the usage of initialization methods: -- A MISSILETRAINER object will behave differently based on the usage of initialization methods:
-- --
-- * @{#MISSILETRAINER.InitMessagesOnOff}: Sets by default the display of any message to be ON or OFF. -- * @{#MISSILETRAINER.InitMessagesOnOff}: Sets by default the display of any message to be ON or OFF.
@ -97,8 +97,8 @@
-- * @{#MISSILETRAINER.InitRangeOnOff}: Sets by default the display of range information of missiles ON of OFF. -- * @{#MISSILETRAINER.InitRangeOnOff}: Sets by default the display of range information of missiles ON of OFF.
-- * @{#MISSILETRAINER.InitBearingOnOff}: Sets by default the display of bearing information of missiles ON of OFF. -- * @{#MISSILETRAINER.InitBearingOnOff}: Sets by default the display of bearing information of missiles ON of OFF.
-- * @{#MISSILETRAINER.InitMenusOnOff}: Allows to configure the options through the radio menu. -- * @{#MISSILETRAINER.InitMenusOnOff}: Allows to configure the options through the radio menu.
-- --
-- @field #MISSILETRAINER -- @field #MISSILETRAINER
MISSILETRAINER = { MISSILETRAINER = {
ClassName = "MISSILETRAINER", ClassName = "MISSILETRAINER",
TrackingMissiles = {}, TrackingMissiles = {},
@ -167,7 +167,7 @@ end
-- When a missile is fired a SCHEDULER is set off that follows the missile. When near a certain a client player, the missile will be destroyed. -- When a missile is fired a SCHEDULER is set off that follows the missile. When near a certain a client player, the missile will be destroyed.
-- @param #MISSILETRAINER self -- @param #MISSILETRAINER self
-- @param #number Distance The distance in meters when a tracked missile needs to be destroyed when close to a player. -- @param #number Distance The distance in meters when a tracked missile needs to be destroyed when close to a player.
-- @param #string Briefing (Optional) Will show a text to the players when starting their mission. Can be used for briefing purposes. -- @param #string Briefing (Optional) Will show a text to the players when starting their mission. Can be used for briefing purposes.
-- @return #MISSILETRAINER -- @return #MISSILETRAINER
function MISSILETRAINER:New( Distance, Briefing ) function MISSILETRAINER:New( Distance, Briefing )
local self = BASE:Inherit( self, BASE:New() ) local self = BASE:Inherit( self, BASE:New() )
@ -194,8 +194,8 @@ function MISSILETRAINER:New( Distance, Briefing )
-- self:F( "ForEach:" .. Client.UnitName ) -- self:F( "ForEach:" .. Client.UnitName )
-- Client:Alive( self._Alive, self ) -- Client:Alive( self._Alive, self )
-- end -- end
-- --
self.DBClients:ForEachClient( self.DBClients:ForEachClient(
function( Client ) function( Client )
self:F( "ForEach:" .. Client.UnitName ) self:F( "ForEach:" .. Client.UnitName )
Client:Alive( self._Alive, self ) Client:Alive( self._Alive, self )
@ -207,9 +207,9 @@ function MISSILETRAINER:New( Distance, Briefing )
-- self.DB:ForEachClient( -- self.DB:ForEachClient(
-- --- @param Wrapper.Client#CLIENT Client -- --- @param Wrapper.Client#CLIENT Client
-- function( Client ) -- function( Client )
-- --
-- ... actions ... -- ... actions ...
-- --
-- end -- end
-- ) -- )
@ -225,7 +225,7 @@ function MISSILETRAINER:New( Distance, Briefing )
self.DetailsRangeOnOff = true self.DetailsRangeOnOff = true
self.DetailsBearingOnOff = true self.DetailsBearingOnOff = true
self.MenusOnOff = true self.MenusOnOff = true
self.TrackingMissiles = {} self.TrackingMissiles = {}
@ -293,7 +293,7 @@ end
--- Increases, decreases the missile tracking message display frequency with the provided time interval in seconds. --- Increases, decreases the missile tracking message display frequency with the provided time interval in seconds.
-- The default frequency is a 3 second interval, so the Tracking Frequency parameter specifies the increase or decrease from the default 3 seconds or the last frequency update. -- The default frequency is a 3 second interval, so the Tracking Frequency parameter specifies the increase or decrease from the default 3 seconds or the last frequency update.
-- @param #MISSILETRAINER self -- @param #MISSILETRAINER self
-- @param #number TrackingFrequency Provide a negative or positive value in seconds to incraese or decrease the display frequency. -- @param #number TrackingFrequency Provide a negative or positive value in seconds to incraese or decrease the display frequency.
-- @return #MISSILETRAINER self -- @return #MISSILETRAINER self
function MISSILETRAINER:InitTrackingFrequency( TrackingFrequency ) function MISSILETRAINER:InitTrackingFrequency( TrackingFrequency )
self:F( TrackingFrequency ) self:F( TrackingFrequency )
@ -478,30 +478,30 @@ function MISSILETRAINER:OnEventShot( EVentData )
if TrainerTargetDCSUnit then if TrainerTargetDCSUnit then
local TrainerTargetDCSUnitName = Unit.getName( TrainerTargetDCSUnit ) local TrainerTargetDCSUnitName = Unit.getName( TrainerTargetDCSUnit )
local TrainerTargetSkill = _DATABASE.Templates.Units[TrainerTargetDCSUnitName].Template.skill local TrainerTargetSkill = _DATABASE.Templates.Units[TrainerTargetDCSUnitName].Template.skill
self:T(TrainerTargetDCSUnitName ) self:T(TrainerTargetDCSUnitName )
local Client = self.DBClients:FindClient( TrainerTargetDCSUnitName ) local Client = self.DBClients:FindClient( TrainerTargetDCSUnitName )
if Client then if Client then
local TrainerSourceUnit = UNIT:Find( TrainerSourceDCSUnit ) local TrainerSourceUnit = UNIT:Find( TrainerSourceDCSUnit )
local TrainerTargetUnit = UNIT:Find( TrainerTargetDCSUnit ) local TrainerTargetUnit = UNIT:Find( TrainerTargetDCSUnit )
if self.MessagesOnOff == true and self.AlertsLaunchesOnOff == true then if self.MessagesOnOff == true and self.AlertsLaunchesOnOff == true then
local Message = MESSAGE:New( local Message = MESSAGE:New(
string.format( "%s launched a %s", string.format( "%s launched a %s",
TrainerSourceUnit:GetTypeName(), TrainerSourceUnit:GetTypeName(),
TrainerWeaponName TrainerWeaponName
) .. self:_AddRange( Client, TrainerWeapon ) .. self:_AddBearing( Client, TrainerWeapon ), 5, "Launch Alert" ) ) .. self:_AddRange( Client, TrainerWeapon ) .. self:_AddBearing( Client, TrainerWeapon ), 5, "Launch Alert" )
if self.AlertsToAll then if self.AlertsToAll then
Message:ToAll() Message:ToAll()
else else
Message:ToClient( Client ) Message:ToClient( Client )
end end
end end
local ClientID = Client:GetID() local ClientID = Client:GetID()
self:T( ClientID ) self:T( ClientID )
local MissileData = {} local MissileData = {}
@ -579,52 +579,52 @@ function MISSILETRAINER:_TrackMissiles()
end end
-- ALERTS PART -- ALERTS PART
-- Loop for all Player Clients to check the alerts and deletion of missiles. -- Loop for all Player Clients to check the alerts and deletion of missiles.
for ClientDataID, ClientData in pairs( self.TrackingMissiles ) do for ClientDataID, ClientData in pairs( self.TrackingMissiles ) do
local Client = ClientData.Client local Client = ClientData.Client
if Client and Client:IsAlive() then if Client and Client:IsAlive() then
for MissileDataID, MissileData in pairs( ClientData.MissileData ) do for MissileDataID, MissileData in pairs( ClientData.MissileData ) do
self:T3( MissileDataID ) self:T3( MissileDataID )
local TrainerSourceUnit = MissileData.TrainerSourceUnit local TrainerSourceUnit = MissileData.TrainerSourceUnit
local TrainerWeapon = MissileData.TrainerWeapon local TrainerWeapon = MissileData.TrainerWeapon
local TrainerTargetUnit = MissileData.TrainerTargetUnit local TrainerTargetUnit = MissileData.TrainerTargetUnit
local TrainerWeaponTypeName = MissileData.TrainerWeaponTypeName local TrainerWeaponTypeName = MissileData.TrainerWeaponTypeName
local TrainerWeaponLaunched = MissileData.TrainerWeaponLaunched local TrainerWeaponLaunched = MissileData.TrainerWeaponLaunched
if Client and Client:IsAlive() and TrainerSourceUnit and TrainerSourceUnit:IsAlive() and TrainerWeapon and TrainerWeapon:isExist() and TrainerTargetUnit and TrainerTargetUnit:IsAlive() then if Client and Client:IsAlive() and TrainerSourceUnit and TrainerSourceUnit:IsAlive() and TrainerWeapon and TrainerWeapon:isExist() and TrainerTargetUnit and TrainerTargetUnit:IsAlive() then
local PositionMissile = TrainerWeapon:getPosition().p local PositionMissile = TrainerWeapon:getPosition().p
local TargetVec3 = Client:GetVec3() local TargetVec3 = Client:GetVec3()
local Distance = ( ( PositionMissile.x - TargetVec3.x )^2 + local Distance = ( ( PositionMissile.x - TargetVec3.x )^2 +
( PositionMissile.y - TargetVec3.y )^2 + ( PositionMissile.y - TargetVec3.y )^2 +
( PositionMissile.z - TargetVec3.z )^2 ( PositionMissile.z - TargetVec3.z )^2
) ^ 0.5 / 1000 ) ^ 0.5 / 1000
if Distance <= self.Distance then if Distance <= self.Distance then
-- Hit alert -- Hit alert
TrainerWeapon:destroy() TrainerWeapon:destroy()
if self.MessagesOnOff == true and self.AlertsHitsOnOff == true then if self.MessagesOnOff == true and self.AlertsHitsOnOff == true then
self:T( "killed" ) self:T( "killed" )
local Message = MESSAGE:New( local Message = MESSAGE:New(
string.format( "%s launched by %s killed %s", string.format( "%s launched by %s killed %s",
TrainerWeapon:getTypeName(), TrainerWeapon:getTypeName(),
TrainerSourceUnit:GetTypeName(), TrainerSourceUnit:GetTypeName(),
TrainerTargetUnit:GetPlayerName() TrainerTargetUnit:GetPlayerName()
), 15, "Hit Alert" ) ), 15, "Hit Alert" )
if self.AlertsToAll == true then if self.AlertsToAll == true then
Message:ToAll() Message:ToAll()
else else
Message:ToClient( Client ) Message:ToClient( Client )
end end
MissileData = nil MissileData = nil
table.remove( ClientData.MissileData, MissileDataID ) table.remove( ClientData.MissileData, MissileDataID )
self:T(ClientData.MissileData) self:T(ClientData.MissileData)
@ -639,7 +639,7 @@ function MISSILETRAINER:_TrackMissiles()
TrainerWeaponTypeName, TrainerWeaponTypeName,
TrainerSourceUnit:GetTypeName() TrainerSourceUnit:GetTypeName()
), 5, "Tracking" ) ), 5, "Tracking" )
if self.AlertsToAll == true then if self.AlertsToAll == true then
Message:ToAll() Message:ToAll()
else else
@ -660,41 +660,41 @@ function MISSILETRAINER:_TrackMissiles()
if ShowMessages == true and self.MessagesOnOff == true and self.TrackingOnOff == true then -- Only do this when tracking information needs to be displayed. if ShowMessages == true and self.MessagesOnOff == true and self.TrackingOnOff == true then -- Only do this when tracking information needs to be displayed.
-- TRACKING PART -- TRACKING PART
-- For the current client, the missile range and bearing details are displayed To the Player Client. -- For the current client, the missile range and bearing details are displayed To the Player Client.
-- For the other clients, the missile range and bearing details are displayed To the other Player Clients. -- For the other clients, the missile range and bearing details are displayed To the other Player Clients.
-- To achieve this, a cross loop is done for each Player Client <-> Other Player Client missile information. -- To achieve this, a cross loop is done for each Player Client <-> Other Player Client missile information.
-- Main Player Client loop -- Main Player Client loop
for ClientDataID, ClientData in pairs( self.TrackingMissiles ) do for ClientDataID, ClientData in pairs( self.TrackingMissiles ) do
local Client = ClientData.Client local Client = ClientData.Client
--self:T2( { Client:GetName() } ) --self:T2( { Client:GetName() } )
ClientData.MessageToClient = "" ClientData.MessageToClient = ""
ClientData.MessageToAll = "" ClientData.MessageToAll = ""
-- Other Players Client loop -- Other Players Client loop
for TrackingDataID, TrackingData in pairs( self.TrackingMissiles ) do for TrackingDataID, TrackingData in pairs( self.TrackingMissiles ) do
for MissileDataID, MissileData in pairs( TrackingData.MissileData ) do for MissileDataID, MissileData in pairs( TrackingData.MissileData ) do
--self:T3( MissileDataID ) --self:T3( MissileDataID )
local TrainerSourceUnit = MissileData.TrainerSourceUnit local TrainerSourceUnit = MissileData.TrainerSourceUnit
local TrainerWeapon = MissileData.TrainerWeapon local TrainerWeapon = MissileData.TrainerWeapon
local TrainerTargetUnit = MissileData.TrainerTargetUnit local TrainerTargetUnit = MissileData.TrainerTargetUnit
local TrainerWeaponTypeName = MissileData.TrainerWeaponTypeName local TrainerWeaponTypeName = MissileData.TrainerWeaponTypeName
local TrainerWeaponLaunched = MissileData.TrainerWeaponLaunched local TrainerWeaponLaunched = MissileData.TrainerWeaponLaunched
if Client and Client:IsAlive() and TrainerSourceUnit and TrainerSourceUnit:IsAlive() and TrainerWeapon and TrainerWeapon:isExist() and TrainerTargetUnit and TrainerTargetUnit:IsAlive() then if Client and Client:IsAlive() and TrainerSourceUnit and TrainerSourceUnit:IsAlive() and TrainerWeapon and TrainerWeapon:isExist() and TrainerTargetUnit and TrainerTargetUnit:IsAlive() then
if ShowMessages == true then if ShowMessages == true then
local TrackingTo local TrackingTo
TrackingTo = string.format( " -> %s", TrackingTo = string.format( " -> %s",
TrainerWeaponTypeName TrainerWeaponTypeName
) )
if ClientDataID == TrackingDataID then if ClientDataID == TrackingDataID then
if ClientData.MessageToClient == "" then if ClientData.MessageToClient == "" then
ClientData.MessageToClient = "Missiles to You:\n" ClientData.MessageToClient = "Missiles to You:\n"
@ -712,7 +712,7 @@ function MISSILETRAINER:_TrackMissiles()
end end
end end
end end
-- Once the Player Client and the Other Player Client tracking messages are prepared, show them. -- Once the Player Client and the Other Player Client tracking messages are prepared, show them.
if ClientData.MessageToClient ~= "" or ClientData.MessageToAll ~= "" then if ClientData.MessageToClient ~= "" or ClientData.MessageToAll ~= "" then
local Message = MESSAGE:New( ClientData.MessageToClient .. ClientData.MessageToAll, 1, "Tracking" ):ToClient( Client ) local Message = MESSAGE:New( ClientData.MessageToClient .. ClientData.MessageToAll, 1, "Tracking" ):ToClient( Client )

File diff suppressed because it is too large Load Diff

View File

@ -32,7 +32,9 @@
-- --
-- === -- ===
-- --
-- ## Missions: Example missions will be added later. -- ## Missions:
--
-- * [MAR - On the Range - MOOSE - SC](https://www.digitalcombatsimulator.com/en/files/3317765/) by shagrat
-- --
-- === -- ===
-- --

View File

@ -1,52 +1,52 @@
--- **Functional** -- Make SAM sites execute evasive and defensive behaviour when being fired upon. --- **Functional** -- Make SAM sites execute evasive and defensive behaviour when being fired upon.
-- --
-- === -- ===
-- --
-- ## Features: -- ## Features:
-- --
-- * When SAM sites are being fired upon, the SAMs will take evasive action will reposition themselves when possible. -- * When SAM sites are being fired upon, the SAMs will take evasive action will reposition themselves when possible.
-- * When SAM sites are being fired upon, the SAMs will take defensive action by shutting down their radars. -- * When SAM sites are being fired upon, the SAMs will take defensive action by shutting down their radars.
-- --
-- === -- ===
-- --
-- ## Missions: -- ## Missions:
-- --
-- [SEV - SEAD Evasion](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SEV%20-%20SEAD%20Evasion) -- [SEV - SEAD Evasion](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SEV%20-%20SEAD%20Evasion)
-- --
-- === -- ===
-- --
-- ### Authors: **FlightControl**, **applevangelist** -- ### Authors: **FlightControl**, **applevangelist**
-- --
-- Last Update: Aug 2021 -- Last Update: Aug 2021
-- --
-- === -- ===
-- --
-- @module Functional.Sead -- @module Functional.Sead
-- @image SEAD.JPG -- @image SEAD.JPG
--- ---
-- @type SEAD -- @type SEAD
-- @extends Core.Base#BASE -- @extends Core.Base#BASE
--- Make SAM sites execute evasive and defensive behaviour when being fired upon. --- Make SAM sites execute evasive and defensive behaviour when being fired upon.
-- --
-- This class is very easy to use. Just setup a SEAD object by using @{#SEAD.New}() and SAMs will evade and take defensive action when being fired upon. -- This class is very easy to use. Just setup a SEAD object by using @{#SEAD.New}() and SAMs will evade and take defensive action when being fired upon.
-- --
-- # Constructor: -- # Constructor:
-- --
-- Use the @{#SEAD.New}() constructor to create a new SEAD object. -- Use the @{#SEAD.New}() constructor to create a new SEAD object.
-- --
-- SEAD_RU_SAM_Defenses = SEAD:New( { 'RU SA-6 Kub', 'RU SA-6 Defenses', 'RU MI-26 Troops', 'RU Attack Gori' } ) -- SEAD_RU_SAM_Defenses = SEAD:New( { 'RU SA-6 Kub', 'RU SA-6 Defenses', 'RU MI-26 Troops', 'RU Attack Gori' } )
-- --
-- @field #SEAD -- @field #SEAD
SEAD = { SEAD = {
ClassName = "SEAD", ClassName = "SEAD",
TargetSkill = { TargetSkill = {
Average = { Evade = 30, DelayOn = { 40, 60 } } , Average = { Evade = 30, DelayOn = { 40, 60 } } ,
Good = { Evade = 20, DelayOn = { 30, 50 } } , Good = { Evade = 20, DelayOn = { 30, 50 } } ,
High = { Evade = 15, DelayOn = { 20, 40 } } , High = { Evade = 15, DelayOn = { 20, 40 } } ,
Excellent = { Evade = 10, DelayOn = { 10, 30 } } Excellent = { Evade = 10, DelayOn = { 10, 30 } }
}, },
SEADGroupPrefixes = {}, SEADGroupPrefixes = {},
SuppressedGroups = {}, SuppressedGroups = {},
EngagementRange = 75, -- default 75% engagement range Feature Request #1355 EngagementRange = 75, -- default 75% engagement range Feature Request #1355
@ -69,7 +69,7 @@ SEAD = {
["X_31"] = "X_31", ["X_31"] = "X_31",
["Kh25"] = "Kh25", ["Kh25"] = "Kh25",
} }
--- Missile enumerators - from DCS ME and Wikipedia --- Missile enumerators - from DCS ME and Wikipedia
-- @field HarmData -- @field HarmData
SEAD.HarmData = { SEAD.HarmData = {
@ -86,7 +86,7 @@ SEAD = {
["X_31"] = {150, 3}, ["X_31"] = {150, 3},
["Kh25"] = {25, 0.8}, ["Kh25"] = {25, 0.8},
} }
--- Creates the main object which is handling defensive actions for SA sites or moving SA vehicles. --- Creates the main object which is handling defensive actions for SA sites or moving SA vehicles.
-- When an anti radiation missile is fired (KH-58, KH-31P, KH-31A, KH-25MPU, HARM missiles), the SA will shut down their radars and will take evasive actions... -- When an anti radiation missile is fired (KH-58, KH-31P, KH-31A, KH-25MPU, HARM missiles), the SA will shut down their radars and will take evasive actions...
-- Chances are big that the missile will miss. -- Chances are big that the missile will miss.
@ -102,7 +102,7 @@ function SEAD:New( SEADGroupPrefixes, Padding )
local self = BASE:Inherit( self, BASE:New() ) local self = BASE:Inherit( self, BASE:New() )
self:F( SEADGroupPrefixes ) self:F( SEADGroupPrefixes )
if type( SEADGroupPrefixes ) == 'table' then if type( SEADGroupPrefixes ) == 'table' then
for SEADGroupPrefixID, SEADGroupPrefix in pairs( SEADGroupPrefixes ) do for SEADGroupPrefixID, SEADGroupPrefix in pairs( SEADGroupPrefixes ) do
self.SEADGroupPrefixes[SEADGroupPrefix] = SEADGroupPrefix self.SEADGroupPrefixes[SEADGroupPrefix] = SEADGroupPrefix
@ -110,13 +110,13 @@ function SEAD:New( SEADGroupPrefixes, Padding )
else else
self.SEADGroupPrefixes[SEADGroupPrefixes] = SEADGroupPrefixes self.SEADGroupPrefixes[SEADGroupPrefixes] = SEADGroupPrefixes
end end
local padding = Padding or 10 local padding = Padding or 10
if padding < 10 then padding = 10 end if padding < 10 then padding = 10 end
self.Padding = padding self.Padding = padding
self:HandleEvent( EVENTS.Shot, self.HandleEventShot ) self:HandleEvent( EVENTS.Shot, self.HandleEventShot )
self:I("*** SEAD - Started Version 0.3.1") self:I("*** SEAD - Started Version 0.3.1")
return self return self
end end
@ -128,7 +128,7 @@ end
function SEAD:UpdateSet( SEADGroupPrefixes ) function SEAD:UpdateSet( SEADGroupPrefixes )
self:T( SEADGroupPrefixes ) self:T( SEADGroupPrefixes )
if type( SEADGroupPrefixes ) == 'table' then if type( SEADGroupPrefixes ) == 'table' then
for SEADGroupPrefixID, SEADGroupPrefix in pairs( SEADGroupPrefixes ) do for SEADGroupPrefixID, SEADGroupPrefix in pairs( SEADGroupPrefixes ) do
self.SEADGroupPrefixes[SEADGroupPrefix] = SEADGroupPrefix self.SEADGroupPrefixes[SEADGroupPrefix] = SEADGroupPrefix
@ -177,9 +177,9 @@ end
local hit = false local hit = false
local name = "" local name = ""
for _,_name in pairs (SEAD.Harms) do for _,_name in pairs (SEAD.Harms) do
if string.find(WeaponName,_name,1) then if string.find(WeaponName,_name,1) then
hit = true hit = true
name = _name name = _name
break break
end end
end end
@ -212,7 +212,7 @@ end
return -1 return -1
end end
end end
--- Detects if an SAM site was shot with an anti radiation missile. In this case, take evasive actions based on the skill level set within the ME. --- Detects if an SAM site was shot with an anti radiation missile. In this case, take evasive actions based on the skill level set within the ME.
-- @see SEAD -- @see SEAD
-- @param #SEAD -- @param #SEAD
@ -229,7 +229,7 @@ function SEAD:HandleEventShot( EventData )
self:T( "*** SEAD - Missile Launched = " .. SEADWeaponName) self:T( "*** SEAD - Missile Launched = " .. SEADWeaponName)
--self:T({ SEADWeapon }) --self:T({ SEADWeapon })
if self:_CheckHarms(SEADWeaponName) then if self:_CheckHarms(SEADWeaponName) then
self:T( '*** SEAD - Weapon Match' ) self:T( '*** SEAD - Weapon Match' )
local _targetskill = "Random" local _targetskill = "Random"
@ -253,7 +253,7 @@ function SEAD:HandleEventShot( EventData )
self:T( '*** SEAD - Group Match Found' ) self:T( '*** SEAD - Group Match Found' )
break break
end end
end end
if SEADGroupFound == true then -- yes we are being attacked if SEADGroupFound == true then -- yes we are being attacked
if _targetskill == "Random" then -- when skill is random, choose a skill if _targetskill == "Random" then -- when skill is random, choose a skill
local Skills = { "Average", "Good", "High", "Excellent" } local Skills = { "Average", "Good", "High", "Excellent" }
@ -284,19 +284,19 @@ function SEAD:HandleEventShot( EventData )
else else
_distance = 0 _distance = 0
end end
self:T( string.format("*** SEAD - target skill %s, distance %dkm, reach %dkm, tti %dsec", _targetskill, _distance,reach,_tti )) self:T( string.format("*** SEAD - target skill %s, distance %dkm, reach %dkm, tti %dsec", _targetskill, _distance,reach,_tti ))
if reach >= _distance then if reach >= _distance then
self:T("*** SEAD - Shot in Reach") self:T("*** SEAD - Shot in Reach")
local function SuppressionStart(args) local function SuppressionStart(args)
self:T(string.format("*** SEAD - %s Radar Off & Relocating",args[2])) self:T(string.format("*** SEAD - %s Radar Off & Relocating",args[2]))
local grp = args[1] -- Wrapper.Group#GROUP local grp = args[1] -- Wrapper.Group#GROUP
grp:OptionAlarmStateGreen() grp:OptionAlarmStateGreen()
grp:RelocateGroundRandomInRadius(20,300,false,false,"Diamond") grp:RelocateGroundRandomInRadius(20,300,false,false,"Diamond")
end end
local function SuppressionStop(args) local function SuppressionStop(args)
self:T(string.format("*** SEAD - %s Radar On",args[2])) self:T(string.format("*** SEAD - %s Radar On",args[2]))
local grp = args[1] -- Wrapper.Group#GROUP local grp = args[1] -- Wrapper.Group#GROUP
@ -304,22 +304,22 @@ function SEAD:HandleEventShot( EventData )
grp:OptionEngageRange(self.EngagementRange) grp:OptionEngageRange(self.EngagementRange)
self.SuppressedGroups[args[2]] = false self.SuppressedGroups[args[2]] = false
end end
-- randomize switch-on time -- randomize switch-on time
local delay = math.random(self.TargetSkill[_targetskill].DelayOn[1], self.TargetSkill[_targetskill].DelayOn[2]) local delay = math.random(self.TargetSkill[_targetskill].DelayOn[1], self.TargetSkill[_targetskill].DelayOn[2])
if delay > _tti then delay = delay / 2 end -- speed up if delay > _tti then delay = delay / 2 end -- speed up
if _tti > (3*delay) then delay = (_tti / 2) * 0.9 end -- shot from afar if _tti > (3*delay) then delay = (_tti / 2) * 0.9 end -- shot from afar
local SuppressionStartTime = timer.getTime() + delay local SuppressionStartTime = timer.getTime() + delay
local SuppressionEndTime = timer.getTime() + _tti + self.Padding local SuppressionEndTime = timer.getTime() + _tti + self.Padding
if not self.SuppressedGroups[_targetgroupname] then if not self.SuppressedGroups[_targetgroupname] then
self:T(string.format("*** SEAD - %s | Parameters TTI %ds | Switch-Off in %ds",_targetgroupname,_tti,delay)) self:T(string.format("*** SEAD - %s | Parameters TTI %ds | Switch-Off in %ds",_targetgroupname,_tti,delay))
timer.scheduleFunction(SuppressionStart,{_targetgroup,_targetgroupname},SuppressionStartTime) timer.scheduleFunction(SuppressionStart,{_targetgroup,_targetgroupname},SuppressionStartTime)
timer.scheduleFunction(SuppressionStop,{_targetgroup,_targetgroupname},SuppressionEndTime) timer.scheduleFunction(SuppressionStop,{_targetgroup,_targetgroupname},SuppressionEndTime)
self.SuppressedGroups[_targetgroupname] = true self.SuppressedGroups[_targetgroupname] = true
end end
end end
end end
end end

View File

@ -32,6 +32,8 @@
-- * [USS George Washington](https://en.wikipedia.org/wiki/USS_George_Washington_(CVN-73)) (CVN-73) [Super Carrier Module] -- * [USS George Washington](https://en.wikipedia.org/wiki/USS_George_Washington_(CVN-73)) (CVN-73) [Super Carrier Module]
-- * [USS Harry S. Truman](https://en.wikipedia.org/wiki/USS_Harry_S._Truman) (CVN-75) [Super Carrier Module] -- * [USS Harry S. Truman](https://en.wikipedia.org/wiki/USS_Harry_S._Truman) (CVN-75) [Super Carrier Module]
-- * [USS Tarawa](https://en.wikipedia.org/wiki/USS_Tarawa_(LHA-1)) (LHA-1) [**WIP**] -- * [USS Tarawa](https://en.wikipedia.org/wiki/USS_Tarawa_(LHA-1)) (LHA-1) [**WIP**]
-- * [USS America](https://en.wikipedia.org/wiki/USS_America_(LHA-6)) (LHA-6) [**WIP**]
-- * [Juan Carlos I](https://en.wikipedia.org/wiki/Spanish_amphibious_assault_ship_Juan_Carlos_I) (L61) [**WIP**]
-- --
-- **Supported Aircraft:** -- **Supported Aircraft:**
-- --
@ -48,8 +50,8 @@
-- --
-- At the moment, optimized parameters are available for the F/A-18C Hornet (Lot 20) and A-4E community mod as aircraft and the USS John C. Stennis as carrier. -- At the moment, optimized parameters are available for the F/A-18C Hornet (Lot 20) and A-4E community mod as aircraft and the USS John C. Stennis as carrier.
-- --
-- The AV-8B Harrier and the USS Tarawa are WIP. Those two can only be used together, i.e. the Tarawa is the only carrier the harrier is supposed to land on and -- The AV-8B Harrier, the USS Tarawa, USS America and Juan Carlos I are WIP. The AV-8B harrier and the LHA's and LHD can only be used together, i.e. these ships are the only carriers the harrier is supposed to land on and
-- the no other fixed wing aircraft (human or AI controlled) are supposed to land on the Tarawa. Currently only Case I is supported. Case II/III take slightly steps from the CVN carrier. -- no other fixed wing aircraft (human or AI controlled) are supposed to land on these ships. Currently only Case I is supported. Case II/III take slightly different steps from the CVN carrier.
-- However, the two Case II/III pattern are very similar so this is not a big drawback. -- However, the two Case II/III pattern are very similar so this is not a big drawback.
-- --
-- Heatblur's mighty F-14B Tomcat has been added (March 13th 2019) as well. Same goes for the A version. -- Heatblur's mighty F-14B Tomcat has been added (March 13th 2019) as well. Same goes for the A version.
@ -102,12 +104,13 @@
-- ### Wags DCS Hornet Videos: -- ### Wags DCS Hornet Videos:
-- --
-- * [DCS: F/A-18C Hornet - Episode 9: CASE I Carrier Landing](https://www.youtube.com/watch?v=TuigBLhtAH8) -- * [DCS: F/A-18C Hornet - Episode 9: CASE I Carrier Landing](https://www.youtube.com/watch?v=TuigBLhtAH8)
-- * [DCS: F/A-18C Hornet Episode 16: CASE III Introduction](https://www.youtube.com/watch?v=DvlMHnLjbDQ) -- * [DCS: F/A-18C Hornet – Episode 16: CASE III Introduction](https://www.youtube.com/watch?v=DvlMHnLjbDQ)
-- * [DCS: F/A-18C Hornet Case I Carrier Landing Training Lesson Recording](https://www.youtube.com/watch?v=D33uM9q4xgA) -- * [DCS: F/A-18C Hornet Case I Carrier Landing Training Lesson Recording](https://www.youtube.com/watch?v=D33uM9q4xgA)
-- --
-- ### AV-8B Harrier at USS Tarawa -- ### AV-8B Harrier at USS Tarawa
-- --
-- * [Harrier Ship Landing Mission with Auto LSO!](https://www.youtube.com/watch?v=lqmVvpunk2c) -- * [Harrier Ship Landing Mission with Auto LSO!](https://www.youtube.com/watch?v=lqmVvpunk2c)
-- * [Harrier Practice pattern USS America](https://youtu.be/99NigITYmcI)
-- --
-- === -- ===
-- --
@ -295,6 +298,8 @@
-- ![Banner Image](..\Presentations\AIRBOSS\Airboss_Case1_Landing.png) -- ![Banner Image](..\Presentations\AIRBOSS\Airboss_Case1_Landing.png)
-- --
-- Once the aircraft reaches the Initial, the landing pattern begins. The important steps of the pattern are shown in the image above. -- Once the aircraft reaches the Initial, the landing pattern begins. The important steps of the pattern are shown in the image above.
-- The AV-8B Harrier pattern is very similar, the only differences are as there is no angled deck there is no wake check. from the ninety you wil fly a straight approach offset 26 ft to port (left) of the tram line.
-- The aim is to arrive abeam the landing spot in a stable hover at 120 ft with forward speed matched to the boat. From there the LSO will call "cleared to land". You then level cross to the tram line at the designated landing spot at land vertcally.
-- --
-- --
-- ## CASE III -- ## CASE III
@ -919,9 +924,9 @@
-- --
-- ## Sound Packs -- ## Sound Packs
-- --
-- The AIRBOSS currently has two different "sound packs" for both LSO and Marshal radios. These contain voice overs by different actors. -- The AIRBOSS currently has two different "sound packs" for LSO and three different "sound Packs" for Marshal radios. These contain voice overs by different actors.
-- These can be set by @{#AIRBOSS.SetVoiceOversLSOByRaynor}() and @{#AIRBOSS.SetVoiceOversMarshalByRaynor}(). These are the default settings. -- These can be set by @{#AIRBOSS.SetVoiceOversLSOByRaynor}() and @{#AIRBOSS.SetVoiceOversMarshalByRaynor}(). These are the default settings.
-- The other sound files can be set by @{#AIRBOSS.SetVoiceOversLSOByFF}() and @{#AIRBOSS.SetVoiceOversMarshalByFF}(). -- The other sound files can be set by @{#AIRBOSS.SetVoiceOversLSOByFF}(), @{#AIRBOSS.SetVoiceOversMarshalByGabriella}() and @{#AIRBOSS.SetVoiceOversMarshalByFF}().
-- Also combinations can be used, e.g. -- Also combinations can be used, e.g.
-- --
-- airbossStennis:SetVoiceOversLSOByFF() -- airbossStennis:SetVoiceOversLSOByFF()
@ -1256,7 +1261,7 @@ AIRBOSS = {
--- Aircraft types capable of landing on carrier (human+AI). --- Aircraft types capable of landing on carrier (human+AI).
-- @type AIRBOSS.AircraftCarrier -- @type AIRBOSS.AircraftCarrier
-- @field #string AV8B AV-8B Night Harrier. Works only with the USS Tarawa. -- @field #string AV8B AV-8B Night Harrier. Works only with the USS Tarawa, USS America and Juan Carlos I.
-- @field #string A4EC A-4E Community mod. -- @field #string A4EC A-4E Community mod.
-- @field #string HORNET F/A-18C Lot 20 Hornet by Eagle Dynamics. -- @field #string HORNET F/A-18C Lot 20 Hornet by Eagle Dynamics.
-- @field #string F14A F-14A by Heatblur. -- @field #string F14A F-14A by Heatblur.
@ -1292,6 +1297,8 @@ AIRBOSS.AircraftCarrier={
-- @field #string TRUMAN USS Harry S. Truman (CVN-75) [Super Carrier Module] -- @field #string TRUMAN USS Harry S. Truman (CVN-75) [Super Carrier Module]
-- @field #string VINSON USS Carl Vinson (CVN-70) [Obsolete] -- @field #string VINSON USS Carl Vinson (CVN-70) [Obsolete]
-- @field #string TARAWA USS Tarawa (LHA-1) -- @field #string TARAWA USS Tarawa (LHA-1)
-- @field #string AMERICA USS America (LHA-6)
-- @field #string JCARLOS Juan Carlos I (L61)
-- @field #string KUZNETSOV Admiral Kuznetsov (CV 1143.5) -- @field #string KUZNETSOV Admiral Kuznetsov (CV 1143.5)
AIRBOSS.CarrierType={ AIRBOSS.CarrierType={
ROOSEVELT="CVN_71", ROOSEVELT="CVN_71",
@ -1301,6 +1308,8 @@ AIRBOSS.CarrierType={
STENNIS="Stennis", STENNIS="Stennis",
VINSON="VINSON", VINSON="VINSON",
TARAWA="LHA_Tarawa", TARAWA="LHA_Tarawa",
AMERICA="USS America LHA-6",
JCARLOS="L61",
KUZNETSOV="KUZNECOW", KUZNETSOV="KUZNECOW",
} }
@ -1420,8 +1429,8 @@ AIRBOSS.PatternStep={
-- @field #string IM "IM": In the middle. -- @field #string IM "IM": In the middle.
-- @field #string IC "IC": In close. -- @field #string IC "IC": In close.
-- @field #string AR "AR": At the ramp. -- @field #string AR "AR": At the ramp.
-- @field #string AL "AL": Abeam landing position (Tarawa). -- @field #string AL "AL": Abeam landing position (V/STOL).
-- @field #string LC "LC": Level crossing (Tarawa). -- @field #string LC "LC": Level crossing (V/STOL).
-- @field #string IW "IW": In the wires. -- @field #string IW "IW": In the wires.
AIRBOSS.GroovePos={ AIRBOSS.GroovePos={
X0="X0", X0="X0",
@ -1486,6 +1495,7 @@ AIRBOSS.GroovePos={
-- @field #AIRBOSS.RadioCall DEPARTANDREENTER "Depart and re-enter" call. -- @field #AIRBOSS.RadioCall DEPARTANDREENTER "Depart and re-enter" call.
-- @field #AIRBOSS.RadioCall EXPECTHEAVYWAVEOFF "Expect heavy wavoff" call. -- @field #AIRBOSS.RadioCall EXPECTHEAVYWAVEOFF "Expect heavy wavoff" call.
-- @field #AIRBOSS.RadioCall EXPECTSPOT75 "Expect spot 7.5" call. -- @field #AIRBOSS.RadioCall EXPECTSPOT75 "Expect spot 7.5" call.
-- @field #AIRBOSS.RadioCall EXPECTSPOT5 "Expect spot 5" call.
-- @field #AIRBOSS.RadioCall FAST "You're fast" call. -- @field #AIRBOSS.RadioCall FAST "You're fast" call.
-- @field #AIRBOSS.RadioCall FOULDECK "Foul Deck" call. -- @field #AIRBOSS.RadioCall FOULDECK "Foul Deck" call.
-- @field #AIRBOSS.RadioCall HIGH "You're high" call. -- @field #AIRBOSS.RadioCall HIGH "You're high" call.
@ -1970,6 +1980,12 @@ function AIRBOSS:New(carriername, alias)
elseif self.carriertype==AIRBOSS.CarrierType.TARAWA then elseif self.carriertype==AIRBOSS.CarrierType.TARAWA then
-- Tarawa parameters. -- Tarawa parameters.
self:_InitTarawa() self:_InitTarawa()
elseif self.carriertype==AIRBOSS.CarrierType.AMERICA then
-- Use America parameters.
self:_InitAmerica()
elseif self.carriertype==AIRBOSS.CarrierType.JCARLOS then
-- Use Juan Carlos parameters.
self:_InitJcarlos()
elseif self.carriertype==AIRBOSS.CarrierType.KUZNETSOV then elseif self.carriertype==AIRBOSS.CarrierType.KUZNETSOV then
-- Kusnetsov parameters - maybe... -- Kusnetsov parameters - maybe...
self:_InitStennis() self:_InitStennis()
@ -2061,7 +2077,7 @@ function AIRBOSS:New(carriername, alias)
-- Carrier specific. -- Carrier specific.
if self.carrier:GetTypeName()~=AIRBOSS.CarrierType.TARAWA then if self.carrier:GetTypeName()~=AIRBOSS.CarrierType.TARAWA or self.carrier:GetTypeName()~=AIRBOSS.CarrierType.AMERICA or self.carrier:GetTypeName()~=AIRBOSS.CarrierType.JCARLOS then
-- Flare wires. -- Flare wires.
local w1=stern:Translate(self.carrierparam.wire1, FB) local w1=stern:Translate(self.carrierparam.wire1, FB)
@ -2834,7 +2850,7 @@ function AIRBOSS:SetLineupErrorThresholds(_max,_min, Left, LeftMed, LEFT, Right,
self.lue.LeftMed=LeftMed or -2.0 self.lue.LeftMed=LeftMed or -2.0
self.lue.LEFT=LEFT or -3.0 self.lue.LEFT=LEFT or -3.0
self.lue.Right=Right or 1.0 self.lue.Right=Right or 1.0
self.lue.RightMed=RightMed or 2.0 self.lue.RightMed=RightMed or 2.0
self.lue.RIGHT=RIGHT or 3.0 self.lue.RIGHT=RIGHT or 3.0
return self return self
end end
@ -4401,6 +4417,85 @@ function AIRBOSS:_InitTarawa()
end end
--- Init parameters for LHA-6 America carrier.
-- @param #AIRBOSS self
function AIRBOSS:_InitAmerica()
-- Init Stennis as default.
self:_InitStennis()
-- Carrier Parameters.
self.carrierparam.sterndist =-125
self.carrierparam.deckheight = 20 --67 ft
-- Total size of the carrier (approx as rectangle).
self.carrierparam.totlength=257
self.carrierparam.totwidthport=11
self.carrierparam.totwidthstarboard=25
-- Landing runway.
self.carrierparam.rwyangle = 0
self.carrierparam.rwylength = 240
self.carrierparam.rwywidth = 15
-- Wires.
self.carrierparam.wire1=nil
self.carrierparam.wire2=nil
self.carrierparam.wire3=nil
self.carrierparam.wire4=nil
-- Late break.
self.BreakLate.name="Late Break"
self.BreakLate.Xmin=-UTILS.NMToMeters(1) -- Not more than 1 NM behind the boat. Last check was at 0.
self.BreakLate.Xmax= UTILS.NMToMeters(5) -- Not more than 5 NM in front of the boat. Enough for late breaks?
self.BreakLate.Zmin=-UTILS.NMToMeters(1.6) -- Not more than 1.6 NM port.
self.BreakLate.Zmax= UTILS.NMToMeters(1) -- Not more than 1 NM starboard.
self.BreakLate.LimitXmin= 0 -- Check and next step 0.8 NM port and in front of boat.
self.BreakLate.LimitXmax= nil
self.BreakLate.LimitZmin=-UTILS.NMToMeters(0.5) -- 926 m port, closer than the stennis as abeam is 0.8-1.0 rather than 1.2
self.BreakLate.LimitZmax= nil
end
--- Init parameters for L61 Juan Carlos carrier.
-- @param #AIRBOSS self
function AIRBOSS:_InitJcarlos()
-- Init Stennis as default.
self:_InitStennis()
-- Carrier Parameters.
self.carrierparam.sterndist =-125
self.carrierparam.deckheight = 20 --67 ft
-- Total size of the carrier (approx as rectangle).
self.carrierparam.totlength=231
self.carrierparam.totwidthport=10
self.carrierparam.totwidthstarboard=22
-- Landing runway.
self.carrierparam.rwyangle = 0
self.carrierparam.rwylength = 202
self.carrierparam.rwywidth = 14
-- Wires.
self.carrierparam.wire1=nil
self.carrierparam.wire2=nil
self.carrierparam.wire3=nil
self.carrierparam.wire4=nil
-- Late break.
self.BreakLate.name="Late Break"
self.BreakLate.Xmin=-UTILS.NMToMeters(1) -- Not more than 1 NM behind the boat. Last check was at 0.
self.BreakLate.Xmax= UTILS.NMToMeters(5) -- Not more than 5 NM in front of the boat. Enough for late breaks?
self.BreakLate.Zmin=-UTILS.NMToMeters(1.6) -- Not more than 1.6 NM port.
self.BreakLate.Zmax= UTILS.NMToMeters(1) -- Not more than 1 NM starboard.
self.BreakLate.LimitXmin= 0 -- Check and next step 0.8 NM port and in front of boat.
self.BreakLate.LimitXmax= nil
self.BreakLate.LimitZmin=-UTILS.NMToMeters(0.5) -- 926 m port, closer than the stennis as abeam is 0.8-1.0 rather than 1.2
self.BreakLate.LimitZmax= nil
end
--- Init parameters for Marshal Voice overs *Gabriella* by HighwaymanEd. --- Init parameters for Marshal Voice overs *Gabriella* by HighwaymanEd.
-- @param #AIRBOSS self -- @param #AIRBOSS self
-- @param #string mizfolder (Optional) Folder within miz file where the sound files are located. -- @param #string mizfolder (Optional) Folder within miz file where the sound files are located.
@ -4555,6 +4650,7 @@ function AIRBOSS:SetVoiceOversLSOByRaynor(mizfolder)
self.LSOCall.DEPARTANDREENTER.duration=1.10 self.LSOCall.DEPARTANDREENTER.duration=1.10
self.LSOCall.EXPECTHEAVYWAVEOFF.duration=1.30 self.LSOCall.EXPECTHEAVYWAVEOFF.duration=1.30
self.LSOCall.EXPECTSPOT75.duration=1.85 self.LSOCall.EXPECTSPOT75.duration=1.85
self.LSOCall.EXPECTSPOT5.duration=1.3
self.LSOCall.FAST.duration=0.75 self.LSOCall.FAST.duration=0.75
self.LSOCall.FOULDECK.duration=0.75 self.LSOCall.FOULDECK.duration=0.75
self.LSOCall.HIGH.duration=0.65 self.LSOCall.HIGH.duration=0.65
@ -4613,6 +4709,7 @@ function AIRBOSS:SetVoiceOversLSOByFF(mizfolder)
self.LSOCall.DEPARTANDREENTER.duration=1.10 self.LSOCall.DEPARTANDREENTER.duration=1.10
self.LSOCall.EXPECTHEAVYWAVEOFF.duration=1.20 self.LSOCall.EXPECTHEAVYWAVEOFF.duration=1.20
self.LSOCall.EXPECTSPOT75.duration=2.00 self.LSOCall.EXPECTSPOT75.duration=2.00
self.LSOCall.EXPECTSPOT5.duration=1.3
self.LSOCall.FAST.duration=0.70 self.LSOCall.FAST.duration=0.70
self.LSOCall.FOULDECK.duration=0.62 self.LSOCall.FOULDECK.duration=0.62
self.LSOCall.HIGH.duration=0.65 self.LSOCall.HIGH.duration=0.65
@ -4880,6 +4977,14 @@ function AIRBOSS:_InitVoiceOvers()
subtitle="Expect spot 7.5", subtitle="Expect spot 7.5",
duration=2.0, duration=2.0,
subduration=5, subduration=5,
},
EXPECTSPOT5={
file="LSO-ExpectSpot5",
suffix="ogg",
loud=false,
subtitle="Expect spot 5",
duration=1.3,
subduration=5,
}, },
STABILIZED={ STABILIZED={
file="LSO-Stabilized", file="LSO-Stabilized",
@ -5540,14 +5645,14 @@ function AIRBOSS:_GetAircraftAoA(playerData)
aoa.Fast = 8.25 --=17.5/2 aoa.Fast = 8.25 --=17.5/2
aoa.FAST = 8.00 --=16.5/2 aoa.FAST = 8.00 --=16.5/2
elseif harrier then elseif harrier then
-- AV-8B Harrier parameters. This might need further tuning. -- AV-8B Harrier parameters. Tuning done on the Fast AoA to allow for abeam and ninety at Nozzles 60 - 73.
aoa.SLOW = 14.0 aoa.SLOW = 14.0
aoa.Slow = 13.0 aoa.Slow = 13.0
aoa.OnSpeedMax = 12.0 aoa.OnSpeedMax = 12.0
aoa.OnSpeed = 11.0 aoa.OnSpeed = 11.0
aoa.OnSpeedMin = 10.0 aoa.OnSpeedMin = 10.0
aoa.Fast = 9.0 aoa.Fast = 8.0
aoa.FAST = 8.0 aoa.FAST = 7.5
end end
return aoa return aoa
@ -5807,7 +5912,7 @@ function AIRBOSS:_GetAircraftParameters(playerData, step)
alt=UTILS.FeetToMeters(300) --? alt=UTILS.FeetToMeters(300) --?
elseif harrier then elseif harrier then
-- 300-325 ft -- 300-325 ft
alt=UTILS.FeetToMeters(300) alt=UTILS.FeetToMeters(300)-- Need to verify
end end
aoa=aoaac.OnSpeed aoa=aoaac.OnSpeed
@ -6746,8 +6851,8 @@ function AIRBOSS:_GetMarshalAltitude(stack, case)
-- Second point 1.5 NM ahead. -- Second point 1.5 NM ahead.
p2=Carrier:Translate(UTILS.NMToMeters(1.5), hdg) p2=Carrier:Translate(UTILS.NMToMeters(1.5), hdg)
-- Tarawa Delta pattern. -- Tarawa,LHA,LHD Delta patterns.
if self.carriertype==AIRBOSS.CarrierType.TARAWA then if self.carriertype==AIRBOSS.CarrierType.TARAWA or self.carriertype==AIRBOSS.CarrierType.AMERICA or self.carriertype==AIRBOSS.CarrierType.JCARLOS then
-- Pattern is directly overhead the carrier. -- Pattern is directly overhead the carrier.
p1=Carrier:Translate(UTILS.NMToMeters(1.0), hdg+90) p1=Carrier:Translate(UTILS.NMToMeters(1.0), hdg+90)
@ -8592,7 +8697,7 @@ function AIRBOSS:OnEventLand(EventData)
self:T(self.lid..text) self:T(self.lid..text)
-- Check carrier type. -- Check carrier type.
if self.carriertype==AIRBOSS.CarrierType.TARAWA then if self.carriertype==AIRBOSS.CarrierType.TARAWA or self.carriertype==AIRBOSS.CarrierType.AMERICA or self.carriertype==AIRBOSS.CarrierType.JCARLOS then
-- Power "Idle". -- Power "Idle".
self:RadioTransmission(self.LSORadio, self.LSOCall.IDLE, false, 1, nil, true) self:RadioTransmission(self.LSORadio, self.LSOCall.IDLE, false, 1, nil, true)
@ -8627,7 +8732,7 @@ function AIRBOSS:OnEventLand(EventData)
-- AI unit landed -- -- AI unit landed --
-------------------- --------------------
if self.carriertype~=AIRBOSS.CarrierType.TARAWA then if self.carriertype~=AIRBOSS.CarrierType.TARAWA or self.carriertype~=AIRBOSS.CarrierType.AMERICA or self.carriertype~=AIRBOSS.CarrierType.JCARLOS then
-- Coordinate at landing event -- Coordinate at landing event
local coord=EventData.IniUnit:GetCoordinate() local coord=EventData.IniUnit:GetCoordinate()
@ -9534,8 +9639,10 @@ function AIRBOSS:_Bullseye(playerData)
-- Hint for player about altitude, AoA etc. -- Hint for player about altitude, AoA etc.
self:_PlayerHint(playerData) self:_PlayerHint(playerData)
-- LSO expect spot 7.5 call -- LSO expect spot 5 or 7.5 call
if playerData.actype==AIRBOSS.AircraftCarrier.AV8B then if playerData.actype==AIRBOSS.AircraftCarrier.AV8B and self.carriertype==AIRBOSS.CarrierType.JCARLOS then
self:RadioTransmission(self.LSORadio, self.LSOCall.EXPECTSPOT5, nil, nil, nil, true)
elseif playerData.actype==AIRBOSS.AircraftCarrier.AV8B then
self:RadioTransmission(self.LSORadio, self.LSOCall.EXPECTSPOT75, nil, nil, nil, true) self:RadioTransmission(self.LSORadio, self.LSOCall.EXPECTSPOT75, nil, nil, nil, true)
end end
@ -9671,8 +9778,8 @@ function AIRBOSS:_CheckForLongDownwind(playerData)
-- 1.6 NM from carrier is too far. -- 1.6 NM from carrier is too far.
local limit=UTILS.NMToMeters(-1.6) local limit=UTILS.NMToMeters(-1.6)
-- For the tarawa we give a bit more space. -- For the tarawa, other LHA and LHD we give a bit more space.
if self.carriertype==AIRBOSS.CarrierType.TARAWA then if self.carriertype==AIRBOSS.CarrierType.TARAWA or self.carriertype==AIRBOSS.CarrierType.AMERICA or self.carriertype==AIRBOSS.CarrierType.JCARLOS then
limit=UTILS.NMToMeters(-2.0) limit=UTILS.NMToMeters(-2.0)
end end
@ -9717,8 +9824,10 @@ function AIRBOSS:_Abeam(playerData)
-- Paddles contact. -- Paddles contact.
self:RadioTransmission(self.LSORadio, self.LSOCall.PADDLESCONTACT, nil, nil, nil, true) self:RadioTransmission(self.LSORadio, self.LSOCall.PADDLESCONTACT, nil, nil, nil, true)
-- LSO expect spot 7.5 call -- LSO expect spot 5 or 7.5 call
if playerData.actype==AIRBOSS.AircraftCarrier.AV8B then if playerData.actype==AIRBOSS.AircraftCarrier.AV8B and self.carriertype==AIRBOSS.CarrierType.JCARLOS then
self:RadioTransmission(self.LSORadio, self.LSOCall.EXPECTSPOT5, false, 5, nil, true)
elseif playerData.actype==AIRBOSS.AircraftCarrier.AV8B then
self:RadioTransmission(self.LSORadio, self.LSOCall.EXPECTSPOT75, false, 5, nil, true) self:RadioTransmission(self.LSORadio, self.LSOCall.EXPECTSPOT75, false, 5, nil, true)
end end
@ -9755,7 +9864,7 @@ function AIRBOSS:_Ninety(playerData)
self:_PlayerHint(playerData) self:_PlayerHint(playerData)
-- Next step: wake. -- Next step: wake.
if self.carriertype==AIRBOSS.CarrierType.TARAWA then if self.carriertype==AIRBOSS.CarrierType.TARAWA or self.carriertype==AIRBOSS.CarrierType.AMERICA or self.carriertype==AIRBOSS.CarrierType.JCARLOS then
-- Harrier has no wake stop. It stays port of the boat. -- Harrier has no wake stop. It stays port of the boat.
self:_SetPlayerStep(playerData, AIRBOSS.PatternStep.FINAL) self:_SetPlayerStep(playerData, AIRBOSS.PatternStep.FINAL)
else else
@ -10108,7 +10217,7 @@ function AIRBOSS:_Groove(playerData)
-- Drift on lineup. -- Drift on lineup.
if rho>=RAR and rho<=RIM then if rho>=RAR and rho<=RIM then
if gd.LUE>0.22 and lineupError<-0.22 then if gd.LUE>0.22 and lineupError<-0.22 then
env.info" Drift Right across centre ==> DR-" env.info" Drift Right across centre ==> DR-"
gd.Drift=" DR" gd.Drift=" DR"
self:T(self.lid..string.format("Got Drift Right across centre step %s, d=%.3f: Max LUE=%.3f, lower LUE=%.3f", gs, d, gd.LUE, lineupError)) self:T(self.lid..string.format("Got Drift Right across centre step %s, d=%.3f: Max LUE=%.3f, lower LUE=%.3f", gs, d, gd.LUE, lineupError))
@ -10123,7 +10232,7 @@ function AIRBOSS:_Groove(playerData)
elseif gd.LUE<-0.13 and lineupError>0.14 then elseif gd.LUE<-0.13 and lineupError>0.14 then
env.info" Little Drift Left across centre ==> (DL-)" env.info" Little Drift Left across centre ==> (DL-)"
gd.Drift=" (DL)" gd.Drift=" (DL)"
self:E(self.lid..string.format("Got Little Drift Left across centre at step %s, d=%.3f: Min LUE=%.3f, lower LUE=%.3f", gs, d, gd.LUE, lineupError)) self:E(self.lid..string.format("Got Little Drift Left across centre at step %s, d=%.3f: Min LUE=%.3f, lower LUE=%.3f", gs, d, gd.LUE, lineupError))
end end
end end
@ -10429,7 +10538,7 @@ function AIRBOSS:_GetSternCoord()
--local stern=self:GetCoordinate() --local stern=self:GetCoordinate()
-- Stern coordinate (sterndist<0). -- Stern coordinate (sterndist<0).
if self.carriertype==AIRBOSS.CarrierType.TARAWA then if self.carriertype==AIRBOSS.CarrierType.TARAWA or self.carriertype==AIRBOSS.CarrierType.AMERICA or self.carriertype==AIRBOSS.CarrierType.JCARLOS then
-- Tarawa: Translate 8 meters port. -- Tarawa: Translate 8 meters port.
self.sterncoord:Translate(self.carrierparam.sterndist, hdg, true, true):Translate(8, FB-90, true, true) self.sterncoord:Translate(self.carrierparam.sterndist, hdg, true, true):Translate(8, FB-90, true, true)
elseif self.carriertype==AIRBOSS.CarrierType.STENNIS then elseif self.carriertype==AIRBOSS.CarrierType.STENNIS then
@ -10467,7 +10576,7 @@ function AIRBOSS:_GetWire(Lcoord, dc)
-- Corrected landing distance wrt to stern. Landing distance needs to be reduced due to delayed landing event for human players. -- Corrected landing distance wrt to stern. Landing distance needs to be reduced due to delayed landing event for human players.
local d=Ldist-dc local d=Ldist-dc
-- Multiplayer wire correction. -- Multiplayer wire correction.
if self.mpWireCorrection then if self.mpWireCorrection then
d=d-self.mpWireCorrection d=d-self.mpWireCorrection
@ -11172,7 +11281,7 @@ function AIRBOSS:_GetZoneHolding(case, stack)
self.zoneHolding=ZONE_RADIUS:New("CASE I Holding Zone", Post:GetVec2(), self.marshalradius) self.zoneHolding=ZONE_RADIUS:New("CASE I Holding Zone", Post:GetVec2(), self.marshalradius)
-- Delta pattern. -- Delta pattern.
if self.carriertype==AIRBOSS.CarrierType.TARAWA then if self.carriertype==AIRBOSS.CarrierType.TARAWA or self.carriertype==AIRBOSS.CarrierType.AMERICA or self.carriertype==AIRBOSS.CarrierType.JCARLOS then
self.zoneHolding=ZONE_RADIUS:New("CASE I Holding Zone", self.carrier:GetVec2(), UTILS.NMToMeters(5)) self.zoneHolding=ZONE_RADIUS:New("CASE I Holding Zone", self.carrier:GetVec2(), UTILS.NMToMeters(5))
end end
@ -11225,7 +11334,7 @@ function AIRBOSS:_GetZoneCommence(case, stack)
-- Three position -- Three position
local Three=self:GetCoordinate():Translate(D, hdg+275) local Three=self:GetCoordinate():Translate(D, hdg+275)
if self.carriertype==AIRBOSS.CarrierType.TARAWA then if self.carriertype==AIRBOSS.CarrierType.TARAWA or self.carriertype==AIRBOSS.CarrierType.AMERICA or self.carriertype==AIRBOSS.CarrierType.JCARLOS then
local Dx=UTILS.NMToMeters(2.25) local Dx=UTILS.NMToMeters(2.25)
@ -11516,7 +11625,7 @@ function AIRBOSS:_GetAltCarrier(unit)
return h return h
end end
--- Get optimal landing position of the aircraft. Usually between second and third wire. In case of Tarawa we take the abeam landing spot 120 ft abeam the 7.5 position. --- Get optimal landing position of the aircraft. Usually between second and third wire. In case of Tarawa and America we take the abeam landing spot 120 ft abeam the 7.5 position, for the Juan Carlos I it is 120 ft and abeam the 5 position.
-- @param #AIRBOSS self -- @param #AIRBOSS self
-- @return Core.Point#COORDINATE Optimal landing coordinate. -- @return Core.Point#COORDINATE Optimal landing coordinate.
function AIRBOSS:_GetOptLandingCoordinate() function AIRBOSS:_GetOptLandingCoordinate()
@ -11536,6 +11645,23 @@ function AIRBOSS:_GetOptLandingCoordinate()
self.landingcoord:UpdateFromCoordinate(self:_GetLandingSpotCoordinate()):Translate(35, FB-90, true, true) self.landingcoord:UpdateFromCoordinate(self:_GetLandingSpotCoordinate()):Translate(35, FB-90, true, true)
--stern=self:_GetLandingSpotCoordinate():Translate(35, FB-90) --stern=self:_GetLandingSpotCoordinate():Translate(35, FB-90)
-- Alitude 120 ft.
self.landingcoord:SetAltitude(UTILS.FeetToMeters(120))
elseif self.carriertype==AIRBOSS.CarrierType.AMERICA then
-- Landing 100 ft abeam, 120 ft alt. To allow adjustments to match different deck configurations.
self.landingcoord:UpdateFromCoordinate(self:_GetLandingSpotCoordinate()):Translate(35, FB-90, true, true)
--stern=self:_GetLandingSpotCoordinate():Translate(35, FB-90)
-- Alitude 120 ft.
self.landingcoord:SetAltitude(UTILS.FeetToMeters(120))
elseif self.carriertype==AIRBOSS.CarrierType.JCARLOS then
-- Landing 100 ft abeam, 120 ft alt.
self.landingcoord:UpdateFromCoordinate(self:_GetLandingSpotCoordinate()):Translate(35, FB-100, true, true)
--stern=self:_GetLandingSpotCoordinate():Translate(35, FB-100)
-- Alitude 120 ft. -- Alitude 120 ft.
self.landingcoord:SetAltitude(UTILS.FeetToMeters(120)) self.landingcoord:SetAltitude(UTILS.FeetToMeters(120))
@ -11573,6 +11699,21 @@ function AIRBOSS:_GetLandingSpotCoordinate()
-- Primary landing spot 7.5 -- Primary landing spot 7.5
self.landingspotcoord:Translate(57, hdg, true, true):SetAltitude(self.carrierparam.deckheight) self.landingspotcoord:Translate(57, hdg, true, true):SetAltitude(self.carrierparam.deckheight)
elseif self.carriertype==AIRBOSS.CarrierType.AMERICA then
-- Landing 100 ft abeam, 120 alt.
local hdg=self:GetHeading()
-- Primary landing spot 7.5 a little further forwad on the America
self.landingspotcoord:Translate(59, hdg, true, true):SetAltitude(self.carrierparam.deckheight)
elseif self.carriertype==AIRBOSS.CarrierType.JCARLOS then
-- Landing 100 ft abeam, 120 alt.
local hdg=self:GetHeading()
-- Primary landing spot 5.0 -- TODO voice for different landing Spots.
self.landingspotcoord:Translate(89, hdg, true, true):SetAltitude(self.carrierparam.deckheight)
end end
@ -12065,6 +12206,11 @@ end
-- * > 24 seconds: No Grade "--" -- * > 24 seconds: No Grade "--"
-- --
-- If you manage to be between 16.4 and and 16.6 seconds, you will even get and okay underline "\_OK\_". -- If you manage to be between 16.4 and and 16.6 seconds, you will even get and okay underline "\_OK\_".
-- No groove time for Harrier on LHA, LHD set to Tgroove Unicorn as starting point to allow possible _OK_ 5.0.
-- If time in the AV-8B
--
-- * < 90 seconds: OK V/STOL
-- * > 91 Seconds: SLOW V/STOL (Early hover stop selection)
-- --
-- @param #AIRBOSS self -- @param #AIRBOSS self
-- @param #AIRBOSS.PlayerData playerData Player data table. -- @param #AIRBOSS.PlayerData playerData Player data table.
@ -12083,6 +12229,13 @@ function AIRBOSS:_EvalGrooveTime(playerData)
grade="OK Groove" grade="OK Groove"
elseif t<=24 then elseif t<=24 then
grade="(LIG)" grade="(LIG)"
-- Time in groove for AV-8B
elseif playerData.actype==AIRBOSS.AircraftCarrier.AV8B and t<55 then -- VSTOL Late Hover stop selection too fast to Abeam LDG Spot AV-8B.
grade="FAST V/STOL Groove"
elseif playerData.actype==AIRBOSS.AircraftCarrier.AV8B and t<90 then -- VSTOL Operations with AV-8B.
grade="OK V/STOL Groove"
elseif playerData.actype==AIRBOSS.AircraftCarrier.AV8B and t>=91 then -- VSTOL Early Hover stop selection slow to Abeam LDG Spot AV-8B.
grade="SLOW V/STOL Groove"
else else
grade="LIG" grade="LIG"
end end
@ -12092,6 +12245,11 @@ function AIRBOSS:_EvalGrooveTime(playerData)
grade="_OK_" grade="_OK_"
end end
-- V/STOL Unicorn!
if playerData.actype==AIRBOSS.AircraftCarrier.AV8B and (t>=65.0 and t<=75.0) then
grade="_OK_ V/STOL"
end
return grade return grade
end end
@ -12108,7 +12266,7 @@ function AIRBOSS:_LSOgrade(playerData)
return select(2, string.gsub(base, pattern, "")) return select(2, string.gsub(base, pattern, ""))
end end
-- Analyse flight data and conver to LSO text. -- Analyse flight data and convert to LSO text.
local GXX,nXX=self:_Flightdata2Text(playerData, AIRBOSS.GroovePos.XX) local GXX,nXX=self:_Flightdata2Text(playerData, AIRBOSS.GroovePos.XX)
local GIM,nIM=self:_Flightdata2Text(playerData, AIRBOSS.GroovePos.IM) local GIM,nIM=self:_Flightdata2Text(playerData, AIRBOSS.GroovePos.IM)
local GIC,nIC=self:_Flightdata2Text(playerData, AIRBOSS.GroovePos.IC) local GIC,nIC=self:_Flightdata2Text(playerData, AIRBOSS.GroovePos.IC)
@ -12117,25 +12275,37 @@ function AIRBOSS:_LSOgrade(playerData)
-- Put everything together. -- Put everything together.
local G=GXX.." "..GIM.." ".." "..GIC.." "..GAR local G=GXX.." "..GIM.." ".." "..GIC.." "..GAR
-- Count number of minor, normal and major deviations. -- Count number of minor, normal and major deviations. TODO - work on Harrier counts due slower approach speed.
local N=nXX+nIM+nIC+nAR local N=nXX+nIM+nIC+nAR
local nL=count(G, '_')/2 local nL=count(G, '_')/2
local nS=count(G, '%(') local nS=count(G, '%(')
local nN=N-nS-nL local nN=N-nS-nL
-- Groove time 15-18.99 sec for a unicorn. -- Groove time 15-18.99 sec for a unicorn. Or 65-70 for V/STOL unicorn.
local Tgroove=playerData.Tgroove local Tgroove=playerData.Tgroove
local TgrooveUnicorn=Tgroove and (Tgroove>=15.0 and Tgroove<=18.99) or false local TgrooveUnicorn=Tgroove and (Tgroove>=15.0 and Tgroove<=18.99) or false
local TgrooveVstolUnicorn=Tgroove and (Tgroove>=65.0 and Tgroove<=70.0)and playerData.actype==AIRBOSS.AircraftCarrier.AV8B or false
local grade local grade
local points local points
if N==0 and TgrooveUnicorn then if N==0 and (TgrooveUnicorn or TgrooveVstolUnicorn ) then
-- No deviations, should be REALLY RARE! -- No deviations, should be REALLY RARE!
grade="_OK_" grade="_OK_"
points=5.0 points=5.0
G="Unicorn" G="Unicorn"
else else
if nL>0 then
-- Add AV-8B Harrier devation allowances due to lower groundspeed and 3x conventional groove time, this allows to maintain LSO tolerances while respecting the deviations are not unsafe. (WIP requires feedback)
-- Large devaitions still result in a No Grade, A Unicorn still requires a clean pass with no deviation.
if nL>3 and playerData.actype==AIRBOSS.AircraftCarrier.AV8B then
-- Larger deviations ==> "No grade" 2.0 points.
grade="--"
points=2.0
elseif nN>2 and playerData.actype==AIRBOSS.AircraftCarrier.AV8B then
-- Only average deviations ==> "Fair Pass" Pass with average deviations and corrections.
grade="(OK)"
points=3.0
elseif nL>0 then
-- Larger deviations ==> "No grade" 2.0 points. -- Larger deviations ==> "No grade" 2.0 points.
grade="--" grade="--"
points=2.0 points=2.0
@ -12148,7 +12318,8 @@ function AIRBOSS:_LSOgrade(playerData)
grade="OK" grade="OK"
points=4.0 points=4.0
end end
end
end
-- Replace" )"( and "__" -- Replace" )"( and "__"
G=G:gsub("%)%(", "") G=G:gsub("%)%(", "")
@ -12258,35 +12429,35 @@ function AIRBOSS:_Flightdata2Text(playerData, groovestep)
-- Aircraft specific AoA values. -- Aircraft specific AoA values.
local acaoa=self:_GetAircraftAoA(playerData) local acaoa=self:_GetAircraftAoA(playerData)
--Angled Approach. --Angled Approach.
local P=nil local P=nil
if step==AIRBOSS.PatternStep.GROOVE_XX and ROL<=4.0 and playerData.case<3 then if step==AIRBOSS.PatternStep.GROOVE_XX and ROL<=4.0 and playerData.case<3 then
if LUE>self.lue.RIGHT then if LUE>self.lue.RIGHT then
P=underline("AA") P=underline("AA")
elseif elseif
LUE>self.lue.RightMed then LUE>self.lue.RightMed then
P="AA " P="AA "
elseif elseif
LUE>self.lue.Right then LUE>self.lue.Right then
P=little("AA") P=little("AA")
end end
end end
--Overshoot Start. --Overshoot Start.
local O=nil local O=nil
if step==AIRBOSS.PatternStep.GROOVE_XX then if step==AIRBOSS.PatternStep.GROOVE_XX then
if LUE<self.lue.LEFT then if LUE<self.lue.LEFT then
O=underline("OS") O=underline("OS")
elseif elseif
LUE<self.lue.Left then LUE<self.lue.Left then
O="OS" O="OS"
elseif elseif
LUE<self.lue._min then LUE<self.lue._min then
O=little("OS") O=little("OS")
end end
end end
-- Speed via AoA. Depends on aircraft type. -- Speed via AoA. Depends on aircraft type.
local S=nil local S=nil
if AOA>acaoa.SLOW then if AOA>acaoa.SLOW then
@ -12356,7 +12527,7 @@ function AIRBOSS:_Flightdata2Text(playerData, groovestep)
if P then if P then
G=G..P G=G..P
n=n n=n
end end
-- Speed. -- Speed.
if S then if S then
G=G..S G=G..S
@ -12382,7 +12553,7 @@ function AIRBOSS:_Flightdata2Text(playerData, groovestep)
G=G..O G=G..O
n=n+1 n=n+1
end end
-- Add current step. -- Add current step.
local step=self:_GS(step) local step=self:_GS(step)
step=step:gsub("XX","X") step=step:gsub("XX","X")
@ -12444,7 +12615,7 @@ function AIRBOSS:_GS(step, n)
if n==-1 then if n==-1 then
gp=AIRBOSS.GroovePos.IC gp=AIRBOSS.GroovePos.IC
elseif n==1 then elseif n==1 then
if self.carriertype==AIRBOSS.CarrierType.TARAWA then if self.carriertype==AIRBOSS.CarrierType.TARAWA or self.carriertype==AIRBOSS.CarrierType.AMERICA or self.carriertype==AIRBOSS.CarrierType.JCARLOS then
gp=AIRBOSS.GroovePos.AL gp=AIRBOSS.GroovePos.AL
else else
gp=AIRBOSS.GroovePos.IW gp=AIRBOSS.GroovePos.IW
@ -14334,17 +14505,17 @@ function AIRBOSS:_IsCarrierAircraft(unit)
-- Get aircraft type name -- Get aircraft type name
local aircrafttype=unit:GetTypeName() local aircrafttype=unit:GetTypeName()
-- Special case for Harrier which can only land on Tarawa. -- Special case for Harrier which can only land on Tarawa, LHA and LHD.
if aircrafttype==AIRBOSS.AircraftCarrier.AV8B then if aircrafttype==AIRBOSS.AircraftCarrier.AV8B then
if self.carriertype==AIRBOSS.CarrierType.TARAWA then if self.carriertype==AIRBOSS.CarrierType.TARAWA or self.carriertype==AIRBOSS.CarrierType.AMERICA or self.carriertype==AIRBOSS.CarrierType.JCARLOS then
return true return true
else else
return false return false
end end
end end
-- Also only Harriers can land on the Tarawa. -- Also only Harriers can land on the Tarawa, LHA and LHD.
if self.carriertype==AIRBOSS.CarrierType.TARAWA then if self.carriertype==AIRBOSS.CarrierType.TARAWA or self.carriertype==AIRBOSS.CarrierType.AMERICA or self.carriertype==AIRBOSS.CarrierType.JCARLOS then
if aircrafttype~=AIRBOSS.AircraftCarrier.AV8B then if aircrafttype~=AIRBOSS.AircraftCarrier.AV8B then
return false return false
end end
@ -17713,8 +17884,8 @@ function AIRBOSS:_MarkCaseZones(_unitName, flare)
self:_GetZoneBullseye(case):FlareZone(FLARECOLOR.Green, 45) self:_GetZoneBullseye(case):FlareZone(FLARECOLOR.Green, 45)
end end
-- Tarawa landing spots. -- Tarawa, LHA and LHD landing spots.
if self.carriertype==AIRBOSS.CarrierType.TARAWA then if self.carriertype==AIRBOSS.CarrierType.TARAWA or self.carriertype==AIRBOSS.CarrierType.AMERICA or self.carriertype==AIRBOSS.CarrierType.JCARLOS then
text=text.."\n* abeam landing stop with RED flares" text=text.."\n* abeam landing stop with RED flares"
-- Abeam landing spot zone. -- Abeam landing spot zone.
local ALSPT=self:_GetZoneAbeamLandingSpot() local ALSPT=self:_GetZoneAbeamLandingSpot()

View File

@ -1,9 +1,9 @@
--- **Core** - Makes the radio talk. --- **Core** - Makes the radio talk.
-- --
-- === -- ===
-- --
-- ## Features: -- ## Features:
-- --
-- * Send text strings using a vocabulary that is converted in spoken language. -- * Send text strings using a vocabulary that is converted in spoken language.
-- * Possiblity to implement multiple language. -- * Possiblity to implement multiple language.
-- --
@ -15,10 +15,10 @@
-- @image Core_Radio.JPG -- @image Core_Radio.JPG
--- Makes the radio speak. --- Makes the radio speak.
-- --
-- # RADIOSPEECH usage -- # RADIOSPEECH usage
-- --
-- --
-- @type RADIOSPEECH -- @type RADIOSPEECH
-- @extends Core.RadioQueue#RADIOQUEUE -- @extends Core.RadioQueue#RADIOQUEUE
RADIOSPEECH = { RADIOSPEECH = {
@ -59,24 +59,24 @@ RADIOSPEECH.Vocabulary.EN = {
["70"] = { "70", 0.48 }, ["70"] = { "70", 0.48 },
["80"] = { "80", 0.26 }, ["80"] = { "80", 0.26 },
["90"] = { "90", 0.36 }, ["90"] = { "90", 0.36 },
["100"] = { "100", 0.55 }, ["100"] = { "100", 0.55 },
["200"] = { "200", 0.55 }, ["200"] = { "200", 0.55 },
["300"] = { "300", 0.61 }, ["300"] = { "300", 0.61 },
["400"] = { "400", 0.60 }, ["400"] = { "400", 0.60 },
["500"] = { "500", 0.61 }, ["500"] = { "500", 0.61 },
["600"] = { "600", 0.65 }, ["600"] = { "600", 0.65 },
["700"] = { "700", 0.70 }, ["700"] = { "700", 0.70 },
["800"] = { "800", 0.54 }, ["800"] = { "800", 0.54 },
["900"] = { "900", 0.60 }, ["900"] = { "900", 0.60 },
["1000"] = { "1000", 0.60 }, ["1000"] = { "1000", 0.60 },
["2000"] = { "2000", 0.61 }, ["2000"] = { "2000", 0.61 },
["3000"] = { "3000", 0.64 }, ["3000"] = { "3000", 0.64 },
["4000"] = { "4000", 0.62 }, ["4000"] = { "4000", 0.62 },
["5000"] = { "5000", 0.69 }, ["5000"] = { "5000", 0.69 },
["6000"] = { "6000", 0.69 }, ["6000"] = { "6000", 0.69 },
["7000"] = { "7000", 0.75 }, ["7000"] = { "7000", 0.75 },
["8000"] = { "8000", 0.59 }, ["8000"] = { "8000", 0.59 },
["9000"] = { "9000", 0.65 }, ["9000"] = { "9000", 0.65 },
["chevy"] = { "chevy", 0.35 }, ["chevy"] = { "chevy", 0.35 },
["colt"] = { "colt", 0.35 }, ["colt"] = { "colt", 0.35 },
@ -94,10 +94,10 @@ RADIOSPEECH.Vocabulary.EN = {
["meters"] = { "meters", 0.41 }, ["meters"] = { "meters", 0.41 },
["mi"] = { "miles", 0.45 }, ["mi"] = { "miles", 0.45 },
["feet"] = { "feet", 0.29 }, ["feet"] = { "feet", 0.29 },
["br"] = { "br", 1.1 }, ["br"] = { "br", 1.1 },
["bra"] = { "bra", 0.3 }, ["bra"] = { "bra", 0.3 },
["returning to base"] = { "returning_to_base", 0.85 }, ["returning to base"] = { "returning_to_base", 0.85 },
["on route to ground target"] = { "on_route_to_ground_target", 1.05 }, ["on route to ground target"] = { "on_route_to_ground_target", 1.05 },
@ -143,24 +143,24 @@ RADIOSPEECH.Vocabulary.RU = {
["70"] = { "70", 0.68 }, ["70"] = { "70", 0.68 },
["80"] = { "80", 0.84 }, ["80"] = { "80", 0.84 },
["90"] = { "90", 0.71 }, ["90"] = { "90", 0.71 },
["100"] = { "100", 0.35 }, ["100"] = { "100", 0.35 },
["200"] = { "200", 0.59 }, ["200"] = { "200", 0.59 },
["300"] = { "300", 0.53 }, ["300"] = { "300", 0.53 },
["400"] = { "400", 0.70 }, ["400"] = { "400", 0.70 },
["500"] = { "500", 0.50 }, ["500"] = { "500", 0.50 },
["600"] = { "600", 0.58 }, ["600"] = { "600", 0.58 },
["700"] = { "700", 0.64 }, ["700"] = { "700", 0.64 },
["800"] = { "800", 0.77 }, ["800"] = { "800", 0.77 },
["900"] = { "900", 0.75 }, ["900"] = { "900", 0.75 },
["1000"] = { "1000", 0.87 }, ["1000"] = { "1000", 0.87 },
["2000"] = { "2000", 0.83 }, ["2000"] = { "2000", 0.83 },
["3000"] = { "3000", 0.84 }, ["3000"] = { "3000", 0.84 },
["4000"] = { "4000", 1.00 }, ["4000"] = { "4000", 1.00 },
["5000"] = { "5000", 0.77 }, ["5000"] = { "5000", 0.77 },
["6000"] = { "6000", 0.90 }, ["6000"] = { "6000", 0.90 },
["7000"] = { "7000", 0.77 }, ["7000"] = { "7000", 0.77 },
["8000"] = { "8000", 0.92 }, ["8000"] = { "8000", 0.92 },
["9000"] = { "9000", 0.87 }, ["9000"] = { "9000", 0.87 },
["градусы"] = { "degrees", 0.5 }, ["градусы"] = { "degrees", 0.5 },
["километры"] = { "kilometers", 0.65 }, ["километры"] = { "kilometers", 0.65 },
@ -170,10 +170,10 @@ RADIOSPEECH.Vocabulary.RU = {
["метров"] = { "meters", 0.41 }, ["метров"] = { "meters", 0.41 },
["m"] = { "meters", 0.41 }, ["m"] = { "meters", 0.41 },
["ноги"] = { "feet", 0.37 }, ["ноги"] = { "feet", 0.37 },
["br"] = { "br", 1.1 }, ["br"] = { "br", 1.1 },
["bra"] = { "bra", 0.3 }, ["bra"] = { "bra", 0.3 },
["возвращение на базу"] = { "returning_to_base", 1.40 }, ["возвращение на базу"] = { "returning_to_base", 1.40 },
["на пути к наземной цели"] = { "on_route_to_ground_target", 1.45 }, ["на пути к наземной цели"] = { "on_route_to_ground_target", 1.45 },
@ -200,11 +200,11 @@ function RADIOSPEECH:New(frequency, modulation)
-- Inherit base -- Inherit base
local self = BASE:Inherit( self, RADIOQUEUE:New( frequency, modulation ) ) -- #RADIOSPEECH local self = BASE:Inherit( self, RADIOQUEUE:New( frequency, modulation ) ) -- #RADIOSPEECH
self.Language = "EN" self.Language = "EN"
self:BuildTree() self:BuildTree()
return self return self
end end
@ -262,7 +262,7 @@ end
function RADIOSPEECH:BuildTree() function RADIOSPEECH:BuildTree()
self.Speech = {} self.Speech = {}
for Language, Sentences in pairs( self.Vocabulary ) do for Language, Sentences in pairs( self.Vocabulary ) do
self:I( { Language = Language, Sentences = Sentences }) self:I( { Language = Language, Sentences = Sentences })
self.Speech[Language] = {} self.Speech[Language] = {}
@ -271,7 +271,7 @@ function RADIOSPEECH:BuildTree()
self:AddSentenceToSpeech( Sentence, self.Speech[Language], Sentence, Data ) self:AddSentenceToSpeech( Sentence, self.Speech[Language], Sentence, Data )
end end
end end
self:I( { Speech = self.Speech } ) self:I( { Speech = self.Speech } )
return self return self
@ -290,7 +290,7 @@ function RADIOSPEECH:SpeakWords( Sentence, Speech, Language )
local Word, RemainderSentence = Sentence:match( "^[., ]*([^ .,]+)(.*)" ) local Word, RemainderSentence = Sentence:match( "^[., ]*([^ .,]+)(.*)" )
self:I( { Word = Word, Speech = Speech[Word], RemainderSentence = RemainderSentence } ) self:I( { Word = Word, Speech = Speech[Word], RemainderSentence = RemainderSentence } )
if Word then if Word then
if Word ~= "" and tonumber(Word) == nil then if Word ~= "" and tonumber(Word) == nil then
@ -302,7 +302,7 @@ function RADIOSPEECH:SpeakWords( Sentence, Speech, Language )
if Speech[Word].Next == nil then if Speech[Word].Next == nil then
self:I( { Sentence = Speech[Word].Sentence, Data = Speech[Word].Data } ) self:I( { Sentence = Speech[Word].Sentence, Data = Speech[Word].Data } )
self:NewTransmission( Speech[Word].Data[1] .. ".wav", Speech[Word].Data[2], Language .. "/" ) self:NewTransmission( Speech[Word].Data[1] .. ".wav", Speech[Word].Data[2], Language .. "/" )
else else
if RemainderSentence and RemainderSentence ~= "" then if RemainderSentence and RemainderSentence ~= "" then
return self:SpeakWords( RemainderSentence, Speech[Word].Next, Language ) return self:SpeakWords( RemainderSentence, Speech[Word].Next, Language )
end end
@ -310,11 +310,11 @@ function RADIOSPEECH:SpeakWords( Sentence, Speech, Language )
end end
return RemainderSentence return RemainderSentence
end end
return OriginalSentence return OriginalSentence
else else
return "" return ""
end end
end end
--- Speak a sentence. --- Speak a sentence.
@ -333,7 +333,7 @@ function RADIOSPEECH:SpeakDigits( Sentence, Speech, Langauge )
if Digits then if Digits then
if Digits ~= "" and tonumber( Digits ) ~= nil then if Digits ~= "" and tonumber( Digits ) ~= nil then
-- Construct numbers -- Construct numbers
local Number = tonumber( Digits ) local Number = tonumber( Digits )
local Multiple = nil local Multiple = nil
@ -357,7 +357,7 @@ function RADIOSPEECH:SpeakDigits( Sentence, Speech, Langauge )
end end
return RemainderSentence return RemainderSentence
end end
return OriginalSentence return OriginalSentence
else else
return "" return ""
end end
@ -374,26 +374,26 @@ function RADIOSPEECH:Speak( Sentence, Language )
self:I( { Sentence, Language } ) self:I( { Sentence, Language } )
local Language = Language or "EN" local Language = Language or "EN"
self:I( { Language = Language } ) self:I( { Language = Language } )
-- If there is no node for Speech, then we start at the first nodes of the language. -- If there is no node for Speech, then we start at the first nodes of the language.
local Speech = self.Speech[Language] local Speech = self.Speech[Language]
self:I( { Speech = Speech, Language = Language } ) self:I( { Speech = Speech, Language = Language } )
self:NewTransmission( "_In.wav", 0.52, Language .. "/" ) self:NewTransmission( "_In.wav", 0.52, Language .. "/" )
repeat repeat
Sentence = self:SpeakWords( Sentence, Speech, Language ) Sentence = self:SpeakWords( Sentence, Speech, Language )
self:I( { Sentence = Sentence } ) self:I( { Sentence = Sentence } )
Sentence = self:SpeakDigits( Sentence, Speech, Language ) Sentence = self:SpeakDigits( Sentence, Speech, Language )
self:I( { Sentence = Sentence } ) self:I( { Sentence = Sentence } )
-- Sentence = self:SpeakSymbols( Sentence, Speech ) -- Sentence = self:SpeakSymbols( Sentence, Speech )
-- --
-- self:I( { Sentence = Sentence } ) -- self:I( { Sentence = Sentence } )

View File

@ -767,12 +767,12 @@ end
function UTILS.GetCharacters(str) function UTILS.GetCharacters(str)
local chars={} local chars={}
for i=1,#str do for i=1,#str do
local c=str:sub(i,i) local c=str:sub(i,i)
table.insert(chars, c) table.insert(chars, c)
end end
return chars return chars
end end
@ -1379,7 +1379,7 @@ function UTILS.GMTToLocalTimeDifference()
elseif theatre==DCSMAP.Syria then elseif theatre==DCSMAP.Syria then
return 3 -- Damascus is UTC+3 hours return 3 -- Damascus is UTC+3 hours
elseif theatre==DCSMAP.MarianaIslands then elseif theatre==DCSMAP.MarianaIslands then
return 10 -- Guam is UTC+10 hours. return 10 -- Guam is UTC+10 hours.
else else
BASE:E(string.format("ERROR: Unknown Map %s in UTILS.GMTToLocal function. Returning 0", tostring(theatre))) BASE:E(string.format("ERROR: Unknown Map %s in UTILS.GMTToLocal function. Returning 0", tostring(theatre)))
return 0 return 0
@ -1577,17 +1577,17 @@ function UTILS.IsLoadingDoorOpen( unit_name )
local unit = Unit.getByName(unit_name) local unit = Unit.getByName(unit_name)
if unit ~= nil then if unit ~= nil then
local type_name = unit:getTypeName() local type_name = unit:getTypeName()
if type_name == "Mi-8MT" and unit:getDrawArgumentValue(38) == 1 or unit:getDrawArgumentValue(86) == 1 or unit:getDrawArgumentValue(250) == 1 then if type_name == "Mi-8MT" and unit:getDrawArgumentValue(38) == 1 or unit:getDrawArgumentValue(86) == 1 or unit:getDrawArgumentValue(250) == 1 then
BASE:T(unit_name .. " Cargo doors are open or cargo door not present") BASE:T(unit_name .. " Cargo doors are open or cargo door not present")
ret_val = true ret_val = true
end end
if type_name == "Mi-24P" and unit:getDrawArgumentValue(38) == 1 or unit:getDrawArgumentValue(86) == 1 then if type_name == "Mi-24P" and unit:getDrawArgumentValue(38) == 1 or unit:getDrawArgumentValue(86) == 1 then
BASE:T(unit_name .. " a side door is open") BASE:T(unit_name .. " a side door is open")
ret_val = true ret_val = true
end end
if type_name == "UH-1H" and unit:getDrawArgumentValue(43) == 1 or unit:getDrawArgumentValue(44) == 1 then if type_name == "UH-1H" and unit:getDrawArgumentValue(43) == 1 or unit:getDrawArgumentValue(44) == 1 then
BASE:T(unit_name .. " a side door is open ") BASE:T(unit_name .. " a side door is open ")
ret_val = true ret_val = true
@ -1602,9 +1602,9 @@ function UTILS.IsLoadingDoorOpen( unit_name )
BASE:T(unit_name .. " all doors are closed") BASE:T(unit_name .. " all doors are closed")
end end
return ret_val return ret_val
end -- nil end -- nil
return nil return nil
end end
@ -1643,13 +1643,13 @@ function UTILS.GenerateVHFrequencies()
905,907,920,935,942,950,995, 905,907,920,935,942,950,995,
1000,1025,1030,1050,1065,1116,1175,1182,1210 1000,1025,1030,1050,1065,1116,1175,1182,1210
} }
local FreeVHFFrequencies = {} local FreeVHFFrequencies = {}
-- first range -- first range
local _start = 200000 local _start = 200000
while _start < 400000 do while _start < 400000 do
-- skip existing NDB frequencies# -- skip existing NDB frequencies#
local _found = false local _found = false
for _, value in pairs(_skipFrequencies) do for _, value in pairs(_skipFrequencies) do
@ -1663,7 +1663,7 @@ function UTILS.GenerateVHFrequencies()
end end
_start = _start + 10000 _start = _start + 10000
end end
-- second range -- second range
_start = 400000 _start = 400000
while _start < 850000 do while _start < 850000 do
@ -1680,7 +1680,7 @@ function UTILS.GenerateVHFrequencies()
end end
_start = _start + 10000 _start = _start + 10000
end end
-- third range -- third range
_start = 850000 _start = 850000
while _start <= 999000 do -- adjusted for Gazelle while _start <= 999000 do -- adjusted for Gazelle
@ -1720,7 +1720,7 @@ end
-- @return #table Laser Codes. -- @return #table Laser Codes.
function UTILS.GenerateLaserCodes() function UTILS.GenerateLaserCodes()
local jtacGeneratedLaserCodes = {} local jtacGeneratedLaserCodes = {}
-- helper function -- helper function
local function ContainsDigit(_number, _numberToFind) local function ContainsDigit(_number, _numberToFind)
local _thisNumber = _number local _thisNumber = _number
@ -1734,7 +1734,7 @@ function UTILS.GenerateLaserCodes()
end end
return false return false
end end
-- generate list of laser codes -- generate list of laser codes
local _code = 1111 local _code = 1111
local _count = 1 local _count = 1

View File

@ -547,6 +547,13 @@ function AIRBASE:Register(AirbaseName)
self.isHelipad=true self.isHelipad=true
elseif self.category==Airbase.Category.SHIP then elseif self.category==Airbase.Category.SHIP then
self.isShip=true self.isShip=true
-- DCS bug: Oil rigs and gas platforms have category=2 (ship). Also they cannot be retrieved by coalition.getStaticObjects()
if self.descriptors.typeName=="Oil rig" or self.descriptors.typeName=="Ga" then
self.isHelipad=true
self.isShip=false
self.category=Airbase.Category.HELIPAD
_DATABASE:AddStatic(AirbaseName)
end
else else
self:E("ERROR: Unknown airbase category!") self:E("ERROR: Unknown airbase category!")
end end

View File

@ -1851,27 +1851,27 @@ do -- Patrol methods
-- Calculate the new Route. -- Calculate the new Route.
local FromCoord = PatrolGroup:GetCoordinate() local FromCoord = PatrolGroup:GetCoordinate()
-- test for submarine -- test for submarine
local depth = 0 local depth = 0
local IsSub = false local IsSub = false
if PatrolGroup:IsShip() then if PatrolGroup:IsShip() then
local navalvec3 = FromCoord:GetVec3() local navalvec3 = FromCoord:GetVec3()
if navalvec3.y < 0 then if navalvec3.y < 0 then
depth = navalvec3.y depth = navalvec3.y
IsSub = true IsSub = true
end end
end end
local Waypoint = Waypoints[1] local Waypoint = Waypoints[1]
local Speed = Waypoint.speed or (20 / 3.6) local Speed = Waypoint.speed or (20 / 3.6)
local From = FromCoord:WaypointGround( Speed ) local From = FromCoord:WaypointGround( Speed )
if IsSub then if IsSub then
From = FromCoord:WaypointNaval( Speed, Waypoint.alt ) From = FromCoord:WaypointNaval( Speed, Waypoint.alt )
end end
table.insert( Waypoints, 1, From ) table.insert( Waypoints, 1, From )
local TaskRoute = PatrolGroup:TaskFunction( "CONTROLLABLE.PatrolRoute" ) local TaskRoute = PatrolGroup:TaskFunction( "CONTROLLABLE.PatrolRoute" )
@ -1916,7 +1916,7 @@ do -- Patrol methods
local IsSub = false local IsSub = false
if PatrolGroup:IsShip() then if PatrolGroup:IsShip() then
local navalvec3 = FromCoord:GetVec3() local navalvec3 = FromCoord:GetVec3()
if navalvec3.y < 0 then if navalvec3.y < 0 then
depth = navalvec3.y depth = navalvec3.y
IsSub = true IsSub = true
end end
@ -1982,16 +1982,16 @@ do -- Patrol methods
self:F( { PatrolGroup = PatrolGroup:GetName() } ) self:F( { PatrolGroup = PatrolGroup:GetName() } )
if PatrolGroup:IsGround() or PatrolGroup:IsShip() then if PatrolGroup:IsGround() or PatrolGroup:IsShip() then
-- Calculate the new Route. -- Calculate the new Route.
local FromCoord = PatrolGroup:GetCoordinate() local FromCoord = PatrolGroup:GetCoordinate()
-- test for submarine -- test for submarine
local depth = 0 local depth = 0
local IsSub = false local IsSub = false
if PatrolGroup:IsShip() then if PatrolGroup:IsShip() then
local navalvec3 = FromCoord:GetVec3() local navalvec3 = FromCoord:GetVec3()
if navalvec3.y < 0 then if navalvec3.y < 0 then
depth = navalvec3.y depth = navalvec3.y
IsSub = true IsSub = true
end end

View File

@ -598,16 +598,16 @@ function POSITIONABLE:GetHeading()
if DCSPositionable then if DCSPositionable then
local PositionablePosition = DCSPositionable:getPosition() local PositionablePosition = DCSPositionable:getPosition()
if PositionablePosition then if PositionablePosition then
local PositionableHeading = math.atan2( PositionablePosition.x.z, PositionablePosition.x.x ) local PositionableHeading = math.atan2( PositionablePosition.x.z, PositionablePosition.x.x )
if PositionableHeading < 0 then if PositionableHeading < 0 then
PositionableHeading = PositionableHeading + 2 * math.pi PositionableHeading = PositionableHeading + 2 * math.pi
end end
PositionableHeading = PositionableHeading * 180 / math.pi PositionableHeading = PositionableHeading * 180 / math.pi
return PositionableHeading return PositionableHeading
end end
end end
@ -1484,7 +1484,7 @@ do -- Cargo
["Dry-cargo ship-1"] = 70000, ["Dry-cargo ship-1"] = 70000,
["Dry-cargo ship-2"] = 70000, ["Dry-cargo ship-2"] = 70000,
["Higgins_boat"] = 3700, -- Higgins Boat can load 3700 kg of general cargo or 36 men (source wikipedia). ["Higgins_boat"] = 3700, -- Higgins Boat can load 3700 kg of general cargo or 36 men (source wikipedia).
["USS_Samuel_Chase"] = 25000, -- Let's say 25 tons for now. Wiki says 33 Higgins boats, which would be 264 tons (can't be right!) and/or 578 troops. ["USS_Samuel_Chase"] = 25000, -- Let's say 25 tons for now. Wiki says 33 Higgins boats, which would be 264 tons (can't be right!) and/or 578 troops.
["LST_Mk2"] =2100000, -- Can carry 2100 tons according to wiki source! ["LST_Mk2"] =2100000, -- Can carry 2100 tons according to wiki source!
} }
self.__.CargoBayWeightLimit = ( Weights[Desc.typeName] or 50000 ) self.__.CargoBayWeightLimit = ( Weights[Desc.typeName] or 50000 )