Compare commits

...

124 Commits

Author SHA1 Message Date
Frank
8b4ba430fb Update Airbase.lua
- Fixed #1524
2021-05-07 21:55:56 +02:00
Frank
3b0949de72 Fixed Ground Speed Issues
COORDINATE
- Fixed issue with ground units not honoring set speed by setting `ETA_locked=false` in `COORDINATE:WaypointGround` function (used by other classes and routines in MOOSE). See #1484
- Also set `ETA_locked=false` for `COORINATE:WaypointAir` and `COORDINATE:WaypointNaval`
2021-05-07 21:46:03 +02:00
Applevangelist
2309487429 Merge pull request #1531 from FlightControl-Master/AA-4
Update Shorad.lua
2021-05-03 17:32:40 +02:00
Applevangelist
a3decc33c9 Update Shorad.lua
Add option to defend a SET_STATIC - e.g. group of bunkers or other static objects.
2021-05-03 17:30:18 +02:00
Applevangelist
b2d87a8780 Update Set.lua
correct typo in function name
2021-05-03 09:27:56 +02:00
Applevangelist
5034005f6b slightly higher landing speed 2021-05-02 15:29:42 +02:00
Applevangelist
c045ba0c6d Update Sead.lua 2021-05-02 11:35:30 +02:00
Applevangelist
d0fb4d44ef Update Sead.lua
test GH Desktop
2021-05-02 11:28:50 +02:00
Applevangelist
620f4b96b9 Merge pull request #1530 from FlightControl-Master/AA-4
Update Mantis.lua
2021-05-01 17:32:24 +02:00
Applevangelist
39d3f85b71 Update Mantis.lua
Adjustments for 2.7
2021-05-01 17:23:17 +02:00
Applevangelist
9a7df65faa Update Shorad.lua
Adjust to Event changes
2021-05-01 17:18:01 +02:00
Applevangelist
596eb4c7e4 Update Sead.lua
Adjust to Event changes
2021-05-01 17:13:07 +02:00
Applevangelist
2bcc531e73 Update Event.lua (#1526)
Updates for Event 33 and 6 - also makes Scoring work again
2021-05-01 14:26:03 +02:00
Applevangelist
57f6096aa1 Update Controllable.lua (#1518)
Error line 1466
2021-04-25 20:24:41 +02:00
Frank
dc64b98c59 Update Act_Route.lua
- Fixed bug in ACT_GROUP:GetRouteText
2021-04-23 13:27:31 +02:00
Applevangelist
e6dde7335a Merge pull request #1517 from FlightControl-Master/aa
Update Controllable.lua
2021-04-23 12:02:59 +02:00
Applevangelist
bbb2174957 Update Controllable.lua
added `OptionDisperseOnAttack` for GROUND units
2021-04-23 12:00:49 +02:00
Applevangelist
b37b50a0c6 Merge pull request #1515 from FlightControl-Master/AA-3
Update Controllable.lua
2021-04-23 09:53:58 +02:00
Applevangelist
459ff8038b Update Controllable.lua
Some Docu updates
2021-04-23 09:51:58 +02:00
Applevangelist
f2da862442 Merge pull request #1514 from FlightControl-Master/aa-1
Update .gitignore
2021-04-22 12:47:37 +02:00
Applevangelist
9c6c2ec5ca Update .gitignore 2021-04-22 12:46:37 +02:00
Applevangelist
aa13583aa7 Update README.md
added badge
2021-04-22 12:39:35 +02:00
Applevangelist
002f1e09ef Merge pull request #1513 from FlightControl-Master/AA-2
Update Airboss.lua
2021-04-22 10:39:04 +02:00
Applevangelist
5091ed7d6d Update Airboss.lua 2021-04-22 10:26:02 +02:00
Applevangelist
2475f22937 Create .luacheckrc 2021-04-22 10:08:57 +02:00
Applevangelist
f4f12f786c Update Airboss.lua
Escape error
2021-04-21 18:52:44 +02:00
Applevangelist
eb659446df Merge pull request #1510 from FlightControl-Master/AA
Update DCS.lua
2021-04-21 15:50:26 +02:00
Applevangelist
62c42adebc Update DCS.lua 2021-04-21 15:48:54 +02:00
Applevangelist
0fc91595b8 Merge pull request #1508 from FlightControl-Master/Applevangelist-patch-2
Update Group.lua
2021-04-20 17:31:00 +02:00
Applevangelist
18fca6461b Update Group.lua 2021-04-20 17:27:48 +02:00
Applevangelist
869b819a4f Merge pull request #1506 from IdefixRC/master
Create Airbase.lua
2021-04-20 16:23:19 +02:00
IdefixRC
8ae6192a5f Create Airbase.lua
New Syria Airbases added to list: H4, Gaziantep, Rosh Pina, Sayqal, Shayrat, Tiyas, Tha'lah and Naqoura
2021-04-20 15:43:45 +08:00
Applevangelist
3b2af6ea07 Update appveyor.yml 2021-04-19 20:49:17 +02:00
Applevangelist
82da7a8f24 Update appveyor.yml 2021-04-19 20:47:16 +02:00
Applevangelist
3749686882 Update appveyor.yml 2021-04-19 20:46:30 +02:00
Applevangelist
b2eba4911a Update appveyor.yml 2021-04-19 20:44:50 +02:00
Applevangelist
40700a387c Update appveyor.yml 2021-04-19 20:42:24 +02:00
Applevangelist
0577940d58 Update appveyor.yml 2021-04-19 20:38:50 +02:00
Frank
1d6be07cff Update appveyor.yml 2021-04-18 22:59:20 +02:00
Frank
2d6545429a Update Unit.lua
- Appveyor test
2021-04-18 22:16:46 +02:00
Frank
9f095a1d28 Update appveyor.yml
- Token for my appveyor account.
2021-04-18 22:14:51 +02:00
Frank
91b6da70af Update Event.lua 2021-04-18 14:49:08 +02:00
Frank
235e40cb26 Merge pull request #1505 from Applevangelist/revert-1491-patch-83
Revert "Update Group.lua"
2021-04-18 14:38:07 +02:00
Frank
8ba3a30278 Update appveyor.yml 2021-04-18 14:34:36 +02:00
Applevangelist
3675ddaf04 Revert "Update Group.lua" 2021-04-18 12:09:37 +02:00
Frank
62a59e7b2a Merge pull request #1503 from FlightControl-Master/FF/MasterDevel
Update ATIS.lua
2021-04-17 23:38:25 +02:00
Frank
1f949463aa Update ATIS.lua 2021-04-17 23:36:49 +02:00
Frank
6d53a30b1f Update appveyor.yml 2021-04-17 23:36:14 +02:00
Frank
5aeb480069 Update ATIS.lua 2021-04-17 23:29:53 +02:00
Frank
4b6aa3b56f Update appveyor.yml 2021-04-17 23:29:31 +02:00
Frank
4209569f29 Merge pull request #1502 from FlightControl-Master/FF/MasterDevel
Update Unit.lua
2021-04-17 23:05:42 +02:00
Frank
7106efbc04 Update Unit.lua 2021-04-17 22:56:54 +02:00
Frank
4e878e49a7 Merge pull request #1501 from FlightControl-Master/FF/MasterDevel
Update Unit.lua
2021-04-17 22:20:32 +02:00
Frank
3e470e557d Update Unit.lua 2021-04-17 22:19:27 +02:00
Frank
5f567fcf66 Merge pull request #1500 from FlightControl-Master/FF/MasterDevel
Ff/master devel
2021-04-17 21:46:46 +02:00
Frank
2289e16d91 Update Unit.lua 2021-04-17 21:45:17 +02:00
Frank
40415ef933 Update Unit.lua 2021-04-17 21:31:55 +02:00
Frank
6519c30b3a Update Unit.lua 2021-04-17 21:26:26 +02:00
Frank
42d253a9ca Update Unit.lua 2021-04-17 21:22:09 +02:00
Frank
38b40e2931 Update Unit.lua 2021-04-17 21:16:34 +02:00
Frank
f7a7ea14a3 Merge pull request #1495 from FlightControl-Master/FF/MasterDevel
Update Unit.lua
2021-04-17 19:49:38 +02:00
Frank
41e0f92cc0 Update Unit.lua 2021-04-17 19:49:04 +02:00
Frank
2c5e9789db Merge pull request #1494 from FlightControl-Master/FF/MasterDevel
Update ATIS.lua
2021-04-17 10:29:19 +02:00
Frank
e198aae1dd Update ATIS.lua 2021-04-17 10:28:18 +02:00
Frank
d040cc0d03 DCS 2.7
- Added COORDINATE:LineToAll and COORDINATE:CircleToAll
- Added altitude parameter to CONTROLLABLE:TaskFireAtPoint
- Added emission on/off functions to UNIT
2021-04-16 23:05:02 +02:00
Pikes
f078e94a7a Merge pull request #1493 from Applevangelist/patch-86
Update DCS.lua
2021-04-16 17:57:05 +01:00
Pikes
9973099f57 Merge pull request #1492 from Applevangelist/patch-85
Update Unit.lua
2021-04-16 17:56:50 +01:00
Pikes
9ca7785a64 Merge pull request #1491 from Applevangelist/patch-83
Update Group.lua
2021-04-16 17:56:33 +01:00
Applevangelist
e7d5fd6c1b Update DCS.lua
enableEmissions
2021-04-16 12:46:45 +02:00
Applevangelist
9eed35ace7 Update Unit.lua
Added changes for EnableEmission
2021-04-16 12:40:32 +02:00
Applevangelist
c7ec1b4e5e Update Group.lua
Added code for EnableEmission
2021-04-16 12:37:35 +02:00
Frank
34ffebb46a Merge pull request #1489 from Applevangelist/patch-81
Events - Workaround for 2.7
2021-04-15 14:53:30 +02:00
Applevangelist
e8a2167934 Events - Workaround for 2.7
Same as for Event 31
2021-04-15 13:01:02 +02:00
Frank
fa342a5b6b ATIS v0.9.1
- DCS 2.7 weather presetss
2021-04-14 23:42:36 +02:00
Frank
4ebcaf913c Merge pull request #1488 from Applevangelist/patch-80
Update Shorad.lua
2021-04-07 20:52:29 +02:00
Frank
7a4c9806a4 Merge pull request #1487 from Applevangelist/patch-79
Update Mantis.lua
2021-04-07 20:52:16 +02:00
Applevangelist
bddc1d7fdc Update Shorad.lua
Added option to use AI on/off instead of changing the alert state
2021-04-07 19:32:34 +02:00
Applevangelist
cb813b70e1 Update Mantis.lua
Added option to use AI on/off instead of changing the alert state
2021-04-07 19:31:10 +02:00
Frank
f161f08fc1 Update Event.lua
- Fixed typo
2021-03-29 19:55:11 +02:00
Frank
3e22411328 Events
- Added new DCS events
2021-03-29 18:01:42 +02:00
Frank
b00778bb86 Update AI_A2A_Cap.lua
Fixes #1474
2021-03-29 09:53:30 +02:00
Frank
564f95781e Update Positionable.lua
- Added cargo bay limits for ground (by kappa) and naval units.
2021-03-28 20:29:15 +02:00
Frank
6c2f8aa6ff Merge pull request #1477 from Applevangelist/patch-73
Utils - added Convert knots to alitude corrected KIAS
2021-03-22 12:04:24 +01:00
Applevangelist
2e342e4341 Utils - added Convert knots to alitude corrected KIAS
Added - Convert knots to alitude corrected KIAS, e.g. for tankers.
2021-03-22 11:47:39 +01:00
Frank
3c6089884e Update Airboss.lua
- Added MP wire correction function.
2021-03-02 21:19:30 +01:00
Frank
884ea866e2 AIRBOSS v1.1.6
Adjusted and (hopefully improved) parameters.
- Angled deck 9.0° --> 9.1359° (from DCS config file)
USS Stennis:
- Deck height 19.00 --> 19.06 meters (from DCS config file)
Supercarriers:
- Deck height 20.0 -->20.1394 meters (from DCS config file)
- stern coordinate 1.0 meters more on starboard side (LUR calls).
2021-02-28 23:25:32 +01:00
Frank
1af1ada7dc Merge pull request #1463 from Applevangelist/patch-65
Update Mantis.lua
2021-02-24 13:46:24 +01:00
Applevangelist
c72c3fd091 Update Mantis.lua
Added a smarter switch-on distance for SHORAD, added user function to set AWACS detection range, change default SAM firing range to 95%
2021-02-24 12:55:54 +01:00
Frank
0848718313 Merge pull request #1462 from Applevangelist/patch-64
Error in NewFromLLDD - altitude isn't set if given
2021-02-23 10:37:25 +01:00
Applevangelist
832abd7860 Error in NewFromLLDD - altitude isn't set if given
Thanks to tomekldc
2021-02-23 10:34:55 +01:00
Frank
12e745af54 Merge pull request #1460 from Applevangelist/patch-62
Update AI_Cargo_Helicopter.lua
2021-02-19 14:41:37 +01:00
Applevangelist
f18c818b8e Update AI_Cargo_Helicopter.lua 2021-02-19 10:04:30 +01:00
Applevangelist
4deca4f816 Update AI_Cargo_Helicopter.lua
Helicopters don't drive, they fly... ;)
2021-02-19 09:59:12 +01:00
Frank
b023ecfb99 Merge pull request #1459 from Applevangelist/patch-61
Update AI_Cargo_Helicopter.lua
2021-02-18 17:21:28 +01:00
Applevangelist
cdb491bb5f Update AI_Cargo_Helicopter.lua
Added docu on Pseudo Function, make Home() function clear and Height useful
2021-02-18 17:05:36 +01:00
Frank
3ac47c967e Merge pull request #1458 from Applevangelist/patch-60
Update Shorad.lua
2021-02-17 15:44:47 +01:00
Frank
e577062720 Merge pull request #1457 from Applevangelist/patch-59
Update Mantis.lua
2021-02-17 15:44:34 +01:00
Applevangelist
95dc7ad2b4 Update Shorad.lua
code example added
2021-02-17 14:04:59 +01:00
Applevangelist
fccf58cd6c Update Mantis.lua
added code examples
2021-02-17 14:02:37 +01:00
Frank
6791e4d4ba Update Set.lua
- Improved docs for `:FilterPrefixes()`
2021-02-17 13:11:22 +01:00
Frank
11f8ac4820 Merge pull request #1456 from Applevangelist/patch-58
Update Mantis.lua
2021-02-17 11:00:43 +01:00
Frank
8f2672f928 Merge pull request #1455 from Applevangelist/patch-57
Update Shorad.lua
2021-02-17 11:00:33 +01:00
Frank
fb66d74ab7 ENUMS
- ENUMS: Added Phonetic and ISOLang by A101Wayz

- Fixed CALLSIGN.JTAC.Warrior (was CALLSIGN.JTAC.Warrier)
2021-02-17 10:26:13 +01:00
Applevangelist
37c061bcbd Update Mantis.lua
Nicefy doc output, Shorad link doc
2021-02-17 09:14:56 +01:00
Applevangelist
9491b18ff4 Update Shorad.lua
Own picture and quote, cleanup docs, link missions, less overhead by avoiding checks on friendly fire.
2021-02-17 09:13:35 +01:00
Frank
8cff2eaac0 Merge pull request #1454 from Applevangelist/patch-56
Update Moose.files
2021-02-16 17:56:30 +01:00
Frank
f64550f7c8 Merge pull request #1453 from Applevangelist/patch-55
Include Shorad.lua
2021-02-16 17:56:18 +01:00
Frank
0addafa627 Merge pull request #1452 from Applevangelist/patch-54
Shorad.lua - Initial release
2021-02-16 17:56:06 +01:00
Frank
b643d73f7f Merge pull request #1451 from Applevangelist/patch-53
Update Sead.lua
2021-02-16 17:55:53 +01:00
Applevangelist
798c5b292a Update Moose.files 2021-02-16 16:30:46 +01:00
Applevangelist
688c57d91d Update Moose.files 2021-02-16 16:29:13 +01:00
Applevangelist
d4c8d5d91b Include Shorad.lua 2021-02-16 16:26:25 +01:00
Applevangelist
154cc9fbeb Shorad.lua - Initial release
:)
2021-02-16 16:25:22 +01:00
Frank
327bac3058 Merge pull request #1450 from Applevangelist/patch-52
Integrate option for Shorad in Mantis
2021-02-16 16:23:14 +01:00
Applevangelist
c0e58e9c92 Update Sead.lua
Handle new shortened weapon names in DCS, make handling more graceful
2021-02-16 16:14:53 +01:00
Applevangelist
e8bfab515c Integrate option for Shorad in Mantis
Also, correct some documentation errors
2021-02-16 16:13:10 +01:00
Frank
695f204493 Merge pull request #1442 from Applevangelist/patch-49
Update Task_A2G_Dispatcher.lua
2021-01-28 15:47:22 +01:00
Frank
a7202ccd0d Merge pull request #1443 from Applevangelist/patch-50
Update Designate.lua
2021-01-28 12:24:46 +01:00
Applevangelist
c71c6c5178 Update Designate.lua
Use of added injection of Task Name into DetectedItem; useful when using also Designate with same Detection Object to ensure menu entries are harmonized.
2021-01-28 10:10:39 +01:00
Applevangelist
155b06edc8 Update Task_A2G_Dispatcher.lua
Added injection of Task Name into DetectedItem; useful when using also Designate with same Detection Object to ensure menu entries are harmonized.
2021-01-28 10:04:00 +01:00
Frank
64b8f2fb46 Merge pull request #1441 from Applevangelist/patch-48
Update Mantis.lua
2021-01-26 12:39:14 +01:00
Applevangelist
7a07e15032 Update Mantis.lua 2021-01-26 11:06:08 +01:00
Frank
3d74312d43 Merge pull request #1440 from Applevangelist/patch-47
Update Mantis.lua
2021-01-26 09:27:42 +01:00
Applevangelist
6baf85d429 Update Mantis.lua
Some Doc corrections
2021-01-26 09:26:39 +01:00
28 changed files with 1535 additions and 207 deletions

View File

@@ -26,24 +26,25 @@ init:
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
install:
- cmd:
# Outcomment if lua environment invalidates and needs to be reinstalled, otherwise all will run from the cache.
# - call choco install 7zip.commandline
# - call choco install lua51
# - call choco install luarocks
# - call refreshenv
# - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
# - cmd: PATH = %PATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\bin
# - cmd: set LUA_PATH = %LUA_PATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\share\lua\5.1\?.lua;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\share\lua\5.1\?\init.lua
# - cmd: set LUA_CPATH = %LUA_CPATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\lib\lua\5.1\?.dll
# - call luarocks install luasrcdiet
# - call luarocks install checks
# - call luarocks install luadocumentor
# - call luarocks install luacheck
call choco install 7zip.commandline
call choco install lua51
call choco install luarocks
call refreshenv
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
cmd: PATH = %PATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\bin
cmd: set LUA_PATH = %LUA_PATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\share\lua\5.1\?.lua;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\share\lua\5.1\?\init.lua
cmd: set LUA_CPATH = %LUA_CPATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\lib\lua\5.1\?.dll
call luarocks install luasrcdiet
call luarocks install checks
call luarocks install luadocumentor
call luarocks install luacheck
#cache:
# - C:\ProgramData\chocolatey\lib
# - C:\ProgramData\chocolatey\bin
cache:
C:\ProgramData\chocolatey\lib
C:\ProgramData\chocolatey\bin
@@ -51,8 +52,9 @@ build_script:
- ps: |
if( $env:appveyor_repo_branch -eq 'master' -or $env:appveyor_repo_branch -eq 'develop' )
{
echo "Hello World!"
$apiUrl = 'https://ci.appveyor.com/api'
$token = 'qts80b5kpq0ooj4x6vvw'
$token = 'v2.6hcv3ige78kg3yvg4ge8'
$headers = @{
"Authorization" = "Bearer $token"
"Content-type" = "application/json"
@@ -65,7 +67,7 @@ build_script:
if( $env:appveyor_repo_branch -eq 'master' -or $env:appveyor_repo_branch -eq 'develop' )
{
$apiUrl = 'https://ci.appveyor.com/api'
$token = 'qts80b5kpq0ooj4x6vvw'
$token = 'v2.6hcv3ige78kg3yvg4ge8'
$headers = @{
"Authorization" = "Bearer $token"
"Content-type" = "application/json"

2
.gitignore vendored
View File

@@ -18,6 +18,8 @@ local.properties
# External tool builders
.externalToolBuilders/
# AppVeyor
.appveyor/
# CDT-specific
.cproject

54
.luacheckrc Normal file
View File

@@ -0,0 +1,54 @@
ignore = {
"011", -- A syntax error.
"021", -- An invalid inline option.
"022", -- An unpaired inline push directive.
"023", -- An unpaired inline pop directive.
"111", -- Setting an undefined global variable.
"112", -- Mutating an undefined global variable.
"113", -- Accessing an undefined global variable.
"121", -- Setting a read-only global variable.
"122", -- Setting a read-only field of a global variable.
"131", -- Unused implicitly defined global variable.
"142", -- Setting an undefined field of a global variable.
"143", -- Accessing an undefined field of a global variable.
"211", -- Unused local variable.
"212", -- Unused argument.
"213", -- Unused loop variable.
"221", -- Local variable is accessed but never set.
"231", -- Local variable is set but never accessed.
"232", -- An argument is set but never accessed.
"233", -- Loop variable is set but never accessed.
"241", -- Local variable is mutated but never accessed.
"311", -- Value assigned to a local variable is unused.
"312", -- Value of an argument is unused.
"313", -- Value of a loop variable is unused.
"314", -- Value of a field in a table literal is unused.
"321", -- Accessing uninitialized local variable.
"331", -- Value assigned to a local variable is mutated but never accessed.
"341", -- Mutating uninitialized local variable.
"411", -- Redefining a local variable.
"412", -- Redefining an argument.
"413", -- Redefining a loop variable.
"421", -- Shadowing a local variable.
"422", -- Shadowing an argument.
"423", -- Shadowing a loop variable.
"431", -- Shadowing an upvalue.
"432", -- Shadowing an upvalue argument.
"433", -- Shadowing an upvalue loop variable.
"511", -- Unreachable code.
"512", -- Loop can be executed at most once.
"521", -- Unused label.
"531", -- Left-hand side of an assignment is too short.
"532", -- Left-hand side of an assignment is too long.
"541", -- An empty do end block.
"542", -- An empty if branch.
"551", -- An empty statement.
"561", -- Cyclomatic complexity of a function is too high.
"571", -- A numeric for loop goes from #(expr) down to 1 or less without negative step.
"611", -- A line consists of nothing but whitespace.
"612", -- A line contains trailing whitespace.
"613", -- Trailing whitespace in a string.
"614", -- Trailing whitespace in a comment.
"621", -- Inconsistent indentation (SPACE followed by TAB).
"631", -- Line is too long.
}

View File

@@ -143,7 +143,7 @@ end
-- @return #AI_A2A_CAP
function AI_A2A_CAP:New( AICap, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, EngageMinSpeed, EngageMaxSpeed, PatrolAltType )
return self:New2( AICap, EngageMinSpeed, EngageMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolZone, PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, PatrolAltType )
return self:New2( AICap, EngageMinSpeed, EngageMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, PatrolZone, PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType )
end

View File

@@ -33,7 +33,7 @@
--
-- ## Infantry health.
--
-- When infantry is unboarded from the APCs, the infantry is actually respawned into the battlefield.
-- When infantry is unboarded from the helicopters, the infantry is actually respawned into the battlefield.
-- As a result, the unboarding infantry is very _healthy_ every time it unboards.
-- This is due to the limitation of the DCS simulator, which is not able to specify the health of new spawned units as a parameter.
-- However, infantry that was destroyed when unboarded, won't be respawned again. Destroyed is destroyed.
@@ -67,18 +67,6 @@ function AI_CARGO_HELICOPTER:New( Helicopter, CargoSet )
self:AddTransition( "Unloaded", "Pickup", "*" )
self:AddTransition( "Loaded", "Deploy", "*" )
--[[
self:AddTransition( { "Unloaded", "Loading" }, "Load", "Boarding" )
self:AddTransition( "Boarding", "Board", "Boarding" )
self:AddTransition( "Boarding", "Loaded", "Loaded" )
self:AddTransition( "Boarding", "PickedUp", "Loaded" )
self:AddTransition( "Boarding", "Deploy", "Loaded" )
self:AddTransition( "Loaded", "Unload", "Unboarding" )
self:AddTransition( "Unboarding", "Unboard", "Unboarding" )
self:AddTransition( "Unboarding", "Unloaded", "Unboarding" )
self:AddTransition( "Unboarding", "Deployed", "Unloaded" )
self:AddTransition( "Unboarding", "Pickup", "Unloaded" )
--]]
self:AddTransition( "*", "Loaded", "Loaded" )
self:AddTransition( "Unboarding", "Pickup", "Unloaded" )
self:AddTransition( "Unloaded", "Unboard", "Unloaded" )
@@ -107,13 +95,31 @@ function AI_CARGO_HELICOPTER:New( Helicopter, CargoSet )
-- @param #string Event
-- @param #string To
-- @param Core.Point#COORDINATE Coordinate
-- @param #number Speed Speed in km/h to drive to the pickup coordinate. Default is 50% of max possible speed the unit can go.
-- @param #number Speed Speed in km/h to fly to the pickup coordinate. Default is 50% of max possible speed the unit can go.
--- PickedUp Handler OnAfter for AI_CARGO_HELICOPTER - Cargo set has been picked up, ready to deploy
-- @function [parent=#AI_CARGO_HELICOPTER] OnAfterPickedUp
-- @param #AI_CARGO_HELICOPTER self
-- @param Wrapper.Group#GROUP Helicopter The helicopter #GROUP object
-- @param #string From
-- @param #string Event
-- @param #string To
-- @param Wrapper.Unit#UNIT Unit The helicopter #UNIT object
--- Unloaded Handler OnAfter for AI_CARGO_HELICOPTER - Cargo unloaded, carrier is empty
-- @function [parent=#AI_CARGO_HELICOPTER] OnAfterUnloaded
-- @param #AI_CARGO_HELICOPTER self
-- @param #string From
-- @param #string Event
-- @param #string To
-- @param Cargo.CargoGroup#CARGO_GROUP Cargo The #CARGO_GROUP object.
-- @param Wrapper.Unit#UNIT Unit The helicopter #UNIT object
--- Pickup Trigger for AI_CARGO_HELICOPTER
-- @function [parent=#AI_CARGO_HELICOPTER] Pickup
-- @param #AI_CARGO_HELICOPTER self
-- @param Core.Point#COORDINATE Coordinate
-- @param #number Speed Speed in km/h to drive to the pickup coordinate. Default is 50% of max possible speed the unit can go.
-- @param #number Speed Speed in km/h to fly to the pickup coordinate. Default is 50% of max possible speed the unit can go.
--- Pickup Asynchronous Trigger for AI_CARGO_HELICOPTER
-- @function [parent=#AI_CARGO_HELICOPTER] __Pickup
@@ -129,7 +135,7 @@ function AI_CARGO_HELICOPTER:New( Helicopter, CargoSet )
-- @param #string Event
-- @param #string To
-- @param Core.Point#COORDINATE Coordinate Place at which cargo is deployed.
-- @param #number Speed Speed in km/h to drive to the pickup coordinate. Default is 50% of max possible speed the unit can go.
-- @param #number Speed Speed in km/h to fly to the pickup coordinate. Default is 50% of max possible speed the unit can go.
-- @return #boolean
--- Deploy Handler OnAfter for AI_CARGO_HELICOPTER
@@ -139,21 +145,42 @@ function AI_CARGO_HELICOPTER:New( Helicopter, CargoSet )
-- @param #string Event
-- @param #string To
-- @param Core.Point#COORDINATE Coordinate
-- @param #number Speed Speed in km/h to drive to the pickup coordinate. Default is 50% of max possible speed the unit can go.
-- @param #number Speed Speed in km/h to fly to the pickup coordinate. Default is 50% of max possible speed the unit can go.
--- Deployed Handler OnAfter for AI_CARGO_HELICOPTER
-- @function [parent=#AI_CARGO_HELICOPTER] OnAfterDeployed
-- @param #AI_CARGO_HELICOPTER self
-- @param #string From
-- @param #string Event
-- @param #string To
--- Deploy Trigger for AI_CARGO_HELICOPTER
-- @function [parent=#AI_CARGO_HELICOPTER] Deploy
-- @param #AI_CARGO_HELICOPTER self
-- @param Core.Point#COORDINATE Coordinate Place at which the cargo is deployed.
-- @param #number Speed Speed in km/h to drive to the pickup coordinate. Default is 50% of max possible speed the unit can go.
-- @param #number Speed Speed in km/h to fly to the pickup coordinate. Default is 50% of max possible speed the unit can go.
--- Deploy Asynchronous Trigger for AI_CARGO_HELICOPTER
-- @function [parent=#AI_CARGO_HELICOPTER] __Deploy
-- @param #number Delay Delay in seconds.
-- @param #AI_CARGO_HELICOPTER self
-- @param Core.Point#COORDINATE Coordinate Place at which the cargo is deployed.
-- @param #number Speed Speed in km/h to drive to the pickup coordinate. Default is 50% of max possible speed the unit can go.
-- @param #number Speed Speed in km/h to fly to the pickup coordinate. Default is 50% of max possible speed the unit can go.
--- Home Trigger for AI_CARGO_HELICOPTER
-- @function [parent=#AI_CARGO_HELICOPTER] Home
-- @param #AI_CARGO_HELICOPTER self
-- @param Core.Point#COORDINATE Coordinate Place to which the helicopter will go.
-- @param #number Speed (optional) Speed in km/h to fly to the pickup coordinate. Default is 50% of max possible speed the unit can go.
-- @param #number Height (optional) Height the Helicopter should be flying at.
--- Home Asynchronous Trigger for AI_CARGO_HELICOPTER
-- @function [parent=#AI_CARGO_HELICOPTER] __Home
-- @param #number Delay Delay in seconds.
-- @param #AI_CARGO_HELICOPTER self
-- @param Core.Point#COORDINATE Coordinate Place to which the helicopter will go.
-- @param #number Speed (optional) Speed in km/h to fly to the pickup coordinate. Default is 50% of max possible speed the unit can go.
-- @param #number Height (optional) Height the Helicopter should be flying at.
-- We need to capture the Crash events for the helicopters.
-- The helicopter reference is used in the semaphore AI_CARGO_QUEUE.
@@ -235,7 +262,7 @@ end
-- @param Event
-- @param To
function AI_CARGO_HELICOPTER:onafterLanded( Helicopter, From, Event, To )
self:F({From, Event, To})
Helicopter:F( { Name = Helicopter:GetName() } )
if Helicopter and Helicopter:IsAlive() then
@@ -250,7 +277,7 @@ function AI_CARGO_HELICOPTER:onafterLanded( Helicopter, From, Event, To )
self:F( { Helicopter:GetName(), Height = Helicopter:GetHeight( true ), Velocity = Helicopter:GetVelocityKMH() } )
if self.RoutePickup == true then
if Helicopter:GetHeight( true ) <= 5.5 and Helicopter:GetVelocityKMH() < 10 then
if Helicopter:GetHeight( true ) <= 5.5 and Helicopter:GetVelocityKMH() < 15 then
--self:Load( Helicopter:GetPointVec2() )
self:Load( self.PickupZone )
self.RoutePickup = false
@@ -258,7 +285,7 @@ function AI_CARGO_HELICOPTER:onafterLanded( Helicopter, From, Event, To )
end
if self.RouteDeploy == true then
if Helicopter:GetHeight( true ) <= 5.5 and Helicopter:GetVelocityKMH() < 10 then
if Helicopter:GetHeight( true ) <= 5.5 and Helicopter:GetVelocityKMH() < 15 then
self:Unload( self.DeployZone )
self.RouteDeploy = false
end
@@ -276,7 +303,7 @@ end
-- @param Core.Point#COORDINATE Coordinate
-- @param #number Speed
function AI_CARGO_HELICOPTER:onafterQueue( Helicopter, From, Event, To, Coordinate, Speed, DeployZone )
self:F({From, Event, To, Coordinate, Speed, DeployZone})
local HelicopterInZone = false
if Helicopter and Helicopter:IsAlive() == true then
@@ -359,7 +386,8 @@ end
-- @param Core.Point#COORDINATE Coordinate
-- @param #number Speed
function AI_CARGO_HELICOPTER:onafterOrbit( Helicopter, From, Event, To, Coordinate )
self:F({From, Event, To, Coordinate})
if Helicopter and Helicopter:IsAlive() then
local Route = {}
@@ -394,7 +422,7 @@ end
-- @param #boolean Deployed Cargo is deployed.
-- @return #boolean True if all cargo has been unloaded.
function AI_CARGO_HELICOPTER:onafterDeployed( Helicopter, From, Event, To, DeployZone )
self:F( { Helicopter, From, Event, To, DeployZone = DeployZone } )
self:F( { From, Event, To, DeployZone = DeployZone } )
self:Orbit( Helicopter:GetCoordinate(), 50 )
@@ -416,7 +444,7 @@ end
-- @param Event
-- @param To
-- @param Core.Point#COORDINATE Coordinate Pickup place.
-- @param #number Speed Speed in km/h to drive to the pickup coordinate. Default is 50% of max possible speed the unit can go.
-- @param #number Speed Speed in km/h to fly to the pickup coordinate. Default is 50% of max possible speed the unit can go.
-- @param #number Height Height in meters to move to the pickup coordinate. This parameter is ignored for APCs.
-- @param Core.Zone#ZONE PickupZone (optional) The zone where the cargo will be picked up. The PickupZone can be nil, if there wasn't any PickupZoneSet provided.
function AI_CARGO_HELICOPTER:onafterPickup( Helicopter, From, Event, To, Coordinate, Speed, Height, PickupZone )
@@ -485,10 +513,10 @@ end
-- @param Event
-- @param To
-- @param Core.Point#COORDINATE Coordinate Place at which the cargo is deployed.
-- @param #number Speed Speed in km/h to drive to the pickup coordinate. Default is 50% of max possible speed the unit can go.
-- @param #number Speed Speed in km/h to fly to the pickup coordinate. Default is 50% of max possible speed the unit can go.
-- @param #number Height Height in meters to move to the deploy coordinate.
function AI_CARGO_HELICOPTER:onafterDeploy( Helicopter, From, Event, To, Coordinate, Speed, Height, DeployZone )
self:F({From, Event, To, Coordinate, Speed, Height, DeployZone})
if Helicopter and Helicopter:IsAlive() ~= nil then
self.RouteDeploy = true
@@ -550,11 +578,12 @@ end
-- @param Event
-- @param To
-- @param Core.Point#COORDINATE Coordinate Home place.
-- @param #number Speed Speed in km/h to drive to the pickup coordinate. Default is 50% of max possible speed the unit can go.
-- @param #number Speed Speed in km/h to fly to the pickup coordinate. Default is 50% of max possible speed the unit can go.
-- @param #number Height Height in meters to move to the home coordinate.
-- @param Core.Zone#ZONE HomeZone The zone wherein the carrier will return when all cargo has been transported. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE.
function AI_CARGO_HELICOPTER:onafterHome( Helicopter, From, Event, To, Coordinate, Speed, Height, HomeZone )
self:F({From, Event, To, Coordinate, Speed, Height})
if Helicopter and Helicopter:IsAlive() ~= nil then
self.RouteHome = true
@@ -563,7 +592,8 @@ function AI_CARGO_HELICOPTER:onafterHome( Helicopter, From, Event, To, Coordinat
--- Calculate the target route point.
Coordinate.y = Height
--Coordinate.y = Height
Height = Height or 50
Speed = Speed or Helicopter:GetSpeedMax()*0.5
@@ -576,7 +606,7 @@ function AI_CARGO_HELICOPTER:onafterHome( Helicopter, From, Event, To, Coordinat
--- Create a route point of type air.
local CoordinateTo = Coordinate
local landheight = CoordinateTo:GetLandHeight() -- get target height
CoordinateTo.y = landheight + 50 -- flight height should be 50m above ground
CoordinateTo.y = landheight + Height -- flight height should be 50m above ground
local WaypointTo = CoordinateTo:WaypointAir("RADIO", POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, Speed, true)
@@ -589,12 +619,11 @@ function AI_CARGO_HELICOPTER:onafterHome( Helicopter, From, Event, To, Coordinat
Tasks[#Tasks+1] = Helicopter:TaskLandAtVec2( CoordinateTo:GetVec2() )
Route[#Route].task = Helicopter:TaskCombo( Tasks )
Route[#Route+1] = WaypointTo
-- Now route the helicopter
Helicopter:Route(Route, 0)
end
end

View File

@@ -190,7 +190,7 @@ do -- ACT_ROUTE
self:F( { ZoneName = ZoneName } )
local Zone = Zone -- Core.Zone#ZONE
local ZoneCoord = Zone:GetCoordinate()
local ZoneDistance = ZoneCoord:Get2DDistance( self.Coordinate )
local ZoneDistance = ZoneCoord:Get2DDistance( Coordinate )
self:F( { ShortestDistance, ShortestReferenceName } )
if ShortestDistance == 0 or ZoneDistance < ShortestDistance then
ShortestDistance = ZoneDistance

View File

@@ -676,6 +676,37 @@ do -- Event Handling
-- @param #BASE self
-- @param Core.Event#EVENTDATA EventData The EventData structure.
--- Paratrooper landing.
-- @function [parent=#BASE] OnEventParatrooperLanding
-- @param #BASE self
-- @param Core.Event#EVENTDATA EventData The EventData structure.
--- Discard chair after ejection.
-- @function [parent=#BASE] OnEventDiscardChairAfterEjection
-- @param #BASE self
-- @param Core.Event#EVENTDATA EventData The EventData structure.
--- Weapon add. Fires when entering a mission per pylon with the name of the weapon (double pylons not counted, infinite wep reload not counted.
-- @function [parent=#BASE] OnEventParatrooperLanding
-- @param #BASE self
-- @param Core.Event#EVENTDATA EventData The EventData structure.
--- Trigger zone.
-- @function [parent=#BASE] OnEventTriggerZone
-- @param #BASE self
-- @param Core.Event#EVENTDATA EventData The EventData structure.
--- Landing quality mark.
-- @function [parent=#BASE] OnEventLandingQualityMark
-- @param #BASE self
-- @param Core.Event#EVENTDATA EventData The EventData structure.
--- BDA.
-- @function [parent=#BASE] OnEventBDA
-- @param #BASE self
-- @param Core.Event#EVENTDATA EventData The EventData structure.
--- Occurs when a player enters a slot and takes control of an aircraft.
-- **NOTE**: This is a workaround of a long standing DCS bug with the PLAYER_ENTER_UNIT event.
-- initiator : The unit that is being taken control of.

View File

@@ -241,13 +241,20 @@ EVENTS = {
Score = world.event.S_EVENT_SCORE or -1,
UnitLost = world.event.S_EVENT_UNIT_LOST or -1,
LandingAfterEjection = world.event.S_EVENT_LANDING_AFTER_EJECTION or -1,
-- Added with DCS 2.7.0
ParatrooperLanding = world.event.S_EVENT_PARATROOPER_LENDING or -1,
DiscardChairAfterEjection = world.event.S_EVENT_DISCARD_CHAIR_AFTER_EJECTION or -1,
WeaponAdd = world.event.S_EVENT_WEAPON_ADD or -1,
TriggerZone = world.event.S_EVENT_TRIGGER_ZONE or -1,
LandingQualityMark = world.event.S_EVENT_LANDING_QUALITY_MARK or -1,
BDA = world.event.S_EVENT_BDA or -1,
}
--- The Event structure
-- Note that at the beginning of each field description, there is an indication which field will be populated depending on the object type involved in the Event:
--
-- * A (Object.Category.)UNIT : A UNIT object type is involved in the Event.
-- * A (Object.Category.)STATIC : A STATIC object type is involved in the Event.µ
-- * A (Object.Category.)STATIC : A STATIC object type is involved in the Event.
--
-- @type EVENTDATA
-- @field #number id The identifier of the event.
@@ -521,6 +528,37 @@ local _EVENTMETA = {
Order = 1,
Event = "OnEventLandingAfterEjection",
Text = "S_EVENT_LANDING_AFTER_EJECTION"
},
-- Added with DCS 2.7.0
[EVENTS.ParatrooperLanding] = {
Order = 1,
Event = "OnEventParatrooperLanding",
Text = "S_EVENT_PARATROOPER_LENDING"
},
[EVENTS.DiscardChairAfterEjection] = {
Order = 1,
Event = "OnEventDiscardChairAfterEjection",
Text = "S_EVENT_DISCARD_CHAIR_AFTER_EJECTION"
},
[EVENTS.WeaponAdd] = {
Order = 1,
Event = "OnEventWeaponAdd",
Text = "S_EVENT_WEAPON_ADD"
},
[EVENTS.TriggerZone] = {
Order = 1,
Event = "OnEventTriggerZone",
Text = "S_EVENT_TRIGGER_ZONE"
},
[EVENTS.LandingQualityMark] = {
Order = 1,
Event = "OnEventLandingQualityMark",
Text = "S_EVENT_LANDING_QUALITYMARK"
},
[EVENTS.BDA] = {
Order = 1,
Event = "OnEventBDA",
Text = "S_EVENT_BDA"
},
}
@@ -1011,6 +1049,14 @@ function EVENT:onEvent( Event )
Event.IniCoalition = 0
Event.IniCategory = 0
Event.IniTypeName = "Ejected Pilot"
elseif Event.id == 33 then -- ejection seat discarded
Event.IniDCSUnit = Event.initiator
local ID=Event.initiator.id_
Event.IniDCSUnitName = string.format("Ejection Seat ID %s", tostring(ID))
Event.IniUnitName = Event.IniDCSUnitName
Event.IniCoalition = 0
Event.IniCategory = 0
Event.IniTypeName = "Ejection Seat"
else
Event.IniDCSUnit = Event.initiator
Event.IniDCSUnitName = Event.IniDCSUnit:getName()
@@ -1077,13 +1123,34 @@ function EVENT:onEvent( Event )
end
if Event.TgtObjectCategory == Object.Category.STATIC then
Event.TgtDCSUnit = Event.target
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
Event.TgtUnitName = Event.TgtDCSUnitName
Event.TgtUnit = STATIC:FindByName( Event.TgtDCSUnitName, false )
Event.TgtCoalition = Event.TgtDCSUnit:getCoalition()
Event.TgtCategory = Event.TgtDCSUnit:getDesc().category
Event.TgtTypeName = Event.TgtDCSUnit:getTypeName()
BASE:T({StaticTgtEvent = Event.id})
-- get base data
Event.TgtDCSUnit = Event.target
if Event.target:isExist() and Event.id ~= 33 then -- leave out ejected seat object
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
Event.TgtUnitName = Event.TgtDCSUnitName
Event.TgtUnit = STATIC:FindByName( Event.TgtDCSUnitName, false )
Event.TgtCoalition = Event.TgtDCSUnit:getCoalition()
Event.TgtCategory = Event.TgtDCSUnit:getDesc().category
Event.TgtTypeName = Event.TgtDCSUnit:getTypeName()
else
Event.TgtDCSUnitName = string.format("No target object for Event ID %s", tostring(Event.id))
Event.TgtUnitName = Event.TgtDCSUnitName
Event.TgtUnit = nil
Event.TgtCoalition = 0
Event.TgtCategory = 0
if Event.id == 6 then
Event.TgtTypeName = "Ejected Pilot"
Event.TgtDCSUnitName = string.format("Ejected Pilot ID %s", tostring(Event.IniDCSUnitName))
Event.TgtUnitName = Event.TgtDCSUnitName
elseif Event.id == 33 then
Event.TgtTypeName = "Ejection Seat"
Event.TgtDCSUnitName = string.format("Ejection Seat ID %s", tostring(Event.IniDCSUnitName))
Event.TgtUnitName = Event.TgtDCSUnitName
else
Event.TgtTypeName = "Static"
end
end
end
if Event.TgtObjectCategory == Object.Category.SCENERY then

View File

@@ -355,9 +355,9 @@ do -- COORDINATE
-- Adjust height
if altitude==nil then
_coord.y=altitude
else
_coord.y=self:GetLandHeight()
else
_coord.y=altitude
end
return _coord
@@ -1184,7 +1184,7 @@ do -- COORDINATE
-- ETA.
RoutePoint.ETA=0
RoutePoint.ETA_locked=true
RoutePoint.ETA_locked=false
-- Waypoint description.
RoutePoint.name=description
@@ -1333,7 +1333,7 @@ do -- COORDINATE
RoutePoint.formation_template=""
RoutePoint.ETA=0
RoutePoint.ETA_locked=true
RoutePoint.ETA_locked=false
RoutePoint.speed = ( Speed or 20 ) / 3.6
RoutePoint.speed_locked = true
@@ -1368,7 +1368,7 @@ do -- COORDINATE
RoutePoint.formation_template = ""
RoutePoint.ETA=0
RoutePoint.ETA_locked=true
RoutePoint.ETA_locked=false
RoutePoint.speed = ( Speed or 20 ) / 3.6
RoutePoint.speed_locked = true
@@ -1978,6 +1978,62 @@ do -- COORDINATE
function COORDINATE:RemoveMark( MarkID )
trigger.action.removeMark( MarkID )
end
--- Line to all.
-- Creates a line on the F10 map from one point to another.
-- @param #COORDINATE self
-- @param #COORDINATE Endpoint COORDIANTE to where the line is drawn.
-- @param #number Coalition Coalition: All=-1, Neutral=0, Red=1, Blue=2. Default -1=All.
-- @param #number LineType Line type: 0=No line, 1=Solid, 2=Dashed, 3=Dotted, 4=Dot dash, 5=Long dash, 6=Two dash. Default 1=Solid.
-- @param #table Color RGB color table {r, g, b}, e.g. {1,0,0} for red (default).
-- @param #number Alpha Transparency [0,1]. Default 1.
-- @param #boolean ReadOnly (Optional) Mark is readonly and cannot be removed by users. Default false.
-- @param #string Text (Optional) Text displayed when mark is added. Default none.
-- @return #number The resulting Mark ID which is a number.
function COORDINATE:LineToAll(Endpoint, Coalition, LineType, Color, Alpha, ReadOnly, Text)
local MarkID = UTILS.GetMarkID()
if ReadOnly==nil then
ReadOnly=false
end
local vec3=Endpoint:GetVec3()
Coalition=Coalition or -1
Color=Color or {1,0,0}
Color[4]=Alpha or 1.0
LineType=LineType or 1
trigger.action.lineToAll(Coalition, MarkID, self:GetVec3(), vec3, Color, LineType, ReadOnly, Text or "")
return MarkID
end
--- Circle to all.
-- Creates a circle on the map with a given radius, color, fill color, and outline.
-- @param #COORDINATE self
-- @param #COORDINATE Center COORDIANTE of the center of the circle.
-- @param #numberr Radius Radius in meters. Default 1000 m.
-- @param #number Coalition Coalition: All=-1, Neutral=0, Red=1, Blue=2. Default -1=All.
-- @param #number LineType Line type: 0=No line, 1=Solid, 2=Dashed, 3=Dotted, 4=Dot dash, 5=Long dash, 6=Two dash. Default 1=Solid.
-- @param #table Color RGB color table {r, g, b}, e.g. {1,0,0} for red (default).
-- @param #number Alpha Transparency [0,1]. Default 1.
-- @param #table FillColor RGB color table {r, g, b}, e.g. {1,0,0} for red (default).
-- @param #number FillAlpha Transparency [0,1]. Default 0.5.
-- @param #boolean ReadOnly (Optional) Mark is readonly and cannot be removed by users. Default false.
-- @param #string Text (Optional) Text displayed when mark is added. Default none.
-- @return #number The resulting Mark ID which is a number.
function COORDINATE:CircleToAll(Radius, Coalition, LineType, Color, Alpha, FillColor, FillAlpha, ReadOnly, Text)
local MarkID = UTILS.GetMarkID()
if ReadOnly==nil then
ReadOnly=false
end
local vec3=self:GetVec3()
Radius=Radius or 1000
Coalition=Coalition or -1
Color=Color or {1,0,0}
Color[4]=Alpha or 1.0
LineType=LineType or 1
FillColor=FillColor or {1,0,0}
FillColor[4]=FillAlpha or 0.5
trigger.action.circleToAll(Coalition, MarkID, vec3, Radius, Color, FillColor, LineType, ReadOnly, Text or "")
return MarkID
end
end -- Markings

View File

@@ -880,8 +880,8 @@ do -- SET_GROUP
--
-- * @{#SET_GROUP.FilterCoalitions}: Builds the SET_GROUP with the groups belonging to the coalition(s).
-- * @{#SET_GROUP.FilterCategories}: Builds the SET_GROUP with the groups belonging to the category(ies).
-- * @{#SET_GROUP.FilterCountries}: Builds the SET_GROUP with the gruops belonging to the country(ies).
-- * @{#SET_GROUP.FilterPrefixes}: Builds the SET_GROUP with the groups starting with the same prefix string(s).
-- * @{#SET_GROUP.FilterCountries}: Builds the SET_GROUP with the groups belonging to the country(ies).
-- * @{#SET_GROUP.FilterPrefixes}: Builds the SET_GROUP with the groups *containing* the given string in the group name. **Attention!** Bad naming convention, as this not really filtering *prefixes*.
-- * @{#SET_GROUP.FilterActive}: Builds the SET_GROUP with the groups that are only active. Groups that are inactive (late activation) won't be included in the set!
--
-- For the Category Filter, extra methods have been added:
@@ -1241,10 +1241,10 @@ do -- SET_GROUP
end
--- Builds a set of groups of defined GROUP prefixes.
-- All the groups starting with the given prefixes will be included within the set.
--- Builds a set of groups that contain the given string in their group name.
-- **Attention!** Bad naming convention as this **does not** filter only **prefixes** but all groups that **contain** the string.
-- @param #SET_GROUP self
-- @param #string Prefixes The prefix of which the group name starts with.
-- @param #string Prefixes The string pattern(s) that needs to be contained in the group name. Can also be passed as a `#table` of strings.
-- @return #SET_GROUP self
function SET_GROUP:FilterPrefixes( Prefixes )
if not self.Filter.GroupPrefixes then
@@ -1843,7 +1843,7 @@ do -- SET_UNIT
-- * @{#SET_UNIT.FilterCategories}: Builds the SET_UNIT with the units belonging to the category(ies).
-- * @{#SET_UNIT.FilterTypes}: Builds the SET_UNIT with the units belonging to the unit type(s).
-- * @{#SET_UNIT.FilterCountries}: Builds the SET_UNIT with the units belonging to the country(ies).
-- * @{#SET_UNIT.FilterPrefixes}: Builds the SET_UNIT with the units starting with the same prefix string(s).
-- * @{#SET_UNIT.FilterPrefixes}: Builds the SET_UNIT with the units sharing the same string(s) in their name. **ATTENTION!** Bad naming convention as this *does not* only filter *prefixes*.
-- * @{#SET_UNIT.FilterActive}: Builds the SET_UNIT with the units that are only active. Units that are inactive (late activation) won't be included in the set!
--
-- Once the filter criteria have been set for the SET_UNIT, you can start filtering using:
@@ -2105,10 +2105,10 @@ do -- SET_UNIT
end
--- Builds a set of units of defined unit prefixes.
-- All the units starting with the given prefixes will be included within the set.
--- Builds a set of UNITs that contain a given string in their unit name.
-- **Attention!** Bad naming convention as this **does not** filter only **prefixes** but all units that **contain** the string.
-- @param #SET_UNIT self
-- @param #string Prefixes The prefix of which the unit name starts with.
-- @param #string Prefixes The string pattern(s) that needs to be contained in the unit name. Can also be passed as a `#table` of strings.
-- @return #SET_UNIT self
function SET_UNIT:FilterPrefixes( Prefixes )
if not self.Filter.UnitPrefixes then
@@ -2963,7 +2963,7 @@ do -- SET_STATIC
-- * @{#SET_STATIC.FilterCategories}: Builds the SET_STATIC with the units belonging to the category(ies).
-- * @{#SET_STATIC.FilterTypes}: Builds the SET_STATIC with the units belonging to the unit type(s).
-- * @{#SET_STATIC.FilterCountries}: Builds the SET_STATIC with the units belonging to the country(ies).
-- * @{#SET_STATIC.FilterPrefixes}: Builds the SET_STATIC with the units starting with the same prefix string(s).
-- * @{#SET_STATIC.FilterPrefixes}: Builds the SET_STATIC with the units containing the same string(s) in their name. **ATTENTION** bad naming convention as this *does not** only filter *prefixes*.
--
-- Once the filter criteria have been set for the SET_STATIC, you can start filtering using:
--
@@ -3176,10 +3176,10 @@ do -- SET_STATIC
end
--- Builds a set of units of defined unit prefixes.
-- All the units starting with the given prefixes will be included within the set.
--- Builds a set of STATICs that contain the given string in their name.
-- **Attention!** Bad naming convention as this **does not** filter only **prefixes** but all statics that **contain** the string.
-- @param #SET_STATIC self
-- @param #string Prefixes The prefix of which the unit name starts with.
-- @param #string Prefixes The string pattern(s) that need to be contained in the static name. Can also be passed as a `#table` of strings.
-- @return #SET_STATIC self
function SET_STATIC:FilterPrefixes( Prefixes )
if not self.Filter.StaticPrefixes then
@@ -3267,7 +3267,7 @@ do -- SET_STATIC
-- @param #SET_STATIC self
-- @param Core.Zone#ZONE Zone The Zone to be tested for.
-- @return #boolean
function SET_STATIC:IsPatriallyInZone( Zone )
function SET_STATIC:IsPartiallyInZone( Zone )
local IsPartiallyInZone = false
@@ -3675,7 +3675,7 @@ do -- SET_CLIENT
-- * @{#SET_CLIENT.FilterCategories}: Builds the SET_CLIENT with the clients belonging to the category(ies).
-- * @{#SET_CLIENT.FilterTypes}: Builds the SET_CLIENT with the clients belonging to the client type(s).
-- * @{#SET_CLIENT.FilterCountries}: Builds the SET_CLIENT with the clients belonging to the country(ies).
-- * @{#SET_CLIENT.FilterPrefixes}: Builds the SET_CLIENT with the clients starting with the same prefix string(s).
-- * @{#SET_CLIENT.FilterPrefixes}: Builds the SET_CLIENT with the clients containing the same string(s) in their unit/pilot name. **ATTENTION!** Bad naming convention as this *does not* only filter *prefixes*.
-- * @{#SET_CLIENT.FilterActive}: Builds the SET_CLIENT with the units that are only active. Units that are inactive (late activation) won't be included in the set!
--
-- Once the filter criteria have been set for the SET_CLIENT, you can start filtering using:
@@ -3858,10 +3858,10 @@ do -- SET_CLIENT
end
--- Builds a set of clients of defined client prefixes.
-- All the clients starting with the given prefixes will be included within the set.
--- Builds a set of CLIENTs that contain the given string in their unit/pilot name.
-- **Attention!** Bad naming convention as this **does not** filter only **prefixes** but all clients that **contain** the string.
-- @param #SET_CLIENT self
-- @param #string Prefixes The prefix of which the client name starts with.
-- @param #string Prefixes The string pattern(s) that needs to be contained in the unit/pilot name. Can also be passed as a `#table` of strings.
-- @return #SET_CLIENT self
function SET_CLIENT:FilterPrefixes( Prefixes )
if not self.Filter.ClientPrefixes then
@@ -4114,7 +4114,7 @@ do -- SET_PLAYER
-- * @{#SET_PLAYER.FilterCategories}: Builds the SET_PLAYER with the clients belonging to the category(ies).
-- * @{#SET_PLAYER.FilterTypes}: Builds the SET_PLAYER with the clients belonging to the client type(s).
-- * @{#SET_PLAYER.FilterCountries}: Builds the SET_PLAYER with the clients belonging to the country(ies).
-- * @{#SET_PLAYER.FilterPrefixes}: Builds the SET_PLAYER with the clients starting with the same prefix string(s).
-- * @{#SET_PLAYER.FilterPrefixes}: Builds the SET_PLAYER with the clients sharing the same string(s) in their unit/pilot name. **ATTENTION** Bad naming convention as this *does not* only filter prefixes.
--
-- Once the filter criteria have been set for the SET_PLAYER, you can start filtering using:
--
@@ -4293,10 +4293,10 @@ do -- SET_PLAYER
end
--- Builds a set of clients of defined client prefixes.
-- All the clients starting with the given prefixes will be included within the set.
--- Builds a set of PLAYERs that contain the given string in their unit/pilot name.
-- **Attention!** Bad naming convention as this **does not** filter only **prefixes** but all player clients that **contain** the string.
-- @param #SET_PLAYER self
-- @param #string Prefixes The prefix of which the client name starts with.
-- @param #string Prefixes The string pattern(s) that needs to be contained in the unit/pilot name. Can also be passed as a `#table` of strings.
-- @return #SET_PLAYER self
function SET_PLAYER:FilterPrefixes( Prefixes )
if not self.Filter.ClientPrefixes then
@@ -4874,7 +4874,7 @@ do -- SET_CARGO
-- Filter criteria are defined by:
--
-- * @{#SET_CARGO.FilterCoalitions}: Builds the SET_CARGO with the cargos belonging to the coalition(s).
-- * @{#SET_CARGO.FilterPrefixes}: Builds the SET_CARGO with the cargos containing the prefix string(s).
-- * @{#SET_CARGO.FilterPrefixes}: Builds the SET_CARGO with the cargos containing the same string(s). **ATTENTION** Bad naming convention as this *does not* only filter *prefixes*.
-- * @{#SET_CARGO.FilterTypes}: Builds the SET_CARGO with the cargos belonging to the cargo type(s).
-- * @{#SET_CARGO.FilterCountries}: Builds the SET_CARGO with the cargos belonging to the country(ies).
--
@@ -5036,10 +5036,10 @@ do -- SET_CARGO
end
--- (R2.1) Builds a set of cargos of defined cargo prefixes.
-- All the cargos starting with the given prefixes will be included within the set.
--- Builds a set of CARGOs that contain a given string in their name.
-- **Attention!** Bad naming convention as this **does not** filter only **prefixes** but all cargos that **contain** the string.
-- @param #SET_CARGO self
-- @param #string Prefixes The prefix of which the cargo name starts with.
-- @param #string Prefixes The string pattern(s) that need to be in the cargo name. Can also be passed as a `#table` of strings.
-- @return #SET_CARGO self
function SET_CARGO:FilterPrefixes( Prefixes ) --R2.1
if not self.Filter.CargoPrefixes then
@@ -5315,7 +5315,7 @@ do -- SET_ZONE
-- You can set filter criteria to build the collection of zones in SET_ZONE.
-- Filter criteria are defined by:
--
-- * @{#SET_ZONE.FilterPrefixes}: Builds the SET_ZONE with the zones having a certain text pattern of prefix.
-- * @{#SET_ZONE.FilterPrefixes}: Builds the SET_ZONE with the zones having a certain text pattern in their name. **ATTENTION!** Bad naming convention as this *does not* only filter *prefixes*.
--
-- Once the filter criteria have been set for the SET_ZONE, you can start filtering using:
--
@@ -5450,10 +5450,10 @@ do -- SET_ZONE
--- Builds a set of zones of defined zone prefixes.
-- All the zones starting with the given prefixes will be included within the set.
--- Builds a set of ZONEs that contain the given string in their name.
-- **ATTENTION!** Bad naming convention as this **does not** filter only **prefixes** but all zones that **contain** the string.
-- @param #SET_ZONE self
-- @param #string Prefixes The prefix of which the zone name starts with.
-- @param #string Prefixes The string pattern(s) that need to be contained in the zone name. Can also be passed as a `#table` of strings.
-- @return #SET_ZONE self
function SET_ZONE:FilterPrefixes( Prefixes )
if not self.Filter.Prefixes then
@@ -5652,7 +5652,7 @@ do -- SET_ZONE_GOAL
-- You can set filter criteria to build the collection of zones in SET_ZONE_GOAL.
-- Filter criteria are defined by:
--
-- * @{#SET_ZONE_GOAL.FilterPrefixes}: Builds the SET_ZONE_GOAL with the zones having a certain text pattern of prefix.
-- * @{#SET_ZONE_GOAL.FilterPrefixes}: Builds the SET_ZONE_GOAL with the zones having a certain text pattern in their name. **ATTENTION!** Bad naming convention as this *does not* only filter *prefixes*.
--
-- Once the filter criteria have been set for the SET_ZONE_GOAL, you can start filtering using:
--
@@ -5768,10 +5768,10 @@ do -- SET_ZONE_GOAL
--- Builds a set of zones of defined zone prefixes.
-- All the zones starting with the given prefixes will be included within the set.
--- Builds a set of ZONE_GOALs that contain the given string in their name.
-- **ATTENTION!** Bad naming convention as this **does not** filter only **prefixes** but all zones that **contain** the string.
-- @param #SET_ZONE_GOAL self
-- @param #string Prefixes The prefix of which the zone name starts with.
-- @param #string Prefixes The string pattern(s) that needs to be contained in the zone name. Can also be passed as a `#table` of strings.
-- @return #SET_ZONE_GOAL self
function SET_ZONE_GOAL:FilterPrefixes( Prefixes )
if not self.Filter.Prefixes then

View File

@@ -736,7 +736,66 @@ do -- Airbase
end -- Airbase
do -- Spot
--- [DCS Class Spot](https://wiki.hoggitworld.com/view/DCS_Class_Spot)
-- Represents a spot from laser or IR-pointer.
-- @type Spot
-- @field #Spot.Category Category enum that stores spot categories.
--- Enum that stores spot categories.
-- @type Spot.Category
-- @field #string INFRA_RED
-- @field #string LASER
--- Creates a laser ray emanating from the given object to a point in 3d space.
-- @function [parent=#Spot] createLaser
-- @param DCS#Object Source The source object of the laser.
-- @param DCS#Vec3 LocalRef An optional 3D offset for the source.
-- @param DCS#Vec3 Vec3 Target coordinate where the ray is pointing at.
-- @param #number LaserCode Any 4 digit number between 1111 and 1788.
-- @return #Spot
--- Creates an infrared ray emanating from the given object to a point in 3d space. Can be seen with night vision goggles.
-- @function [parent=#Spot] createInfraRed
-- @param DCS#Object Source Source position of the IR ray.
-- @param DCS#Vec3 LocalRef An optional 3D offset for the source.
-- @param DCS#Vec3 Vec3 Target coordinate where the ray is pointing at.
-- @return #Spot
--- Returns a vec3 table of the x, y, and z coordinates for the position of the given object in 3D space. Coordinates are dependent on the position of the maps origin.
-- @function [parent=#Spot] getPoint
-- @param #Spot self
-- @return DCS#Vec3 Point in 3D, where the beam is pointing at.
--- Sets the destination point from which the source of the spot is drawn toward.
-- @function [parent=#Spot] setPoint
-- @param #Spot self
-- @param DCS#Vec3 Vec3 Point in 3D, where the beam is pointing at.
--- Returns the number that is used to define the laser code for which laser designation can track.
-- @function [parent=#Spot] getCode
-- @param #Spot self
-- @return #number Code The laser code used.
--- Sets the number that is used to define the laser code for which laser designation can track.
-- @function [parent=#Spot] setCode
-- @param #Spot self
-- @param #number Code The laser code. Default value is 1688.
--- Destroys the spot.
-- @function [parent=#Spot] destroy
-- @param #Spot self
--- Gets the category of the spot (laser or IR).
-- @function [parent=#Spot] getCategory
-- @param #Spot self
-- @return #string Category.
Spot = {} --#Spot
end -- Spot
do -- Controller
--- Controller is an object that performs A.I.-routines. Other words controller is an instance of A.I.. Controller stores current main task, active enroute tasks and behavior options. Controller performs commands. Please, read DCS A-10C GUI Manual EN.pdf chapter "Task Planning for Unit Groups", page 91 to understand A.I. system of DCS:A-10C.
@@ -1093,6 +1152,10 @@ do -- Unit
-- @param #Unit self
-- @return #Unit.Desc
--- GROUND - Switch on/off radar emissions
-- @function [parent=#Unit] enableEmission
-- @param #Unit self
-- @param #boolean switch
Unit = {} --#Unit
@@ -1163,7 +1226,7 @@ do -- Group
-- @param #Group self
-- @return #number
--- Returns initial size of the group. If some of the units will be destroyed, initial size of the group will not be changed. Initial size limits the unitNumber parameter for Group.getUnit() function.
--- Returns initial size of the group. If some of the units will be destroyed, initial size of the group will not be changed; Initial size limits the unitNumber parameter for Group.getUnit() function.
-- @function [parent=#Group] getInitialSize
-- @param #Group self
-- @return #number
@@ -1178,6 +1241,11 @@ do -- Group
-- @param #Group self
-- @return #Controller
--- GROUND - Switch on/off radar emissions
-- @function [parent=#Group] enableEmission
-- @param #Group self
-- @param #boolean switch
Group = {} --#Group
end -- Group
@@ -1393,4 +1461,4 @@ do -- AI
AI = {} --#AI
end -- AI
end -- AI

View File

@@ -1001,7 +1001,13 @@ do -- DESIGNATE
local ID = self.Detection:GetDetectedItemID( DetectedItem )
local MenuText = ID --.. ", " .. Coord:ToStringA2G( AttackGroup )
MenuText = string.format( "(%3s) %s", Designating, MenuText )
-- Use injected MenuName from TaskA2GDispatcher if using same Detection Object
if DetectedItem.DesignateMenuName then
MenuText = string.format( "(%3s) %s", Designating, DetectedItem.DesignateMenuName )
else
MenuText = string.format( "(%3s) %s", Designating, MenuText )
end
local DetectedMenu = MENU_GROUP_DELAYED:New( AttackGroup, MenuText, MenuDesignate ):SetTime( MenuTime ):SetTag( self.DesignateName )
-- Build the Lasing menu.

View File

@@ -1,4 +1,4 @@
--- **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
--
-- ===
--
@@ -20,24 +20,24 @@
-- @module Functional.Mantis
-- @image Functional.Mantis.jpg
-- Date: Jan 2021
-- Date: Apr 2021
-------------------------------------------------------------------------
--- **MANTIS** class, extends @{#Core.Base#BASE}
-- @type MANTIS #MANTIS
--- **MANTIS** class, extends #Core.Base#BASE
-- @type MANTIS
-- @field #string Classname
-- @field #string name Name of this Mantis
-- @field #string SAM_Templates_Prefix Prefix to build the #GROUP_SET for SAM sites
-- @field @{#Core.Set#GROUP_SET} SAM_Group The SAM #GROUP_SET
-- @field #string EWR_Templates_Prefix Prefix to build the #GROUP_SET for EWR group
-- @field @{#Core.Set#GROUP_SET} EWR_Group The EWR #GROUP_SET
-- @field @{#Core.Set#GROUP_SET} Adv_EWR_Group The EWR #GROUP_SET used for advanced mode
-- @field #string SAM_Templates_Prefix Prefix to build the #SET_GROUP for SAM sites
-- @field Core.Set#SET_GROUP SAM_Group The SAM #SET_GROUP
-- @field #string EWR_Templates_Prefix Prefix to build the #SET_GROUP for EWR group
-- @field Core.Set#SET_GROUP EWR_Group The EWR #SET_GROUP
-- @field Core.Set#SET_GROUP Adv_EWR_Group The EWR #SET_GROUP used for advanced mode
-- @field #string HQ_Template_CC The ME name of the HQ object
-- @field @{#Wrapper.Group#GROUP} HQ_CC The #GROUP object of the HQ
-- @field Wrapper.Group#GROUP HQ_CC The #GROUP object of the HQ
-- @field #table SAM_Table Table of SAM sites
-- @field #string lid Prefix for logging
-- @field @{#Functional.Detection#DETECTION_AREAS} Detection The #DETECTION_AREAS object for EWR
-- @field @{Functional.Detection#DETECTION_AREAS} AWACS_Detection The #DETECTION_AREAS object for AWACS
-- @field Functional.Detection#DETECTION_AREAS Detection The #DETECTION_AREAS object for EWR
-- @field Functional.Detection#DETECTION_AREAS AWACS_Detection The #DETECTION_AREAS object for AWACS
-- @field #boolean debug Switch on extra messages
-- @field #boolean verbose Switch on extra logging
-- @field #number checkradius Radius of the SAM sites
@@ -51,7 +51,12 @@
-- @field #number adv_state Advanced mode state tracker
-- @field #boolean advAwacs Boolean switch to use Awacs as a separate detection stream
-- @field #number awacsrange Detection range of an optional Awacs unit
-- @extends @{#Core.Base#BASE}
-- @field #boolean UseEmOnOff Decide if we are using Emissions on/off (true) or AlarmState red/green (default)
-- @field Functional.Shorad#SHORAD Shorad SHORAD Object, if available
-- @field #boolean ShoradLink If true, #MANTIS has #SHORAD enabled
-- @field #number ShoradTime Timer in seconds, how long #SHORAD will be active after a detection inside of the defense range
-- @field #number ShoradActDistance Distance of an attacker in meters from a Mantis SAM site, on which Shorad will be switched on. Useful to not give away Shorad sites too early. Default 15km. Should be smaller than checkradius.
-- @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
@@ -96,7 +101,7 @@
--
-- # 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()`
--
-- [optional] Use
@@ -111,7 +116,7 @@
--
-- 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()`
--
-- # 3. Default settings
@@ -124,7 +129,7 @@
-- * 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)`
-- * detectinterval = 30 (seconds) - MANTIS will decide every 30 seconds which SAM to activate - `MANTIS:SetDetectInterval(interval)`
-- * engagerange = 75 (percent) - SAMs will only fire if flights are inside of a 75% 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)`
-- * autorelocate = false - HQ and (mobile) EWR system will not relocate in random intervals between 30mins and 1 hour - `MANTIS:SetAutoRelocate(hq, ewr)`
-- * debug = false - Debugging reports on screen are set to off - `MANTIS:Debug(onoff)`
@@ -132,8 +137,26 @@
-- # 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.
-- 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.
--
-- # 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
-- 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()`
-- `myshorad = SHORAD:New("BlueShorad", "Blue SHORAD", SamSet, 22000, 600, "blue")`
-- `-- now set up MANTIS`
-- `mymantis = MANTIS:New("BlueMantis","Blue SAM","Blue EWR",nil,"blue",false,"Blue Awacs")`
-- `mymantis:AddShorad(myshorad,720)`
-- `mymantis:Start()`
--
-- and (optionally) remove the link later on with
--
-- `mymantis:RemoveShorad()`
--
-- @field #MANTIS
MANTIS = {
@@ -163,7 +186,12 @@ MANTIS = {
AWACS_Prefix = "",
advAwacs = false,
verbose = false,
awacsrange = 250000
awacsrange = 250000,
Shorad = nil,
ShoradLink = false,
ShoradTime = 600,
ShoradActDistance = 15000,
UseEmOnOff = true,
}
-----------------------------------------------------------------------
@@ -180,8 +208,29 @@ do
--@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 #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, deault true)
--@return #MANTIS self
function MANTIS:New(name,samprefix,ewrprefix,hq,coaltion,dynamic,awacs)
--@usage Start up your MANTIS with a basic setting
--
-- `myredmantis = MANTIS:New("myredmantis","Red SAM","Red EWR",nil,"red",false)`
-- `myredmantis:Start()`
--
-- [optional] Use
--
-- * `MANTIS:SetEWRGrouping(radius)`
-- * `MANTIS:SetEWRRange(radius)`
-- * `MANTIS:SetSAMRadius(radius)`
-- * `MANTIS:SetDetectInterval(interval)`
-- * `MANTIS:SetAutoRelocate(hq, ewr)`
--
-- 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:
--
-- `mybluemantis = MANTIS:New("bluemantis","Blue SAM","Blue EWR",nil,"blue",false,"Blue Awacs")`
-- `mybluemantis:Start()`
--
function MANTIS:New(name,samprefix,ewrprefix,hq,coaltion,dynamic,awacs, EmOnOff)
-- DONE: Create some user functions for these
-- DONE: Make HQ useful
@@ -209,16 +258,26 @@ do
self.verbose = false
self.Adv_EWR_Group = nil
self.AWACS_Prefix = awacs or nil
self.awacsrange = 250000 --TODO: 250km, User Function to change
self.awacsrange = 250000 --DONE: 250km, User Function to change
self.Shorad = nil
self.ShoradLink = false
self.ShoradTime = 600
self.ShoradActDistance = 15000
-- TODO: add emissions on/off when available .... in 2 weeks
if EmOnOff then
if EmOnOff == false then
self.UseEmOnOff = false
end
end
if type(awacs) == "string" then
self.advAwacs = true
else
self.advAwacs = false
end
-- @field #string version
self.version="0.3.6"
env.info(string.format("***** Starting MANTIS Version %s *****", self.version))
-- Inherit everything from BASE class.
local self = BASE:Inherit(self, BASE:New()) -- #MANTIS
-- Set the string id for output to DCS.log file.
self.lid=string.format("MANTIS %s | ", self.name)
@@ -247,8 +306,10 @@ do
if self.HQ_Template_CC then
self.HQ_CC = GROUP:FindByName(self.HQ_Template_CC)
end
-- Inherit everything from BASE class.
local self = BASE:Inherit(self, BASE:New()) -- #MANTIS
-- @field #string version
self.version="0.4.1"
self:I(string.format("***** Starting MANTIS Version %s *****", self.version))
return self
end
@@ -307,7 +368,7 @@ do
self.engagerange = range
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 #number range Percent of the max fire range
function MANTIS:SetNewSAMRangeWhileRunning(range)
@@ -350,10 +411,18 @@ do
end
end
end
--- Function to set AWACS detection range. Defaults to 250.000m (250km) - use **before** starting your Mantis!
-- @param #MANTIS self
-- @param #number range Detection range of the AWACS group
function MANTIS:SetAwacsRange(range)
local range = range or 250000
self.awacsrange = range
end
--- Function to set the HQ object for further use
-- @param #MANTIS self
-- @param Wrapper.GROUP#GROUP The HQ #GROUP object to be set as HQ
-- @param Wrapper.GROUP#GROUP group The #GROUP object to be set as HQ
function MANTIS:SetCommandCenter(group)
local group = group or nil
if group ~= nil then
@@ -398,6 +467,13 @@ do
end
end
--- Set using Emissions on/off instead of changing alarm state
-- @param #MANTIS self
-- @param #boolean switch Decide if we are changing alarm state or Emission state
function MANTIS:SetUsingEmOnOff(switch)
self.UseEmOnOff = switch or false
end
--- [Internal] Function to check if HQ is alive
-- @param #MANTIS self
-- @return #boolean True if HQ is alive, else false
@@ -535,11 +611,12 @@ do
end
end
--- 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 #table dectset Table of coordinates of detected items
-- @param samcoordinate Core.Point#COORDINATE Coordinate object.
-- @return #boolean True if in any zone, else false
-- @return #number Distance Target distance in meters or zero when no object is in zone
function MANTIS:CheckObjectInZone(dectset, samcoordinate)
self:F(self.lid.."CheckObjectInZone Called")
-- check if non of the coordinate is in the given defense zone
@@ -556,13 +633,13 @@ do
if self.verbose then env.info(self.lid..text) end
-- end output to cross-check
if targetdistance <= radius then
return true
return true, targetdistance
end
end
return false
return false, 0
end
--- Function to start the detection via EWR groups
--- (Internal) Function to start the detection via EWR groups
-- @param #MANTIS self
-- @return Functional.Detection #DETECTION_AREAS The running detection set
function MANTIS:StartDetection()
@@ -593,7 +670,7 @@ do
return _MANTISdetection
end
--- 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
-- @return Functional.Detection #DETECTION_AREAS The running detection set
function MANTIS:StartAwacsDetection()
@@ -625,11 +702,11 @@ do
return _MANTISAwacs
end
--- Function to set the SAM start state
--- (Internal) Function to set the SAM start state
-- @param #MANTIS self
-- @return #MANTIS self
function MANTIS:SetSAMStartState()
-- TODO: if using dynamic filtering, update SAM_Table and the (active) SEAD groups, pull req #1405/#1406
-- DONE: if using dynamic filtering, update SAM_Table and the (active) SEAD groups, pull req #1405/#1406
self:F(self.lid.."Setting SAM Start States")
-- get SAM Group
local SAM_SET = self.SAM_Group
@@ -640,7 +717,13 @@ do
--cycle through groups and set alarm state etc
for _i,_group in pairs (SAM_Grps) do
local group = _group
group:OptionAlarmStateGreen() -- AI off
-- TODO: add emissions on/off
if self.UseEmOnOff then
group:EnableEmission(false)
--group:SetAIOff()
else
group:OptionAlarmStateGreen() -- AI off
end
group:SetOption(AI.Option.Ground.id.AC_ENGAGEMENT_RANGE_RESTRICTION,engagerange) --default engagement will be 75% of firing range
if group:IsGround() then
local grpname = group:GetName()
@@ -689,6 +772,27 @@ do
return self
end
--- Function to link up #MANTIS with a #SHORAD installation
-- @param #MANTIS self
-- @param Functional.Shorad#SHORAD Shorad The #SHORAD object
-- @param #number Shoradtime Number of seconds #SHORAD stays active post wake-up
function MANTIS:AddShorad(Shorad,Shoradtime)
local Shorad = Shorad or nil
local ShoradTime = Shoradtime or 600
local ShoradLink = true
if Shorad:IsInstanceOf("SHORAD") then
self.ShoradLink = ShoradLink
self.Shorad = Shorad --#SHORAD
self.ShoradTime = Shoradtime -- #number
end
end
--- Function to unlink #MANTIS from a #SHORAD installation
-- @param #MANTIS self
function MANTIS:RemoveShorad()
self.ShoradLink = false
end
-----------------------------------------------------------------------
-- MANTIS main functions
-----------------------------------------------------------------------
@@ -719,12 +823,25 @@ do
local samcoordinate = _data[2]
local name = _data[1]
local samgroup = GROUP:FindByName(name)
if self:CheckObjectInZone(detset, samcoordinate) then --check any target in zone
local IsInZone, Distance = self:CheckObjectInZone(detset, samcoordinate)
if IsInZone then --check any target in zone
if samgroup:IsAlive() then
-- switch off SAM
-- switch on SAM
if self.UseEmOnOff then
-- TODO: add emissions on/off
--samgroup:SetAIOn()
samgroup:EnableEmission(true)
end
samgroup:OptionAlarmStateRed()
--samgroup:OptionROEWeaponFree()
--samgroup:SetAIOn()
-- link in to SHORAD if available
-- DONE: Test integration fully
if self.ShoradLink and Distance < self.ShoradActDistance then -- don't give SHORAD position away too early
local Shorad = self.Shorad
local radius = self.checkradius
local ontime = self.ShoradTime
Shorad:WakeUpShorad(name, radius, ontime)
end
-- debug output
local text = string.format("SAM %s switched to alarm state RED!", name)
local m=MESSAGE:New(text,10,"MANTIS"):ToAllIf(self.debug)
if self.verbose then env.info(self.lid..text) end
@@ -732,7 +849,13 @@ do
else
if samgroup:IsAlive() then
-- switch off SAM
samgroup:OptionAlarmStateGreen()
if self.UseEmOnOff then
-- TODO: add emissions on/off
samgroup:EnableEmission(false)
--samgroup:SetAIOff()
else
samgroup:OptionAlarmStateGreen()
end
--samgroup:OptionROEWeaponFree()
--samgroup:SetAIOn()
local text = string.format("SAM %s switched to alarm state GREEN!", name)
@@ -767,6 +890,11 @@ do
local name = _data[1]
local samgroup = GROUP:FindByName(name)
if samgroup:IsAlive() then
if self.UseEmOnOff then
-- TODO: add emissions on/off
--samgroup:SetAIOn()
samgroup:EnableEmission(true)
end
samgroup:OptionAlarmStateRed()
end -- end alive
end -- end for loop

View File

@@ -17,8 +17,8 @@
--
-- ### Authors: **FlightControl**, **applevangelist**
--
-- Last Update: Dec 2020
--
-- Last Update: April 2021
--
-- ===
--
-- @module Functional.Sead
@@ -51,9 +51,44 @@ SEAD = {
EngagementRange = 75 -- default 75% engagement range Feature Request #1355
}
-- TODO Complete list?
--- Missile enumerators
-- @field Harms
SEAD.Harms = {
--[[
["X58"] = "weapons.missiles.X_58", --Kh-58X anti-radiation missiles fired
["Kh25"] = "weapons.missiles.Kh25MP_PRGS1VP", --Kh-25MP anti-radiation missiles fired
["X25"] = "weapons.missiles.X_25MP", --Kh-25MPU anti-radiation missiles fired
["X28"] = "weapons.missiles.X_28", --Kh-28 anti-radiation missiles fired
["X31"] = "weapons.missiles.X_31P", --Kh-31P anti-radiation missiles fired
["AGM45A"] = "weapons.missiles.AGM_45A", --AGM-45A anti-radiation missiles fired
["AGM45"] = "weapons.missiles.AGM_45", --AGM-45B anti-radiation missiles fired
["AGM88"] = "weapons.missiles.AGM_88", --AGM-88C anti-radiation missiles fired
["AGM122"] = "weapons.missiles.AGM_122", --AGM-122 Sidearm anti-radiation missiles fired
["LD10"] = "weapons.missiles.LD-10", --LD-10 anti-radiation missiles fired
["ALARM"] = "weapons.missiles.ALARM", --ALARM anti-radiation missiles fired
["AGM84E"] = "weapons.missiles.AGM_84E", --AGM84 anti-radiation missiles fired
["AGM84A"] = "weapons.missiles.AGM_84A", --AGM84 anti-radiation missiles fired
["AGM84H"] = "weapons.missiles.AGM_84H", --AGM84 anti-radiation missiles fired
--]]
["AGM_88"] = "AGM_88",
["AGM_45"] = "AGM_45",
["AGM_122"] = "AGM_122",
["AGM_84"] = "AGM_84",
["AGM_45"] = "AGM_45",
["ALARN"] = "ALARM",
["LD-10"] = "LD-10",
["X_58"] = "X_58",
["X_28"] = "X_28",
["X_25"] = "X_25",
["X_31"] = "X_31",
["Kh25"] = "Kh25",
}
--- 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...
-- Chances are big that the missile will miss.
-- @param #SEAD self
-- @param table{string,...}|string SEADGroupPrefixes which is a table of Prefixes of the SA Groups in the DCS mission editor on which evasive actions need to be taken.
-- @return SEAD
-- @usage
@@ -74,7 +109,7 @@ function SEAD:New( SEADGroupPrefixes )
end
self:HandleEvent( EVENTS.Shot )
self:I("*** SEAD - Started Version 0.2.2")
self:I("*** SEAD - Started Version 0.2.7")
return self
end
@@ -112,7 +147,20 @@ function SEAD:SetEngagementRange(range)
return self
end
--- Detects if an SA site was shot with an anti radiation missile. In this case, take evasive actions based on the skill level set within the ME.
--- Check if a known HARM was fired
-- @param #SEAD self
-- @param #string WeaponName
-- @return #boolean Returns true for a match
function SEAD:_CheckHarms(WeaponName)
self:F( { WeaponName } )
local hit = false
for _,_name in pairs (SEAD.Harms) do
if string.find(WeaponName,_name,1) then hit = true end
end
return hit
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.
-- @see SEAD
-- @param #SEAD
-- @param Core.Event#EVENTDATA EventData
@@ -127,7 +175,7 @@ function SEAD:OnEventShot( EventData )
self:T( "*** SEAD - Missile Launched = " .. SEADWeaponName)
self:T({ SEADWeapon })
--check for SEAD missiles
--[[check for SEAD missiles
if SEADWeaponName == "weapons.missiles.X_58" --Kh-58U anti-radiation missiles fired
or
SEADWeaponName == "weapons.missiles.Kh25MP_PRGS1VP" --Kh-25MP anti-radiation missiles fired
@@ -155,16 +203,20 @@ function SEAD:OnEventShot( EventData )
SEADWeaponName == "weapons.missiles.AGM_84A" --AGM84 anti-radiation missiles fired
or
SEADWeaponName == "weapons.missiles.AGM_84H" --AGM84 anti-radiation missiles fired
then
--]]
if self:_CheckHarms(SEADWeaponName) then
local _targetskill = "Random"
local _targetMimgroupName = "none"
local _evade = math.random (1,100) -- random number for chance of evading action
local _targetMim = EventData.Weapon:getTarget() -- Identify target
local _targetMimname = Unit.getName(_targetMim) -- Unit name
local _targetMimgroup = Unit.getGroup(Weapon.getTarget(SEADWeapon)) --targeted grouo
local _targetMimgroupName = _targetMimgroup:getName() -- group name
local _targetskill = _DATABASE.Templates.Units[_targetMimname].Template.skill
self:T( self.SEADGroupPrefixes )
self:T( _targetMimgroupName )
local _targetUnit = UNIT:Find(_targetMim) -- Unit name by DCS Object
if _targetUnit and _targetUnit:IsAlive() then
local _targetMimgroup = _targetUnit:GetGroup()
local _targetMimgroupName = _targetMimgroup:GetName() -- group name
--local _targetskill = _DATABASE.Templates.Units[_targetUnit].Template.skill
self:T( self.SEADGroupPrefixes )
self:T( _targetMimgroupName )
end
-- see if we are shot at
local SEADGroupFound = false
for SEADGroupPrefixID, SEADGroupPrefix in pairs( self.SEADGroupPrefixes ) do
@@ -200,6 +252,7 @@ function SEAD:OnEventShot( EventData )
local range = self.EngagementRange -- Feature Request #1355
self:T(string.format("*** SEAD - Engagement Range is %d", range))
id.ctrl:setOption(AI.Option.Ground.id.ALARM_STATE,AI.Option.Ground.val.ALARM_STATE.RED)
--id.groupName:enableEmission(true)
id.ctrl:setOption(AI.Option.Ground.id.AC_ENGAGEMENT_RANGE_RESTRICTION,range) --Feature Request #1355
self.SuppressedGroups[id.groupName] = nil --delete group id from table when done
end
@@ -212,6 +265,7 @@ function SEAD:OnEventShot( EventData )
SuppressionEndTime = delay
}
Controller.setOption(_targetMimcont, AI.Option.Ground.id.ALARM_STATE,AI.Option.Ground.val.ALARM_STATE.GREEN)
--_targetMimgroup:enableEmission(false)
timer.scheduleFunction(SuppressionEnd, id, SuppressionEndTime) --Schedule the SuppressionEnd() function
end
end

View File

@@ -0,0 +1,527 @@
--- **Functional** -- Short Range Air Defense System
--
-- ===
--
-- **SHORAD** - Short Range Air Defense System
-- Controls a network of short range air/missile defense groups.
--
-- ===
--
-- ## Missions:
--
-- ### [SHORAD - Short Range Air Defense](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SRD%20-%20SHORAD%20Defense)
--
-- ===
--
-- ### Author : **applevangelist **
--
-- @module Functional.Shorad
-- @image Functional.Shorad.jpg
--
-- Date: May 2021
-------------------------------------------------------------------------
--- **SHORAD** class, extends Core.Base#BASE
-- @type SHORAD
-- @field #string ClassName
-- @field #string name Name of this Shorad
-- @field #boolean debug Set the debug state
-- @field #string Prefixes String to be used to build the @{#Core.Set#SET_GROUP}
-- @field #number Radius Shorad defense radius in meters
-- @field Core.Set#SET_GROUP Groupset The set of Shorad groups
-- @field Core.Set#SET_GROUP Samset The set of SAM groups to defend
-- @field #string Coalition The coalition of this Shorad
-- @field #number ActiveTimer How long a Shorad stays active after wake-up in seconds
-- @field #table ActiveGroups Table for the timer function
-- @field #string lid The log ID for the dcs.log
-- @field #boolean DefendHarms Default true, intercept incoming HARMS
-- @field #boolean DefendMavs Default true, intercept incoming AG-Missiles
-- @field #number DefenseLowProb Default 70, minimum detection limit
-- @field #number DefenseHighProb Default 90, maximim detection limit
-- @field #boolean UseEmOnOff Decide if we are using Emission on/off (default) or AlarmState red/green.
-- @extends Core.Base#BASE
--- *Good friends are worth defending.* Mr Tushman, Wonder (the Movie)
--
-- Simple Class for a more intelligent Short Range Air Defense System
--
-- #SHORAD
-- Moose derived missile intercepting short range defense system.
-- Protects a network of SAM sites. Uses events to switch on the defense groups closest to the enemy.
-- Easily integrated with @{Functional.Mantis#MANTIS} to complete the defensive system setup.
--
-- ## Usage
--
-- Set up a #SET_GROUP for the SAM sites to be protected:
--
-- `local SamSet = SET_GROUP:New():FilterPrefixes("Red SAM"):FilterCoalitions("red"):FilterStart()`
--
-- By default, SHORAD will defense against both HARMs and AG-Missiles with short to medium range. The default defense probability is 70-90%.
-- When a missile is detected, SHORAD will activate defense groups in the given radius around the target for 10 minutes. It will *not* react to friendly fire.
--
-- ### Start a new SHORAD system, parameters are:
--
-- * Name: Name of this SHORAD.
-- * ShoradPrefix: Filter for the Shorad #SET_GROUP.
-- * Samset: The #SET_GROUP of SAM sites to defend.
-- * Radius: Defense radius in meters.
-- * ActiveTimer: Determines how many seconds the systems stay on red alert after wake-up call.
-- * Coalition: Coalition, i.e. "blue", "red", or "neutral".*
--
-- `myshorad = SHORAD:New("RedShorad", "Red SHORAD", SamSet, 25000, 600, "red")`
--
-- ## Customize options
--
-- * SHORAD:SwitchDebug(debug)
-- * SHORAD:SwitchHARMDefense(onoff)
-- * SHORAD:SwitchAGMDefense(onoff)
-- * SHORAD:SetDefenseLimits(low,high)
-- * SHORAD:SetActiveTimer(seconds)
-- * SHORAD:SetDefenseRadius(meters)
--
-- @field #SHORAD
SHORAD = {
ClassName = "SHORAD",
name = "MyShorad",
debug = false,
Prefixes = "",
Radius = 20000,
Groupset = nil,
Samset = nil,
Coalition = nil,
ActiveTimer = 600, --stay on 10 mins
ActiveGroups = {},
lid = "",
DefendHarms = true,
DefendMavs = true,
DefenseLowProb = 70,
DefenseHighProb = 90,
UseEmOnOff = false,
}
-----------------------------------------------------------------------
-- SHORAD System
-----------------------------------------------------------------------
do
-- TODO Complete list?
--- Missile enumerators
-- @field Harms
SHORAD.Harms = {
--[[
["X58"] = "weapons.missiles.X_58", --Kh-58X anti-radiation missiles fired
["Kh25"] = "weapons.missiles.Kh25MP_PRGS1VP", --Kh-25MP anti-radiation missiles fired
["X25"] = "weapons.missiles.X_25MP", --Kh-25MPU anti-radiation missiles fired
["X28"] = "weapons.missiles.X_28", --Kh-28 anti-radiation missiles fired
["X31"] = "weapons.missiles.X_31P", --Kh-31P anti-radiation missiles fired
["AGM45A"] = "weapons.missiles.AGM_45A", --AGM-45A anti-radiation missiles fired
["AGM45"] = "weapons.missiles.AGM_45", --AGM-45B anti-radiation missiles fired
["AGM88"] = "weapons.missiles.AGM_88", --AGM-88C anti-radiation missiles fired
["AGM122"] = "weapons.missiles.AGM_122", --AGM-122 Sidearm anti-radiation missiles fired
["LD10"] = "weapons.missiles.LD-10", --LD-10 anti-radiation missiles fired
["ALARM"] = "weapons.missiles.ALARM", --ALARM anti-radiation missiles fired
["AGM84E"] = "weapons.missiles.AGM_84E", --AGM84 anti-radiation missiles fired
["AGM84A"] = "weapons.missiles.AGM_84A", --AGM84 anti-radiation missiles fired
["AGM84H"] = "weapons.missiles.AGM_84H", --AGM84 anti-radiation missiles fired
--]]
["AGM_88"] = "AGM_88",
["AGM_45"] = "AGM_45",
["AGM_122"] = "AGM_122",
["AGM_84"] = "AGM_84",
["AGM_45"] = "AGM_45",
["ALARN"] = "ALARM",
["LD-10"] = "LD-10",
["X_58"] = "X_58",
["X_28"] = "X_28",
["X_25"] = "X_25",
["X_31"] = "X_31",
["Kh25"] = "Kh25",
}
--- TODO complete list?
-- @field Mavs
SHORAD.Mavs = {
["AGM"] = "AGM",
["C-701"] = "C-701",
["Kh25"] = "Kh25",
["Kh29"] = "Kh29",
["Kh31"] = "Kh31",
["Kh66"] = "Kh66",
}
--- Instantiates a new SHORAD object
-- @param #SHORAD self
-- @param #string Name Name of this SHORAD
-- @param #string ShoradPrefix Filter for the Shorad #SET_GROUP
-- @param Core.Set#SET_GROUP Samset The #SET_GROUP of SAM sites to defend
-- @param #number Radius Defense radius in meters, used to switch on groups
-- @param #number ActiveTimer Determines how many seconds the systems stay on red alert after wake-up call
-- @param #string Coalition Coalition, i.e. "blue", "red", or "neutral"
function SHORAD:New(Name, ShoradPrefix, Samset, Radius, ActiveTimer, Coalition)
local self = BASE:Inherit( self, BASE:New() )
self:T({Name, ShoradPrefix, Samset, Radius, ActiveTimer, Coalition})
local GroupSet = SET_GROUP:New():FilterPrefixes(ShoradPrefix):FilterCoalitions(Coalition):FilterCategoryGround():FilterStart()
self.name = Name or "MyShorad"
self.Prefixes = ShoradPrefix or "SAM SHORAD"
self.Radius = Radius or 20000
self.Coalition = Coalition or "blue"
self.Samset = Samset or GroupSet
self.ActiveTimer = ActiveTimer or 600
self.ActiveGroups = {}
self.Groupset = GroupSet
self:HandleEvent( EVENTS.Shot )
self.DefendHarms = true
self.DefendMavs = true
self.DefenseLowProb = 70 -- probability to detect a missile shot, low margin
self.DefenseHighProb = 90 -- probability to detect a missile shot, high margin
self.UseEmOnOff = true -- Decide if we are using Emission on/off (default) or AlarmState red/green
self:I("*** SHORAD - Started Version 0.2.5")
-- Set the string id for output to DCS.log file.
self.lid=string.format("SHORAD %s | ", self.name)
self:_InitState()
return self
end
--- Initially set all groups to alarm state GREEN
-- @param #SHORAD self
function SHORAD:_InitState()
local table = {}
local set = self.Groupset
self:T({set = set})
local aliveset = set:GetAliveSet() --#table
for _,_group in pairs (aliveset) do
if self.UseEmOnOff then
--_group:SetAIOff()
_group:EnableEmission(false)
else
_group:OptionAlarmStateGreen() --Wrapper.Group#GROUP
end
end
-- gather entropy
for i=1,10 do
math.random()
end
end
--- Switch debug state
-- @param #SHORAD self
-- @param #boolean debug Switch debug on (true) or off (false)
function SHORAD:SwitchDebug(debug)
self:T( { debug } )
local onoff = debug or false
if debug then
self.debug = true
--tracing
BASE:TraceOn()
BASE:TraceClass("SHORAD")
else
self.debug = false
BASE:TraceOff()
end
end
--- Switch defense for HARMs
-- @param #SHORAD self
-- @param #boolean onoff
function SHORAD:SwitchHARMDefense(onoff)
self:T( { onoff } )
local onoff = onoff or true
self.DefendHarms = onoff
end
--- Switch defense for AGMs
-- @param #SHORAD self
-- @param #boolean onoff
function SHORAD:SwitchAGMDefense(onoff)
self:T( { onoff } )
local onoff = onoff or true
self.DefendMavs = onoff
end
--- Set defense probability limits
-- @param #SHORAD self
-- @param #number low Minimum detection limit, integer 1-100
-- @param #number high Maximum detection limit integer 1-100
function SHORAD:SetDefenseLimits(low,high)
self:T( { low, high } )
local low = low or 70
local high = high or 90
if (low < 0) or (low > 100) or (low > high) then
low = 70
end
if (high < 0) or (high > 100) or (high < low ) then
high = 90
end
self.DefenseLowProb = low
self.DefenseHighProb = high
end
--- Set the number of seconds a SHORAD site will stay active
-- @param #SHORAD self
-- @param #number seconds Number of seconds systems stay active
function SHORAD:SetActiveTimer(seconds)
local timer = seconds or 600
if timer < 0 then
timer = 600
end
self.ActiveTimer = timer
end
--- Set the number of meters for the SHORAD defense zone
-- @param #SHORAD self
-- @param #number meters Radius of the defense search zone in meters. #SHORADs in this range around a targeted group will go active
function SHORAD:SetDefenseRadius(meters)
local radius = meters or 20000
if radius < 0 then
radius = 20000
end
self.Radius = radius
end
--- Set using Emission on/off instead of changing alarm state
-- @param #SHORAD self
-- @param #boolean switch Decide if we are changing alarm state or AI state
function SHORAD:SetUsingEmOnOff(switch)
self.UseEmOnOff = switch or false
end
--- Check if a HARM was fired
-- @param #SHORAD self
-- @param #string WeaponName
-- @return #boolean Returns true for a match
function SHORAD:_CheckHarms(WeaponName)
self:T( { WeaponName } )
local hit = false
if self.DefendHarms then
for _,_name in pairs (SHORAD.Harms) do
if string.find(WeaponName,_name,1) then hit = true end
end
end
return hit
end
--- Check if an AGM was fired
-- @param #SHORAD self
-- @param #string WeaponName
-- @return #boolean Returns true for a match
function SHORAD:_CheckMavs(WeaponName)
self:T( { WeaponName } )
local hit = false
if self.DefendMavs then
for _,_name in pairs (SHORAD.Mavs) do
if string.find(WeaponName,_name,1) then hit = true end
end
end
return hit
end
--- Check the coalition of the attacker
-- @param #SHORAD self
-- @param #string Coalition name
-- @return #boolean Returns false for a match
function SHORAD:_CheckCoalition(Coalition)
local owncoalition = self.Coalition
local othercoalition = ""
if Coalition == 0 then
othercoalition = "neutral"
elseif Coalition == 1 then
othercoalition = "red"
else
othercoalition = "blue"
end
self:T({owncoalition = owncoalition, othercoalition = othercoalition})
if owncoalition ~= othercoalition then
return true
else
return false
end
end
--- Check if the missile is aimed at a SHORAD
-- @param #SHORAD self
-- @param #string TargetGroupName Name of the target group
-- @return #boolean Returns true for a match, else false
function SHORAD:_CheckShotAtShorad(TargetGroupName)
local tgtgrp = TargetGroupName
local shorad = self.Groupset
local shoradset = shorad:GetAliveSet() --#table
local returnname = false
for _,_groups in pairs (shoradset) do
local groupname = _groups:GetName()
if string.find(groupname, tgtgrp, 1) then
returnname = true
_groups:RelocateGroundRandomInRadius(7,100,false,false) -- be a bit evasive
end
end
return returnname
end
--- Check if the missile is aimed at a SAM site
-- @param #SHORAD self
-- @param #string TargetGroupName Name of the target group
-- @return #boolean Returns true for a match, else false
function SHORAD:_CheckShotAtSams(TargetGroupName)
local tgtgrp = TargetGroupName
local shorad = self.Samset
--local shoradset = shorad:GetAliveSet() --#table
local shoradset = shorad:GetSet() --#table
local returnname = false
for _,_groups in pairs (shoradset) do
local groupname = _groups:GetName()
if string.find(groupname, tgtgrp, 1) then
returnname = true
end
end
return returnname
end
--- Calculate if the missile shot is detected
-- @param #SHORAD self
-- @return #boolean Returns true for a detection, else false
function SHORAD:_ShotIsDetected()
local IsDetected = false
local DetectionProb = math.random(self.DefenseLowProb, self.DefenseHighProb) -- reference value
local ActualDetection = math.random(1,100) -- value for this shot
if ActualDetection <= DetectionProb then
IsDetected = true
end
return IsDetected
end
--- Wake up #SHORADs in a zone with diameter Radius for ActiveTimer seconds
-- @param #SHORAD self
-- @param #string TargetGroup Name of the target group used to build the #ZONE
-- @param #number Radius Radius of the #ZONE
-- @param #number ActiveTimer Number of seconds to stay active
-- @param #number TargetCat (optional) Category, i.e. Object.Category.UNIT or Object.Category.STATIC
-- @usage Use this function to integrate with other systems, example
--
-- local SamSet = SET_GROUP:New():FilterPrefixes("Blue SAM"):FilterCoalitions("blue"):FilterStart()
-- myshorad = SHORAD:New("BlueShorad", "Blue SHORAD", SamSet, 22000, 600, "blue")
-- myshorad:SwitchDebug(true)
-- mymantis = MANTIS:New("BlueMantis","Blue SAM","Blue EWR",nil,"blue",false,"Blue Awacs")
-- mymantis:AddShorad(myshorad,720)
-- mymantis:Start()
function SHORAD:WakeUpShorad(TargetGroup, Radius, ActiveTimer, TargetCat)
self:T({TargetGroup, Radius, ActiveTimer, TargetCat})
local targetcat = TargetCat or Object.Category.UNIT
local targetgroup = TargetGroup
local targetvec2 = nil
if targetcat == Object.Category.UNIT then
targetvec2 = GROUP:FindByName(targetgroup):GetVec2()
elseif targetcat == Object.Category.STATIC then
targetvec2 = STATIC:FindByName(targetgroup,false):GetVec2()
else
local samset = self.Samset
local sam = samset:GetRandom()
targetvec2 = sam:GetVec2()
end
local targetzone = ZONE_RADIUS:New("Shorad",targetvec2,Radius) -- create a defense zone to check
local groupset = self.Groupset --Core.Set#SET_GROUP
local shoradset = groupset:GetAliveSet() --#table
-- local function to switch off shorad again
local function SleepShorad(group)
local groupname = group:GetName()
self.ActiveGroups[groupname] = nil
if self.UseEmOnOff then
group:EnableEmission(false)
--group:SetAIOff()
else
group:OptionAlarmStateGreen()
end
local text = string.format("Sleeping SHORAD %s", group:GetName())
self:T(text)
local m = MESSAGE:New(text,10,"SHORAD"):ToAllIf(self.debug)
end
-- go through set and find the one(s) to activate
for _,_group in pairs (shoradset) do
if _group:IsAnyInZone(targetzone) then
local text = string.format("Waking up SHORAD %s", _group:GetName())
self:T(text)
local m = MESSAGE:New(text,10,"SHORAD"):ToAllIf(self.debug)
if self.UseEmOnOff then
_group:SetAIOn()
_group:EnableEmission(true)
end
_group:OptionAlarmStateRed()
local groupname = _group:GetName()
if self.ActiveGroups[groupname] == nil then -- no timer yet for this group
self.ActiveGroups[groupname] = { Timing = ActiveTimer }
local endtime = timer.getTime() + (ActiveTimer * math.random(75,100) / 100 ) -- randomize wakeup a bit
timer.scheduleFunction(SleepShorad, _group, endtime)
end
end
end
end
--- Main function - work on the EventData
-- @param #SHORAD self
-- @param Core.Event#EVENTDATA EventData The event details table data set
function SHORAD:OnEventShot( EventData )
self:T( { EventData } )
--local ShootingUnit = EventData.IniDCSUnit
--local ShootingUnitName = EventData.IniDCSUnitName
local ShootingWeapon = EventData.Weapon -- Identify the weapon fired
local ShootingWeaponName = EventData.WeaponName -- return weapon type
-- get firing coalition
local weaponcoalition = EventData.IniGroup:GetCoalition()
-- get detection probability
if self:_CheckCoalition(weaponcoalition) then --avoid overhead on friendly fire
local IsDetected = self:_ShotIsDetected()
-- convert to text
local DetectedText = "false"
if IsDetected then
DetectedText = "true"
end
local text = string.format("%s Missile Launched = %s | Detected probability state is %s", self.lid, ShootingWeaponName, DetectedText)
self:T( text )
local m = MESSAGE:New(text,10,"Info"):ToAllIf(self.debug)
--
if (self:_CheckHarms(ShootingWeaponName) or self:_CheckMavs(ShootingWeaponName)) and IsDetected then
-- get target data
local targetdata = EventData.Weapon:getTarget() -- Identify target
local targetcat = targetdata:getCategory() -- Identify category
self:T(string.format("Target Category (3=STATIC, 1=UNIT)= %s",tostring(targetcat)))
local targetunit = nil
if targetcat == Object.Category.UNIT then -- UNIT
targetunit = UNIT:Find(targetdata)
elseif targetcat == Object.Category.STATIC then -- STATIC
targetunit = STATIC:Find(targetdata)
end
--local targetunitname = Unit.getName(targetdata) -- Unit name
if targetunit and targetunit:IsAlive() then
local targetunitname = targetunit:GetName()
--local targetgroup = Unit.getGroup(Weapon.getTarget(ShootingWeapon)) --targeted group
local targetgroup = nil
local targetgroupname = "none"
if targetcat == Object.Category.UNIT then
targetgroup = targetunit:GetGroup()
targetgroupname = targetgroup:GetName() -- group name
elseif targetcat == Object.Category.STATIC then
targetgroup = targetunit
targetgroupname = targetunitname
end
local text = string.format("%s Missile Target = %s", self.lid, tostring(targetgroupname))
self:T( text )
local m = MESSAGE:New(text,10,"Info"):ToAllIf(self.debug)
-- check if we or a SAM site are the target
--local TargetGroup = EventData.TgtGroup -- Wrapper.Group#GROUP
local shotatus = self:_CheckShotAtShorad(targetgroupname) --#boolean
local shotatsams = self:_CheckShotAtSams(targetgroupname) --#boolean
-- if being shot at, find closest SHORADs to activate
if shotatsams or shotatus then
self:T({shotatsams=shotatsams,shotatus=shotatus})
self:WakeUpShorad(targetgroupname, self.Radius, self.ActiveTimer, targetcat)
end
end
end
end
end
--
end
-----------------------------------------------------------------------
-- SHORAD end
-----------------------------------------------------------------------

View File

@@ -68,6 +68,7 @@ __Moose.Include( 'Scripts/Moose/Functional/PseudoATC.lua' )
__Moose.Include( 'Scripts/Moose/Functional/Warehouse.lua' )
__Moose.Include( 'Scripts/Moose/Functional/Fox.lua' )
__Moose.Include( 'Scripts/Moose/Functional/Mantis.lua' )
__Moose.Include( 'Scripts/Moose/Functional/Shorad.lua' )
__Moose.Include( 'Scripts/Moose/Ops/Airboss.lua' )
__Moose.Include( 'Scripts/Moose/Ops/RecoveryTanker.lua' )

View File

@@ -7,7 +7,7 @@
-- * Wind direction and speed
-- * Visibility
-- * Cloud coverage, base and ceiling
-- * Temprature
-- * Temperature
-- * Dew point (approximate as there is no relative humidity in DCS yet)
-- * Pressure QNH/QFE
-- * Weather phenomena: rain, thunderstorm, fog, dust
@@ -564,7 +564,7 @@ _ATIS={}
--- ATIS class version.
-- @field #string version
ATIS.version="0.9.0"
ATIS.version="0.9.1"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO list
@@ -580,6 +580,8 @@ ATIS.version="0.9.0"
-- DONE: Metric units.
-- DONE: Set UTC correction.
-- DONE: Set magnetic variation.
-- DONE: New DCS 2.7 weather presets.
-- DONE: whatever
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Constructor
@@ -1431,9 +1433,103 @@ function ATIS:onafterBroadcast(From, Event, To)
local cloudceil=clouds.base+clouds.thickness
local clouddens=clouds.density
-- Cloud preset (DCS 2.7)
local cloudspreset=clouds.preset or "Nothing"
-- Precepitation: 0=None, 1=Rain, 2=Thunderstorm, 3=Snow, 4=Snowstorm.
local precepitation=tonumber(clouds.iprecptns)
local precepitation=0
if cloudspreset:find("Preset10") then
-- Scattered 5
clouddens=4
elseif cloudspreset:find("Preset11") then
-- Scattered 6
clouddens=4
elseif cloudspreset:find("Preset12") then
-- Scattered 7
clouddens=4
elseif cloudspreset:find("Preset13") then
-- Broken 1
clouddens=7
elseif cloudspreset:find("Preset14") then
-- Broken 2
clouddens=7
elseif cloudspreset:find("Preset15") then
-- Broken 3
clouddens=7
elseif cloudspreset:find("Preset16") then
-- Broken 4
clouddens=7
elseif cloudspreset:find("Preset17") then
-- Broken 5
clouddens=7
elseif cloudspreset:find("Preset18") then
-- Broken 6
clouddens=7
elseif cloudspreset:find("Preset19") then
-- Broken 7
clouddens=7
elseif cloudspreset:find("Preset20") then
-- Broken 8
clouddens=7
elseif cloudspreset:find("Preset21") then
-- Overcast 1
clouddens=9
elseif cloudspreset:find("Preset22") then
-- Overcast 2
clouddens=9
elseif cloudspreset:find("Preset23") then
-- Overcast 3
clouddens=9
elseif cloudspreset:find("Preset24") then
-- Overcast 4
clouddens=9
elseif cloudspreset:find("Preset25") then
-- Overcast 5
clouddens=9
elseif cloudspreset:find("Preset26") then
-- Overcast 6
clouddens=9
elseif cloudspreset:find("Preset27") then
-- Overcast 7
clouddens=9
elseif cloudspreset:find("Preset1") then
-- Light Scattered 1
clouddens=1
elseif cloudspreset:find("Preset2") then
-- Light Scattered 2
clouddens=1
elseif cloudspreset:find("Preset3") then
-- High Scattered 1
clouddens=4
elseif cloudspreset:find("Preset4") then
-- High Scattered 2
clouddens=4
elseif cloudspreset:find("Preset5") then
-- Scattered 1
clouddens=4
elseif cloudspreset:find("Preset6") then
-- Scattered 2
clouddens=4
elseif cloudspreset:find("Preset7") then
-- Scattered 3
clouddens=4
elseif cloudspreset:find("Preset8") then
-- High Scattered 3
clouddens=4
elseif cloudspreset:find("Preset9") then
-- Scattered 4
clouddens=4
elseif cloudspreset:find("RainyPreset") then
-- Overcast + Rain
clouddens=9
if temperature>5 then
precepitation=1 -- rain
else
precepitation=3 -- snow
end
end
local CLOUDBASE=string.format("%d", UTILS.MetersToFeet(cloudbase))
local CLOUDCEIL=string.format("%d", UTILS.MetersToFeet(cloudceil))

View File

@@ -1705,7 +1705,7 @@ AIRBOSS.MenuF10Root=nil
--- Airboss class version.
-- @field #string version
AIRBOSS.version="1.1.5"
AIRBOSS.version="1.1.6"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO list
@@ -2641,6 +2641,15 @@ function AIRBOSS:SetRecoveryTurnTime(interval)
return self
end
--- Set multiplayer environment wire correction.
-- @param #AIRBOSS self
-- @param #number Dcorr Correction distance in meters. Default 8.7 m.
-- @return #AIRBOSS self
function AIRBOSS:SetMPWireCorrection(Dcorr)
self.mpWireCorrection=Dcorr or 8.7
return self
end
--- Set time interval for updating queues and other stuff.
-- @param #AIRBOSS self
-- @param #number interval Time interval in seconds. Default 30 sec.
@@ -4160,7 +4169,7 @@ function AIRBOSS:_InitStennis()
-- Carrier Parameters.
self.carrierparam.sterndist =-153
self.carrierparam.deckheight = 19
self.carrierparam.deckheight = 19.06
-- Total size of the carrier (approx as rectangle).
self.carrierparam.totlength=310 -- Wiki says 332.8 meters overall length.
@@ -4168,7 +4177,7 @@ function AIRBOSS:_InitStennis()
self.carrierparam.totwidthstarboard=30
-- Landing runway.
self.carrierparam.rwyangle = -9
self.carrierparam.rwyangle = -9.1359
self.carrierparam.rwylength = 225
self.carrierparam.rwywidth = 20
@@ -4311,7 +4320,7 @@ function AIRBOSS:_InitNimitz()
-- Carrier Parameters.
self.carrierparam.sterndist =-164
self.carrierparam.deckheight = 20
self.carrierparam.deckheight = 20.1494 --DCS World OpenBeta\CoreMods\tech\USS_Nimitz\Database\USS_CVN_7X.lua
-- Total size of the carrier (approx as rectangle).
self.carrierparam.totlength=332.8 -- Wiki says 332.8 meters overall length.
@@ -4319,7 +4328,7 @@ function AIRBOSS:_InitNimitz()
self.carrierparam.totwidthstarboard=35
-- Landing runway.
self.carrierparam.rwyangle = -9
self.carrierparam.rwyangle = -9.1359 --DCS World OpenBeta\CoreMods\tech\USS_Nimitz\scripts\USS_Nimitz_RunwaysAndRoutes.lua
self.carrierparam.rwylength = 250
self.carrierparam.rwywidth = 25
@@ -10341,7 +10350,7 @@ function AIRBOSS:_GetSternCoord()
stern=stern:Translate(self.carrierparam.sterndist, hdg):Translate(7, FB+90)
else
-- Nimitz SC: translate 8 meters starboard wrt Final bearing.
stern=stern:Translate(self.carrierparam.sterndist, hdg):Translate(8.5, FB+90)
stern=stern:Translate(self.carrierparam.sterndist, hdg):Translate(9.5, FB+90)
end
-- Set altitude.
@@ -10371,6 +10380,11 @@ 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.
local d=Ldist-dc
-- Multiplayer wire correction.
if self.mpWireCorrection then
d=d-self.mpWireCorrection
end
-- Shift wires from stern to their correct position.
local w1=self.carrierparam.wire1
@@ -17725,7 +17739,7 @@ function AIRBOSS:onbeforeSave(From, Event, To, path, filename)
-- Check default path.
if path==nil and not lfs then
self:E(self.lid.."WARNING: lfs not desanitized. Results will be saved in DCS installation root directory rather than your \"Saved Games\DCS\" folder.")
self:E(self.lid.."WARNING: lfs not desanitized. Results will be saved in DCS installation root directory rather than your \"Saved Games\\DCS\" folder.")
end
return true
@@ -17832,7 +17846,7 @@ function AIRBOSS:onbeforeLoad(From, Event, To, path, filename)
-- Check default path.
if path==nil and not lfs then
self:E(self.lid.."WARNING: lfs not desanitized. Results will be saved in DCS installation root directory rather than your \"Saved Games\DCS\" folder.")
self:E(self.lid.."WARNING: lfs not desanitized. Results will be saved in DCS installation root directory rather than your \"Saved Games\\DCS\" folder.")
end
-- Set path or default.

View File

@@ -753,6 +753,7 @@ do -- TASK_A2G_DISPATCHER
local TargetSetUnit = self:EvaluateSEAD( DetectedItem ) -- Returns a SetUnit if there are targets to be SEADed...
if TargetSetUnit then
Task = TASK_A2G_SEAD:New( Mission, self.SetGroup, string.format( "SEAD.%03d", DetectedItemID ), TargetSetUnit )
DetectedItem.DesignateMenuName = string.format( "SEAD.%03d", DetectedItemID ) --inject a name for DESIGNATE, if using same DETECTION object
Task:SetDetection( Detection, DetectedItem )
end
@@ -761,6 +762,7 @@ do -- TASK_A2G_DISPATCHER
local TargetSetUnit = self:EvaluateCAS( DetectedItem ) -- Returns a SetUnit if there are targets to be CASed...
if TargetSetUnit then
Task = TASK_A2G_CAS:New( Mission, self.SetGroup, string.format( "CAS.%03d", DetectedItemID ), TargetSetUnit )
DetectedItem.DesignateMenuName = string.format( "CAS.%03d", DetectedItemID ) --inject a name for DESIGNATE, if using same DETECTION object
Task:SetDetection( Detection, DetectedItem )
end
@@ -769,6 +771,7 @@ do -- TASK_A2G_DISPATCHER
local TargetSetUnit = self:EvaluateBAI( DetectedItem, self.Mission:GetCommandCenter():GetPositionable():GetCoalition() ) -- Returns a SetUnit if there are targets to be BAIed...
if TargetSetUnit then
Task = TASK_A2G_BAI:New( Mission, self.SetGroup, string.format( "BAI.%03d", DetectedItemID ), TargetSetUnit )
DetectedItem.DesignateMenuName = string.format( "BAI.%03d", DetectedItemID ) --inject a name for DESIGNATE, if using same DETECTION object
Task:SetDetection( Detection, DetectedItem )
end
end

View File

@@ -310,4 +310,53 @@ ENUMS.Morse.N7="- - * * *"
ENUMS.Morse.N8="- - - * *"
ENUMS.Morse.N9="- - - - *"
ENUMS.Morse.N0="- - - - -"
ENUMS.Morse[" "]=" "
ENUMS.Morse[" "]=" "
--- ISO (639-1) 2-letter Language Codes. See the [Wikipedia](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
--
-- @type ENUMS.ISOLang
ENUMS.ISOLang =
{
Arabic = 'AR',
Chinese = 'ZH',
English = 'EN',
French = 'FR',
German = 'DE',
Russian = 'RU',
Spanish = 'ES',
Japanese = 'JA',
Italian = 'IT',
}
--- Phonetic Alphabet (NATO). See the [Wikipedia](https://en.wikipedia.org/wiki/NATO_phonetic_alphabet).
--
-- @type ENUMS.Phonetic
ENUMS.Phonetic =
{
A = 'Alpha',
B = 'Bravo',
C = 'Charlie',
D = 'Delta',
E = 'Echo',
F = 'Foxtrot',
G = 'Golf',
H = 'Hotel',
I = 'India',
J = 'Juliett',
K = 'Kilo',
L = 'Lima',
M = 'Mike',
N = 'November',
O = 'Oscar',
P = 'Papa',
Q = 'Quebec',
R = 'Romeo',
S = 'Sierra',
T = 'Tango',
U = 'Uniform',
V = 'Victor',
W = 'Whiskey',
X = 'Xray',
Y = 'Yankee',
Z = 'Zulu',
}

View File

@@ -97,7 +97,7 @@ CALLSIGN={
JTAC={
Axeman=1,
Darknight=2,
Warrier=3,
Warrior=3,
Pointer=4,
Eyeball=5,
Moonbeam=6,
@@ -408,6 +408,14 @@ UTILS.hPa2inHg = function( hPa )
return hPa * 0.0295299830714
end
--- Convert knots to alitude corrected KIAS, e.g. for tankers.
-- @param #number knots Speed in knots.
-- @param #number altitude Altitude in feet
-- @return #number Corrected KIAS
UTILS.KnotsToAltKIAS = function( knots, altitude )
return (knots * 0.018 * (altitude / 1000)) + knots
end
--- Convert pressure from hecto Pascal (hPa) to millimeters of mercury (mmHg).
-- @param #number hPa Pressure in hPa.
-- @return #number Pressure in mmHg.
@@ -1457,4 +1465,4 @@ function UTILS.GetOSTime()
end
return nil
end
end

View File

@@ -361,6 +361,14 @@ AIRBASE.TheChannel = {
-- * AIRBASE.Syria.Beirut_Rafic_Hariri
-- * AIRBASE.Syria.An_Nasiriyah
-- * AIRBASE.Syria.Abu_al_Duhur
-- * AIRBASE.Syria.H4
-- * AIRBASE.Syria.Gaziantep
-- * AIRBASE.Syria.Rosh_Pina
-- * AIRBASE.Syria.Sayqal
-- * AIRBASE.Syria.Shayrat
-- * AIRBASE.Syria.Tiyas
-- * AIRBASE.Syria.Tha_lah
-- * AIRBASE.Syria.Naqoura
--
-- @field Syria
AIRBASE.Syria={
@@ -397,6 +405,14 @@ AIRBASE.Syria={
["Beirut_Rafic_Hariri"]="Beirut-Rafic Hariri",
["An_Nasiriyah"]="An Nasiriyah",
["Abu_al_Duhur"]="Abu al-Duhur",
["H4"]="H4",
["Gaziantep"]="Gaziantep",
["Rosh_Pina"]="Rosh Pina",
["Sayqal"]="Sayqal",
["Shayrat"]="Shayrat",
["Tiyas"]="Tiyas",
["Tha_lah"]="Tha'lah",
["Naqoura"]="Naqoura",
}
@@ -592,7 +608,7 @@ end
--- Get all airbase names of the current map. This includes ships and FARPS.
-- @param DCS#Coalition coalition (Optional) Return only airbases belonging to the specified coalition. By default, all airbases of the map are returned.
-- @param #number category (Optional) Return only airbases of a certain category, e.g. Airbase.Category.FARP
-- @param #number category (Optional) Return only airbases of a certain category, e.g. `Airbase.Category.HELIPAD`.
-- @return #table Table containing all airbase names of the current map.
function AIRBASE.GetAllAirbaseNames(coalition, category)

View File

@@ -1431,16 +1431,22 @@ end
-- @param DCS#Distance Radius The radius of the zone to deploy the fire at.
-- @param #number AmmoCount (optional) Quantity of ammunition to expand (omit to fire until ammunition is depleted).
-- @param #number WeaponType (optional) Enum for weapon type ID. This value is only required if you want the group firing to use a specific weapon, for instance using the task on a ship to force it to fire guided missiles at targets within cannon range. See http://wiki.hoggit.us/view/DCS_enum_weapon_flag
-- @param #number Altitude (Optional) Altitude in meters.
-- @param #number ASL Altitude is above mean sea level. Default is above ground level.
-- @return DCS#Task The DCS task structure.
function CONTROLLABLE:TaskFireAtPoint( Vec2, Radius, AmmoCount, WeaponType )
function CONTROLLABLE:TaskFireAtPoint( Vec2, Radius, AmmoCount, WeaponType, Altitude, ASL )
local DCSTask = {
id = 'FireAtPoint',
params = {
point = Vec2,
x=Vec2.x,
y=Vec2.y,
zoneRadius = Radius,
radius = Radius,
expendQty = 100, -- dummy value
expendQtyEnabled = false,
alt_type = ASL and 0 or 1
}
}
@@ -1448,10 +1454,16 @@ function CONTROLLABLE:TaskFireAtPoint( Vec2, Radius, AmmoCount, WeaponType )
DCSTask.params.expendQty = AmmoCount
DCSTask.params.expendQtyEnabled = true
end
if Altitude then
DCSTask.params.altitude=Altitude
end
if WeaponType then
DCSTask.params.weaponType=WeaponType
end
--self:I(DCSTask)
return DCSTask
end
@@ -2898,7 +2910,7 @@ end
--- Set option for Rules of Engagement (ROE).
-- @param Wrapper.Controllable#CONTROLLABLE self
-- @param #number ROEvalue ROE value. See ENUMS.ROE.
-- @return Wrapper.Controllable#CONTROLLABLE self
-- @return #CONTROLLABLE self
function CONTROLLABLE:OptionROE(ROEvalue)
local DCSControllable = self:GetDCSObject()
@@ -2940,8 +2952,8 @@ function CONTROLLABLE:OptionROEHoldFirePossible()
end
--- Weapons Hold: AI will hold fire under all circumstances.
-- @param Wrapper.Controllable#CONTROLLABLE self
-- @return Wrapper.Controllable#CONTROLLABLE self
-- @param #CONTROLLABLE self
-- @return #CONTROLLABLE self
function CONTROLLABLE:OptionROEHoldFire()
self:F2( { self.ControllableName } )
@@ -3539,7 +3551,7 @@ end
-- Note that when WayPointInitialize is called, the Mission of the controllable is RESTARTED!
-- @param #CONTROLLABLE self
-- @param #table WayPoints If WayPoints is given, then use the route.
-- @return #CONTROLLABLE
-- @return #CONTROLLABLE self
function CONTROLLABLE:WayPointInitialize( WayPoints )
self:F( { WayPoints } )
@@ -3570,7 +3582,7 @@ end
-- @param #number WayPoint The waypoint number. Note that the start waypoint on the route is WayPoint 1!
-- @param #number WayPointIndex When defining multiple WayPoint functions for one WayPoint, use WayPointIndex to set the sequence of actions.
-- @param #function WayPointFunction The waypoint function to be called when the controllable moves over the waypoint. The waypoint function takes variable parameters.
-- @return #CONTROLLABLE
-- @return #CONTROLLABLE self
function CONTROLLABLE:WayPointFunction( WayPoint, WayPointIndex, WayPointFunction, ... )
self:F2( { WayPoint, WayPointIndex, WayPointFunction } )
@@ -3586,7 +3598,7 @@ end
-- @param #CONTROLLABLE self
-- @param #number WayPoint The WayPoint from where to execute the mission.
-- @param #number WaitTime The amount seconds to wait before initiating the mission.
-- @return #CONTROLLABLE
-- @return #CONTROLLABLE self
function CONTROLLABLE:WayPointExecute( WayPoint, WaitTime )
self:F( { WayPoint, WaitTime } )
@@ -3670,6 +3682,7 @@ end
--- Sets Controllable Option for A2A attack range for AIR FIGHTER units.
-- @param #CONTROLLABLE self
-- @param #number range Defines the range
-- @return #CONTROLLABLE self
-- @usage Range can be one of MAX_RANGE = 0, NEZ_RANGE = 1, HALF_WAY_RMAX_NEZ = 2, TARGET_THREAT_EST = 3, RANDOM_RANGE = 4. Defaults to 3. See: https://wiki.hoggitworld.com/view/DCS_option_missileAttack
function CONTROLLABLE:OptionAAAttackRange(range)
self:F2( { self.ControllableName } )
@@ -3721,6 +3734,7 @@ end
-- @param #number radius Radius of the relocation zone, default 500
-- @param #boolean onroad If true, route on road (less problems with AI way finding), default true
-- @param #boolean shortcut If true and onroad is set, take a shorter route - if available - off road, default false
-- @return #CONTROLLABLE self
function CONTROLLABLE:RelocateGroundRandomInRadius(speed, radius, onroad, shortcut)
self:F2( { self.ControllableName } )
@@ -3744,3 +3758,24 @@ function CONTROLLABLE:RelocateGroundRandomInRadius(speed, radius, onroad, shortc
return self
end
--- Defines how long a GROUND unit/group will move to avoid an ongoing attack.
-- @param #CONTROLLABLE self
-- @param #number Seconds Any positive number: AI will disperse, but only for the specified time before continuing their route. 0: AI will not disperse.
-- @return #CONTROLLABLE self
function CONTROLLABLE:OptionDisperseOnAttack(Seconds)
self:F2( { self.ControllableName } )
-- Set default if not specified.
local seconds = Seconds or 0
local DCSControllable = self:GetDCSObject()
if DCSControllable then
local Controller = self:_GetController()
if Controller then
if self:IsGround() then
self:SetOption(AI.Option.GROUND.id.DISPERSE_ON_ATTACK, seconds)
end
end
return self
end
return nil
end

View File

@@ -2551,6 +2551,23 @@ do -- Players
end
--- GROUND - Switch on/off radar emissions
-- @param #GROUP self
-- @param #boolean switch
function GROUP:EnableEmission(switch)
self:F2( self.GroupName )
local switch = switch or false
local DCSUnit = self:GetDCSObject()
if DCSUnit then
DCSUnit:enableEmission(switch)
end
end
--do -- Smoke
--
----- Signal a flare at the position of the GROUP.
@@ -2641,4 +2658,4 @@ end
--
--
--
--end
--end

View File

@@ -1457,11 +1457,14 @@ do -- Cargo
self:F({Desc=Desc})
local Weights = {
["Type_071"] = 245000,
["LHA_Tarawa"] = 500000,
["Ropucha-class"] = 150000,
["Dry-cargo ship-1"] = 70000,
["Dry-cargo ship-2"] = 70000,
["Type_071"] = 245000,
["LHA_Tarawa"] = 500000,
["Ropucha-class"] = 150000,
["Dry-cargo ship-1"] = 70000,
["Dry-cargo ship-2"] = 70000,
["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.
["LST_Mk2"] =2100000, -- Can carry 2100 tons according to wiki source!
}
self.__.CargoBayWeightLimit = ( Weights[Desc.typeName] or 50000 )
@@ -1469,40 +1472,47 @@ do -- Cargo
local Desc = self:GetDesc()
local Weights = {
["M1126 Stryker ICV"] = 9,
["M-113"] = 9,
["AAV7"] = 25,
["M2A1_halftrack"] = 9,
["BMD-1"] = 9,
["Bedford_MWD"] = 8, -- new by kappa
["Blitz_36-6700A"] = 10, -- new by kappa
["BMD-1"] = 9, -- IRL should be 4 passengers
["BMP-1"] = 8,
["BMP-2"] = 7,
["BMP-3"] = 8,
["BMP-3"] = 8, -- IRL should be 7+2 passengers
["Boman"] = 25,
["BTR-80"] = 9,
["BTR_D"] = 12,
["BTR-80"] = 9, -- IRL should be 7 passengers
["BTR-82A"] = 9, -- new by kappa -- IRL should be 7 passengers
["BTR_D"] = 12, -- IRL should be 10 passengers
["Cobra"] = 8,
["Land_Rover_101_FC"] = 11, -- new by kappa
["Land_Rover_109_S3"] = 7, -- new by kappa
["LAV-25"] = 6,
["M-2 Bradley"] = 6,
["M1043 HMMWV Armament"] = 4,
["M1045 HMMWV TOW"] = 4,
["M1126 Stryker ICV"] = 9,
["M1134 Stryker ATGM"] = 9,
["M2A1_halftrack"] = 9,
["M-113"] = 9, -- IRL should be 11 passengers
["Marder"] = 6,
["MCV-80"] = 9,
["MCV-80"] = 9, -- IRL should be 7 passengers
["MLRS FDDM"] = 4,
["MTLB"] = 25,
["TPZ"] = 10,
["Ural-4320 APA-5D"] = 10,
["MTLB"] = 25, -- IRL should be 11 passengers
["GAZ-66"] = 8,
["GAZ-3307"] = 12,
["GAZ-3308"] = 14,
["Tigr_233036"] = 6,
["Grad_FDDM"] = 6, -- new by kappa
["KAMAZ Truck"] = 12,
["KrAZ6322"] = 12,
["M 818"] = 12,
["Tigr_233036"] = 6,
["TPZ"] = 10,
["UAZ-469"] = 4, -- new by kappa
["Ural-375"] = 12,
["Ural-4320-31"] = 14,
["Ural-4320 APA-5D"] = 10,
["Ural-4320T"] = 14,
["ZBD04A"] = 7, -- new by kappa
}
local CargoBayWeightLimit = ( Weights[Desc.typeName] or 0 ) * 95

View File

@@ -63,7 +63,7 @@
--
-- The UNIT class provides methods to obtain the current point or position of the DCS Unit.
-- The @{#UNIT.GetPointVec2}(), @{#UNIT.GetVec3}() will obtain the current **location** of the DCS Unit in a Vec2 (2D) or a **point** in a Vec3 (3D) vector respectively.
-- If you want to obtain the complete **3D position** including ori<EFBFBD>ntation and direction vectors, consult the @{#UNIT.GetPositionVec3}() method respectively.
-- If you want to obtain the complete **3D position** including orientation and direction vectors, consult the @{#UNIT.GetPositionVec3}() method respectively.
--
-- ## Test if alive
--
@@ -154,8 +154,8 @@ function UNIT:Name()
return self.UnitName
end
--- @param #UNIT self
--- Get the DCS unit object.
-- @param #UNIT self
-- @return DCS#Unit
function UNIT:GetDCSObject()
@@ -527,8 +527,7 @@ end
--- Returns the unit's group if it exist and nil otherwise.
-- @param Wrapper.Unit#UNIT self
-- @return Wrapper.Group#GROUP The Group of the Unit.
-- @return #nil The DCS Unit is not existing or alive.
-- @return Wrapper.Group#GROUP The Group of the Unit or `nil` if the unit does not exist.
function UNIT:GetGroup()
self:F2( self.UnitName )
@@ -762,6 +761,41 @@ function UNIT:GetFuel()
return nil
end
--- Sets the passed group or unit objects radar emitters on or off. Can be used on sam sites for example to shut down the radar without setting AI off or changing the alarm state.
-- @param #UNIT self
-- @param #boolean Switch If `true` or `nil`, emission is enabled. If `false`, emission is turned off.
-- @return #UNIT self
function UNIT:SetEmission(Switch)
if Switch==nil then
Switch=true
end
local DCSUnit = self:GetDCSObject()
if DCSUnit then
DCSUnit:enableEmission(Switch)
end
return self
end
--- Sets the passed group or unit objects radar emitters ON. Can be used on sam sites for example to shut down the radar without setting AI off or changing the alarm state.
-- @param #UNIT self
-- @return #UNIT self
function UNIT:EnableEmission()
self:SetEmission(true)
return self
end
--- Sets the passed group or unit objects radar emitters OFF. Can be used on sam sites for example to shut down the radar without setting AI off or changing the alarm state.
-- @param #UNIT self
-- @return #UNIT self
function UNIT:DisableEmission()
self:SetEmission(false)
return self
end
--- Returns a list of one @{Wrapper.Unit}.
-- @param #UNIT self
-- @return #list<Wrapper.Unit#UNIT> A list of one @{Wrapper.Unit}.
@@ -1175,8 +1209,9 @@ end
--- Returns true if the UNIT is in the air.
-- @param #UNIT self
-- @param #boolean NoHeloCheck If true, no additonal checks for helos are performed.
-- @return #boolean Return true if in the air or #nil if the UNIT is not existing or alive.
function UNIT:InAir()
function UNIT:InAir(NoHeloCheck)
self:F2( self.UnitName )
-- Get DCS unit object.
@@ -1186,14 +1221,14 @@ function UNIT:InAir()
-- Get DCS result of whether unit is in air or not.
local UnitInAir = DCSUnit:inAir()
-- Get unit category.
local UnitCategory = DCSUnit:getDesc().category
-- If DCS says that it is in air, check if this is really the case, since we might have landed on a building where inAir()=true but actually is not.
-- This is a workaround since DCS currently does not acknoledge that helos land on buildings.
-- Note however, that the velocity check will fail if the ground is moving, e.g. on an aircraft carrier!
if UnitInAir==true and UnitCategory == Unit.Category.HELICOPTER then
if UnitInAir==true and UnitCategory == Unit.Category.HELICOPTER and (not NoHeloCheck) then
local VelocityVec3 = DCSUnit:getVelocity()
local Velocity = UTILS.VecNorm(VelocityVec3)
local Coordinate = DCSUnit:getPoint()
@@ -1393,3 +1428,21 @@ function UNIT:GetTemplateFuel()
return nil
end
--- GROUND - Switch on/off radar emissions.
-- @param #UNIT self
-- @param #boolean switch
function UNIT:EnableEmission(switch)
self:F2( self.UnitName )
local switch = switch or false
local DCSUnit = self:GetDCSObject()
if DCSUnit then
DCSUnit:enableEmission(switch)
end
end

View File

@@ -68,6 +68,8 @@ Functional/Suppression.lua
Functional/PseudoATC.lua
Functional/Warehouse.lua
Functional/Fox.lua
Functional/Mantis.lua
Functional/Shorad.lua
Ops/Airboss.lua
Ops/RecoveryTanker.lua

View File

@@ -1,3 +1,5 @@
[![Build status](https://ci.appveyor.com/api/projects/status/1y8nfmx7lwsn33tt?svg=true)](https://ci.appveyor.com/project/Applevangelist/MOOSE)
# MOOSE framework
MOOSE is a **M**ission **O**bject **O**riented **S**cripting **E**nvironment, and is meant for mission designers in DCS World.
@@ -50,9 +52,7 @@ This repository contains all the demonstration missions in packed format (*.miz)
This repository contains all the demonstration missions in unpacked format. That means that there is no .miz file included, but all the .miz contents are unpacked.
## [MOOSE Web Site](https://flightcontrol-master.github.io/MOOSE_DOCS/)
Documentation on the MOOSE class hierarchy, usage guides and background information can be found here for normal users, beta testers and contributors.