Compare commits

...

450 Commits

Author SHA1 Message Date
kaltokri
4c66fd7cab Renamed basic.md to concepts.md and added more text 2024-01-22 17:36:32 +01:00
kaltokri
80f76b26c2 Small fixes in advanced guide 2024-01-19 16:57:33 +01:00
kaltokri
4e956c3203 New guides added 2024-01-19 11:41:09 +01:00
Applevangelist
08f2c29014 #AIRBASE
* Small workaround for Beirut runways
* ATIS minor fix
2024-01-18 14:32:17 +01:00
Applevangelist
dcd4d0ab62 CONTROLLABLE
* Added CommandSetFrequencyForUnit
2024-01-17 12:15:46 +01:00
Rolf Geuenich
bb07e1935e Downpatching changes from development to master 2024-01-12 16:05:14 +01:00
Rolf Geuenich
088436c5ce Downpatching changes from development to master in Arty.lua 2024-01-12 15:44:28 +01:00
Rolf Geuenich
797bf0047b Down patching of code enhancements from develop to master in Set.lua 2024-01-12 15:33:27 +01:00
Applevangelist
f29d055ca3 Correction 2024-01-11 17:31:40 +01:00
Applevangelist
1468641563 CTLD - avoid UHT beacons between 243 and 320 mHz 2024-01-11 17:14:07 +01:00
Applevangelist
8b08942c4d CONTROLLABLE - Added options for Radar Using 2024-01-11 12:52:02 +01:00
kaltokri
eb84ad3cee Fix for Moose_Create.lua and dynamic path 2024-01-10 15:43:24 +01:00
kaltokri
91a34ac4d8 Added PyCharm to gitignore 2024-01-10 15:40:46 +01:00
Applevangelist
28c8d99878 Added player name to ...PilotDown() event 2024-01-10 15:18:38 +01:00
kaltokri
4fda8cc5fb Easy debugging for all Moosers #2093
Enables everybody to use load Moose from an external full path.
This is needed to use PyCharm with EmmyLua Debugger.
Needs also De-Sanitize to load mission script with full path.
2024-01-10 14:12:17 +01:00
Applevangelist
4ac583e434 SRS changes 2024-01-09 17:28:58 +01:00
Applevangelist
fa762fe0fc #MSRS
* Added voice enumerator ofr gRPC using MS as provider MSRS.Voices.MicrosoftGRPC
2024-01-07 14:44:07 +01:00
Mr.Alien
aca5846209 Fix scoring to not het more points when not killed at once. + overridable method call on kill (#2079) 2024-01-07 13:28:12 +01:00
Mr.Alien
4fd7d7cba9 Spawn all unit randomly inside a zone, instead of only the first unit in zone and the other within a radius (potentially outside the zone, and in some cases in the middle of a runway) (#2069) 2024-01-07 13:27:23 +01:00
Applevangelist
9280a1224d MSRS additions 2024-01-07 13:23:50 +01:00
Applevangelist
fce7b07014 Fixes for MSRS changes 2024-01-06 18:21:39 +01:00
kaltokri
4696569f83 Added mission check for desanitized io 2024-01-06 12:22:02 +01:00
Applevangelist
84230e2360 Fixes for 4th SRS Parameter 2024-01-05 16:08:46 +01:00
Applevangelist
ca9913e38b nu aber 2024-01-05 15:51:09 +01:00
Applevangelist
ff951c69d9 Error dfix 2024-01-05 15:45:40 +01:00
Applevangelist
f2f7c88299 SRS changes 2024-01-05 15:42:11 +01:00
Applevangelist
f5d6d31b10 xxx 2024-01-04 14:01:12 +01:00
Frank
9b95e71d75 Update Airboss.lua
- Potential fix for error raised on discord
2024-01-03 22:32:37 +01:00
Applevangelist
db6dc7b77e SET: Added GetRandomSurely() 2024-01-03 18:05:29 +01:00
Rolf Geuenich
4c81333a0a Add the dynamic loading of developer files (#2090) 2024-01-03 07:19:18 +01:00
kaltokri
79b1f1615f Fix broken link in AI_Escort_Request.lua 2024-01-02 22:06:59 +01:00
kaltokri
47f010cb28 Fixed broken link in AI_Escort.lua 2024-01-02 19:03:19 +01:00
Applevangelist
d14b7e8f4c #POINT
* added missing COORDINATE:ToStringLL()
2024-01-02 18:12:42 +01:00
Frank
d9748ef147 Update SRS.lua
- Fixed bugs for self
2024-01-02 17:06:32 +01:00
kaltokri
64d7946c06 Fix for broken links in master branch 2024-01-02 13:33:10 +01:00
kaltokri
b052fc6243 Merge branch 'restructuring' 2024-01-01 19:06:34 +01:00
kaltokri
8385b1d21a Fixed broken links in A2A_Dispatcher 2024-01-01 19:06:21 +01:00
kaltokri
d4f4465b0a Merge branch 'restructuring' 2024-01-01 15:53:05 +01:00
kaltokri
5fe77956cb Fixed broken links of restructure 2024-01-01 15:51:02 +01:00
Applevangelist
d640acc7cc docu 2024-01-01 13:07:08 +01:00
kaltokri
8dcd22f18c Merge branch 'msrs' 2024-01-01 00:38:59 +01:00
kaltokri
2d086a62f0 Added link to example missions to MSRS 2024-01-01 00:38:48 +01:00
Applevangelist
47ad2499d4 Merge remote-tracking branch 'origin/master' 2023-12-31 17:26:01 +01:00
Applevangelist
5d510807c9 xxx 2023-12-31 17:25:56 +01:00
Applevangelist
5ba8f9e0e8 #UTILS
* Added NATO name for KC-135MPRS

#SET
* Made filtering a tad faster
2023-12-31 17:21:02 +01:00
kaltokri
0338fd5d33 Merge branch 'msrs' 2023-12-31 17:15:51 +01:00
kaltokri
ea2175bba8 Added debug output to SRS.lua 2023-12-31 17:14:54 +01:00
Applevangelist
0835022c5c #GROUP
* Corrections for "IsAAA()"
2023-12-31 14:57:13 +01:00
Applevangelist
f306361317 #GROUP
* Added IsSam and IsAAA

#SET
* Corrected EvalFilterFunctions - all must be true
2023-12-30 16:52:24 +01:00
Applevangelist
0347e42fc7 CARGO noise 2023-12-30 16:50:12 +01:00
Applevangelist
9cc32ff8dc AIRBOSS - Superfluous error message removal 2023-12-29 15:02:41 +01:00
Applevangelist
b052d99349 Fixes 2023-12-29 14:50:01 +01:00
kaltokri
4fe1318e7c Fixed a logic failure with external sound files in SoundOutput.lua 2023-12-28 16:38:26 +01:00
Applevangelist
6ffe69484c Reduce noise 2023-12-28 13:32:53 +01:00
Applevangelist
501ab70992 xxx 2023-12-27 19:34:20 +01:00
Applevangelist
6ac46addf0 #SET
* Added `FilterFunction()` for these SETs: UNIT, GROUP, CLIENT, STATIC
2023-12-27 19:28:19 +01:00
Applevangelist
3bdf4b4c76 #CTLD
* Fix multi-crate requests deducting too much Stock
2023-12-26 19:18:13 +01:00
kaltokri
46f70dd8a6 Fixed logic in SoundOutput.lua to play internal sound files with SRS 2023-12-26 14:50:54 +01:00
Thomas
aeac2eb3d7 Update build-includes.yml 2023-12-25 13:20:13 +01:00
Thomas
e83c8c3ee0 Update build-includes.yml (#2078) 2023-12-25 13:14:46 +01:00
Applevangelist
d65042c640 SRS error from luacheck 2023-12-25 13:12:03 +01:00
Thomas
c72cdd8f0b Update build-includes.yml (#2077) 2023-12-25 13:08:21 +01:00
Thomas
7e2f8771b5 Update build-includes.yml (#2076) 2023-12-25 13:01:59 +01:00
Applevangelist
3ccfcdbd0f CSAR 2023-12-25 13:00:36 +01:00
Applevangelist
16f3dcbbb4 New SRS fixes 2023-12-25 12:14:41 +01:00
kaltokri
f6f3189504 MSRS enhancements
- Added more tracing
- A check if executable exists
- Removed STTS references
2023-12-25 11:27:48 +01:00
kaltokri
071554bfc5 Fixed some small typos and removed STTS in comments 2023-12-25 09:39:21 +01:00
kaltokri
1527b53c76 Fixed ASW typo in SRS.lua 2023-12-25 06:09:31 +01:00
kaltokri
bbc7f7e14c Added mission repositries to repositories.md 2023-12-25 05:58:58 +01:00
kaltokri
b9830a8437 Fixed some typos in demo-missions.md 2023-12-25 05:35:41 +01:00
Frank
caaee4f551 Merge pull request #2068 from FlightControl-Master/FF/MasterDevel
MSRS
2023-12-24 03:21:50 +01:00
Frank
5f7115f4fe Update SRS.lua 2023-12-23 16:53:42 +01:00
Frank
9ec92a8fca SRS
- Refactoring
2023-12-23 15:57:27 +01:00
Applevangelist
7cc040c234 #RANGE
* Fixed Range trying to find a pilot on each and every birth event...
2023-12-23 14:51:59 +01:00
Frank
9227ba9ecd Merge branch 'master' into FF/MasterDevel 2023-12-22 22:01:59 +01:00
Frank
e7fb073bab Update RAT.lua
- Removed restriction that zones need to be defined in the ME
2023-12-22 21:11:30 +01:00
Frank
f86b3505b2 Update Airboss.lua
- Fixed Attitude Monitor
2023-12-22 10:36:25 +01:00
Frank
e89b921f3e Update Zone.lua 2023-12-22 10:27:00 +01:00
Frank
0d18ce086c Update Zone.lua 2023-12-21 22:33:08 +01:00
Frank
8fb126682f Merge branch 'master' into FF/MasterDevel 2023-12-21 22:22:10 +01:00
Applevangelist
ebe486c69a UTILS
* Small fix for UH60L door checker
2023-12-20 10:07:42 +01:00
Applevangelist
702ec75935 Small fix 2023-12-19 17:38:31 +01:00
Applevangelist
465ec216ea #CONTROLLABLE - Option ECM 2023-12-19 12:11:09 +01:00
Applevangelist
d803b51e84 #ZONE
* Fixed filling/drawing of more complex polygon zones
* Added function to (re-)fill polygon
* Added function to (re-)draw polygon outline
2023-12-19 10:19:44 +01:00
Applevangelist
53f89fd42c #DATABASE
* Read color, fill color from drawing data
2023-12-19 10:18:20 +01:00
Frank
c72f109553 SRS 2023-12-19 00:02:17 +01:00
kaltokri
92e03522db Finished beginner section 2023-12-18 16:21:32 +01:00
Frank
9716162739 Update SRS.lua 2023-12-17 22:55:31 +01:00
Frank
4eea8fcadd Merge branch 'master' into FF/MasterDevel 2023-12-17 20:37:30 +01:00
Frank
0ae9be49da Update Range.lua
- Fixed random good by phrase
2023-12-16 09:31:44 +01:00
kaltokri
bda4efc634 Added page "Create your own Hello world" 2023-12-15 14:11:58 +01:00
Applevangelist
e84e16f58b xx 2023-12-14 12:43:36 +01:00
Applevangelist
55ffe37a79 #USERSOUND
* Added USERSOUND:ToClient( Client, Delay )
2023-12-14 12:42:13 +01:00
Applevangelist
68548f4581 #COORDINATE
* Fix for NewFromMGRS for less precise coordinates (below level 5)
2023-12-14 11:12:14 +01:00
Thomas
8382eb9cd8 Update Range.lua (#2066)
MSRS config compatibility
2023-12-13 19:21:28 +01:00
Applevangelist
f837e9dec7 #COORDINATE
* Added functions to create a COORDINATE from MGRS
2023-12-12 10:53:37 +01:00
Thomas
230d9d82bf Update Detection.lua (#2063)
# RadarBlur - make burn-through limit configureable
2023-12-11 11:04:35 +01:00
Applevangelist
c089e56060 # DETECTION
* Make the radar blur less effective when under 20km distance
2023-12-10 14:37:41 +01:00
Applevangelist
87f1a5ed0d # DETECTION
* Option to make Radar Blue decision visible in logs (self.debug) and/or screen (self.verbose)
2023-12-10 11:58:19 +01:00
Applevangelist
d2d6fac7df # DETECTION, logic fix 2023-12-09 18:16:29 +01:00
Applevangelist
bc3f9ed7c0 #SPAWN
* Added SPAWN:InitCallSign(ID,Name,Minor,Major)
2023-12-09 15:51:35 +01:00
Applevangelist
0f4162a9a9 * fixes 2023-12-09 14:34:41 +01:00
Applevangelist
6b270916c4 # DETECTION_BASE
* Added `SetRadarBlur(minheight,thresheight,thresblur)`
2023-12-09 13:53:27 +01:00
Applevangelist
b3a006096c fixes 2023-12-09 13:03:34 +01:00
Applevangelist
6903e252d2 #UTILS
* Nicer PrintTableToLog()
2023-12-07 16:08:47 +01:00
Applevangelist
ff6704f123 #ZONE docu fixes 2023-12-07 15:11:53 +01:00
Applevangelist
c770f4cb68 #ZONE Docu fixes 2023-12-07 13:46:32 +01:00
Applevangelist
9ce1d360d6 #CTLD
* Spawn dropped troops in a nice circle 5m (hover: 1.5m) left of the he
2023-12-07 13:31:40 +01:00
Thomas
6f473faa92 Update Message.lua
#2059 fixed
2023-12-07 12:14:59 +01:00
Thomas
dd37a42470 Update CTLD.lua (#2060)
Changes from @Rey
2023-12-07 12:12:19 +01:00
Applevangelist
88e1bbd60d #SET
* Repaired SET_UNIT:GetCoordinate()
2023-12-07 11:20:43 +01:00
Applevangelist
e078e48853 #SPAWN
* Fix for a Link16 flight having a non-NATO callsign as number
2023-12-06 08:42:07 +01:00
Thomas
fac7a5fdc6 Update CTLD.lua (#2058)
Add Remove Crates option
2023-12-04 10:40:38 +01:00
Applevangelist
49191fb144 clarifications 2023-12-03 15:34:55 +01:00
Applevangelist
f739062463 #ZONE_OVAL - fix documentation and intellisense 2023-12-03 12:39:08 +01:00
Applevangelist
c22304f2b0 Remove demo links which were empty 2023-12-03 12:25:25 +01:00
Applevangelist
c97d2ecaba #ATIS - multi freq example added 2023-12-03 12:11:22 +01:00
Applevangelist
89a9d1d0a4 #CONTROLLABLE
* Fixed ID issue with AA Missile Attack Range option

#POINT
* Added methdo to get the BULLSEYE as coordinate
2023-12-03 12:01:50 +01:00
Applevangelist
cf7d41cd7f #ZONE_POLYGON improvements
#ZONE_OVAL NEW
2023-12-03 11:42:53 +01:00
Thomas
afe542cc63 Update Event.lua
Fix for playername in weapon target
2023-12-03 09:23:42 +01:00
Applevangelist
89a902fd57 #ATIS
* make info multi-frequency safe
2023-12-02 15:11:14 +01:00
Applevangelist
ae604fd847 #AIRBASE
* Add'l Normandy Airfields
2023-12-02 14:45:42 +01:00
Frank
4b8d120f20 Update Warehouse.lua
- Added check that DCS warehouse has enough air assets for selfpropelled assets
2023-11-30 23:29:29 +01:00
Applevangelist
c489a88106 #GROUP
* Get Link16 S/TN data from a group
2023-11-27 16:49:06 +01:00
Applevangelist
641707f37b #UNIT
* Added `GetSTN()` to obtain Link16 info from a unit
2023-11-26 16:59:44 +01:00
Frank
67924c894d Update SRS.lua
- Removed altbackend functions
2023-11-26 16:45:19 +01:00
Applevangelist
7c8f212b03 -- noise 2023-11-25 18:44:21 +01:00
Applevangelist
85c73cb0a5 #SPAWN
*Link16 fixes
* Wrongly created STN's will be replaced with random five digit octals with leading 0
* Voice call sign label will be the callsign's first and last letters, e.g. Enfield = ED. Navy One = NY
* Voice call sign number equals callsign minor major, e.g. Enfield 6-1 = ED 61
* Also works for A10CII which has a different entry with a four-digit octal with leading 0
* for fighter aircraft you can use :InitRandomizeCallsign() to give each spawn a random callsign
2023-11-25 18:28:59 +01:00
Frank
1b1f8e0d2c Update SRS.lua 2023-11-24 23:59:31 +01:00
Frank
f87126f22c Merge branch 'master' into FF/MasterDevel 2023-11-24 15:44:54 +01:00
Applevangelist
b635490e47 SPAWN - Init Link16/datalink details in UNITs 2023-11-24 12:17:25 +01:00
Thomas
cac7b39823 Update SRS.lua
Fix for config load when not desanitized
2023-11-24 06:32:44 +01:00
Frank
af3c579a03 Update SRS.lua 2023-11-23 22:22:59 +01:00
Frank
a508c63279 Merge branch 'master' into FF/MasterDevel 2023-11-23 22:12:52 +01:00
Frank
427a11bd0f Merge pull request #2046 from nielsvaes/moose_master_vanilla
bugfix for impactHeading
2023-11-23 22:11:59 +01:00
Niels Vaes
6f3133d48c bugfix for impactHeading
clamping GetImpactHeading and GetReleaseHeading
2023-11-23 21:50:08 +01:00
Applevangelist
aa7f26ac79 ATC_GROUND fix for scheduler 2023-11-23 18:45:36 +01:00
Frank
084caad5d7 Merge branch 'master' into FF/MasterDevel 2023-11-23 18:25:43 +01:00
Applevangelist
343bf05c2c SPAWN - Set correct unit ID in the group callsign 2023-11-23 18:14:25 +01:00
Applevangelist
3e40d72e25 #ATC_GROUND 2023-11-23 17:00:58 +01:00
Frank
1c1daa4ebe Merge pull request #2045 from nielsvaes/moose_master_vanilla
Adding a bunch of various helper functions to UTILS
2023-11-23 16:16:05 +01:00
Niels Vaes
fdcda6e5f3 typos 2023-11-23 15:22:14 +01:00
Niels Vaes
a50dde7f2b added functions:
UTILS.TimeNow
UTILS.TimeDifferenceInSeconds
UTILS.TimeLaterThan
UTILS.TimeBefore
UTILS.CombineTimeStrings
UTILS.SubtractTimeStrings
UTILS.TimeBetween
UTILS.PercentageChance
UTILS.Clamp
UTILS.ClampAngle
UTILS.RemapValue
UTILS.RandomPointInTriangle
UTILS.AngleBetween
UTILS.WriteJSON
UTILS.ReadJSON
UTILS.GetZoneProperties
UTILS.RotatePointAroundPivot
UTILS.UniqueName

string.startswith
string.endswith
string.split
string.contains

table.contains_key
table.remove_by_value
table.remove_key
table.index_of
table.length
table.slice
table.count_value
table.combine
table.merge
table.add
table.shuffle
table.find_key_value_pair
2023-11-23 15:18:23 +01:00
Frank
1fb4cb1c4f Merge pull request #2044 from nielsvaes/moose_master_vanilla
Added functions to get info at the time of weapon release
2023-11-23 00:31:57 +01:00
Niels Vaes
cd0f854f41 added functions:
GetReleaseHeading
GetReleaseAltitudeASL
GetReleaseCoordinate
GetReleasePitch
GetImpactHeading
2023-11-22 23:48:00 +01:00
Frank
52c2401d93 Update SRS.lua 2023-11-22 22:53:54 +01:00
Applevangelist
02a87d9fe0 fix 2023-11-22 18:35:12 +01:00
Applevangelist
12d68a41ca #MSRS
* Added option to explicitly set/switch the TTS provider between Google and MS (the default)
* Added this option to the config file, so you can set up both but switch
2023-11-22 17:54:52 +01:00
Applevangelist
6c4a64601f MSRS
Docu fix
2023-11-21 13:21:22 +01:00
Applevangelist
434f985e77 #MSRS
* Cleaner config loading strategy
2023-11-21 10:12:46 +01:00
Thomas
ba1dcfcdba Update Utils.lua
Avoid file loading stop scripts
2023-11-20 14:49:16 +01:00
Thomas
b346dabdf8 Update introduction.md (#2043) 2023-11-20 11:24:25 +01:00
kaltokri
1376a16812 Make linkinator results more stable with retry features 2023-11-20 10:15:20 +01:00
kaltokri
4267314260 Merge branch 'userguide' 2023-11-20 09:59:07 +01:00
kaltokri
b5110c8554 Migration of MOOSE user guide
introduction and hello world
2023-11-20 09:56:44 +01:00
Applevangelist
1f1d1e4f2f #CTLD
* Added info event for repairs and builds starting
2023-11-19 15:36:16 +01:00
Applevangelist
522eb8b256 #EVENT
* Handler for 2.9 new events
2023-11-19 12:40:22 +01:00
Applevangelist
b662ecc76b #MANTIS, SHORAD
* Added more options for ScootZones
2023-11-18 17:16:27 +01:00
Applevangelist
6dd69eb6db CTLD - avoid old mission go haywire with UnitCapabilities() 2023-11-18 16:44:23 +01:00
Applevangelist
1b6aeff005 #CTLD
* if a unit cannot do troops/crates, those menus are not shown
* renamed `UnitCapabilities()` to `SetUnitCapabilities()`
2023-11-18 16:31:10 +01:00
Applevangelist
4287774d9f EVENT fix for borked target info 2023-11-18 13:23:15 +01:00
Applevangelist
6bba2fec0b Spot 2023-11-17 15:06:52 +01:00
Applevangelist
5d2656d679 SET 2023-11-17 15:05:19 +01:00
Applevangelist
65a729a2d6 Merge remote-tracking branch 'origin/master' 2023-11-17 11:05:26 +01:00
Applevangelist
7868930fcb ATIS 2023-11-17 11:05:22 +01:00
Applevangelist
67248a290c ATIS small fix 2023-11-17 11:04:33 +01:00
Frank
0bc52eb331 DCS stable
- Added check that ` Airbase.getWarehouse`  method exists because it causes problems with DCS stable as this method does not exist there.
2023-11-17 00:26:21 +01:00
Frank
5353be482e getCategory behaviour
- Fixed several classes for new `getCategory` behaviour (should be backwards compatible to earlier DCS versions).
2023-11-16 22:32:01 +01:00
Applevangelist
826ae86cb7 #MANTIS
* Added IDF data
2023-11-16 18:11:30 +01:00
Applevangelist
475153be4c #RANGE
* Added coalition option to `New()`
2023-11-16 16:10:47 +01:00
Applevangelist
5f734a0d17 #MESSAGE
* Fixes for ToSRS() for MS Desktop
2023-11-15 18:16:46 +01:00
Applevangelist
1b8c9367a3 #MANTIS/#SEAD/#SHORAD
* Added shoot and scoot for MANTIS and SHORAD
* Added detection of TALD ADM-141A (all)
2023-11-14 11:57:58 +01:00
Applevangelist
19047843cc #SEAD
* Added data and actions for TALD ADM_141
2023-11-12 16:53:34 +01:00
kaltokri
174454b8c5 Migrated Text-To-Speech guide to docs 2023-11-11 16:06:22 +01:00
kaltokri
d30a53333c Migration of eclipse installation guide from wiki to docs 2023-11-10 16:53:41 +01:00
kaltokri
30b89328f1 Extension of the build documentation 2023-11-10 16:22:58 +01:00
kaltokri
b38dc62be7 Restructure of the docs content 2023-11-10 15:36:54 +01:00
kaltokri
6d9333aa94 Added new README.md 2023-11-10 10:50:20 +01:00
kaltokri
6947bcfcf2 Used newest Discord link and small enhancements 2023-11-09 16:38:50 +01:00
Applevangelist
db06154ad7 #DATABASE
* Register players joining CA slots as CLIENTs
2023-11-09 15:09:01 +01:00
Applevangelist
fa43a6c40b Symlink fix 2023-11-08 17:53:43 +01:00
Applevangelist
5056187fb9 #GROUP #UNIT
* Added `FindByMatching(Pattern)` and `FindAllByMatching(Pattern)`
2023-11-08 17:43:29 +01:00
kaltokri
72c5c2ee4d Parameter has different behaviour on Windows and Linux 2023-11-08 17:39:19 +01:00
kaltokri
25936a526d Fixed small typo in gh-pages.yml 2023-11-08 17:33:25 +01:00
kaltokri
8bc735288f Skip java.com when checking links. Seems to be blocked for GitHub 2023-11-08 17:27:04 +01:00
kaltokri
f8afa1cb78 Renamed old-guides into archive 2023-11-08 16:59:20 +01:00
kaltokri
e95eb2768d Replaced absolute links with relative ones to fix problem on GitHub pages 2023-11-08 16:23:31 +01:00
kaltokri
f6091cd117 Migrated old documentation to just-the-docs 2023-11-08 13:44:56 +01:00
Applevangelist
9fafdea0bb #EVENT #NET
* On a MP server, added IniPlayerUCID and TgtPlayerUCID to the EventData structure (filled in applicable Events)
2023-11-08 11:23:01 +01:00
Frank
fbf2c4c721 Update Event.lua
- Improved getCategory behaviour
2023-11-06 22:01:05 +01:00
Applevangelist
9d3cb4cc1b #MESSAGE
* SRS label correction
2023-11-05 13:01:27 +01:00
kaltokri
9d500186d1 Enhancement of build-docs to remove old files 2023-11-03 16:33:45 +01:00
kaltokri
f80265786d Fix broken links SetEngageRange 2023-11-03 15:52:53 +01:00
Applevangelist
7b9d8d375d #SRS Improvements 2023-11-03 13:37:59 +01:00
Applevangelist
7393cb2cbe #ATIS
* Some fixes
2023-11-02 19:25:28 +01:00
Applevangelist
bcbe872c7d #ATIS
* Added coordinate for SRS
* Added SRS calling out take off AND landing runway (if set)
2023-11-02 18:18:55 +01:00
kaltokri
bf60c535bc Merge branch 'master' of github.com:FlightControl-Master/MOOSE
# Conflicts:
#	Moose Development/Moose/Tasking/Task_Cargo_CSAR.lua
2023-11-02 15:16:12 +01:00
kaltokri
feb99e9405 Fix for SetEngageRange documentation in AI_A2A and A2G classes 2023-11-02 15:14:57 +01:00
Frank
9fde88d61a Merge branch 'master' of https://github.com/FlightControl-Master/MOOSE 2023-11-02 01:39:42 +01:00
Frank
430b4a274c Update Warehouse.lua
#2033
2023-11-02 01:39:40 +01:00
Thomas
5996426119 Update Storage.lua (#2035) 2023-11-01 06:20:36 +01:00
Thomas
36d9460cdf Update Storage.lua 2023-11-01 06:19:53 +01:00
Frank
1561f49c9c Lings
- Fixed link in Core.Condition (will add demo miz)
- Fixed lings in Task_Cargo_CSAR und Task_Cargo_Transport
2023-10-31 19:53:20 +01:00
kaltokri
e032781a92 Changed Core.Group to Wrapper.Group 2023-10-31 16:36:51 +01:00
kaltokri
aa7d0b1e25 Fixed broken links 2023-10-31 16:30:48 +01:00
kaltokri
13a8babe75 Fixed broken links 2023-10-31 16:05:48 +01:00
kaltokri
87dda49113 Fixed broken links 2023-10-31 15:44:07 +01:00
kaltokri
018830b539 Merge branch 'master' of github.com:FlightControl-Master/MOOSE
# Conflicts:
#	Moose Development/Moose/AI/AI_Air_Engage.lua
2023-10-31 15:23:26 +01:00
kaltokri
d92d2d07c5 Fixed broken links 2023-10-31 15:21:15 +01:00
Frank
046e49ac6b Merge branch 'master' of https://github.com/FlightControl-Master/MOOSE 2023-10-31 13:35:41 +01:00
Frank
52e66ae969 Broken Links
- AI_A2A_Gci Removed reference to SetEngageZone
- Fixed link to #AI_A2G_SEAD.SetEngageRange #2025
- AI_Air_Engage removed reference to SetEngageZone. Does not seem to exist any more.
- AI_Air_Patrol removed reference to SetEngageZone. Does not seem to exist any more or is passed as argument now.
- AI_FORMATION Fixed DCSTypes#AI.Option.Air.val.ROE OptionROE #2029
- SETTINGS Fixed link to Message #2021
- Fixed wrong indent of "Developer Note" in various classes
2023-10-31 13:33:45 +01:00
kaltokri
ca15d7cb00 Merge branch 'master' of github.com:FlightControl-Master/MOOSE 2023-10-31 13:05:29 +01:00
kaltokri
1086c61ccf Fixed broken links 2023-10-31 13:04:48 +01:00
Frank
77f9721102 AI
- Fixed various `@extends` errors pointing to non-existing classes for AI_*
2023-10-31 11:44:45 +01:00
kaltokri
b05683d384 Fixed some broken links 2023-10-31 10:25:00 +01:00
kaltokri
d7df08d754 Fixed broken links in documentation 2023-10-30 18:01:57 +01:00
kaltokri
92b21aa5c1 Fixed broken links in documentation 2023-10-30 14:48:49 +01:00
kaltokri
0e2dff4e6b Fixed some dead links in Ops.Airboss 2023-10-29 23:06:09 +01:00
kaltokri
5c9e3570e2 Added more docker jobs and apply same naming convention as build jobs 2023-10-29 19:43:55 +01:00
Applevangelist
51102e47ae #CTLD
* Adding re-packing dropped units
2023-10-29 17:44:31 +01:00
kaltokri
7643568706 Fixed dead links in documentation 2023-10-27 17:48:41 +02:00
kaltokri
3684a023da Fixed dead link 2023-10-27 17:27:38 +02:00
kaltokri
b0c8f05f38 Build optimization
- Remove appveyor
- Added docker compose for building docs locally
- Added manuall run of GitHub Action builds
- Added paths to trigger builds
2023-10-27 17:01:51 +02:00
Applevangelist
d8c2b8b719 #UTILS
* Added new tanke callsigns
2023-10-27 09:09:36 +02:00
Applevangelist
31075f7c04 #UNIT
* Typos in IsTanker, added some typenames
2023-10-26 12:45:45 +02:00
kaltokri
6bf6b933cc Fixed last broken link 2023-10-25 15:52:11 +02:00
kaltokri
5681244941 Fix for canonical link 2023-10-25 15:45:20 +02:00
kaltokri
788108c5b8 Added check for dead links and fixed dead links 2023-10-25 15:34:06 +02:00
kaltokri
3fbc76e37f Documentation of the build system added 2023-10-24 17:03:01 +02:00
Applevangelist
4e5b483cc0 #CONTROLLABLE
* Added PatrolRaceTrack
2023-10-24 13:45:43 +02:00
Applevangelist
ab068670cc #RECOVERYTANKER
* Added option to set unlimited fuel
2023-10-21 12:43:20 +02:00
kaltokri
456c002c3c Fix for missing w3.css in DOCS repo 2023-10-20 23:37:29 +02:00
kaltokri
038b89776d Added replacement of head tag again 2023-10-20 22:45:52 +02:00
Applevangelist
df6d968ebe #CONTROLLABLE
* Added `CommandSetUnlimitedFuel()`
* Added `TaskStrafing()`
2023-10-20 18:44:28 +02:00
kaltokri
4d9197b3cc First version of the new GitHub pages 2023-10-20 16:13:30 +02:00
kaltokri
10dffb0689 Changed mail from MooseBotter 2023-10-20 09:58:35 +02:00
kaltokri
722c33df62 Fixed wrong git config entries in build-docs.yml 2023-10-19 18:53:52 +02:00
kaltokri
dc54cc82af Fixed wrong repository owner 2023-10-19 18:24:46 +02:00
kaltokri
d4a46606fd Switched from env.FORCE_PUSH to vars.FORCE_PUSH 2023-10-19 18:16:45 +02:00
Thomas
015af9774c Update build-includes.yml 2023-10-19 16:17:48 +02:00
Thomas
f0a37172b9 Update build-includes.yml (#2018) 2023-10-19 16:14:59 +02:00
Thomas
2dd2e593e8 Update README.md (#2017) 2023-10-19 15:48:50 +02:00
Applevangelist
49fd78abe7 #SRS
* Typo
2023-10-19 15:22:13 +02:00
Rolf Geuenich
7c8cca7f56 Added new build system with GitHub Action Workflows 2023-10-19 13:59:33 +02:00
Rolf Geuenich
0658f6dc2b Align Moose_Create.lua with the develop branch
Needed for later build system enhancements
2023-10-19 11:39:07 +02:00
Rolf Geuenich
75558078ee Cleanup and extension for GitHub Action Workflow build and act 2023-10-19 11:11:23 +02:00
Applevangelist
f6b5c69d4e #Triggers - docu changes 2023-10-17 16:58:14 +02:00
Applevangelist
a7f01eb04a #ZONE and #SET_ZONE watch trigger 2023-10-17 16:02:01 +02:00
Applevangelist
65f9db8efa #MSRS
* Added loading of a config file
2023-10-17 11:05:09 +02:00
Applevangelist
2ebad9ce96 #MSRS
* Fixes for alternative backend
2023-10-13 16:13:12 +02:00
Applevangelist
b9cc66004d #WAREHOUSE
* Syntax
2023-10-12 17:55:41 +02:00
Applevangelist
17838e7fe7 #MESSAGE
* Docu adds and corrections
2023-10-06 15:49:42 +02:00
Applevangelist
b0d0dbfe72 #MESSAGE
* Added `ToSRS()`
2023-10-06 13:18:28 +02:00
Applevangelist
2d081dfc03 CTLD/CSAR - Added sound file location 2023-10-06 11:42:51 +02:00
Applevangelist
4a594f41b0 #SET_ZONE
* Added GetAverageCoordinate()
2023-10-06 11:30:59 +02:00
Frank
04b4af58f7 Update ATIS.lua
#2010
2023-09-29 14:26:22 +02:00
Applevangelist
f44ba39ec5 Fox/Missiletrainers 2023-09-29 10:20:01 +02:00
Frank
05df765c5c Merge pull request #2006 from FlightControl-Master/FF/MasterDevel
Update Airboss.lua
2023-09-27 22:28:21 +02:00
Frank
04a7c912ea Update Airboss.lua
- Improved into wind
2023-09-27 22:21:17 +02:00
Applevangelist
55fb8f2064 nil check added 2023-09-27 18:08:02 +02:00
Applevangelist
912c162eee Logic fixes for GetRandomCoordinateWithoutBuildings() 2023-09-27 15:41:52 +02:00
Applevangelist
2efb6a624f #SCORING
* Rechtschreibung
2023-09-25 08:43:24 +02:00
Applevangelist
ca84fa11cd #ATIS
* Added Spanish TTS locale ("es")
2023-09-20 17:17:12 +02:00
Applevangelist
ed614767e6 #ATIS
* Added localization option
2023-09-19 18:07:51 +02:00
Applevangelist
6d94a0c776 Smaller fixes 2023-09-19 12:13:39 +02:00
Applevangelist
81fd5cb605 One Typo Less 2023-09-19 11:30:46 +02:00
Applevangelist
b70bf3b9af #SEAD
* Better calculation of switch-on again time
2023-09-19 11:10:06 +02:00
Applevangelist
250d640e76 #SPAWN
* Added option for Modex pre- and postfix strings
* Added string check for SpawnAtParkingSpot when Airbase is handed as string
2023-09-17 17:15:12 +02:00
Frank
6a05789db5 Update Controllable.lua
- Fixed wrong id of task`EnrouteTaskEngageGroup`
- Fixed wrong id of task `EnrouteTaskFAC_EngageGroup`
2023-09-17 16:13:28 +02:00
Applevangelist
5e20874dca #Startup
* Re-instate suppression of error box.
2023-09-15 09:11:32 +02:00
Applevangelist
bc16970d96 #SET_CLIENT
* Small fix for FilterCallsign string search
2023-09-14 12:36:15 +02:00
Applevangelist
f8f4bac77e Intellisense docu fixes 2023-09-13 16:03:05 +02:00
Frank
5aa8338c59 Update Airboss.lua
- Adjust into wind angle
2023-09-13 11:10:35 +02:00
Frank
1362fe9019 Update SRS.lua 2023-09-10 22:40:05 +02:00
Applevangelist
ba361e7eff #RAT
* Try more than once to get coord in status loop
2023-09-10 15:41:54 +02:00
Thomas
31fb9bc169 Update Group.lua
Docu fix
2023-09-09 11:54:45 +02:00
Applevangelist
e95a9525c6 #GENERAL
* Remove dependencies from UTILS.Routines
* Remove UTILS.Routines
2023-09-08 11:14:41 +02:00
Applevangelist
326d4b3135 Merge remote-tracking branch 'origin/master' 2023-09-07 16:14:45 +02:00
Applevangelist
c4fad08d58 Act 2023-09-07 16:14:42 +02:00
Applevangelist
5a57d05fd6 Deprecated flags 2023-09-07 16:14:21 +02:00
Frank
8a7fa326cd Update MissileTrainer.lua
- Docs: Class deprecated ==> use FOX instead
2023-09-06 21:33:05 +02:00
Applevangelist
18afe9ad7a #AIRBOSS
* Suppress unnecessary SRS TTS calls with empty text
2023-09-01 09:44:12 +02:00
Applevangelist
253cf0f5a5 #MANTIS
* Added zone filter option.
2023-09-01 08:52:13 +02:00
Applevangelist
c5a85456c0 #MANTIS
* CHM Assets
2023-08-30 16:46:13 +02:00
Applevangelist
9a383826e7 Merge remote-tracking branch 'origin/master' 2023-08-29 15:49:52 +02:00
Applevangelist
1e6731830e #MANTIS
* Added two more CH mod types
2023-08-29 15:49:48 +02:00
Applevangelist
d9aff32a36 #MANTIS
* Added two more CH mod types
2023-08-29 15:48:36 +02:00
Frank
38cb8fb88e Merge pull request #1998 from FlightControl-Master/FF/MasterDevel
STORAGE
2023-08-26 14:00:26 +02:00
Frank
ad5488784f Update Storage.lua
**STORAGE**
- Added easier functions to add, set and remove items and liquids.
- Added checks if warehouse items are limited or unlimited.
2023-08-26 13:56:45 +02:00
Frank
a4cdd62aff Merge branch 'master' into FF/MasterDevel 2023-08-26 10:27:18 +02:00
Thomas
9a9de9306e Update Set.lua Docu (#1995)
* Update Set.lua Docu

Added regex explanation

* Update Set.lua
2023-08-23 11:39:45 +02:00
Applevangelist
cf824b912d #Controllable
* Added Aerobtics tasks
2023-08-22 10:24:40 +02:00
Thomas
8d2e291deb Update Enums.lua
Error in ENUM
2023-08-21 11:35:01 +02:00
Applevangelist
3a432782b2 Storages Enum 2023-08-20 15:22:49 +02:00
Applevangelist
bda1fac923 #ENUMS
* Added enumerator for ENUMS.Storage.weapons
2023-08-20 15:12:47 +02:00
Thomas
ef40b1c524 Range fix for #1984 (#1992)
Range fix for #1984
2023-08-20 13:41:20 +02:00
Frank
a4c81736aa Update DCS.lua 2023-08-20 11:57:37 +02:00
Applevangelist
045c49679d #ATIS
* Fix explicitly set RWY not reported via SRS
2023-08-20 11:18:58 +02:00
Applevangelist
f40442d309 #POSITIONABLE
* Make cargo weights an enumerator
2023-08-18 11:07:43 +02:00
Frank
fe7acecdd3 Merge pull request #1991 from FlightControl-Master/FF/MasterDevel
STORAGE - DCS Warehouse
2023-08-17 19:11:01 +02:00
Frank
4471ec9b96 DCS Warehouse 2023-08-17 18:46:09 +02:00
Frank
32e1d4f8fa DCS Warehouse 2023-08-16 23:58:32 +02:00
Frank
747e5d801a Merge pull request #1986 from FlightControl-Master/FF/MasterDevel
COORDINATE
2023-08-13 18:19:16 +02:00
Frank
29ed630536 COORDINATE
- Generalized MarkupToAllFreeForm

UTILS
- Added some functions from MIST
2023-08-13 17:40:28 +02:00
Applevangelist
c5757ffd22 #CONTROLLABLE
* Added EnRouteTaskCAP()
2023-08-02 18:02:34 +02:00
Applevangelist
9cc08cb088 # 2023-08-01 16:26:29 +02:00
Applevangelist
2771e7f856 #SCENERY, SET_SCENERY
* Reworked COORDINATE scan as this doesn't seem to work
* Added SET_SCENERY Filters, and FilterOnce() to apply them
2023-08-01 16:18:23 +02:00
Thomas
7c4dd8160d Update Set.lua (#1982)
Intellisense updates
2023-08-01 11:53:00 +02:00
Thomas
1fdc50b0da Update Scenery.lua (#1980)
_id might be nil in :FindByZoneName()
2023-08-01 10:00:42 +02:00
Thomas
f87a676e4b Update Scoring.lua (#1976)
Add report Spaces
2023-07-29 16:45:00 +02:00
Frank
8bf56b8b1a Update Airboss.lua
- Fixed AI handling (got lost in some merge with develop branch and was using FLIGHTGROUPS)
2023-07-26 16:36:44 +02:00
Applevangelist
f31741f934 #AI_ESCORT
* Improve documentation
2023-07-25 12:01:18 +02:00
Applevangelist
46258492bd #AIRBASE, #ATIS
* Additions
2023-07-23 12:37:57 +02:00
Applevangelist
6481f66e27 #MANTIS
* Added IDs for Current Hill Assets, keyword "CHM" for group names
2023-07-16 11:27:34 +02:00
Thomas
5954b8692f Update Spot.lua
Fix
2023-07-15 09:36:24 +02:00
Applevangelist
f6fdecf892 Merge remote-tracking branch 'origin/master' 2023-07-13 16:15:11 +02:00
Applevangelist
53fb77b50d #SPAWN 2023-07-13 16:15:06 +02:00
Applevangelist
04a9dc3a8c #SPAWN
* Added method to init spawn position
2023-07-13 16:13:00 +02:00
Applevangelist
10b9a32f29 #SPOT
* Fix for switching laser off and on again not follwing unit any more
2023-07-12 17:54:17 +02:00
Applevangelist
40fa929eb0 * Added omissed DetectedItem.Name found by @Nocke 2023-07-07 15:14:33 +02:00
Applevangelist
8c8ef19f01 #CONTROLLABLE
* Added TaskGroundEscort
2023-07-03 16:44:46 +02:00
Applevangelist
1eaa3d309d #SCORING
* typo
2023-07-01 13:15:59 +02:00
Applevangelist
a52cd5612a Merge remote-tracking branch 'origin/master' 2023-07-01 13:12:29 +02:00
Applevangelist
e82ed762be Merge remote-tracking branch 'origin/master' 2023-07-01 13:11:46 +02:00
Applevangelist
0bb16ec827 #AIRBASE
* Fix for nil error in finding parking for a group

#MANTIS
* Added SAM type "SHORAD" as designator

#SCORING
* fix for non local problem

#UTILS
* fix for OneLineSerialize
2023-07-01 13:11:21 +02:00
Thomas
a978420a67 Point - BRAANATO (#1969)
corrected Track to be direction of travel of bogey (self in this case)
2023-06-26 13:25:23 +02:00
Applevangelist
f59326bf10 #ATIS
* Fix for airbases which have no runways, e.g. Naqoura Syria
2023-06-24 14:03:43 +02:00
Thomas
d937ab2679 CTLD (#1967)
* Added option for troops subcategories in menu
2023-06-22 13:46:11 +02:00
Applevangelist
7164e211f2 #AIRBASE
- Nicosia unused atm
2023-06-21 10:42:35 +02:00
Applevangelist
dae78d7ac1 #Positionable, Unit - remove pcall 2023-06-16 11:06:46 +02:00
Applevangelist
254468c723 #NET
* Improvements
2023-06-15 14:51:36 +02:00
Applevangelist
71be4d99d6 #POSITIONABLE:GetRelativeCoordinate( x, y, z ) 2023-06-14 17:40:33 +02:00
Frank
f86fc845e7 Update Timer.lua
- Timer stop is using protected call now because it can crash the whole script.
2023-06-13 21:53:19 +02:00
Frank
cc907b9c14 Update Unit.lua
- UNIT:IsAlive() fixed so it is consistent with GROUP:IsAlive()
2023-06-13 19:02:55 +02:00
Applevangelist
241b2beee1 * Makes calls for GetAmmo() and GetVec3() safer with pcall()
* Small docu fix Ben-Gurion
2023-06-13 08:39:56 +02:00
Frank
12f260e857 Update Unit.lua
- Added `UNIT:IsExist` function.
2023-06-12 23:01:19 +02:00
Thomas
096d145cf9 Update Airbase.lua (#1957)
Deleted raj al … airbases #1955
2023-06-12 06:22:51 +02:00
Thomas
b3883301a2 Update Airbase.lua
Corrected enumerator for Ben-Gurion (Ben_Gurion)
2023-06-11 12:33:01 +02:00
Applevangelist
3a7521c492 #UTILS
* Sinai TIme
2023-06-10 19:08:46 +02:00
Applevangelist
caa5a96235 fix 2023-06-10 19:06:22 +02:00
Applevangelist
cee1c592ba #UTILS
* Sinai TIme
2023-06-10 19:04:40 +02:00
Frank
f1fc9f0b27 Update Utils.lua
- Added parameters time zone and magvar for Sinai map
2023-06-10 10:08:22 +02:00
Applevangelist
e9adcb0dd5 #AIRBASE
* Sinai airfield enumerator
2023-06-09 15:13:45 +02:00
Applevangelist
afe2b675e5 #RAT
* Fixes from dev
2023-06-08 13:59:59 +02:00
Applevangelist
2c14ee74b0 #SCORING
* Can leave text empty on some instances
2023-06-08 13:58:26 +02:00
Frank
f351d2a37e Merge pull request #1951 from FlightControl-Master/FF/MasterDevel
Update RAT.lua
2023-06-08 09:45:49 +02:00
Frank
4cb0e70184 Update RAT.lua
- Fixed RATMANAGER spamming due to not accounting for planned/scheduled groups
2023-06-08 09:43:11 +02:00
Applevangelist
41bb2551d3 #CTLD
* Ensure new menus can be build if player changes helos
2023-06-03 12:34:18 +02:00
Applevangelist
55ed394782 #UNIT #CTLD
* Stabilize that sometimes a unit coordinate cannot be found
2023-06-02 08:44:14 +02:00
Applevangelist
dd7a883a33 Fixes 2023-06-01 10:02:51 +02:00
Applevangelist
f7acbc3928 #CSAR
* Corrected flare distance to kms
2023-05-30 07:38:19 +02:00
Applevangelist
2318578126 #SPAWN
* Logic fix for the last parameter of `NewFromTemplate()`
2023-05-28 15:27:34 +02:00
Applevangelist
3e6f25f17c #UTILS
* Added UTILS.PrintTableToLog()
2023-05-26 08:28:08 +02:00
Applevangelist
0cd6a59ce4 #CONTROLLER
* Fix for Link4
2023-05-25 08:57:15 +02:00
Applevangelist
91a445961b #RESCUEHELO
* Small fix to get the coordinate of an ejected/crashed unit
2023-05-25 08:23:31 +02:00
Frank
749e9b7e08 Update Event.lua
Fixed bug that statics are handled incorrectly if they are the target object of an event (*e.g.* hit event)
2023-05-24 11:16:01 +02:00
Applevangelist
905d29b279 #SPAWN
* Tweaked NewFromTemplate, and gave a better example
2023-05-22 17:57:03 +02:00
Applevangelist
5f97299cb2 Small Fix 2023-05-20 12:12:18 +02:00
Applevangelist
60b75a4c8f #POINT
* Added FindClosestStatic()
2023-05-19 17:11:54 +02:00
Applevangelist
0868286f27 #WAREHOUSE
* Fixed one omission for SHIP transport types
2023-05-17 10:26:29 +02:00
Applevangelist
ffcc46cb2d #CTLD
* Changed VHF modulation to AM
* Added option to have a different sound file for UHF, in case you want to silent FC3 radios
* Thanks to Streakeagle
2023-05-17 09:34:54 +02:00
Frank
21bcd64c9d Update Controllable.lua
Corrected parameters for enroute tasks according to hoggit for
- CONTROLLABLE:EnRouteTaskFAC
- CONTROLLABLE:EnRouteTaskFAC_EngageGroup
2023-05-13 23:35:58 +02:00
Applevangelist
943b68f38f #CTLD
* placement of dropped crates to better align to unit length
2023-05-11 15:31:24 +02:00
Applevangelist
256b93087f #AI_A2X...
* Fixes
2023-05-09 09:48:21 +02:00
Applevangelist
7ed0d7eec3 #AI_A2X...
* Fixes
2023-05-09 09:44:41 +02:00
Applevangelist
9b8154246f #COORDINATE
* Added `IsInSteepArea()`and `IsInFlatArea()`
2023-05-05 10:31:23 +02:00
Frank
c360759e49 Merge pull request #1939 from FlightControl-Master/FF/MasterDevel
Update Socket.lua
2023-04-25 21:42:53 +02:00
Frank
d8b80aab1a Update Socket.lua
- Added `SOCKET:SendTextToSpeech()` function
2023-04-25 21:20:16 +02:00
Applevangelist
b96ebc1872 #SCENERY
* Added update of Life0 value if `GetLife()`is called
#SET_SCENERY
* Added Documentation
2023-04-25 09:12:31 +02:00
Applevangelist
6896dc155a #SCENERY
* Added update of Life0 value if `GetLife()`is called
#SET_SCENERY
* Added Documentation
2023-04-25 09:12:25 +02:00
Applevangelist
1060d63808 #SET_SCENERY
* Added functions to count Life0, Life and RelativeLife points of SET_SCENERY
2023-04-24 16:44:38 +02:00
Thomas
88b6540f5b AIRBASE - add Normandy AFBs (#1937)
Add Normandy AFBs
2023-04-24 11:09:03 +02:00
Frank
302e785f32 Merge pull request #1936 from FlightControl-Master/FF/MasterDevel
Remove Junk
2023-04-22 14:05:09 +02:00
Frank
1507cc0b42 Remove Junk
**ZONE**
- Added `ZONE_RADIUS:RemoveJunk()` function
- Added `ZONE_POLYGON_BASE:RemoveJunk()` function (not working)

**POSITIONABLE**
- Added `Explosion`
2023-04-22 14:02:18 +02:00
Applevangelist
240307ef94 #CTLD
* Docu changes
2023-04-20 08:23:03 +02:00
Applevangelist
90c74bd82c #SET
- Minus one log entry
2023-04-20 08:06:43 +02:00
Thomas
9414096de7 Added active ZONE filtering (#1935)
for groups, units, clients entering/leaving zones to be used with `FilterStart()`
2023-04-19 09:51:53 +02:00
Applevangelist
07c3be9d6a Fixes for getPlayername() errors 2023-04-18 10:24:56 +02:00
Applevangelist
9869dbd95a #CTLD
* Include current group structure in load/save functions
2023-04-16 16:10:46 +02:00
Frank
49b702106a Update Weapon.lua
- Decreased min possible time step to 0.00001 seconds
2023-04-16 12:29:57 +02:00
Applevangelist
8eb09beb96 Merge remote-tracking branch 'origin/master' 2023-04-15 16:19:46 +02:00
Applevangelist
b402a99a25 #CTLD
* Small fix allowing minus signs in template names for repairs
2023-04-15 16:19:35 +02:00
Applevangelist
ad8938cd74 #CTLD
* Small fix allowing minus signs in template names for repairs
2023-04-15 16:17:01 +02:00
Applevangelist
ee409c45a0 #CTLD
* Allow save/loadback with precise(r) coordinates for vehicles and troops.
2023-04-13 15:51:21 +02:00
Applevangelist
9d5da3388d smaller docu item 2023-04-13 15:28:41 +02:00
Applevangelist
9e138aa149 #DATABASE
* Small fix for CLIENT:FindByName()
2023-04-04 10:33:04 +02:00
Applevangelist
cf94c4d043 #NET
* Fix for ucid can be nil
2023-04-03 12:15:29 +02:00
Applevangelist
63b3807cf6 Added Init Methods to set Unit Positions on Spawn 2023-03-30 12:22:04 +02:00
Applevangelist
f3b6b27521 Small fix for SET_UNIT if used in capture zone coalition with a polygon zone 2023-03-30 09:24:08 +02:00
Applevangelist
ff656182e8 SET_STATIC - Added GetClosestStatic() 2023-03-28 11:03:00 +02:00
Applevangelist
a85ef6e769 Merge remote-tracking branch 'origin/master' 2023-03-23 09:21:46 +01:00
Applevangelist
0bb8c56ea9 Typo fix 2023-03-23 09:21:42 +01:00
Applevangelist
5f108aec23 Typo fix 2023-03-23 09:21:20 +01:00
Applevangelist
bf6683f993 Merge remote-tracking branch 'origin/master' 2023-03-23 08:47:07 +01:00
Applevangelist
b7a5e8dd85 Add'l check in UNIT:GetLife() 2023-03-23 08:47:04 +01:00
Applevangelist
57294aeaf5 Add'l check in UNIT:GetLife() 2023-03-23 08:45:54 +01:00
Applevangelist
20bfb8b08f #AIRBASE
* Added/changed South Atlantic Map:
  ["Hipico_Flying_Club"] = "Hipico Flying Club",
  ["Aeropuerto_de_Gobernador_Gregores"] = "Aeropuerto de Gobernador Gregores",
  ["Aerodromo_O_Higgins"] = "Aerodromo O'Higgins",
  ["Cullen_Airport"] = "Cullen Airport",
  ["Gull_Point"] = "Gull Point",
2023-03-16 08:44:16 +01:00
UglySkyfire
5585a8992c Drop crates from herc as CTLD_Cargo (#1929)
Adds option to drop crates from a herc via parachute drop as CTLD_Cargo that needs proper unpacking - can be picked up be a helo.
2023-03-15 20:12:30 +01:00
Applevangelist
d92a20050c #CTLD
* Added/completed add/get/set functions for stock
2023-03-10 10:09:08 +01:00
Applevangelist
c9a91d0683 #GROUP
* Fix for GetMaxHeight()
2023-03-09 08:49:07 +01:00
Applevangelist
ae6716ac01 #GROUP
* Callsign translation refactor
2023-03-05 11:03:26 +01:00
Applevangelist
34285b26ae #SPAWN
* clarified docu for SpawnScheduled()
* Added parameter to SpawnScheduled() for a delayed spawn
2023-02-28 08:00:06 +01:00
Thomas
5341e5faee Update Enums.lua 2023-02-26 19:03:33 +01:00
Applevangelist
a6224b484e dcs 2023-02-23 10:33:11 +01:00
Applevangelist
e95c1ad3aa #Fixes from dev 2023-02-23 10:30:59 +01:00
Applevangelist
9cfed56847 #CTLD logic correction for loading 2023-02-21 11:38:40 +01:00
Applevangelist
6c1abddb1e #NET added a couple of functions 2023-02-19 17:16:00 +01:00
Applevangelist
7dc239f506 Added CLIENT:FindByPlayerName(Name)
NET - slot blocker comments in log removed
2023-02-19 12:31:32 +01:00
Applevangelist
3e8413c6b7 #NET - further ado 2023-02-18 15:03:53 +01:00
Applevangelist
ff86bfb91d #NET Event blocker fix 2023-02-17 16:41:38 +01:00
Applevangelist
66494b7b5a NET 2023-02-17 16:23:02 +01:00
Applevangelist
973127aa8c #NET Fixes 2023-02-17 15:42:06 +01:00
Applevangelist
83866c3dd3 #NET Fixes 2023-02-17 15:02:11 +01:00
Applevangelist
4797abc287 #NET Bugfix 2023-02-17 14:32:48 +01:00
Applevangelist
50f73f1be2 #NET extended block to UCID 2023-02-17 13:22:10 +01:00
Applevangelist
2ebbc8f466 #NET - added docu 2023-02-17 08:54:15 +01:00
Frank
1a96b30a45 Merge pull request #1922 from FlightControl-Master/FF/MasterDevel
Airspeed
2023-02-16 17:28:13 +01:00
Frank
3b1b57a33e Update Positionable.lua
- Added GetGroundSpeed
2023-02-16 17:20:53 +01:00
Frank
f85c0320ec Airspeed
**POSITIONABLE**
- Added function `GetAirspeedIndicated` to return IAS
- Added function `GetAirspeedTrue` to return TAS

**UTILS**
- Added function `UTILS.IasToTas` to convert IAS to TAS
- Added function `TasToIas` to convert TAS to IAS.

**POINT**
- Added function `COORDINATE:GetWindVec3`
2023-02-16 17:09:12 +01:00
Applevangelist
bae7edb914 #NET
* Added event management for clients and block/unblock functions
2023-02-16 11:41:45 +01:00
Applevangelist
35322399e9 #SPOT - minor fixes 2023-02-15 12:23:31 +01:00
Applevangelist
5d4c0f3c87 Bugfix 2023-02-15 10:31:52 +01:00
Frank
92c5c32e8c Merge pull request #1921 from FlightControl-Master/FF/MasterDevel
Update Range.lua
2023-02-12 13:03:08 +01:00
Frank
c8780b2d5f Update Range.lua
- Coordinate of bomb target is now always updated (not only for moving targets)
- If the target is not alive any more, the last known position is used for its coordinate
2023-02-12 13:00:19 +01:00
Frank
f11dbfa367 Merge branch 'FF/MasterDevel' 2023-02-12 11:49:13 +01:00
Frank
54fb9deb3e Polygon and line drawings 2023-02-12 11:38:46 +01:00
Thomas
d3c34ef04d Update MarkerOps_Base.lua (#1919) 2023-02-11 22:11:21 +01:00
Applevangelist
3d5470eb22 #NET
* Initial release
2023-02-10 11:00:14 +01:00
Applevangelist
2a3d69d0d5 #DETECTION
* Docu fixes
2023-02-09 16:11:45 +01:00
Frank
9862c32378 Update settings.json 2023-02-08 16:30:44 +01:00
Frank
9f02232589 Update settings.json 2023-02-08 16:29:25 +01:00
Frank
ffc86bf046 Unwanted changes 2023-02-08 16:28:04 +01:00
Frank
e4c8ca34ed Update Pathline.lua 2023-02-08 16:11:47 +01:00
Frank
f02b7036a9 PATHLINE 2023-02-08 12:37:18 +01:00
Frank
6adef47340 PATHLINE
Added new class PATHLINE
2023-02-07 22:47:55 +01:00
Thomas
5b044cc036 Update CSAR.lua (#1917) 2023-02-07 07:28:00 +01:00
Mr.Alien
03ba7524b2 Comment out code for scoring hits (#1911) 2023-02-06 08:15:45 +01:00
Frank
772921c6b8 WEAPON
- Added new class WEAPON
2023-02-04 23:31:55 +01:00
Mr.Alien
d4d305d53b Fix confusing hit and kill messages with incorrect math (#1913) 2023-02-04 23:02:36 +01:00
Mr.Alien
c58918e002 Add missing part of code in previous commit (#1910) 2023-02-04 22:36:16 +01:00
Mr.Alien
dec7854476 Fix issue with getting thread level after a kill (#1908) 2023-02-04 22:01:55 +01:00
Mr.Alien
8ca102f584 Scoring credits a kill to player who hit the same unit before it spawned (#1905) 2023-02-04 21:46:34 +01:00
Applevangelist
4748c66d9c #CTLD
* Added method `CTLD:PreloadCrates(Unit,Cratesname,NumberOfCrates)`
2023-02-04 17:21:16 +01:00
Frank
bf486b9f44 Merge pull request #1901 from MrAlien753/patch-1
fix nil error message in dcs.log
2023-02-03 22:34:01 +01:00
MrAlien753
6ff433ed7a fix nil error message in dcs.log
When instant killing a target in a capture zone nil error message is printed in the dcs.log. This fixes this issue.
2023-02-03 22:14:14 +01:00
Applevangelist
f9aa392c6d #CTLD_HERCULES
* Fixed an issue spawning 90 paratroopers instead of 30
2023-02-02 09:35:53 +01:00
Frank
819912cfd3 Database
- Polygon drawings are adde as polygon zones to DB
2023-01-28 15:39:42 +01:00
Frank
50ee1ae922 Merge branch 'master' into FF/MasterDevel 2023-01-28 11:09:08 +01:00
Frank
c9ccc28251 Merge branch 'master' into FF/MasterDevel 2022-11-19 11:44:46 +01:00
Frank
2157f8e8cd Airboss
Take animation for determining the wire
2022-09-26 23:34:00 +02:00
340 changed files with 22469 additions and 6905 deletions

View File

@@ -1,87 +0,0 @@
version: 2.4.a.{build}
shallow_clone: true
skip_branch_with_pr: false
skip_commits:
message: /!nobuild/
skip_tags: false
environment:
access_token_documentation:
secure: JVBVVL8uJUcLXN+48eRdELEeCGOGCCaMzCqutsUqNuaZ/KblG5ZTt7+LV4UKv/0f
LUAROCKS_VER: 2.4.1
LUA_VER: 5.1.5
LUA: lua5.3
matrix:
- LUA_VER: 5.1.5
platform:
- x64
init:
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
throw "There are newer queued builds for this pull request, failing early." }
# - 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
cache:
C:\ProgramData\chocolatey\lib
C:\ProgramData\chocolatey\bin
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 = 'v2.6hcv3ige78kg3yvg4ge8'
$headers = @{
"Authorization" = "Bearer $token"
"Content-type" = "application/json"
}
$RequestBody = @{ accountName = 'FlightControl-Master'; projectSlug = 'moose-include'; branch = "$env:appveyor_repo_branch"; environmentVariables = @{} } | ConvertTo-Json
# Generate the new version ...
$project = Invoke-RestMethod -method Post -Uri "$apiUrl/builds" -Headers $headers -Body $RequestBody
}
- ps: |
if( $env:appveyor_repo_branch -eq 'master' -or $env:appveyor_repo_branch -eq 'develop' )
{
$apiUrl = 'https://ci.appveyor.com/api'
$token = 'v2.6hcv3ige78kg3yvg4ge8'
$headers = @{
"Authorization" = "Bearer $token"
"Content-type" = "application/json"
}
$RequestBody = @{ accountName = 'FlightControl-Master'; projectSlug = 'moose-docs'; branch = "$env:appveyor_repo_branch"; environmentVariables = @{} } | ConvertTo-Json
# get project with last build details
$project = Invoke-RestMethod -method Post -Uri "$apiUrl/builds" -Headers $headers -Body $RequestBody
}
test: off
# test_script:
# - cmd: luacheck "Moose Development\Moose\moose.lua" "Moose Mission Setup\moose.lua"
on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

4
.gitattributes vendored
View File

@@ -15,3 +15,7 @@
*.PDF diff=astextplain *.PDF diff=astextplain
*.rtf diff=astextplain *.rtf diff=astextplain
*.RTF diff=astextplain *.RTF diff=astextplain
# Avoid Windows line endings on shell scripts
# Needed for dockerfile builds
*.sh text eol=lf

168
.github/workflows/build-docs.yml vendored Normal file
View File

@@ -0,0 +1,168 @@
name: Moose-Docs
on:
push:
branches:
- master
- develop
paths:
- 'Moose Setup/**/*.lua'
- 'Moose Development/**/*.lua'
- 'Moose Development/**/*.py'
- 'Moose Development/**/*.html'
- '.github/workflows/build-docs.yml'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
Build:
runs-on: ubuntu-latest
steps:
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Build informations
run: |
echo "Triggered by: ${{ github.event_name }}"
echo "Running on: ${{ runner.os }}"
echo "Ref: ${{ github.ref }}"
echo "Branch name: ${{ steps.extract_branch.outputs.branch }}"
echo "Repository: ${{ github.repository }}"
echo "Commit-Id: ${{ github.sha }}"
echo "Owner: ${{ github.repository_owner }}"
echo "FORCE_PUSH: ${{ vars.FORCE_PUSH }}"
#########################################################################
# Prepare build environment
#########################################################################
- name: Check out repository code
uses: actions/checkout@v4
- name: Prepare build output folders
run: |
mkdir -p build/tools
mkdir -p build/doc
- name: Checkout FlightControls modified luadocumentor
uses: actions/checkout@v4
with:
repository: Applevangelist/luadocumentor
path: './build/tools/luadocumentor'
ref: 'patch-1'
token: ${{ secrets.BOT_TOKEN }}
- name: Update apt-get (needed for act docker image)
run: |
sudo apt-get -qq update
- name: Install tree
run: |
sudo apt-get -qq install tree
#########################################################################
# Install all prerequisites for LuaDocumentor
#########################################################################
- name: Install Lua
run: |
sudo apt-get -qq install lua5.1
- name: Install LuaRocks
run: |
sudo apt-get -qq install luarocks -y
- name: Install markdown (prereq for LuaDocumentor)
run: |
sudo luarocks install markdown 0.32-2
- name: Install penlight (prereq for LuaDocumentor)
run: |
sudo luarocks install penlight 1.11.0-1
- name: Install metalua-compiler (prereq for LuaDocumentor)
run: |
sudo luarocks install metalua-compiler 0.7.3-1
- name: Install metalua-parser (prereq for LuaDocumentor)
run: |
sudo luarocks install metalua-parser 0.7.3-2
- name: Install checks (prereq for LuaDocumentor)
run: |
sudo luarocks install checks
#########################################################################
# Run LuaDocumentor
#########################################################################
- name: Run LuaDocumentor
run: |
lua luadocumentor.lua -d ${{ github.workspace }}/build/doc "${{ github.workspace }}/Moose Development/Moose"
working-directory: ${{ github.workspace }}/build/tools/luadocumentor
#########################################################################
# Replace <head> tag
#########################################################################
- name: Replace head tag
run: |
python3 "${{ github.workspace }}/Moose Development/docs-header.py"
working-directory: ${{ github.workspace }}/build/doc
- name: Check replacement of head tag
run: |
head -10 ${{ github.workspace }}/build/doc/AI.AI_A2A_Cap.html
#########################################################################
# Push to MOOSE_DOCS
#########################################################################
- name: Set docs repo for branch
shell: bash
id: set_doc_repo
run: |
if [[ $GITHUB_REF == 'refs/heads/master' ]]; then
echo "docrepo=MOOSE_DOCS" >> "$GITHUB_OUTPUT"
else
echo "docrepo=MOOSE_DOCS_DEVELOP" >> "$GITHUB_OUTPUT"
fi
- name: Checkout ${{ steps.set_doc_repo.outputs.docrepo }} to folder MOOSE_DOCS
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/${{ steps.set_doc_repo.outputs.docrepo }}
path: './build/MOOSE_DOCS'
fetch-depth: 0
ref: 'master'
token: ${{ secrets.BOT_TOKEN }}
- name: Delete folder to remove deleted files
run: |
rm -rf ./build/MOOSE_DOCS/Documentation/
- name: Create target folder
run: mkdir -p build/MOOSE_DOCS/Documentation
- name: Copy build result to MOOSE_DOCS
run: |
cp ./build/doc/*.* ./build/MOOSE_DOCS/Documentation/
- name: Push result to docs repository
if: ${{ vars.FORCE_PUSH == 'true' }}
run: |
git config user.name "MooseBotter"
git config user.email "MooseBotter@users.noreply.github.com"
git add .
git commit --allow-empty -m "Auto commit by GitHub Actions Workflow"
git push --set-upstream origin master
working-directory: ${{ github.workspace }}/build/MOOSE_DOCS
#########################################################################
# Show the results
#########################################################################
- name: List files in the repository
run: |
tree ${{ github.workspace }}/build
- run: echo "This job's status is ${{ job.status }}."

148
.github/workflows/build-includes.yml vendored Normal file
View File

@@ -0,0 +1,148 @@
name: Moose-Includes
on:
push:
branches:
- master
- develop
paths:
- 'Moose Setup/**/*.lua'
- 'Moose Development/**/*.lua'
- '.github/workflows/build-includes.yml'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
Build:
runs-on: ubuntu-latest
steps:
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Build informations
run: |
echo "Triggered by: ${{ github.event_name }}"
echo "Running on: ${{ runner.os }}"
echo "Ref: ${{ github.ref }}"
echo "Branch name: ${{ steps.extract_branch.outputs.branch }}"
echo "Repository: ${{ github.repository }}"
echo "Commit-Id: ${{ github.sha }}"
echo "Owner: ${{ github.repository_owner }}"
echo "FORCE_PUSH: ${{ vars.FORCE_PUSH }}"
#########################################################################
# Prepare build environment
#########################################################################
- name: Check out repository code
uses: actions/checkout@v4
- name: Prepare build output folders
run: |
mkdir -p build/result/Moose_Include_Dynamic
mkdir -p build/result/Moose_Include_Static
- name: Update apt-get (needed for act docker image)
run: |
sudo apt-get -qq update
- name: Install tree
run: |
sudo apt-get -qq install tree
#########################################################################
# Install all prerequisites
#########################################################################
- name: Install Lua 5.3
run: |
sudo apt-get -qq install lua5.3 -y
- name: Check Lua version
run: |
lua -v
- name: Install LuaRocks
run: |
sudo apt-get -qq install luarocks -y
- name: Check LuaRocks version
run: |
luarocks --version
- name: Install Lua 5.3 Dev for prerequisites for LuaSrcDiet
run: |
sudo apt-get -qq install liblua5.3-dev -y
- name: Install LuaSrcDiet
run: |
sudo luarocks install luasrcdiet
- name: Install LuaCheck
run: |
sudo luarocks install luacheck
#########################################################################
# Build Include files
#########################################################################
- name: Build Include Static
run: |
export COMMIT_TIME=$(git show -s --format=%cd ${{ github.sha }} --date=iso-strict)
lua5.3 "./Moose Setup/Moose_Create.lua" S "$COMMIT_TIME-${{ github.sha }}" "./Moose Development/Moose" "./Moose Setup" "./build/result/Moose_Include_Static"
- name: Build Includes Dynamic
run: |
export COMMIT_TIME=$(git show -s --format=%cd ${{ github.sha }} --date=iso-strict)
lua5.3 "./Moose Setup/Moose_Create.lua" D "$COMMIT_TIME-${{ github.sha }}" "./Moose Development/Moose" "./Moose Setup" "./build/result/Moose_Include_Dynamic"
#########################################################################
# Run LuaCheck
#########################################################################
- name: Run LuaCheck
if: ${{ vars.SKIP_LUACHECK != true }}
continue-on-error: true
run: |
luacheck --std=lua51c --config=.luacheckrc -gurasqq "Moose Development/Moose"
- name: Run LuaSrcDiet
run: |
luasrcdiet --basic --opt-emptylines ./build/result/Moose_Include_Static/Moose.lua -o ./build/result/Moose_Include_Static/Moose_.lua
#########################################################################
# Push to MOOSE_INCLUDE
#########################################################################
- name: Checkout MOOSE_INCLUDE
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/MOOSE_INCLUDE
path: './build/MOOSE_INCLUDE'
fetch-depth: 0
ref: ${{ steps.extract_branch.outputs.branch }}
token: ${{ secrets.BOT_TOKEN }}
- name: Create target folder (needed if checkout is deactivated)
run: mkdir -p build/MOOSE_INCLUDE
- name: Copy build reseult to MOOSE_INCLUDE
run: |
cp -r ./build/result/* ./build/MOOSE_INCLUDE/
- name: Push result to MOOSE_INCLUDE repository
if: ${{ vars.FORCE_PUSH == 'true' }}
run: |
git config user.name "MooseBotter"
git config user.email "MooseBotter@users.noreply.github.com"
git add .
git commit --allow-empty -m "Auto commit by GitHub Actions Workflow"
git push --set-upstream origin ${{ steps.extract_branch.outputs.branch }}
working-directory: ${{ github.workspace }}/build/MOOSE_INCLUDE
#########################################################################
# Show the results
#########################################################################
- name: List files in the repository
run: |
tree ${{ github.workspace }}/build
- run: echo "This job's status is ${{ job.status }}."

78
.github/workflows/gh-pages.yml vendored Normal file
View File

@@ -0,0 +1,78 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
name: Deploy Jekyll site to Pages
on:
push:
branches: ["master"]
paths:
- 'docs/**'
- '.github/workflows/gh-pages.yml'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1' # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
cache-version: 0 # Increment this number if you need to re-download cached gems
working-directory: docs/
- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
- name: Build with Jekyll
# Outputs to the './_site' directory by default
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
env:
JEKYLL_ENV: production
working-directory: docs/
- name: Upload artifact
# Automatically uploads an artifact from the './_site' directory by default
uses: actions/upload-pages-artifact@v1
with:
path: docs/_site/
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
check:
runs-on: ubuntu-latest
needs: deploy
steps:
- name: Setup Node
uses: actions/setup-node@v3
- run: npm install linkinator
- run: npx linkinator https://flightcontrol-master.github.io/MOOSE/ --verbosity error --timeout 5000 --recurse --skip "(java.com)" --retry-errors --retry-errors-count 3 --retry-errors-jitter

16
.gitignore vendored
View File

@@ -35,6 +35,8 @@ local.properties
## Ignore Visual Studio temporary files, build results, and ## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons. ## files generated by popular Visual Studio add-ons.
.vscode
# User-specific files # User-specific files
*.suo *.suo
*.user *.user
@@ -219,12 +221,16 @@ pip-log.txt
#Goodsync #Goodsync
_gsdata_/ _gsdata_/
# PyCharm
.idea
#GITHUB #GITHUB
.gitattributes
.gitignore
Moose Test Missions/MOOSE_Test_Template.miz Moose Test Missions/MOOSE_Test_Template.miz
Moose Development/Moose/.vscode/launch.json Moose Development/Moose/.vscode/launch.json
MooseCodeWS.code-workspace MooseCodeWS.code-workspace
.gitignore
.gitignore # Excludes for act (https://github.com/nektos/act)
/.gitignore .secrets
.env
.actrc
.vars

View File

@@ -92,6 +92,11 @@
-- that will define when the AI will engage with the detected airborne enemy targets. -- that will define when the AI will engage with the detected airborne enemy targets.
-- Use the method @{#AI_A2A_CAP.SetEngageZone}() to define that Zone. -- Use the method @{#AI_A2A_CAP.SetEngageZone}() to define that Zone.
-- --
-- # Developer Note
--
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- === -- ===
-- --
-- @field #AI_A2A_CAP -- @field #AI_A2A_CAP
@@ -118,7 +123,7 @@ function AI_A2A_CAP:New2( AICap, EngageMinSpeed, EngageMaxSpeed, EngageFloorAlti
-- Multiple inheritance ... :-) -- Multiple inheritance ... :-)
local AI_Air = AI_AIR:New( AICap ) local AI_Air = AI_AIR:New( AICap )
local AI_Air_Patrol = AI_AIR_PATROL:New( AI_Air, AICap, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType ) -- #AI_AIR_PATROL local AI_Air_Patrol = AI_AIR_PATROL:New( AI_Air, AICap, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
local AI_Air_Engage = AI_AIR_ENGAGE:New( AI_Air_Patrol, AICap, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType ) local AI_Air_Engage = AI_AIR_ENGAGE:New( AI_Air_Patrol, AICap, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType )
local self = BASE:Inherit( self, AI_Air_Engage ) --#AI_A2A_CAP local self = BASE:Inherit( self, AI_Air_Engage ) --#AI_A2A_CAP

View File

@@ -23,7 +23,7 @@
-- --
-- ## Missions: -- ## Missions:
-- --
-- [AID-A2A - AI A2A Dispatching](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching/AID-A2A%20-%20AI%20A2A%20Dispatching) -- [AID-A2A - AI A2A Dispatching](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher)
-- --
-- === -- ===
-- --
@@ -177,6 +177,11 @@
-- --
-- **The default grouping is 1. That means, that each spawned defender will act individually.** -- **The default grouping is 1. That means, that each spawned defender will act individually.**
-- --
-- # Developer Note
--
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- === -- ===
-- --
-- ### Authors: **FlightControl** rework of GCICAP + introduction of new concepts (squadrons). -- ### Authors: **FlightControl** rework of GCICAP + introduction of new concepts (squadrons).
@@ -305,7 +310,7 @@ do -- AI_A2A_DISPATCHER
-- Use the method @{#AI_A2A_DISPATCHER.SetEngageRadius}() to set a specific Engage Radius. -- Use the method @{#AI_A2A_DISPATCHER.SetEngageRadius}() to set a specific Engage Radius.
-- **The Engage Radius is defined for ALL squadrons which are operational.** -- **The Engage Radius is defined for ALL squadrons which are operational.**
-- --
-- Demonstration Mission: [AID-019 - AI_A2A - Engage Range Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/release-2-2-pre/AID%20-%20AI%20Dispatching/AID-019%20-%20AI_A2A%20-%20Engage%20Range%20Test) -- Demonstration Mission: [AID-019 - AI_A2A - Engage Range Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher/AID-A2A-019%20-%20Engage%20Range%20Test)
-- --
-- In this example an Engage Radius is set to various values. -- In this example an Engage Radius is set to various values.
-- --
@@ -328,7 +333,7 @@ do -- AI_A2A_DISPATCHER
-- Use the method @{#AI_A2A_DISPATCHER.SetGciRadius}() to set a specific controlled ground intercept radius. -- Use the method @{#AI_A2A_DISPATCHER.SetGciRadius}() to set a specific controlled ground intercept radius.
-- **The Ground Controlled Intercept radius is defined for ALL squadrons which are operational.** -- **The Ground Controlled Intercept radius is defined for ALL squadrons which are operational.**
-- --
-- Demonstration Mission: [AID-013 - AI_A2A - Intercept Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/release-2-2-pre/AID%20-%20AI%20Dispatching/AID-013%20-%20AI_A2A%20-%20Intercept%20Test) -- Demonstration Mission: [AID-013 - AI_A2A - Intercept Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher/AID-A2A-013%20-%20Intercept%20Test)
-- --
-- In these examples, the Gci Radius is set to various values: -- In these examples, the Gci Radius is set to various values:
-- --
@@ -361,7 +366,7 @@ do -- AI_A2A_DISPATCHER
-- it makes it easier sometimes for the mission maker to envisage where the red and blue territories roughly are. -- it makes it easier sometimes for the mission maker to envisage where the red and blue territories roughly are.
-- In a hot war the borders are effectively defined by the ground based radar coverage of a coalition. -- In a hot war the borders are effectively defined by the ground based radar coverage of a coalition.
-- --
-- Demonstration Mission: [AID-009 - AI_A2A - Border Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/release-2-2-pre/AID%20-%20AI%20Dispatching/AID-009 - AI_A2A - Border Test) -- Demonstration Mission: [AID-009 - AI_A2A - Border Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher/AID-A2A-009%20-%20Border%20Test)
-- --
-- In this example a border is set for the CCCP A2A dispatcher: -- In this example a border is set for the CCCP A2A dispatcher:
-- --
@@ -1228,7 +1233,7 @@ do -- AI_A2A_DISPATCHER
-- --
-- **Use the method @{#AI_A2A_DISPATCHER.SetEngageRadius}() to modify the default Engage Radius for ALL squadrons.** -- **Use the method @{#AI_A2A_DISPATCHER.SetEngageRadius}() to modify the default Engage Radius for ALL squadrons.**
-- --
-- Demonstration Mission: [AID-019 - AI_A2A - Engage Range Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/release-2-2-pre/AID%20-%20AI%20Dispatching/AID-019%20-%20AI_A2A%20-%20Engage%20Range%20Test) -- Demonstration Mission: [AID-019 - AI_A2A - Engage Range Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher/AID-A2A-019%20-%20Engage%20Range%20Test)
-- --
-- @param #AI_A2A_DISPATCHER self -- @param #AI_A2A_DISPATCHER self
-- @param #number EngageRadius (Optional, Default = 100000) The radius to report friendlies near the target. -- @param #number EngageRadius (Optional, Default = 100000) The radius to report friendlies near the target.
@@ -1278,7 +1283,7 @@ do -- AI_A2A_DISPATCHER
-- Use the method @{#AI_A2A_DISPATCHER.SetGciRadius}() to set a specific controlled ground intercept radius. -- Use the method @{#AI_A2A_DISPATCHER.SetGciRadius}() to set a specific controlled ground intercept radius.
-- **The Ground Controlled Intercept radius is defined for ALL squadrons which are operational.** -- **The Ground Controlled Intercept radius is defined for ALL squadrons which are operational.**
-- --
-- Demonstration Mission: [AID-013 - AI_A2A - Intercept Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/release-2-2-pre/AID%20-%20AI%20Dispatching/AID-013%20-%20AI_A2A%20-%20Intercept%20Test) -- Demonstration Mission: [AID-013 - AI_A2A - Intercept Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher/AID-A2A-013%20-%20Intercept%20Test)
-- --
-- @param #AI_A2A_DISPATCHER self -- @param #AI_A2A_DISPATCHER self
-- @param #number GciRadius (Optional, Default = 200000) The radius to ground control intercept detected targets from the nearest airbase. -- @param #number GciRadius (Optional, Default = 200000) The radius to ground control intercept detected targets from the nearest airbase.
@@ -1687,6 +1692,20 @@ do -- AI_A2A_DISPATCHER
return DefenderSquadron return DefenderSquadron
end end
--- Get a resource count from a specific squadron
-- @param #AI_A2A_DISPATCHER self
-- @param #string Squadron Name of the squadron.
-- @return #number Number of airframes available or nil if the squadron does not exist
function AI_A2A_DISPATCHER:QuerySquadron(Squadron)
local Squadron = self:GetSquadron(Squadron)
if Squadron.ResourceCount then
self:T2(string.format("%s = %s",Squadron.Name,Squadron.ResourceCount))
return Squadron.ResourceCount
end
self:F({Squadron = Squadron.Name,SquadronResourceCount = Squadron.ResourceCount})
return nil
end
--- [DEPRECATED - Might create problems launching planes] Set the Squadron visible before startup of the dispatcher. --- [DEPRECATED - Might create problems launching planes] Set the Squadron visible before startup of the dispatcher.
-- All planes will be spawned as uncontrolled on the parking spot. -- All planes will be spawned as uncontrolled on the parking spot.
@@ -3238,7 +3257,8 @@ do -- AI_A2A_DISPATCHER
end end
end end
--- @param #AI_A2A_DISPATCHER self --- AI_A2A_Fsm:onafterHome
-- @param #AI_A2A_DISPATCHER self
function AI_A2A_Fsm:onafterHome( Defender, From, Event, To, Action ) function AI_A2A_Fsm:onafterHome( Defender, From, Event, To, Action )
if Defender and Defender:IsAlive() then if Defender and Defender:IsAlive() then
self:F( { "CAP Home", Defender:GetName() } ) self:F( { "CAP Home", Defender:GetName() } )
@@ -3486,7 +3506,8 @@ do -- AI_A2A_DISPATCHER
Dispatcher:ClearDefenderTaskTarget( DefenderGroup ) Dispatcher:ClearDefenderTaskTarget( DefenderGroup )
end end
--- @param #AI_A2A_DISPATCHER self --- function Fsm:onafterLostControl
-- @param #AI_A2A_DISPATCHER self
function Fsm:onafterLostControl( Defender, From, Event, To ) function Fsm:onafterLostControl( Defender, From, Event, To )
self:F( { "GCI LostControl", Defender:GetName() } ) self:F( { "GCI LostControl", Defender:GetName() } )
self:GetParent( self ).onafterHome( self, Defender, From, Event, To ) self:GetParent( self ).onafterHome( self, Defender, From, Event, To )
@@ -3499,7 +3520,8 @@ do -- AI_A2A_DISPATCHER
end end
end end
--- @param #AI_A2A_DISPATCHER self --- function Fsm:onafterHome
-- @param #AI_A2A_DISPATCHER self
function Fsm:onafterHome( DefenderGroup, From, Event, To, Action ) function Fsm:onafterHome( DefenderGroup, From, Event, To, Action )
self:F( { "GCI Home", DefenderGroup:GetName() } ) self:F( { "GCI Home", DefenderGroup:GetName() } )
self:GetParent( self ).onafterHome( self, DefenderGroup, From, Event, To ) self:GetParent( self ).onafterHome( self, DefenderGroup, From, Event, To )
@@ -3940,7 +3962,7 @@ do
-- --
-- # Demo Missions -- # Demo Missions
-- --
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching/AID-A2A%20-%20AI%20A2A%20Dispatching) -- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher)
-- --
-- === -- ===
-- --

View File

@@ -14,47 +14,31 @@
--- @type AI_A2A_GCI --- @type AI_A2A_GCI
-- @extends AI.AI_A2A#AI_A2A -- @extends AI.AI_Air_Engage#AI_AIR_ENGAGE
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders. --- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
-- --
-- ![Process](..\Presentations\AI_GCI\Dia3.JPG)
--
-- The AI_A2A_GCI is assigned a @{Wrapper.Group} and this must be done before the AI_A2A_GCI process can be started using the **Start** event. -- The AI_A2A_GCI is assigned a @{Wrapper.Group} and this must be done before the AI_A2A_GCI process can be started using the **Start** event.
-- --
-- ![Process](..\Presentations\AI_GCI\Dia4.JPG)
--
-- The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits. -- The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits.
-- Upon arrival at the 3D point, a new random 3D point will be selected within the patrol zone using the given limits. -- Upon arrival at the 3D point, a new random 3D point will be selected within the patrol zone using the given limits.
-- --
-- ![Process](..\Presentations\AI_GCI\Dia5.JPG)
--
-- This cycle will continue. -- This cycle will continue.
-- --
-- ![Process](..\Presentations\AI_GCI\Dia6.JPG)
--
-- During the patrol, the AI will detect enemy targets, which are reported through the **Detected** event. -- During the patrol, the AI will detect enemy targets, which are reported through the **Detected** event.
-- --
-- ![Process](..\Presentations\AI_GCI\Dia9.JPG)
--
-- When enemies are detected, the AI will automatically engage the enemy. -- When enemies are detected, the AI will automatically engage the enemy.
-- --
-- ![Process](..\Presentations\AI_GCI\Dia10.JPG)
--
-- Until a fuel or damage threshold has been reached by the AI, or when the AI is commanded to RTB. -- Until a fuel or damage threshold has been reached by the AI, or when the AI is commanded to RTB.
-- When the fuel threshold has been reached, the airplane will fly towards the nearest friendly airbase and will land. -- When the fuel threshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
-- --
-- ![Process](..\Presentations\AI_GCI\Dia13.JPG)
--
-- ## 1. AI_A2A_GCI constructor -- ## 1. AI_A2A_GCI constructor
-- --
-- * @{#AI_A2A_GCI.New}(): Creates a new AI_A2A_GCI object. -- * @{#AI_A2A_GCI.New}(): Creates a new AI_A2A_GCI object.
-- --
-- ## 2. AI_A2A_GCI is a FSM -- ## 2. AI_A2A_GCI is a FSM
-- --
-- ![Process](..\Presentations\AI_GCI\Dia2.JPG)
--
-- ### 2.1 AI_A2A_GCI States -- ### 2.1 AI_A2A_GCI States
-- --
-- * **None** ( Group ): The process is not started yet. -- * **None** ( Group ): The process is not started yet.
@@ -75,23 +59,10 @@
-- * **@{#AI_A2A_GCI.Destroyed}**: The AI has destroyed all bogeys @{Wrapper.Unit}s assigned in the CAS task. -- * **@{#AI_A2A_GCI.Destroyed}**: The AI has destroyed all bogeys @{Wrapper.Unit}s assigned in the CAS task.
-- * **Status** ( Group ): The AI is checking status (fuel and damage). When the thresholds have been reached, the AI will RTB. -- * **Status** ( Group ): The AI is checking status (fuel and damage). When the thresholds have been reached, the AI will RTB.
-- --
-- ## 3. Set the Range of Engagement -- # Developer Note
-- --
-- ![Range](..\Presentations\AI_GCI\Dia11.JPG) -- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- -- Therefore, this class is considered to be deprecated
-- An optional range can be set in meters,
-- that will define when the AI will engage with the detected airborne enemy targets.
-- The range can be beyond or smaller than the range of the Patrol Zone.
-- The range is applied at the position of the AI.
-- Use the method @{AI.AI_GCI#AI_A2A_GCI.SetEngageRange}() to define that range.
--
-- ## 4. Set the Zone of Engagement
--
-- ![Zone](..\Presentations\AI_GCI\Dia12.JPG)
--
-- An optional @{Core.Zone} can be set,
-- that will define when the AI will engage with the detected airborne enemy targets.
-- Use the method @{AI.AI_CAP#AI_CAP_ZONE.SetEngageZone}() to define that Zone.
-- --
-- === -- ===
-- --

View File

@@ -11,7 +11,7 @@
--- @type AI_A2A_PATROL --- @type AI_A2A_PATROL
-- @extends AI.AI_A2A#AI_A2A -- @extends AI.AI_Air_Patrol#AI_AIR_PATROL
--- Implements the core functions to patrol a @{Core.Zone} by an AI @{Wrapper.Group} or @{Wrapper.Group}. --- Implements the core functions to patrol a @{Core.Zone} by an AI @{Wrapper.Group} or @{Wrapper.Group}.
-- --
@@ -111,7 +111,12 @@
-- When the AI is damaged, it is required that a new Patrol is started. However, damage cannon be foreseen early on. -- When the AI is damaged, it is required that a new Patrol is started. However, damage cannon be foreseen early on.
-- Therefore, when the damage threshold is reached, the AI will return immediately to the home base (RTB). -- Therefore, when the damage threshold is reached, the AI will return immediately to the home base (RTB).
-- Use the method @{#AI_A2A_PATROL.ManageDamage}() to have this proces in place. -- Use the method @{#AI_A2A_PATROL.ManageDamage}() to have this proces in place.
--
-- # Developer Note
-- --
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- === -- ===
-- --
-- @field #AI_A2A_PATROL -- @field #AI_A2A_PATROL

View File

@@ -12,10 +12,16 @@
-- @image AI_Air_To_Ground_Engage.JPG -- @image AI_Air_To_Ground_Engage.JPG
--- @type AI_A2G_BAI --- @type AI_A2G_BAI
-- @extends AI.AI_A2A_Engage#AI_A2A_Engage -- TODO: Documentation. This class does not exist, unable to determine what it extends. -- @extends AI.AI_Air_Patrol#AI_AIR_PATROL
-- @extends AI.AI_Air_Engage#AI_AIR_ENGAGE
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders. --- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
--
-- # Developer Note
-- --
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- === -- ===
-- --
-- @field #AI_A2G_BAI -- @field #AI_A2G_BAI
@@ -41,7 +47,7 @@ AI_A2G_BAI = {
function AI_A2G_BAI:New2( AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType ) function AI_A2G_BAI:New2( AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
local AI_Air = AI_AIR:New( AIGroup ) local AI_Air = AI_AIR:New( AIGroup )
local AI_Air_Patrol = AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType ) -- #AI_AIR_PATROL local AI_Air_Patrol = AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
local AI_Air_Engage = AI_AIR_ENGAGE:New( AI_Air_Patrol, AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType ) local AI_Air_Engage = AI_AIR_ENGAGE:New( AI_Air_Patrol, AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType )
local self = BASE:Inherit( self, AI_Air_Engage ) local self = BASE:Inherit( self, AI_Air_Engage )

View File

@@ -12,10 +12,16 @@
-- @image AI_Air_To_Ground_Engage.JPG -- @image AI_Air_To_Ground_Engage.JPG
--- @type AI_A2G_CAS --- @type AI_A2G_CAS
-- @extends AI.AI_A2G_Patrol#AI_AIR_PATROL TODO: Documentation. This class does not exist, unable to determine what it extends. -- @extends AI.AI_Air_Patrol#AI_AIR_PATROL
-- @extends AI.AI_Air_Engage#AI_AIR_ENGAGE
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders. --- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
--
-- # Developer Note
-- --
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- === -- ===
-- --
-- @field #AI_A2G_CAS -- @field #AI_A2G_CAS
@@ -41,7 +47,7 @@ AI_A2G_CAS = {
function AI_A2G_CAS:New2( AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType ) function AI_A2G_CAS:New2( AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
local AI_Air = AI_AIR:New( AIGroup ) local AI_Air = AI_AIR:New( AIGroup )
local AI_Air_Patrol = AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType ) -- #AI_AIR_PATROL local AI_Air_Patrol = AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
local AI_Air_Engage = AI_AIR_ENGAGE:New( AI_Air_Patrol, AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType ) local AI_Air_Engage = AI_AIR_ENGAGE:New( AI_Air_Patrol, AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType )
local self = BASE:Inherit( self, AI_Air_Engage ) local self = BASE:Inherit( self, AI_Air_Engage )

View File

@@ -1,4 +1,4 @@
--- **AI** - Create an automated A2G defense system based on a detection network of reconnaissance vehicles and air units, coordinating SEAD, BAI and CAS operations. --- **AI** - Create an automated A2G defense system with reconnaissance units, coordinating SEAD, BAI and CAS operations.
-- --
-- === -- ===
-- --
@@ -24,7 +24,7 @@
-- --
-- ## Missions: -- ## Missions:
-- --
-- [AID-A2G - AI A2G Dispatching](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching/AID-A2G%20-%20AI%20A2G%20Dispatching) -- [AID-A2G - AI A2G Dispatching](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2G_Dispatcher)
-- --
-- === -- ===
-- --
@@ -253,7 +253,12 @@
-- --
-- **The default grouping is 1. That means, that each spawned defender will act individually.** -- **The default grouping is 1. That means, that each spawned defender will act individually.**
-- But you can specify a number between 1 and 4, so that the defenders will act as a group. -- But you can specify a number between 1 and 4, so that the defenders will act as a group.
--
-- # Developer Note
-- --
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- === -- ===
-- --
-- ### Author: **FlightControl** rework of GCICAP + introduction of new concepts (squadrons). -- ### Author: **FlightControl** rework of GCICAP + introduction of new concepts (squadrons).
@@ -291,8 +296,6 @@ do -- AI_A2G_DISPATCHER
-- --
-- ## 1. AI\_A2G\_DISPATCHER constructor: -- ## 1. AI\_A2G\_DISPATCHER constructor:
-- --
-- ![Banner Image](..\Presentations\AI_A2G_DISPATCHER\AI_A2G_DISPATCHER-ME_1.JPG)
--
-- --
-- The @{#AI_A2G_DISPATCHER.New}() method creates a new AI_A2G_DISPATCHER instance. -- The @{#AI_A2G_DISPATCHER.New}() method creates a new AI_A2G_DISPATCHER instance.
-- --
@@ -306,8 +309,6 @@ do -- AI_A2G_DISPATCHER
-- A reconnaissance network, is used to detect enemy ground targets, -- A reconnaissance network, is used to detect enemy ground targets,
-- potentially group them into areas, and to understand the position, level of threat of the enemy. -- potentially group them into areas, and to understand the position, level of threat of the enemy.
-- --
-- ![Banner Image](..\Presentations\AI_A2G_DISPATCHER\Dia5.JPG)
--
-- As explained in the introduction, depending on the type of mission you want to achieve, different types of units can be applied to detect ground enemy targets. -- As explained in the introduction, depending on the type of mission you want to achieve, different types of units can be applied to detect ground enemy targets.
-- Ground based units are very useful to act as a reconnaissance, but they lack sometimes the visibility to detect targets at greater range. -- Ground based units are very useful to act as a reconnaissance, but they lack sometimes the visibility to detect targets at greater range.
-- Recce are very useful to acquire the position of enemy ground targets when spread out over the battlefield at strategic positions. -- Recce are very useful to acquire the position of enemy ground targets when spread out over the battlefield at strategic positions.
@@ -681,8 +682,6 @@ do -- AI_A2G_DISPATCHER
-- --
-- Use the method @{#AI_A2G_DISPATCHER.SetSquadronGrouping}() to set the grouping of aircraft when spawned in. -- Use the method @{#AI_A2G_DISPATCHER.SetSquadronGrouping}() to set the grouping of aircraft when spawned in.
-- --
-- ![Banner Image](..\Presentations\AI_A2G_DISPATCHER\Dia12.JPG)
--
-- In the case of **on call** engagement, the @{#AI_A2G_DISPATCHER.SetSquadronGrouping}() method has additional behaviour. -- In the case of **on call** engagement, the @{#AI_A2G_DISPATCHER.SetSquadronGrouping}() method has additional behaviour.
-- When there aren't enough patrol flights airborne, a on call will be initiated for the remaining -- When there aren't enough patrol flights airborne, a on call will be initiated for the remaining
-- targets to be engaged. Depending on the grouping parameter, the spawned flights for on call aircraft are grouped into this setting. -- targets to be engaged. Depending on the grouping parameter, the spawned flights for on call aircraft are grouped into this setting.
@@ -696,8 +695,6 @@ do -- AI_A2G_DISPATCHER
-- The effectiveness can be set with the **overhead parameter**. This is a number that is used to calculate the amount of Units that dispatching command will allocate to GCI in surplus of detected amount of units. -- The effectiveness can be set with the **overhead parameter**. This is a number that is used to calculate the amount of Units that dispatching command will allocate to GCI in surplus of detected amount of units.
-- The **default value** of the overhead parameter is 1.0, which means **equal balance**. -- The **default value** of the overhead parameter is 1.0, which means **equal balance**.
-- --
-- ![Banner Image](..\Presentations\AI_A2G_DISPATCHER\Dia11.JPG)
--
-- However, depending on the (type of) aircraft (strength and payload) in the squadron and the amount of resources available, this parameter can be changed. -- However, depending on the (type of) aircraft (strength and payload) in the squadron and the amount of resources available, this parameter can be changed.
-- --
-- The @{#AI_A2G_DISPATCHER.SetSquadronOverhead}() method can be used to tweak the defense strength, -- The @{#AI_A2G_DISPATCHER.SetSquadronOverhead}() method can be used to tweak the defense strength,
@@ -843,8 +840,6 @@ do -- AI_A2G_DISPATCHER
-- --
-- For example, the following setup will set the default refuel tanker to "Tanker": -- For example, the following setup will set the default refuel tanker to "Tanker":
-- --
-- ![Banner Image](..\Presentations\AI_A2G_DISPATCHER\AI_A2G_DISPATCHER-ME_11.JPG)
--
-- -- Set the default tanker for refuelling to "Tanker", when the default fuel threshold has reached 90% fuel left. -- -- Set the default tanker for refuelling to "Tanker", when the default fuel threshold has reached 90% fuel left.
-- A2GDispatcher:SetDefaultFuelThreshold( 0.9 ) -- A2GDispatcher:SetDefaultFuelThreshold( 0.9 )
-- A2GDispatcher:SetDefaultTanker( "Tanker" ) -- A2GDispatcher:SetDefaultTanker( "Tanker" )
@@ -951,7 +946,7 @@ do -- AI_A2G_DISPATCHER
AI_A2G_DISPATCHER.DefenseQueue = {} AI_A2G_DISPATCHER.DefenseQueue = {}
--- Defense approach types. --- Defense approach types.
-- @type #AI_A2G_DISPATCHER.DefenseApproach -- @type AI_A2G_DISPATCHER.DefenseApproach
AI_A2G_DISPATCHER.DefenseApproach = { AI_A2G_DISPATCHER.DefenseApproach = {
Random = 1, Random = 1,
Distance = 2, Distance = 2,
@@ -1806,6 +1801,19 @@ do -- AI_A2G_DISPATCHER
return DefenderSquadron return DefenderSquadron
end end
--- Get a resource count from a specific squadron
-- @param #AI_A2G_DISPATCHER self
-- @param #string Squadron Name of the squadron.
-- @return #number Number of airframes available or nil if the squadron does not exist
function AI_A2G_DISPATCHER:QuerySquadron(Squadron)
local Squadron = self:GetSquadron(Squadron)
if Squadron.ResourceCount then
self:T2(string.format("%s = %s",Squadron.Name,Squadron.ResourceCount))
return Squadron.ResourceCount
end
self:F({Squadron = Squadron.Name,SquadronResourceCount = Squadron.ResourceCount})
return nil
end
--- Set the Squadron visible before startup of the dispatcher. --- Set the Squadron visible before startup of the dispatcher.
-- All planes will be spawned as uncontrolled on the parking spot. -- All planes will be spawned as uncontrolled on the parking spot.
@@ -1839,7 +1847,7 @@ do -- AI_A2G_DISPATCHER
--- Check if the Squadron is visible before startup of the dispatcher. --- Check if the Squadron is visible before startup of the dispatcher.
-- @param #AI_A2G_DISPATCHER self -- @param #AI_A2G_DISPATCHER self
-- @param #string SquadronName The squadron name. -- @param #string SquadronName The squadron name.
-- @return #bool true if visible. -- @return #boolean true if visible.
-- @usage -- @usage
-- --
-- -- Set the Squadron visible before startup of dispatcher. -- -- Set the Squadron visible before startup of dispatcher.

View File

@@ -14,61 +14,43 @@
--- @type AI_A2G_SEAD --- @type AI_A2G_SEAD
-- @extends AI.AI_A2G_Patrol#AI_AIR_PATROL -- @extends AI.AI_Air_Patrol#AI_AIR_PATROL
-- @extends AI.AI_Air_Engage#AI_AIR_ENGAGE
--- Implements the core functions to SEAD intruders. Use the Engage trigger to intercept intruders. --- Implements the core functions to SEAD intruders. Use the Engage trigger to intercept intruders.
-- --
-- ![Process](..\Presentations\AI_GCI\Dia3.JPG)
--
-- The AI_A2G_SEAD is assigned a @{Wrapper.Group} and this must be done before the AI_A2G_SEAD process can be started using the **Start** event. -- The AI_A2G_SEAD is assigned a @{Wrapper.Group} and this must be done before the AI_A2G_SEAD process can be started using the **Start** event.
-- --
-- ![Process](..\Presentations\AI_GCI\Dia4.JPG)
--
-- The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits. -- The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits.
-- Upon arrival at the 3D point, a new random 3D point will be selected within the patrol zone using the given limits. -- Upon arrival at the 3D point, a new random 3D point will be selected within the patrol zone using the given limits.
-- --
-- ![Process](..\Presentations\AI_GCI\Dia5.JPG)
--
-- This cycle will continue. -- This cycle will continue.
-- --
-- ![Process](..\Presentations\AI_GCI\Dia6.JPG)
--
-- During the patrol, the AI will detect enemy targets, which are reported through the **Detected** event. -- During the patrol, the AI will detect enemy targets, which are reported through the **Detected** event.
--
-- ![Process](..\Presentations\AI_GCI\Dia9.JPG)
-- --
-- When enemies are detected, the AI will automatically engage the enemy. -- When enemies are detected, the AI will automatically engage the enemy.
-- --
-- ![Process](..\Presentations\AI_GCI\Dia10.JPG)
--
-- Until a fuel or damage threshold has been reached by the AI, or when the AI is commanded to RTB. -- Until a fuel or damage threshold has been reached by the AI, or when the AI is commanded to RTB.
-- When the fuel threshold has been reached, the airplane will fly towards the nearest friendly airbase and will land. -- When the fuel threshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
-- --
-- ![Process](..\Presentations\AI_GCI\Dia13.JPG)
--
-- ## 1. AI_A2G_SEAD constructor -- ## 1. AI_A2G_SEAD constructor
-- --
-- * @{#AI_A2G_SEAD.New}(): Creates a new AI_A2G_SEAD object. -- * @{#AI_A2G_SEAD.New}(): Creates a new AI_A2G_SEAD object.
-- --
-- ## 3. Set the Range of Engagement -- ## 3. Set the Range of Engagement
-- --
-- ![Range](..\Presentations\AI_GCI\Dia11.JPG)
--
-- An optional range can be set in meters, -- An optional range can be set in meters,
-- that will define when the AI will engage with the detected airborne enemy targets. -- that will define when the AI will engage with the detected airborne enemy targets.
-- The range can be beyond or smaller than the range of the Patrol Zone. -- The range can be beyond or smaller than the range of the Patrol Zone.
-- The range is applied at the position of the AI. -- The range is applied at the position of the AI.
-- Use the method @{AI.AI_GCI#AI_A2G_SEAD.SetEngageRange}() to define that range. -- Use the method @{#AI_AIR_PATROL.SetEngageRange}() to define that range.
-- --
-- ## 4. Set the Zone of Engagement -- # Developer Note
-- --
-- ![Zone](..\Presentations\AI_GCI\Dia12.JPG) -- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- -- Therefore, this class is considered to be deprecated
-- An optional @{Core.Zone} can be set, --
-- that will define when the AI will engage with the detected airborne enemy targets.
-- Use the method @{AI.AI_CAP#AI_CAP_ZONE.SetEngageZone}() to define that Zone. -- TODO: Documentation. Check that this is actually correct. The originally referenced class does not exist.
--
-- === -- ===
-- --
-- @field #AI_A2G_SEAD -- @field #AI_A2G_SEAD
@@ -94,7 +76,7 @@ AI_A2G_SEAD = {
function AI_A2G_SEAD:New2( AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType ) function AI_A2G_SEAD:New2( AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
local AI_Air = AI_AIR:New( AIGroup ) local AI_Air = AI_AIR:New( AIGroup )
local AI_Air_Patrol = AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType ) -- #AI_AIR_PATROL local AI_Air_Patrol = AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType )
local AI_Air_Engage = AI_AIR_ENGAGE:New( AI_Air_Patrol, AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType ) local AI_Air_Engage = AI_AIR_ENGAGE:New( AI_Air_Patrol, AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAltitude, EngageCeilingAltitude, EngageAltType )
local self = BASE:Inherit( self, AI_Air_Engage ) local self = BASE:Inherit( self, AI_Air_Engage )

View File

@@ -46,6 +46,11 @@
-- * **Stop**: Stop the transport process. -- * **Stop**: Stop the transport process.
-- * **Monitor**: Monitor and take action. -- * **Monitor**: Monitor and take action.
-- --
-- # Developer Note
--
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- @field #AI_AIR -- @field #AI_AIR
AI_AIR = { AI_AIR = {
ClassName = "AI_AIR", ClassName = "AI_AIR",

View File

@@ -24,7 +24,7 @@
-- --
-- ## Missions: -- ## Missions:
-- --
-- [AID-AIR - AI AIR Dispatching](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching) -- [AI_A2A_Dispatcher](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher)
-- --
-- === -- ===
-- --
@@ -292,8 +292,6 @@ do -- AI_AIR_DISPATCHER
-- --
-- ## 1. AI\_AIR\_DISPATCHER constructor: -- ## 1. AI\_AIR\_DISPATCHER constructor:
-- --
-- ![Banner Image](..\Presentations\AI_AIR_DISPATCHER\AI_AIR_DISPATCHER-ME_1.JPG)
--
-- --
-- The @{#AI_AIR_DISPATCHER.New}() method creates a new AI_AIR_DISPATCHER instance. -- The @{#AI_AIR_DISPATCHER.New}() method creates a new AI_AIR_DISPATCHER instance.
-- --
@@ -306,8 +304,6 @@ do -- AI_AIR_DISPATCHER
-- A reconnaissance network, is used to detect enemy ground targets, -- A reconnaissance network, is used to detect enemy ground targets,
-- potentially group them into areas, and to understand the position, level of threat of the enemy. -- potentially group them into areas, and to understand the position, level of threat of the enemy.
-- --
-- ![Banner Image](..\Presentations\AI_AIR_DISPATCHER\Dia5.JPG)
--
-- As explained in the introduction, depending on the type of mission you want to achieve, different types of units can be applied to detect ground enemy targets. -- As explained in the introduction, depending on the type of mission you want to achieve, different types of units can be applied to detect ground enemy targets.
-- Ground based units are very useful to act as a reconnaissance, but they lack sometimes the visibility to detect targets at greater range. -- Ground based units are very useful to act as a reconnaissance, but they lack sometimes the visibility to detect targets at greater range.
-- Recce are very useful to acquire the position of enemy ground targets when spread out over the battlefield at strategic positions. -- Recce are very useful to acquire the position of enemy ground targets when spread out over the battlefield at strategic positions.
@@ -673,8 +669,6 @@ do -- AI_AIR_DISPATCHER
-- --
-- Use the method @{#AI_AIR_DISPATCHER.SetSquadronGrouping}() to set the grouping of aircraft when spawned in. -- Use the method @{#AI_AIR_DISPATCHER.SetSquadronGrouping}() to set the grouping of aircraft when spawned in.
-- --
-- ![Banner Image](..\Presentations\AI_AIR_DISPATCHER\Dia12.JPG)
--
-- In the case of **on call** engagement, the @{#AI_AIR_DISPATCHER.SetSquadronGrouping}() method has additional behaviour. -- In the case of **on call** engagement, the @{#AI_AIR_DISPATCHER.SetSquadronGrouping}() method has additional behaviour.
-- When there aren't enough patrol flights airborne, a on call will be initiated for the remaining -- When there aren't enough patrol flights airborne, a on call will be initiated for the remaining
-- targets to be engaged. Depending on the grouping parameter, the spawned flights for on call aircraft are grouped into this setting. -- targets to be engaged. Depending on the grouping parameter, the spawned flights for on call aircraft are grouped into this setting.
@@ -688,8 +682,6 @@ do -- AI_AIR_DISPATCHER
-- The effectiveness can be set with the **overhead parameter**. This is a number that is used to calculate the amount of Units that dispatching command will allocate to GCI in surplus of detected amount of units. -- The effectiveness can be set with the **overhead parameter**. This is a number that is used to calculate the amount of Units that dispatching command will allocate to GCI in surplus of detected amount of units.
-- The **default value** of the overhead parameter is 1.0, which means **equal balance**. -- The **default value** of the overhead parameter is 1.0, which means **equal balance**.
-- --
-- ![Banner Image](..\Presentations\AI_AIR_DISPATCHER\Dia11.JPG)
--
-- However, depending on the (type of) aircraft (strength and payload) in the squadron and the amount of resources available, this parameter can be changed. -- However, depending on the (type of) aircraft (strength and payload) in the squadron and the amount of resources available, this parameter can be changed.
-- --
-- The @{#AI_AIR_DISPATCHER.SetSquadronOverhead}() method can be used to tweak the defense strength, -- The @{#AI_AIR_DISPATCHER.SetSquadronOverhead}() method can be used to tweak the defense strength,
@@ -835,8 +827,6 @@ do -- AI_AIR_DISPATCHER
-- --
-- For example, the following setup will set the default refuel tanker to "Tanker": -- For example, the following setup will set the default refuel tanker to "Tanker":
-- --
-- ![Banner Image](..\Presentations\AI_AIR_DISPATCHER\AI_AIR_DISPATCHER-ME_11.JPG)
--
-- -- Define the CAP -- -- Define the CAP
-- A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP SU-34" }, 20 ) -- A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP SU-34" }, 20 )
-- A2ADispatcher:SetSquadronCap( "Sochi", ZONE:New( "PatrolZone" ), 4000, 8000, 600, 800, 1000, 1300 ) -- A2ADispatcher:SetSquadronCap( "Sochi", ZONE:New( "PatrolZone" ), 4000, 8000, 600, 800, 1000, 1300 )
@@ -883,6 +873,11 @@ do -- AI_AIR_DISPATCHER
-- However, the squadron will still stay alive. Any airplane that is airborne will continue its operations until all airborne airplanes -- However, the squadron will still stay alive. Any airplane that is airborne will continue its operations until all airborne airplanes
-- of the squadron will be destroyed. This to keep consistency of air operations not to confuse the players. -- of the squadron will be destroyed. This to keep consistency of air operations not to confuse the players.
-- --
-- # Developer Note
--
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- @field #AI_AIR_DISPATCHER -- @field #AI_AIR_DISPATCHER
AI_AIR_DISPATCHER = { AI_AIR_DISPATCHER = {
ClassName = "AI_AIR_DISPATCHER", ClassName = "AI_AIR_DISPATCHER",
@@ -947,7 +942,7 @@ do -- AI_AIR_DISPATCHER
AI_AIR_DISPATCHER.DefenseQueue = {} AI_AIR_DISPATCHER.DefenseQueue = {}
--- Defense approach types --- Defense approach types
-- @type #AI_AIR_DISPATCHER.DefenseApproach -- @type AI_AIR_DISPATCHER.DefenseApproach
AI_AIR_DISPATCHER.DefenseApproach = { AI_AIR_DISPATCHER.DefenseApproach = {
Random = 1, Random = 1,
Distance = 2, Distance = 2,
@@ -1852,7 +1847,7 @@ do -- AI_AIR_DISPATCHER
--- Check if the Squadron is visible before startup of the dispatcher. --- Check if the Squadron is visible before startup of the dispatcher.
-- @param #AI_AIR_DISPATCHER self -- @param #AI_AIR_DISPATCHER self
-- @param #string SquadronName The squadron name. -- @param #string SquadronName The squadron name.
-- @return #bool true if visible. -- @return #boolean true if visible.
-- @usage -- @usage
-- --
-- -- Set the Squadron visible before startup of dispatcher. -- -- Set the Squadron visible before startup of dispatcher.

View File

@@ -14,61 +14,45 @@
--- @type AI_AIR_ENGAGE --- @type AI_AIR_ENGAGE
-- @extends AI.AI_AIR#AI_AIR -- @extends AI.AI_Air#AI_AIR
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders. --- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
-- --
-- ![Process](..\Presentations\AI_GCI\Dia3.JPG)
--
-- The AI_AIR_ENGAGE is assigned a @{Wrapper.Group} and this must be done before the AI_AIR_ENGAGE process can be started using the **Start** event. -- The AI_AIR_ENGAGE is assigned a @{Wrapper.Group} and this must be done before the AI_AIR_ENGAGE process can be started using the **Start** event.
-- --
-- ![Process](..\Presentations\AI_GCI\Dia4.JPG)
--
-- The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits. -- The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits.
-- Upon arrival at the 3D point, a new random 3D point will be selected within the patrol zone using the given limits. -- Upon arrival at the 3D point, a new random 3D point will be selected within the patrol zone using the given limits.
-- --
-- ![Process](..\Presentations\AI_GCI\Dia5.JPG)
--
-- This cycle will continue. -- This cycle will continue.
-- --
-- ![Process](..\Presentations\AI_GCI\Dia6.JPG)
--
-- During the patrol, the AI will detect enemy targets, which are reported through the **Detected** event. -- During the patrol, the AI will detect enemy targets, which are reported through the **Detected** event.
--
-- ![Process](..\Presentations\AI_GCI\Dia9.JPG)
-- --
-- When enemies are detected, the AI will automatically engage the enemy. -- When enemies are detected, the AI will automatically engage the enemy.
-- --
-- ![Process](..\Presentations\AI_GCI\Dia10.JPG)
--
-- Until a fuel or damage threshold has been reached by the AI, or when the AI is commanded to RTB. -- Until a fuel or damage threshold has been reached by the AI, or when the AI is commanded to RTB.
-- When the fuel threshold has been reached, the airplane will fly towards the nearest friendly airbase and will land. -- When the fuel threshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
-- --
-- ![Process](..\Presentations\AI_GCI\Dia13.JPG)
--
-- ## 1. AI_AIR_ENGAGE constructor -- ## 1. AI_AIR_ENGAGE constructor
-- --
-- * @{#AI_AIR_ENGAGE.New}(): Creates a new AI_AIR_ENGAGE object. -- * @{#AI_AIR_ENGAGE.New}(): Creates a new AI_AIR_ENGAGE object.
-- --
-- ## 3. Set the Range of Engagement -- ## 2. Set the Zone of Engagement
--
-- ![Range](..\Presentations\AI_GCI\Dia11.JPG)
--
-- An optional range can be set in meters,
-- that will define when the AI will engage with the detected airborne enemy targets.
-- The range can be beyond or smaller than the range of the Patrol Zone.
-- The range is applied at the position of the AI.
-- Use the method @{AI.AI_GCI#AI_AIR_ENGAGE.SetEngageRange}() to define that range.
-- --
-- ## 4. Set the Zone of Engagement -- An optional @{Core.Zone} can be set,
--
-- ![Zone](..\Presentations\AI_GCI\Dia12.JPG)
--
-- An optional @{Core.Zone} can be set,
-- that will define when the AI will engage with the detected airborne enemy targets. -- that will define when the AI will engage with the detected airborne enemy targets.
-- Use the method @{AI.AI_CAP#AI_AIR_ENGAGE.SetEngageZone}() to define that Zone. -- Use the method @{AI.AI_CAP#AI_AIR_ENGAGE.SetEngageZone}() to define that Zone.
-- --
-- # Developer Note
--
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- # Developer Note
--
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- === -- ===
-- --
-- @field #AI_AIR_ENGAGE -- @field #AI_AIR_ENGAGE
@@ -451,12 +435,12 @@ function AI_AIR_ENGAGE:onafterEngageRoute( DefenderGroup, From, Event, To, Attac
-- TODO: A factor of * 3 is way too close. This causes the AI not to engange until merged sometimes! -- TODO: A factor of * 3 is way too close. This causes the AI not to engange until merged sometimes!
if TargetDistance <= EngageDistance * 9 then if TargetDistance <= EngageDistance * 9 then
self:I(string.format("AI_AIR_ENGAGE onafterEngageRoute ==> __Engage - target distance = %.1f km", TargetDistance/1000)) --self:I(string.format("AI_AIR_ENGAGE onafterEngageRoute ==> __Engage - target distance = %.1f km", TargetDistance/1000))
self:__Engage( 0.1, AttackSetUnit ) self:__Engage( 0.1, AttackSetUnit )
else else
self:I(string.format("FF AI_AIR_ENGAGE onafterEngageRoute ==> Routing - target distance = %.1f km", TargetDistance/1000)) --self:I(string.format("FF AI_AIR_ENGAGE onafterEngageRoute ==> Routing - target distance = %.1f km", TargetDistance/1000))
local EngageRoute = {} local EngageRoute = {}
local AttackTasks = {} local AttackTasks = {}

View File

@@ -79,16 +79,13 @@
-- that will define when the AI will engage with the detected airborne enemy targets. -- that will define when the AI will engage with the detected airborne enemy targets.
-- The range can be beyond or smaller than the range of the Patrol Zone. -- The range can be beyond or smaller than the range of the Patrol Zone.
-- The range is applied at the position of the AI. -- The range is applied at the position of the AI.
-- Use the method @{AI.AI_CAP#AI_AIR_PATROL.SetEngageRange}() to define that range. -- Use the method @{#AI_AIR_PATROL.SetEngageRange}() to define that range.
-- --
-- ## 4. Set the Zone of Engagement -- # Developer Note
-- --
-- ![Zone](..\Presentations\AI_CAP\Dia12.JPG) -- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- -- Therefore, this class is considered to be deprecated
-- An optional @{Core.Zone} can be set, --
-- that will define when the AI will engage with the detected airborne enemy targets.
-- Use the method @{AI.AI_CAP#AI_AIR_PATROL.SetEngageZone}() to define that Zone.
--
-- === -- ===
-- --
-- @field #AI_AIR_PATROL -- @field #AI_AIR_PATROL

View File

@@ -18,7 +18,12 @@
--- Implements the core functions modeling squadrons for airplanes and helicopters. --- Implements the core functions modeling squadrons for airplanes and helicopters.
--
-- # Developer Note
-- --
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- === -- ===
-- --
-- @field #AI_AIR_SQUADRON -- @field #AI_AIR_SQUADRON

View File

@@ -11,7 +11,7 @@
-- --
-- === -- ===
-- --
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/BAI%20-%20Battlefield%20Air%20Interdiction) -- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_BAI)
-- --
-- === -- ===
-- --
@@ -22,7 +22,7 @@
-- ### Author: **FlightControl** -- ### Author: **FlightControl**
-- ### Contributions: -- ### Contributions:
-- --
-- * **[Gunterlund](http://forums.eagle.ru:8080/member.php?u=75036)**: Test case revision. -- * **Gunterlund**: Test case revision.
-- --
-- === -- ===
-- --
@@ -130,7 +130,12 @@
-- AIBAIZone:SearchOff() -- AIBAIZone:SearchOff()
-- --
-- Searching can be switched back on with the method @{#AI_BAI_ZONE.SearchOn}(). Use the method @{#AI_BAI_ZONE.SearchOnOff}() to flexibily switch searching on or off. -- Searching can be switched back on with the method @{#AI_BAI_ZONE.SearchOn}(). Use the method @{#AI_BAI_ZONE.SearchOnOff}() to flexibily switch searching on or off.
--
-- # Developer Note
-- --
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- === -- ===
-- --
-- @field #AI_BAI_ZONE -- @field #AI_BAI_ZONE

View File

@@ -9,7 +9,7 @@
-- --
-- === -- ===
-- --
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AIB%20-%20AI%20Balancing) -- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_Balancer)
-- --
-- === -- ===
-- --
@@ -20,7 +20,7 @@
-- ### Author: **FlightControl** -- ### Author: **FlightControl**
-- ### Contributions: -- ### Contributions:
-- --
-- * **[Dutch_Baron](https://forums.eagle.ru/member.php?u=112075)**: Working together with James has resulted in the creation of the AI_BALANCER class. James has shared his ideas on balancing AI with air units, and together we made a first design which you can use now :-) -- * **Dutch_Baron**: Working together with James has resulted in the creation of the AI_BALANCER class. James has shared his ideas on balancing AI with air units, and together we made a first design which you can use now :-)
-- --
-- === -- ===
-- --
@@ -40,7 +40,7 @@
-- --
-- The parent class @{Core.Fsm#FSM_SET} manages the functionality to control the Finite State Machine (FSM). -- The parent class @{Core.Fsm#FSM_SET} manages the functionality to control the Finite State Machine (FSM).
-- The mission designer can tailor the behaviour of the AI_BALANCER, by defining event and state transition methods. -- The mission designer can tailor the behaviour of the AI_BALANCER, by defining event and state transition methods.
-- An explanation about state and event transition methods can be found in the @{FSM} module documentation. -- An explanation about state and event transition methods can be found in the @{Core.Fsm} module documentation.
-- --
-- The mission designer can tailor the AI_BALANCER behaviour, by implementing a state or event handling method for the following: -- The mission designer can tailor the AI_BALANCER behaviour, by implementing a state or event handling method for the following:
-- --
@@ -52,7 +52,7 @@
-- --
-- ## 2. AI_BALANCER is a FSM -- ## 2. AI_BALANCER is a FSM
-- --
-- ![Process](..\Presentations\AI_Balancer\Dia13.JPG) -- ![Process](..\Presentations\AI_BALANCER\Dia13.JPG)
-- --
-- ### 2.1. AI_BALANCER States -- ### 2.1. AI_BALANCER States
-- --
@@ -85,7 +85,12 @@
-- --
-- Note that when AI returns to an airbase, the AI_BALANCER will trigger the **Return** event and the AI will return, -- Note that when AI returns to an airbase, the AI_BALANCER will trigger the **Return** event and the AI will return,
-- otherwise the AI_BALANCER will trigger a **Destroy** event, and the AI will be destroyed. -- otherwise the AI_BALANCER will trigger a **Destroy** event, and the AI will be destroyed.
--
-- # Developer Note
-- --
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- @field #AI_BALANCER -- @field #AI_BALANCER
AI_BALANCER = { AI_BALANCER = {
ClassName = "AI_BALANCER", ClassName = "AI_BALANCER",
@@ -163,7 +168,8 @@ function AI_BALANCER:ReturnToHomeAirbase( ReturnThresholdRange )
self.ReturnThresholdRange = ReturnThresholdRange self.ReturnThresholdRange = ReturnThresholdRange
end end
--- @param #AI_BALANCER self --- AI_BALANCER:onenterSpawning
-- @param #AI_BALANCER self
-- @param Core.Set#SET_GROUP SetGroup -- @param Core.Set#SET_GROUP SetGroup
-- @param #string ClientName -- @param #string ClientName
-- @param Wrapper.Group#GROUP AIGroup -- @param Wrapper.Group#GROUP AIGroup
@@ -185,7 +191,8 @@ function AI_BALANCER:onenterSpawning( SetGroup, From, Event, To, ClientName )
end end
end end
--- @param #AI_BALANCER self --- AI_BALANCER:onenterDestroying
-- @param #AI_BALANCER self
-- @param Core.Set#SET_GROUP SetGroup -- @param Core.Set#SET_GROUP SetGroup
-- @param Wrapper.Group#GROUP AIGroup -- @param Wrapper.Group#GROUP AIGroup
function AI_BALANCER:onenterDestroying( SetGroup, From, Event, To, ClientName, AIGroup ) function AI_BALANCER:onenterDestroying( SetGroup, From, Event, To, ClientName, AIGroup )
@@ -228,15 +235,16 @@ function AI_BALANCER:onenterReturning( SetGroup, From, Event, To, AIGroup )
end end
--- AI_BALANCER:onenterMonitoring
--- @param #AI_BALANCER self -- @param #AI_BALANCER self
function AI_BALANCER:onenterMonitoring( SetGroup ) function AI_BALANCER:onenterMonitoring( SetGroup )
self:T2( { self.SetClient:Count() } ) self:T2( { self.SetClient:Count() } )
--self.SetClient:Flush() --self.SetClient:Flush()
self.SetClient:ForEachClient( self.SetClient:ForEachClient(
--- @param Wrapper.Client#CLIENT Client --- SetClient:ForEachClient
-- @param Wrapper.Client#CLIENT Client
function( Client ) function( Client )
self:T3(Client.ClientName) self:T3(Client.ClientName)
@@ -259,7 +267,8 @@ function AI_BALANCER:onenterMonitoring( SetGroup )
self:T2( RangeZone ) self:T2( RangeZone )
_DATABASE:ForEachPlayerUnit( _DATABASE:ForEachPlayerUnit(
--- @param Wrapper.Unit#UNIT RangeTestUnit --- Nameless function
-- @param Wrapper.Unit#UNIT RangeTestUnit
function( RangeTestUnit, RangeZone, AIGroup, PlayerInRange ) function( RangeTestUnit, RangeZone, AIGroup, PlayerInRange )
self:T2( { PlayerInRange, RangeTestUnit.UnitName, RangeZone.ZoneName } ) self:T2( { PlayerInRange, RangeTestUnit.UnitName, RangeZone.ZoneName } )
if RangeTestUnit:IsInZone( RangeZone ) == true then if RangeTestUnit:IsInZone( RangeZone ) == true then
@@ -271,7 +280,8 @@ function AI_BALANCER:onenterMonitoring( SetGroup )
end end
end, end,
--- @param Core.Zone#ZONE_RADIUS RangeZone --- Nameless function
-- @param Core.Zone#ZONE_RADIUS RangeZone
-- @param Wrapper.Group#GROUP AIGroup -- @param Wrapper.Group#GROUP AIGroup
function( RangeZone, AIGroup, PlayerInRange ) function( RangeZone, AIGroup, PlayerInRange )
if PlayerInRange.Value == false then if PlayerInRange.Value == false then
@@ -302,6 +312,3 @@ function AI_BALANCER:onenterMonitoring( SetGroup )
self:__Monitor( 10 ) self:__Monitor( 10 )
end end

View File

@@ -9,7 +9,7 @@
-- --
-- === -- ===
-- --
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/CAP%20-%20Combat%20Air%20Patrol) -- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_CAP)
-- --
-- === -- ===
-- --
@@ -20,11 +20,11 @@
-- ### Author: **FlightControl** -- ### Author: **FlightControl**
-- ### Contributions: -- ### Contributions:
-- --
-- * **[Quax](https://forums.eagle.ru/member.php?u=90530)**: Concept, Advice & Testing. -- * **Quax**: Concept, Advice & Testing.
-- * **[Pikey](https://forums.eagle.ru/member.php?u=62835)**: Concept, Advice & Testing. -- * **Pikey**: Concept, Advice & Testing.
-- * **[Gunterlund](http://forums.eagle.ru:8080/member.php?u=75036)**: Test case revision. -- * **Gunterlund**: Test case revision.
-- * **[Whisper](http://forums.eagle.ru/member.php?u=3829): Testing. -- * **Whisper**: Testing.
-- * **[Delta99](https://forums.eagle.ru/member.php?u=125166): Testing. -- * **Delta99**: Testing.
-- --
-- === -- ===
-- --
@@ -112,7 +112,12 @@
-- An optional @{Core.Zone} can be set, -- An optional @{Core.Zone} can be set,
-- that will define when the AI will engage with the detected airborne enemy targets. -- that will define when the AI will engage with the detected airborne enemy targets.
-- Use the method @{#AI_CAP_ZONE.SetEngageZone}() to define that Zone. -- Use the method @{#AI_CAP_ZONE.SetEngageZone}() to define that Zone.
-- --
-- # Developer Note
--
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- === -- ===
-- --
-- @field #AI_CAP_ZONE -- @field #AI_CAP_ZONE

View File

@@ -11,7 +11,7 @@
-- --
-- === -- ===
-- --
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/CAS%20-%20Close%20Air%20Support) -- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_CAS)
-- --
-- === -- ===
-- --
@@ -22,9 +22,9 @@
-- ### Author: **FlightControl** -- ### Author: **FlightControl**
-- ### Contributions: -- ### Contributions:
-- --
-- * **[Quax](https://forums.eagle.ru/member.php?u=90530)**: Concept, Advice & Testing. -- * **Quax**: Concept, Advice & Testing.
-- * **[Pikey](https://forums.eagle.ru/member.php?u=62835)**: Concept, Advice & Testing. -- * **Pikey**: Concept, Advice & Testing.
-- * **[Gunterlund](http://forums.eagle.ru:8080/member.php?u=75036)**: Test case revision. -- * **Gunterlund**: Test case revision.
-- --
-- === -- ===
-- --
@@ -118,7 +118,12 @@
-- * **@{#AI_CAS_ZONE.Destroy}**: The AI has destroyed a target @{Wrapper.Unit}. -- * **@{#AI_CAS_ZONE.Destroy}**: The AI has destroyed a target @{Wrapper.Unit}.
-- * **@{#AI_CAS_ZONE.Destroyed}**: The AI has destroyed all target @{Wrapper.Unit}s assigned in the CAS task. -- * **@{#AI_CAS_ZONE.Destroyed}**: The AI has destroyed all target @{Wrapper.Unit}s assigned in the CAS task.
-- * **Status**: The AI is checking status (fuel and damage). When the thresholds have been reached, the AI will RTB. -- * **Status**: The AI is checking status (fuel and damage). When the thresholds have been reached, the AI will RTB.
--
-- # Developer Note
-- --
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- === -- ===
-- --
-- @field #AI_CAS_ZONE -- @field #AI_CAS_ZONE

View File

@@ -25,7 +25,12 @@
-- * @{AI.AI_Cargo_APC} - Cargo transportation using APCs and other vehicles between zones. -- * @{AI.AI_Cargo_APC} - Cargo transportation using APCs and other vehicles between zones.
-- * @{AI.AI_Cargo_Helicopter} - Cargo transportation using helicopters between zones. -- * @{AI.AI_Cargo_Helicopter} - Cargo transportation using helicopters between zones.
-- * @{AI.AI_Cargo_Airplane} - Cargo transportation using airplanes to and from airbases. -- * @{AI.AI_Cargo_Airplane} - Cargo transportation using airplanes to and from airbases.
-- --
-- # Developer Note
--
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- @field #AI_CARGO -- @field #AI_CARGO
AI_CARGO = { AI_CARGO = {
ClassName = "AI_CARGO", ClassName = "AI_CARGO",

View File

@@ -75,7 +75,12 @@
-- Using the @{#AI_CARGO_APC.Pickup}() method, you are able to direct the APCs towards a point on the battlefield to board/load the cargo at the specific coordinate. -- Using the @{#AI_CARGO_APC.Pickup}() method, you are able to direct the APCs towards a point on the battlefield to board/load the cargo at the specific coordinate.
-- The APCs will follow nearby roads as much as possible, to ensure fast and clean cargo transportation between the objects and villages in the simulation environment. -- The APCs will follow nearby roads as much as possible, to ensure fast and clean cargo transportation between the objects and villages in the simulation environment.
-- --
--
-- # Developer Note
-- --
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- --
-- @field #AI_CARGO_APC -- @field #AI_CARGO_APC
AI_CARGO_APC = { AI_CARGO_APC = {

View File

@@ -41,7 +41,12 @@
-- marginal impact on the overall battlefield simulation. Fortunately, the firing strength of infantry is limited, and thus, respacing healthy infantry every -- marginal impact on the overall battlefield simulation. Fortunately, the firing strength of infantry is limited, and thus, respacing healthy infantry every
-- time is not so much of an issue ... -- time is not so much of an issue ...
-- --
--
-- # Developer Note
-- --
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- @field #AI_CARGO_AIRPLANE -- @field #AI_CARGO_AIRPLANE
AI_CARGO_AIRPLANE = { AI_CARGO_AIRPLANE = {
ClassName = "AI_CARGO_AIRPLANE", ClassName = "AI_CARGO_AIRPLANE",

View File

@@ -18,7 +18,7 @@
-- --
-- Test missions can be located on the main GITHUB site. -- Test missions can be located on the main GITHUB site.
-- --
-- [FlightControl-Master/MOOSE_MISSIONS/AID - AI Dispatching/AID-CGO - AI Cargo Dispatching/](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/AID%20-%20AI%20Dispatching/AID-CGO%20-%20AI%20Cargo%20Dispatching) -- [FlightControl-Master/MOOSE_MISSIONS/AID - AI Dispatching/AID-CGO - AI Cargo Dispatching/](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_Cargo_Dispatcher)
-- --
-- === -- ===
-- --
@@ -100,7 +100,12 @@
-- --
-- Yes, please ensure that the zones are declared using the @{Core.Zone} classes. -- Yes, please ensure that the zones are declared using the @{Core.Zone} classes.
-- Possible zones that function at the moment are ZONE, ZONE_GROUP, ZONE_UNIT, ZONE_POLYGON. -- Possible zones that function at the moment are ZONE, ZONE_GROUP, ZONE_UNIT, ZONE_POLYGON.
--
-- # Developer Note
-- --
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- === -- ===
-- --
-- ### Author: **FlightControl** -- ### Author: **FlightControl**
@@ -567,7 +572,7 @@
-- A home zone can be specified to where the Carriers will move when there isn't any cargo left for pickup. -- A home zone can be specified to where the Carriers will move when there isn't any cargo left for pickup.
-- Use @{#AI_CARGO_DISPATCHER.SetHomeZone}() to specify the home zone. -- Use @{#AI_CARGO_DISPATCHER.SetHomeZone}() to specify the home zone.
-- --
-- If no home zone is specified, the carriers will wait near the deploy zone for a new pickup command. -- If no home zone is specified, the carriers will wait near the deploy zone for a new pickup command.
-- --
-- === -- ===
-- --
@@ -578,10 +583,12 @@ AI_CARGO_DISPATCHER = {
PickupCargo = {} PickupCargo = {}
} }
--- @field #list --- List of AI_Cargo
-- @field #list
AI_CARGO_DISPATCHER.AI_Cargo = {} AI_CARGO_DISPATCHER.AI_Cargo = {}
--- @field #list --- List of PickupCargo
-- @field #list
AI_CARGO_DISPATCHER.PickupCargo = {} AI_CARGO_DISPATCHER.PickupCargo = {}

View File

@@ -137,7 +137,12 @@
-- Use @{#AI_CARGO_DISPATCHER_APC.SetHomeZone}() to specify the home zone. -- Use @{#AI_CARGO_DISPATCHER_APC.SetHomeZone}() to specify the home zone.
-- --
-- If no home zone is specified, the APCs will wait near the deploy zone for a new pickup command. -- If no home zone is specified, the APCs will wait near the deploy zone for a new pickup command.
--
-- # Developer Note
-- --
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- === -- ===
-- --
-- @field #AI_CARGO_DISPATCHER_APC -- @field #AI_CARGO_DISPATCHER_APC

View File

@@ -108,7 +108,12 @@
-- --
-- **There are a lot of templates available that allows you to quickly setup an event handler for a specific event type!** -- **There are a lot of templates available that allows you to quickly setup an event handler for a specific event type!**
-- --
--
-- # Developer Note
-- --
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- --
-- @field #AI_CARGO_DISPATCHER_AIRPLANE -- @field #AI_CARGO_DISPATCHER_AIRPLANE
AI_CARGO_DISPATCHER_AIRPLANE = { AI_CARGO_DISPATCHER_AIRPLANE = {

View File

@@ -140,7 +140,12 @@
-- Use @{#AI_CARGO_DISPATCHER_HELICOPTER.SetHomeZone}() to specify the home zone. -- Use @{#AI_CARGO_DISPATCHER_HELICOPTER.SetHomeZone}() to specify the home zone.
-- --
-- If no home zone is specified, the helicopters will wait near the deploy zone for a new pickup command. -- If no home zone is specified, the helicopters will wait near the deploy zone for a new pickup command.
--
-- # Developer Note
-- --
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- === -- ===
-- --
-- @field #AI_CARGO_DISPATCHER_HELICOPTER -- @field #AI_CARGO_DISPATCHER_HELICOPTER

View File

@@ -130,7 +130,12 @@
-- Use @{#AI_CARGO_DISPATCHER_SHIP.SetHomeZone}() to specify the home zone. -- Use @{#AI_CARGO_DISPATCHER_SHIP.SetHomeZone}() to specify the home zone.
-- --
-- If no home zone is specified, the Ship will wait near the deploy zone for a new pickup command. -- If no home zone is specified, the Ship will wait near the deploy zone for a new pickup command.
--
-- # Developer Note
-- --
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- === -- ===
-- --
-- @field #AI_CARGO_DISPATCHER_SHIP -- @field #AI_CARGO_DISPATCHER_SHIP

View File

@@ -41,7 +41,12 @@
-- marginal impact on the overall battlefield simulation. Fortunately, the firing strength of infantry is limited, and thus, respacing healthy infantry every -- marginal impact on the overall battlefield simulation. Fortunately, the firing strength of infantry is limited, and thus, respacing healthy infantry every
-- time is not so much of an issue ... -- time is not so much of an issue ...
-- --
--
-- # Developer Note
-- --
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- === -- ===
-- --
-- @field #AI_CARGO_HELICOPTER -- @field #AI_CARGO_HELICOPTER

View File

@@ -55,6 +55,11 @@
-- coordinate. The Ship will follow the Shipping Lane to ensure consistent cargo transportation within the simulation environment. -- coordinate. The Ship will follow the Shipping Lane to ensure consistent cargo transportation within the simulation environment.
-- --
-- --
-- # Developer Note
--
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- @field #AI_CARGO_SHIP -- @field #AI_CARGO_SHIP
AI_CARGO_SHIP = { AI_CARGO_SHIP = {
ClassName = "AI_CARGO_SHIP", ClassName = "AI_CARGO_SHIP",

View File

@@ -19,7 +19,7 @@
-- --
-- ## Missions: -- ## Missions:
-- --
-- [ESC - Escorting](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/ESC%20-%20Escorting) -- [ESC - Escorting](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_Escort)
-- --
-- === -- ===
-- --
@@ -147,8 +147,8 @@
-- @image Escorting.JPG -- @image Escorting.JPG
---
--- @type AI_ESCORT -- @type AI_ESCORT
-- @extends AI.AI_Formation#AI_FORMATION -- @extends AI.AI_Formation#AI_FORMATION
@@ -168,10 +168,17 @@
-- --
-- -- First find the GROUP object and the CLIENT object. -- -- First find the GROUP object and the CLIENT object.
-- local EscortUnit = CLIENT:FindByName( "Unit Name" ) -- The Unit Name is the name of the unit flagged with the skill Client in the mission editor. -- local EscortUnit = CLIENT:FindByName( "Unit Name" ) -- The Unit Name is the name of the unit flagged with the skill Client in the mission editor.
-- local EscortGroup = GROUP:FindByName( "Group Name" ) -- The Group Name is the name of the group that will escort the Escort Client. -- local EscortGroup = SET_GROUP:New():FilterPrefixes("Escort"):FilterOnce() -- The the group name of the escorts contains "Escort".
-- --
-- -- Now use these 2 objects to construct the new EscortPlanes object. -- -- Now use these 2 objects to construct the new EscortPlanes object.
-- EscortPlanes = AI_ESCORT:New( EscortUnit, EscortGroup, "Desert", "Welcome to the mission. You are escorted by a plane with code name 'Desert', which can be instructed through the F10 radio menu." ) -- EscortPlanes = AI_ESCORT:New( EscortUnit, EscortGroup, "Desert", "Welcome to the mission. You are escorted by a plane with code name 'Desert', which can be instructed through the F10 radio menu." )
-- EscortPlanes:MenusAirplanes() -- create menus for airplanes
-- EscortPlanes:__Start(2)
--
-- # Developer Note
--
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
-- --
-- @field #AI_ESCORT -- @field #AI_ESCORT
AI_ESCORT = { AI_ESCORT = {
@@ -189,16 +196,9 @@ AI_ESCORT = {
TaskPoints = {} TaskPoints = {}
} }
--- @field Functional.Detection#DETECTION_AREAS -- @field Functional.Detection#DETECTION_AREAS
AI_ESCORT.Detection = nil AI_ESCORT.Detection = nil
--- MENUPARAM type
-- @type MENUPARAM
-- @field #AI_ESCORT ParamSelf
-- @field #Distance ParamDistance
-- @field #function ParamFunction
-- @field #string ParamMessage
--- AI_ESCORT class constructor for an AI group --- AI_ESCORT class constructor for an AI group
-- @param #AI_ESCORT self -- @param #AI_ESCORT self
-- @param Wrapper.Client#CLIENT EscortUnit The client escorted by the EscortGroup. -- @param Wrapper.Client#CLIENT EscortUnit The client escorted by the EscortGroup.
@@ -211,10 +211,14 @@ AI_ESCORT.Detection = nil
-- --
-- -- First find the GROUP object and the CLIENT object. -- -- First find the GROUP object and the CLIENT object.
-- local EscortUnit = CLIENT:FindByName( "Unit Name" ) -- The Unit Name is the name of the unit flagged with the skill Client in the mission editor. -- local EscortUnit = CLIENT:FindByName( "Unit Name" ) -- The Unit Name is the name of the unit flagged with the skill Client in the mission editor.
-- local EscortGroup = GROUP:FindByName( "Group Name" ) -- The Group Name is the name of the group that will escort the Escort Client. -- local EscortGroup = SET_GROUP:New():FilterPrefixes("Escort"):FilterOnce() -- The the group name of the escorts contains "Escort".
-- --
-- -- Now use these 2 objects to construct the new EscortPlanes object. -- -- Now use these 2 objects to construct the new EscortPlanes object.
-- EscortPlanes = AI_ESCORT:New( EscortUnit, EscortGroup, "Desert", "Welcome to the mission. You are escorted by a plane with code name 'Desert', which can be instructed through the F10 radio menu." ) -- EscortPlanes = AI_ESCORT:New( EscortUnit, EscortGroup, "Desert", "Welcome to the mission. You are escorted by a plane with code name 'Desert', which can be instructed through the F10 radio menu." )
-- EscortPlanes:MenusAirplanes() -- create menus for airplanes
-- EscortPlanes:__Start(2)
--
--
function AI_ESCORT:New( EscortUnit, EscortGroupSet, EscortName, EscortBriefing ) function AI_ESCORT:New( EscortUnit, EscortGroupSet, EscortName, EscortBriefing )
local self = BASE:Inherit( self, AI_FORMATION:New( EscortUnit, EscortGroupSet, EscortName, EscortBriefing ) ) -- #AI_ESCORT local self = BASE:Inherit( self, AI_FORMATION:New( EscortUnit, EscortGroupSet, EscortName, EscortBriefing ) ) -- #AI_ESCORT
@@ -227,10 +231,17 @@ function AI_ESCORT:New( EscortUnit, EscortGroupSet, EscortName, EscortBriefing )
self.EscortGroupSet = EscortGroupSet self.EscortGroupSet = EscortGroupSet
self.EscortGroupSet:SetSomeIteratorLimit( 8 ) self.EscortGroupSet:SetSomeIteratorLimit( 8 )
self.EscortBriefing = EscortBriefing self.EscortBriefing = EscortBriefing
self.Menu = {} self.Menu = {}
self.Menu.HoldAtEscortPosition = self.Menu.HoldAtEscortPosition or {}
self.Menu.HoldAtLeaderPosition = self.Menu.HoldAtLeaderPosition or {}
self.Menu.Flare = self.Menu.Flare or {}
self.Menu.Smoke = self.Menu.Smoke or {}
self.Menu.Targets = self.Menu.Targets or {}
self.Menu.ROE = self.Menu.ROE or {}
self.Menu.ROT = self.Menu.ROT or {}
-- if not EscortBriefing then -- if not EscortBriefing then
-- EscortGroup:MessageToClient( EscortGroup:GetCategoryName() .. " '" .. EscortName .. "' (" .. EscortGroup:GetCallsign() .. ") reporting! " .. -- EscortGroup:MessageToClient( EscortGroup:GetCategoryName() .. " '" .. EscortName .. "' (" .. EscortGroup:GetCallsign() .. ") reporting! " ..
@@ -250,7 +261,7 @@ function AI_ESCORT:New( EscortUnit, EscortGroupSet, EscortName, EscortBriefing )
EscortGroupSet:ForEachGroup( EscortGroupSet:ForEachGroup(
--- @param Core.Group#GROUP EscortGroup -- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup ) function( EscortGroup )
-- Set EscortGroup known at EscortUnit. -- Set EscortGroup known at EscortUnit.
if not self.PlayerUnit._EscortGroups then if not self.PlayerUnit._EscortGroups then
@@ -325,14 +336,14 @@ function AI_ESCORT:_InitEscortRoute( EscortGroup )
end end
--- @param #AI_ESCORT self -- @param #AI_ESCORT self
-- @param Core.Set#SET_GROUP EscortGroupSet -- @param Core.Set#SET_GROUP EscortGroupSet
function AI_ESCORT:onafterStart( EscortGroupSet ) function AI_ESCORT:onafterStart( EscortGroupSet )
self:F() self:F()
EscortGroupSet:ForEachGroup( EscortGroupSet:ForEachGroup(
--- @param Core.Group#GROUP EscortGroup -- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup ) function( EscortGroup )
EscortGroup:WayPointInitialize() EscortGroup:WayPointInitialize()
@@ -370,7 +381,7 @@ function AI_ESCORT:onafterStart( EscortGroupSet )
self:_InitFlightMenus() self:_InitFlightMenus()
self.EscortGroupSet:ForSomeGroupAlive( self.EscortGroupSet:ForSomeGroupAlive(
--- @param Core.Group#GROUP EscortGroup -- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup ) function( EscortGroup )
self:_InitEscortMenus( EscortGroup ) self:_InitEscortMenus( EscortGroup )
@@ -378,7 +389,7 @@ function AI_ESCORT:onafterStart( EscortGroupSet )
self:SetFlightModeFormation( EscortGroup ) self:SetFlightModeFormation( EscortGroup )
--- @param #AI_ESCORT self -- @param #AI_ESCORT self
-- @param Core.Event#EVENTDATA EventData -- @param Core.Event#EVENTDATA EventData
function EscortGroup:OnEventDeadOrCrash( EventData ) function EscortGroup:OnEventDeadOrCrash( EventData )
self:F( { "EventDead", EventData } ) self:F( { "EventDead", EventData } )
@@ -394,14 +405,14 @@ function AI_ESCORT:onafterStart( EscortGroupSet )
end end
--- @param #AI_ESCORT self -- @param #AI_ESCORT self
-- @param Core.Set#SET_GROUP EscortGroupSet -- @param Core.Set#SET_GROUP EscortGroupSet
function AI_ESCORT:onafterStop( EscortGroupSet ) function AI_ESCORT:onafterStop( EscortGroupSet )
self:F() self:F()
EscortGroupSet:ForEachGroup( EscortGroupSet:ForEachGroup(
--- @param Core.Group#GROUP EscortGroup -- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup ) function( EscortGroup )
EscortGroup:WayPointInitialize() EscortGroup:WayPointInitialize()
@@ -443,9 +454,9 @@ end
-- @param #AI_ESCORT self -- @param #AI_ESCORT self
-- @param #number XStart The start position on the X-axis in meters for the first group. -- @param #number XStart The start position on the X-axis in meters for the first group.
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group. -- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group. -- @param #number YStart The start position on the Y-axis in meters for the first group.
-- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group. -- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group.
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group. -- @param #number ZStart The start position on the Z-axis in meters for the first group.
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group. -- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
-- @param #number ZLevels The amount of levels on the Z-axis. -- @param #number ZLevels The amount of levels on the Z-axis.
-- @return #AI_ESCORT -- @return #AI_ESCORT
@@ -493,9 +504,9 @@ end
-- @param #AI_ESCORT self -- @param #AI_ESCORT self
-- @param #number XStart The start position on the X-axis in meters for the first group. -- @param #number XStart The start position on the X-axis in meters for the first group.
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group. -- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group. -- @param #number YStart The start position on the Y-axis in meters for the first group.
-- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group. -- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group.
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group. -- @param #number ZStart The start position on the Z-axis in meters for the first group.
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group. -- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
-- @param #number ZLevels The amount of levels on the Z-axis. -- @param #number ZLevels The amount of levels on the Z-axis.
-- @return #AI_ESCORT -- @return #AI_ESCORT
@@ -550,7 +561,7 @@ function AI_ESCORT:SetFlightMenuFormation( Formation )
local MenuFlightFormationID = MENU_GROUP_COMMAND:New( self.PlayerGroup, Formation, FlightMenuFormation, local MenuFlightFormationID = MENU_GROUP_COMMAND:New( self.PlayerGroup, Formation, FlightMenuFormation,
function ( self, Formation, ... ) function ( self, Formation, ... )
self.EscortGroupSet:ForSomeGroupAlive( self.EscortGroupSet:ForSomeGroupAlive(
--- @param Core.Group#GROUP EscortGroup -- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup, self, Formation, Arguments ) function( EscortGroup, self, Formation, Arguments )
if EscortGroup:IsAir() then if EscortGroup:IsAir() then
self:E({FormationID=FormationID}) self:E({FormationID=FormationID})
@@ -580,7 +591,7 @@ end
-- @param #AI_ESCORT self -- @param #AI_ESCORT self
-- @param #number XStart The start position on the X-axis in meters for the first group. -- @param #number XStart The start position on the X-axis in meters for the first group.
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group. -- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group. -- @param #number YStart The start position on the Y-axis in meters for the first group.
-- @return #AI_ESCORT -- @return #AI_ESCORT
function AI_ESCORT:MenuFormationTrail( XStart, XSpace, YStart ) function AI_ESCORT:MenuFormationTrail( XStart, XSpace, YStart )
@@ -594,7 +605,7 @@ end
-- @param #AI_ESCORT self -- @param #AI_ESCORT self
-- @param #number XStart The start position on the X-axis in meters for the first group. -- @param #number XStart The start position on the X-axis in meters for the first group.
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group. -- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group. -- @param #number YStart The start position on the Y-axis in meters for the first group.
-- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group. -- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group.
-- @return #AI_ESCORT -- @return #AI_ESCORT
function AI_ESCORT:MenuFormationStack( XStart, XSpace, YStart, YSpace ) function AI_ESCORT:MenuFormationStack( XStart, XSpace, YStart, YSpace )
@@ -609,8 +620,8 @@ end
-- This menu will appear under **Formation**. -- This menu will appear under **Formation**.
-- @param #AI_ESCORT self -- @param #AI_ESCORT self
-- @param #number XStart The start position on the X-axis in meters for the first group. -- @param #number XStart The start position on the X-axis in meters for the first group.
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group. -- @param #number YStart The start position on the Y-axis in meters for the first group.
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group. -- @param #number ZStart The start position on the Z-axis in meters for the first group.
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group. -- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
-- @return #AI_ESCORT -- @return #AI_ESCORT
function AI_ESCORT:MenuFormationLeftLine( XStart, YStart, ZStart, ZSpace ) function AI_ESCORT:MenuFormationLeftLine( XStart, YStart, ZStart, ZSpace )
@@ -625,8 +636,8 @@ end
-- This menu will appear under **Formation**. -- This menu will appear under **Formation**.
-- @param #AI_ESCORT self -- @param #AI_ESCORT self
-- @param #number XStart The start position on the X-axis in meters for the first group. -- @param #number XStart The start position on the X-axis in meters for the first group.
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group. -- @param #number YStart The start position on the Y-axis in meters for the first group.
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group. -- @param #number ZStart The start position on the Z-axis in meters for the first group.
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group. -- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
-- @return #AI_ESCORT -- @return #AI_ESCORT
function AI_ESCORT:MenuFormationRightLine( XStart, YStart, ZStart, ZSpace ) function AI_ESCORT:MenuFormationRightLine( XStart, YStart, ZStart, ZSpace )
@@ -642,8 +653,8 @@ end
-- @param #AI_ESCORT self -- @param #AI_ESCORT self
-- @param #number XStart The start position on the X-axis in meters for the first group. -- @param #number XStart The start position on the X-axis in meters for the first group.
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group. -- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group. -- @param #number YStart The start position on the Y-axis in meters for the first group.
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group. -- @param #number ZStart The start position on the Z-axis in meters for the first group.
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group. -- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
-- @return #AI_ESCORT -- @return #AI_ESCORT
function AI_ESCORT:MenuFormationLeftWing( XStart, XSpace, YStart, ZStart, ZSpace ) function AI_ESCORT:MenuFormationLeftWing( XStart, XSpace, YStart, ZStart, ZSpace )
@@ -659,8 +670,8 @@ end
-- @param #AI_ESCORT self -- @param #AI_ESCORT self
-- @param #number XStart The start position on the X-axis in meters for the first group. -- @param #number XStart The start position on the X-axis in meters for the first group.
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group. -- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group. -- @param #number YStart The start position on the Y-axis in meters for the first group.
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group. -- @param #number ZStart The start position on the Z-axis in meters for the first group.
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group. -- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
-- @return #AI_ESCORT -- @return #AI_ESCORT
function AI_ESCORT:MenuFormationRightWing( XStart, XSpace, YStart, ZStart, ZSpace ) function AI_ESCORT:MenuFormationRightWing( XStart, XSpace, YStart, ZStart, ZSpace )
@@ -676,9 +687,9 @@ end
-- @param #AI_ESCORT self -- @param #AI_ESCORT self
-- @param #number XStart The start position on the X-axis in meters for the first group. -- @param #number XStart The start position on the X-axis in meters for the first group.
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group. -- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group. -- @param #number YStart The start position on the Y-axis in meters for the first group.
-- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group. -- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group.
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group. -- @param #number ZStart The start position on the Z-axis in meters for the first group.
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group. -- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
-- @return #AI_ESCORT -- @return #AI_ESCORT
function AI_ESCORT:MenuFormationCenterWing( XStart, XSpace, YStart, YSpace, ZStart, ZSpace ) function AI_ESCORT:MenuFormationCenterWing( XStart, XSpace, YStart, YSpace, ZStart, ZSpace )
@@ -694,9 +705,9 @@ end
-- @param #AI_ESCORT self -- @param #AI_ESCORT self
-- @param #number XStart The start position on the X-axis in meters for the first group. -- @param #number XStart The start position on the X-axis in meters for the first group.
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group. -- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group. -- @param #number YStart The start position on the Y-axis in meters for the first group.
-- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group. -- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group.
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group. -- @param #number ZStart The start position on the Z-axis in meters for the first group.
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group. -- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
-- @return #AI_ESCORT -- @return #AI_ESCORT
function AI_ESCORT:MenuFormationVic( XStart, XSpace, YStart, YSpace, ZStart, ZSpace ) function AI_ESCORT:MenuFormationVic( XStart, XSpace, YStart, YSpace, ZStart, ZSpace )
@@ -712,9 +723,9 @@ end
-- @param #AI_ESCORT self -- @param #AI_ESCORT self
-- @param #number XStart The start position on the X-axis in meters for the first group. -- @param #number XStart The start position on the X-axis in meters for the first group.
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group. -- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group. -- @param #number YStart The start position on the Y-axis in meters for the first group.
-- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group. -- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group.
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group. -- @param #number ZStart The start position on the Z-axis in meters for the first group.
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group. -- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
-- @param #number ZLevels The amount of levels on the Z-axis. -- @param #number ZLevels The amount of levels on the Z-axis.
-- @return #AI_ESCORT -- @return #AI_ESCORT
@@ -764,7 +775,7 @@ end
function AI_ESCORT:SetFlightMenuHoldAtEscortPosition() function AI_ESCORT:SetFlightMenuHoldAtEscortPosition()
for _, MenuHoldAtEscortPosition in pairs( self.Menu.HoldAtEscortPosition ) do for _, MenuHoldAtEscortPosition in pairs( self.Menu.HoldAtEscortPosition or {} ) do
local FlightMenuReportNavigation = MENU_GROUP:New( self.PlayerGroup, "Navigation", self.FlightMenu ) local FlightMenuReportNavigation = MENU_GROUP:New( self.PlayerGroup, "Navigation", self.FlightMenu )
local FlightMenuHoldPosition = MENU_GROUP_COMMAND local FlightMenuHoldPosition = MENU_GROUP_COMMAND
@@ -785,7 +796,7 @@ end
function AI_ESCORT:SetEscortMenuHoldAtEscortPosition( EscortGroup ) function AI_ESCORT:SetEscortMenuHoldAtEscortPosition( EscortGroup )
for _, HoldAtEscortPosition in pairs( self.Menu.HoldAtEscortPosition ) do for _, HoldAtEscortPosition in pairs( self.Menu.HoldAtEscortPosition or {}) do
if EscortGroup:IsAir() then if EscortGroup:IsAir() then
local EscortGroupName = EscortGroup:GetName() local EscortGroupName = EscortGroup:GetName()
local EscortMenuReportNavigation = MENU_GROUP:New( self.PlayerGroup, "Navigation", EscortGroup.EscortMenu ) local EscortMenuReportNavigation = MENU_GROUP:New( self.PlayerGroup, "Navigation", EscortGroup.EscortMenu )
@@ -853,7 +864,7 @@ end
function AI_ESCORT:SetFlightMenuHoldAtLeaderPosition() function AI_ESCORT:SetFlightMenuHoldAtLeaderPosition()
for _, MenuHoldAtLeaderPosition in pairs( self.Menu.HoldAtLeaderPosition ) do for _, MenuHoldAtLeaderPosition in pairs( self.Menu.HoldAtLeaderPosition or {}) do
local FlightMenuReportNavigation = MENU_GROUP:New( self.PlayerGroup, "Navigation", self.FlightMenu ) local FlightMenuReportNavigation = MENU_GROUP:New( self.PlayerGroup, "Navigation", self.FlightMenu )
local FlightMenuHoldAtLeaderPosition = MENU_GROUP_COMMAND local FlightMenuHoldAtLeaderPosition = MENU_GROUP_COMMAND
@@ -874,7 +885,7 @@ end
function AI_ESCORT:SetEscortMenuHoldAtLeaderPosition( EscortGroup ) function AI_ESCORT:SetEscortMenuHoldAtLeaderPosition( EscortGroup )
for _, HoldAtLeaderPosition in pairs( self.Menu.HoldAtLeaderPosition ) do for _, HoldAtLeaderPosition in pairs( self.Menu.HoldAtLeaderPosition or {}) do
if EscortGroup:IsAir() then if EscortGroup:IsAir() then
local EscortGroupName = EscortGroup:GetName() local EscortGroupName = EscortGroup:GetName()
@@ -999,7 +1010,7 @@ end
function AI_ESCORT:SetFlightMenuFlare() function AI_ESCORT:SetFlightMenuFlare()
for _, MenuFlare in pairs( self.Menu.Flare) do for _, MenuFlare in pairs( self.Menu.Flare or {}) do
local FlightMenuReportNavigation = MENU_GROUP:New( self.PlayerGroup, "Navigation", self.FlightMenu ) local FlightMenuReportNavigation = MENU_GROUP:New( self.PlayerGroup, "Navigation", self.FlightMenu )
local FlightMenuFlare = MENU_GROUP:New( self.PlayerGroup, MenuFlare.MenuText, FlightMenuReportNavigation ) local FlightMenuFlare = MENU_GROUP:New( self.PlayerGroup, MenuFlare.MenuText, FlightMenuReportNavigation )
@@ -1014,7 +1025,7 @@ end
function AI_ESCORT:SetEscortMenuFlare( EscortGroup ) function AI_ESCORT:SetEscortMenuFlare( EscortGroup )
for _, MenuFlare in pairs( self.Menu.Flare) do for _, MenuFlare in pairs( self.Menu.Flare or {}) do
if EscortGroup:IsAir() then if EscortGroup:IsAir() then
local EscortGroupName = EscortGroup:GetName() local EscortGroupName = EscortGroup:GetName()
@@ -1059,7 +1070,7 @@ end
function AI_ESCORT:SetFlightMenuSmoke() function AI_ESCORT:SetFlightMenuSmoke()
for _, MenuSmoke in pairs( self.Menu.Smoke) do for _, MenuSmoke in pairs( self.Menu.Smoke or {}) do
local FlightMenuReportNavigation = MENU_GROUP:New( self.PlayerGroup, "Navigation", self.FlightMenu ) local FlightMenuReportNavigation = MENU_GROUP:New( self.PlayerGroup, "Navigation", self.FlightMenu )
local FlightMenuSmoke = MENU_GROUP:New( self.PlayerGroup, MenuSmoke.MenuText, FlightMenuReportNavigation ) local FlightMenuSmoke = MENU_GROUP:New( self.PlayerGroup, MenuSmoke.MenuText, FlightMenuReportNavigation )
@@ -1076,7 +1087,7 @@ end
function AI_ESCORT:SetEscortMenuSmoke( EscortGroup ) function AI_ESCORT:SetEscortMenuSmoke( EscortGroup )
for _, MenuSmoke in pairs( self.Menu.Smoke) do for _, MenuSmoke in pairs( self.Menu.Smoke or {}) do
if EscortGroup:IsAir() then if EscortGroup:IsAir() then
local EscortGroupName = EscortGroup:GetName() local EscortGroupName = EscortGroup:GetName()
@@ -1169,7 +1180,7 @@ function AI_ESCORT:SetFlightMenuTargets()
local FlightMenuAttackNearbyAir = MENU_GROUP_COMMAND:New( self.PlayerGroup, "Attack nearest airborne targets", self.FlightMenuAttack, AI_ESCORT._FlightAttackNearestTarget, self, self.__Enum.ReportType.Air ):SetTag( "Attack" ) local FlightMenuAttackNearbyAir = MENU_GROUP_COMMAND:New( self.PlayerGroup, "Attack nearest airborne targets", self.FlightMenuAttack, AI_ESCORT._FlightAttackNearestTarget, self, self.__Enum.ReportType.Air ):SetTag( "Attack" )
local FlightMenuAttackNearbyGround = MENU_GROUP_COMMAND:New( self.PlayerGroup, "Attack nearest ground targets", self.FlightMenuAttack, AI_ESCORT._FlightAttackNearestTarget, self, self.__Enum.ReportType.Ground ):SetTag( "Attack" ) local FlightMenuAttackNearbyGround = MENU_GROUP_COMMAND:New( self.PlayerGroup, "Attack nearest ground targets", self.FlightMenuAttack, AI_ESCORT._FlightAttackNearestTarget, self, self.__Enum.ReportType.Ground ):SetTag( "Attack" )
for _, MenuTargets in pairs( self.Menu.Targets) do for _, MenuTargets in pairs( self.Menu.Targets or {}) do
MenuTargets.FlightReportTargetsScheduler = SCHEDULER:New( self, self._FlightReportTargetsScheduler, {}, MenuTargets.Interval, MenuTargets.Interval ) MenuTargets.FlightReportTargetsScheduler = SCHEDULER:New( self, self._FlightReportTargetsScheduler, {}, MenuTargets.Interval, MenuTargets.Interval )
end end
@@ -1179,7 +1190,7 @@ end
function AI_ESCORT:SetEscortMenuTargets( EscortGroup ) function AI_ESCORT:SetEscortMenuTargets( EscortGroup )
for _, MenuTargets in pairs( self.Menu.Targets) do for _, MenuTargets in pairs( self.Menu.Targets or {} or {}) do
if EscortGroup:IsAir() then if EscortGroup:IsAir() then
local EscortGroupName = EscortGroup:GetName() local EscortGroupName = EscortGroup:GetName()
--local EscortMenuReportTargets = MENU_GROUP:New( self.PlayerGroup, "Report targets", EscortGroup.EscortMenu ) --local EscortMenuReportTargets = MENU_GROUP:New( self.PlayerGroup, "Report targets", EscortGroup.EscortMenu )
@@ -1231,7 +1242,7 @@ function AI_ESCORT:MenuAssistedAttack()
self:F() self:F()
self.EscortGroupSet:ForSomeGroupAlive( self.EscortGroupSet:ForSomeGroupAlive(
--- @param Core.Group#GROUP EscortGroup -- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup ) function( EscortGroup )
if not EscortGroup:IsAir() then if not EscortGroup:IsAir() then
-- Request assistance from other escorts. -- Request assistance from other escorts.
@@ -1246,7 +1257,7 @@ end
function AI_ESCORT:SetFlightMenuROE() function AI_ESCORT:SetFlightMenuROE()
for _, MenuROE in pairs( self.Menu.ROE) do for _, MenuROE in pairs( self.Menu.ROE or {}) do
local FlightMenuROE = MENU_GROUP:New( self.PlayerGroup, "Rule Of Engagement", self.FlightMenu ) local FlightMenuROE = MENU_GROUP:New( self.PlayerGroup, "Rule Of Engagement", self.FlightMenu )
local FlightMenuROEHoldFire = MENU_GROUP_COMMAND:New( self.PlayerGroup, "Hold fire", FlightMenuROE, AI_ESCORT._FlightROEHoldFire, self, "Holding weapons!" ) local FlightMenuROEHoldFire = MENU_GROUP_COMMAND:New( self.PlayerGroup, "Hold fire", FlightMenuROE, AI_ESCORT._FlightROEHoldFire, self, "Holding weapons!" )
@@ -1261,7 +1272,7 @@ end
function AI_ESCORT:SetEscortMenuROE( EscortGroup ) function AI_ESCORT:SetEscortMenuROE( EscortGroup )
for _, MenuROE in pairs( self.Menu.ROE) do for _, MenuROE in pairs( self.Menu.ROE or {}) do
if EscortGroup:IsAir() then if EscortGroup:IsAir() then
local EscortGroupName = EscortGroup:GetName() local EscortGroupName = EscortGroup:GetName()
@@ -1302,7 +1313,7 @@ end
function AI_ESCORT:SetFlightMenuROT() function AI_ESCORT:SetFlightMenuROT()
for _, MenuROT in pairs( self.Menu.ROT) do for _, MenuROT in pairs( self.Menu.ROT or {}) do
local FlightMenuROT = MENU_GROUP:New( self.PlayerGroup, "Reaction On Threat", self.FlightMenu ) local FlightMenuROT = MENU_GROUP:New( self.PlayerGroup, "Reaction On Threat", self.FlightMenu )
local FlightMenuROTNoReaction = MENU_GROUP_COMMAND:New( self.PlayerGroup, "Fight until death", FlightMenuROT, AI_ESCORT._FlightROTNoReaction, self, "Fighting until death!" ) local FlightMenuROTNoReaction = MENU_GROUP_COMMAND:New( self.PlayerGroup, "Fight until death", FlightMenuROT, AI_ESCORT._FlightROTNoReaction, self, "Fighting until death!" )
@@ -1317,7 +1328,7 @@ end
function AI_ESCORT:SetEscortMenuROT( EscortGroup ) function AI_ESCORT:SetEscortMenuROT( EscortGroup )
for _, MenuROT in pairs( self.Menu.ROT) do for _, MenuROT in pairs( self.Menu.ROT or {}) do
if EscortGroup:IsAir() then if EscortGroup:IsAir() then
local EscortGroupName = EscortGroup:GetName() local EscortGroupName = EscortGroup:GetName()
@@ -1375,7 +1386,7 @@ function AI_ESCORT:SetEscortMenuResumeMission( EscortGroup )
end end
--- @param #AI_ESCORT self -- @param #AI_ESCORT self
-- @param Wrapper.Group#GROUP OrbitGroup -- @param Wrapper.Group#GROUP OrbitGroup
-- @param Wrapper.Group#GROUP EscortGroup -- @param Wrapper.Group#GROUP EscortGroup
-- @param #number OrbitHeight -- @param #number OrbitHeight
@@ -1419,7 +1430,7 @@ function AI_ESCORT:_HoldPosition( OrbitGroup, EscortGroup, OrbitHeight, OrbitSec
end end
--- @param #AI_ESCORT self -- @param #AI_ESCORT self
-- @param Wrapper.Group#GROUP OrbitGroup -- @param Wrapper.Group#GROUP OrbitGroup
-- @param #number OrbitHeight -- @param #number OrbitHeight
-- @param #number OrbitSeconds -- @param #number OrbitSeconds
@@ -1428,7 +1439,7 @@ function AI_ESCORT:_FlightHoldPosition( OrbitGroup, OrbitHeight, OrbitSeconds )
local EscortUnit = self.PlayerUnit local EscortUnit = self.PlayerUnit
self.EscortGroupSet:ForEachGroupAlive( self.EscortGroupSet:ForEachGroupAlive(
--- @param Core.Group#GROUP EscortGroup -- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup, OrbitGroup ) function( EscortGroup, OrbitGroup )
if EscortGroup:IsAir() then if EscortGroup:IsAir() then
if OrbitGroup == nil then if OrbitGroup == nil then
@@ -1456,7 +1467,7 @@ end
function AI_ESCORT:_FlightJoinUp() function AI_ESCORT:_FlightJoinUp()
self.EscortGroupSet:ForEachGroupAlive( self.EscortGroupSet:ForEachGroupAlive(
--- @param Core.Group#GROUP EscortGroup -- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup ) function( EscortGroup )
if EscortGroup:IsAir() then if EscortGroup:IsAir() then
self:_JoinUp( EscortGroup ) self:_JoinUp( EscortGroup )
@@ -1471,7 +1482,7 @@ end
-- @param #AI_ESCORT self -- @param #AI_ESCORT self
-- @param #number XStart The start position on the X-axis in meters for the first group. -- @param #number XStart The start position on the X-axis in meters for the first group.
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group. -- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group. -- @param #number YStart The start position on the Y-axis in meters for the first group.
-- @return #AI_ESCORT -- @return #AI_ESCORT
function AI_ESCORT:_EscortFormationTrail( EscortGroup, XStart, XSpace, YStart ) function AI_ESCORT:_EscortFormationTrail( EscortGroup, XStart, XSpace, YStart )
@@ -1483,7 +1494,7 @@ end
function AI_ESCORT:_FlightFormationTrail( XStart, XSpace, YStart ) function AI_ESCORT:_FlightFormationTrail( XStart, XSpace, YStart )
self.EscortGroupSet:ForEachGroupAlive( self.EscortGroupSet:ForEachGroupAlive(
--- @param Core.Group#GROUP EscortGroup -- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup ) function( EscortGroup )
if EscortGroup:IsAir() then if EscortGroup:IsAir() then
self:_EscortFormationTrail( EscortGroup, XStart, XSpace, YStart ) self:_EscortFormationTrail( EscortGroup, XStart, XSpace, YStart )
@@ -1510,7 +1521,7 @@ end
function AI_ESCORT:_FlightFormationStack( XStart, XSpace, YStart, YSpace ) function AI_ESCORT:_FlightFormationStack( XStart, XSpace, YStart, YSpace )
self.EscortGroupSet:ForEachGroupAlive( self.EscortGroupSet:ForEachGroupAlive(
--- @param Core.Group#GROUP EscortGroup -- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup ) function( EscortGroup )
if EscortGroup:IsAir() then if EscortGroup:IsAir() then
self:_EscortFormationStack( EscortGroup, XStart, XSpace, YStart, YSpace ) self:_EscortFormationStack( EscortGroup, XStart, XSpace, YStart, YSpace )
@@ -1533,7 +1544,7 @@ end
function AI_ESCORT:_FlightFlare( Color, Message ) function AI_ESCORT:_FlightFlare( Color, Message )
self.EscortGroupSet:ForEachGroupAlive( self.EscortGroupSet:ForEachGroupAlive(
--- @param Core.Group#GROUP EscortGroup -- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup ) function( EscortGroup )
if EscortGroup:IsAir() then if EscortGroup:IsAir() then
self:_Flare( EscortGroup, Color, Message ) self:_Flare( EscortGroup, Color, Message )
@@ -1556,7 +1567,7 @@ end
function AI_ESCORT:_FlightSmoke( Color, Message ) function AI_ESCORT:_FlightSmoke( Color, Message )
self.EscortGroupSet:ForEachGroupAlive( self.EscortGroupSet:ForEachGroupAlive(
--- @param Core.Group#GROUP EscortGroup -- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup ) function( EscortGroup )
if EscortGroup:IsAir() then if EscortGroup:IsAir() then
self:_Smoke( EscortGroup, Color, Message ) self:_Smoke( EscortGroup, Color, Message )
@@ -1587,7 +1598,7 @@ end
function AI_ESCORT:_FlightSwitchReportNearbyTargets( ReportTargets ) function AI_ESCORT:_FlightSwitchReportNearbyTargets( ReportTargets )
self.EscortGroupSet:ForEachGroupAlive( self.EscortGroupSet:ForEachGroupAlive(
--- @param Core.Group#GROUP EscortGroup -- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup ) function( EscortGroup )
if EscortGroup:IsAir() then if EscortGroup:IsAir() then
self:_EscortSwitchReportNearbyTargets( EscortGroup, ReportTargets ) self:_EscortSwitchReportNearbyTargets( EscortGroup, ReportTargets )
@@ -1679,7 +1690,7 @@ function AI_ESCORT:_ScanTargets( ScanDuration )
end end
--- @param Wrapper.Group#GROUP EscortGroup -- @param Wrapper.Group#GROUP EscortGroup
-- @param #AI_ESCORT self -- @param #AI_ESCORT self
function AI_ESCORT.___Resume( EscortGroup, self ) function AI_ESCORT.___Resume( EscortGroup, self )
@@ -1701,7 +1712,7 @@ function AI_ESCORT.___Resume( EscortGroup, self )
end end
--- @param #AI_ESCORT self -- @param #AI_ESCORT self
-- @param Wrapper.Group#GROUP EscortGroup -- @param Wrapper.Group#GROUP EscortGroup
-- @param #number WayPoint -- @param #number WayPoint
function AI_ESCORT:_ResumeMission( EscortGroup, WayPoint ) function AI_ESCORT:_ResumeMission( EscortGroup, WayPoint )
@@ -1723,7 +1734,7 @@ function AI_ESCORT:_ResumeMission( EscortGroup, WayPoint )
end end
--- @param #AI_ESCORT self -- @param #AI_ESCORT self
-- @param Wrapper.Group#GROUP EscortGroup The escort group that will attack the detected item. -- @param Wrapper.Group#GROUP EscortGroup The escort group that will attack the detected item.
-- @param Functional.Detection#DETECTION_BASE.DetectedItem DetectedItem -- @param Functional.Detection#DETECTION_BASE.DetectedItem DetectedItem
function AI_ESCORT:_AttackTarget( EscortGroup, DetectedItem ) function AI_ESCORT:_AttackTarget( EscortGroup, DetectedItem )
@@ -1743,7 +1754,7 @@ function AI_ESCORT:_AttackTarget( EscortGroup, DetectedItem )
local AttackUnitTasks = {} local AttackUnitTasks = {}
DetectedSet:ForEachUnit( DetectedSet:ForEachUnit(
--- @param Wrapper.Unit#UNIT DetectedUnit -- @param Wrapper.Unit#UNIT DetectedUnit
function( DetectedUnit, Tasks ) function( DetectedUnit, Tasks )
if DetectedUnit:IsAlive() then if DetectedUnit:IsAlive() then
AttackUnitTasks[#AttackUnitTasks+1] = EscortGroup:TaskAttackUnit( DetectedUnit ) AttackUnitTasks[#AttackUnitTasks+1] = EscortGroup:TaskAttackUnit( DetectedUnit )
@@ -1767,7 +1778,7 @@ function AI_ESCORT:_AttackTarget( EscortGroup, DetectedItem )
local Tasks = {} local Tasks = {}
DetectedSet:ForEachUnit( DetectedSet:ForEachUnit(
--- @param Wrapper.Unit#UNIT DetectedUnit -- @param Wrapper.Unit#UNIT DetectedUnit
function( DetectedUnit, Tasks ) function( DetectedUnit, Tasks )
if DetectedUnit:IsAlive() then if DetectedUnit:IsAlive() then
Tasks[#Tasks+1] = EscortGroup:TaskFireAtPoint( DetectedUnit:GetVec2(), 50 ) Tasks[#Tasks+1] = EscortGroup:TaskFireAtPoint( DetectedUnit:GetVec2(), 50 )
@@ -1795,7 +1806,7 @@ end
function AI_ESCORT:_FlightAttackTarget( DetectedItem ) function AI_ESCORT:_FlightAttackTarget( DetectedItem )
self.EscortGroupSet:ForEachGroupAlive( self.EscortGroupSet:ForEachGroupAlive(
--- @param Core.Group#GROUP EscortGroup -- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup, DetectedItem ) function( EscortGroup, DetectedItem )
if EscortGroup:IsAir() then if EscortGroup:IsAir() then
self:_AttackTarget( EscortGroup, DetectedItem ) self:_AttackTarget( EscortGroup, DetectedItem )
@@ -1842,7 +1853,7 @@ end
--- ---
--- @param #AI_ESCORT self -- @param #AI_ESCORT self
-- @param Wrapper.Group#GROUP EscortGroup The escort group that will attack the detected item. -- @param Wrapper.Group#GROUP EscortGroup The escort group that will attack the detected item.
-- @param Functional.Detection#DETECTION_BASE.DetectedItem DetectedItem -- @param Functional.Detection#DETECTION_BASE.DetectedItem DetectedItem
function AI_ESCORT:_AssistTarget( EscortGroup, DetectedItem ) function AI_ESCORT:_AssistTarget( EscortGroup, DetectedItem )
@@ -1854,7 +1865,7 @@ function AI_ESCORT:_AssistTarget( EscortGroup, DetectedItem )
local Tasks = {} local Tasks = {}
DetectedSet:ForEachUnit( DetectedSet:ForEachUnit(
--- @param Wrapper.Unit#UNIT DetectedUnit -- @param Wrapper.Unit#UNIT DetectedUnit
function( DetectedUnit, Tasks ) function( DetectedUnit, Tasks )
if DetectedUnit:IsAlive() then if DetectedUnit:IsAlive() then
Tasks[#Tasks+1] = EscortGroup:TaskFireAtPoint( DetectedUnit:GetVec2(), 50 ) Tasks[#Tasks+1] = EscortGroup:TaskFireAtPoint( DetectedUnit:GetVec2(), 50 )
@@ -1881,7 +1892,7 @@ end
function AI_ESCORT:_FlightROEHoldFire( EscortROEMessage ) function AI_ESCORT:_FlightROEHoldFire( EscortROEMessage )
self.EscortGroupSet:ForEachGroupAlive( self.EscortGroupSet:ForEachGroupAlive(
--- @param Wrapper.Group#GROUP EscortGroup -- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup ) function( EscortGroup )
self:_ROE( EscortGroup, EscortGroup.OptionROEHoldFire, EscortROEMessage ) self:_ROE( EscortGroup, EscortGroup.OptionROEHoldFire, EscortROEMessage )
end end
@@ -1890,7 +1901,7 @@ end
function AI_ESCORT:_FlightROEOpenFire( EscortROEMessage ) function AI_ESCORT:_FlightROEOpenFire( EscortROEMessage )
self.EscortGroupSet:ForEachGroupAlive( self.EscortGroupSet:ForEachGroupAlive(
--- @param Wrapper.Group#GROUP EscortGroup -- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup ) function( EscortGroup )
self:_ROE( EscortGroup, EscortGroup.OptionROEOpenFire, EscortROEMessage ) self:_ROE( EscortGroup, EscortGroup.OptionROEOpenFire, EscortROEMessage )
end end
@@ -1899,7 +1910,7 @@ end
function AI_ESCORT:_FlightROEReturnFire( EscortROEMessage ) function AI_ESCORT:_FlightROEReturnFire( EscortROEMessage )
self.EscortGroupSet:ForEachGroupAlive( self.EscortGroupSet:ForEachGroupAlive(
--- @param Wrapper.Group#GROUP EscortGroup -- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup ) function( EscortGroup )
self:_ROE( EscortGroup, EscortGroup.OptionROEReturnFire, EscortROEMessage ) self:_ROE( EscortGroup, EscortGroup.OptionROEReturnFire, EscortROEMessage )
end end
@@ -1908,7 +1919,7 @@ end
function AI_ESCORT:_FlightROEWeaponFree( EscortROEMessage ) function AI_ESCORT:_FlightROEWeaponFree( EscortROEMessage )
self.EscortGroupSet:ForEachGroupAlive( self.EscortGroupSet:ForEachGroupAlive(
--- @param Wrapper.Group#GROUP EscortGroup -- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup ) function( EscortGroup )
self:_ROE( EscortGroup, EscortGroup.OptionROEWeaponFree, EscortROEMessage ) self:_ROE( EscortGroup, EscortGroup.OptionROEWeaponFree, EscortROEMessage )
end end
@@ -1924,7 +1935,7 @@ end
function AI_ESCORT:_FlightROTNoReaction( EscortROTMessage ) function AI_ESCORT:_FlightROTNoReaction( EscortROTMessage )
self.EscortGroupSet:ForEachGroupAlive( self.EscortGroupSet:ForEachGroupAlive(
--- @param Wrapper.Group#GROUP EscortGroup -- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup ) function( EscortGroup )
self:_ROT( EscortGroup, EscortGroup.OptionROTNoReaction, EscortROTMessage ) self:_ROT( EscortGroup, EscortGroup.OptionROTNoReaction, EscortROTMessage )
end end
@@ -1933,7 +1944,7 @@ end
function AI_ESCORT:_FlightROTPassiveDefense( EscortROTMessage ) function AI_ESCORT:_FlightROTPassiveDefense( EscortROTMessage )
self.EscortGroupSet:ForEachGroupAlive( self.EscortGroupSet:ForEachGroupAlive(
--- @param Wrapper.Group#GROUP EscortGroup -- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup ) function( EscortGroup )
self:_ROT( EscortGroup, EscortGroup.OptionROTPassiveDefense, EscortROTMessage ) self:_ROT( EscortGroup, EscortGroup.OptionROTPassiveDefense, EscortROTMessage )
end end
@@ -1942,7 +1953,7 @@ end
function AI_ESCORT:_FlightROTEvadeFire( EscortROTMessage ) function AI_ESCORT:_FlightROTEvadeFire( EscortROTMessage )
self.EscortGroupSet:ForEachGroupAlive( self.EscortGroupSet:ForEachGroupAlive(
--- @param Wrapper.Group#GROUP EscortGroup -- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup ) function( EscortGroup )
self:_ROT( EscortGroup, EscortGroup.OptionROTEvadeFire, EscortROTMessage ) self:_ROT( EscortGroup, EscortGroup.OptionROTEvadeFire, EscortROTMessage )
end end
@@ -1951,7 +1962,7 @@ end
function AI_ESCORT:_FlightROTVertical( EscortROTMessage ) function AI_ESCORT:_FlightROTVertical( EscortROTMessage )
self.EscortGroupSet:ForEachGroupAlive( self.EscortGroupSet:ForEachGroupAlive(
--- @param Wrapper.Group#GROUP EscortGroup -- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup ) function( EscortGroup )
self:_ROT( EscortGroup, EscortGroup.OptionROTVertical, EscortROTMessage ) self:_ROT( EscortGroup, EscortGroup.OptionROTVertical, EscortROTMessage )
end end
@@ -2178,5 +2189,3 @@ function AI_ESCORT:_FlightReportTargetsScheduler()
return false return false
end end

View File

@@ -20,7 +20,12 @@
--- Models the automatic assignment of AI escorts to player flights. --- Models the automatic assignment of AI escorts to player flights.
--
-- # Developer Note
-- --
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- === -- ===
-- --
-- @field #AI_ESCORT_DISPATCHER -- @field #AI_ESCORT_DISPATCHER

View File

@@ -20,7 +20,12 @@
--- Models the assignment of AI escorts to player flights upon request using the radio menu. --- Models the assignment of AI escorts to player flights upon request using the radio menu.
--
-- # Developer Note
-- --
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- === -- ===
-- --
-- @field #AI_ESCORT_DISPATCHER_REQUEST -- @field #AI_ESCORT_DISPATCHER_REQUEST

View File

@@ -19,7 +19,7 @@
-- --
-- ## Missions: -- ## Missions:
-- --
-- [ESC - Escorting](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/ESC%20-%20Escorting) -- [ESC - Escorting](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_Escort)
-- --
-- === -- ===
-- --
@@ -137,6 +137,11 @@
-- Escort groups can have their own mission. This menu item will allow the escort group to resume their Mission from a given waypoint. -- Escort groups can have their own mission. This menu item will allow the escort group to resume their Mission from a given waypoint.
-- Note that this is really fantastic, as you now have the dynamic of taking control of the escort groups, and allowing them to resume their path or mission. -- Note that this is really fantastic, as you now have the dynamic of taking control of the escort groups, and allowing them to resume their path or mission.
-- --
-- # Developer Note
--
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- === -- ===
-- --
-- ### Authors: **FlightControl** -- ### Authors: **FlightControl**
@@ -292,7 +297,7 @@ function AI_ESCORT_REQUEST:onafterStop( EscortGroupSet )
self:F() self:F()
EscortGroupSet:ForEachGroup( EscortGroupSet:ForEachGroup(
--- @param Core.Group#GROUP EscortGroup --- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup ) function( EscortGroup )
EscortGroup:WayPointInitialize() EscortGroup:WayPointInitialize()

View File

@@ -7,13 +7,13 @@
-- * Assign a group leader that will guide the large formation path. -- * Assign a group leader that will guide the large formation path.
-- --
-- === -- ===
-- --
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/FOR%20-%20Formation) -- ## Additional Material:
-- --
-- === -- * **Demo Missions:** [GitHub](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_Formation)
-- -- * **YouTube videos:** [Playlist](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl0bFIJ9jIdYM22uaWmIN4oz)
-- ### [YouTube Playlist](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl0bFIJ9jIdYM22uaWmIN4oz) -- * **Guides:** None
-- --
-- === -- ===
-- --
-- ### Author: **FlightControl** -- ### Author: **FlightControl**
@@ -31,11 +31,11 @@
-- @field Core.Set#SET_GROUP FollowGroupSet -- @field Core.Set#SET_GROUP FollowGroupSet
-- @field #string FollowName -- @field #string FollowName
-- @field #AI_FORMATION.MODE FollowMode The mode the escort is in. -- @field #AI_FORMATION.MODE FollowMode The mode the escort is in.
-- @field Scheduler#SCHEDULER FollowScheduler The instance of the SCHEDULER class. -- @field Core.Scheduler#SCHEDULER FollowScheduler The instance of the SCHEDULER class.
-- @field #number FollowDistance The current follow distance. -- @field #number FollowDistance The current follow distance.
-- @field #boolean ReportTargets If true, nearby targets are reported. -- @field #boolean ReportTargets If true, nearby targets are reported.
-- @Field DCSTypes#AI.Option.Air.val.ROE OptionROE Which ROE is set to the FollowGroup. -- @field DCS#AI.Option.Air.val.ROE OptionROE Which ROE is set to the FollowGroup.
-- @field DCSTypes#AI.Option.Air.val.REACTION_ON_THREAT OptionReactionOnThreat Which REACTION_ON_THREAT is set to the FollowGroup. -- @field DCS#AI.Option.Air.val.REACTION_ON_THREAT OptionReactionOnThreat Which REACTION_ON_THREAT is set to the FollowGroup.
-- @field #number dtFollow Time step between position updates. -- @field #number dtFollow Time step between position updates.
@@ -92,7 +92,12 @@
-- local LargeFormation = AI_FORMATION:New( LeaderUnit, FollowGroupSet, "Center Wing Formation", "Briefing" ) -- local LargeFormation = AI_FORMATION:New( LeaderUnit, FollowGroupSet, "Center Wing Formation", "Briefing" )
-- LargeFormation:FormationCenterWing( 500, 50, 0, 250, 250 ) -- LargeFormation:FormationCenterWing( 500, 50, 0, 250, 250 )
-- LargeFormation:__Start( 1 ) -- LargeFormation:__Start( 1 )
--
-- # Developer Note
-- --
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- @field #AI_FORMATION -- @field #AI_FORMATION
AI_FORMATION = { AI_FORMATION = {
ClassName = "AI_FORMATION", ClassName = "AI_FORMATION",
@@ -159,15 +164,6 @@ AI_FORMATION.__Enum.ReportType = {
Ground = "G", Ground = "G",
} }
--- MENUPARAM type
-- @type MENUPARAM
-- @field #AI_FORMATION ParamSelf
-- @field #number ParamDistance
-- @field #function ParamFunction
-- @field #string ParamMessage
--- AI_FORMATION class constructor for an AI group --- AI_FORMATION class constructor for an AI group
-- @param #AI_FORMATION self -- @param #AI_FORMATION self
-- @param Wrapper.Unit#UNIT FollowUnit The UNIT leading the FolllowGroupSet. -- @param Wrapper.Unit#UNIT FollowUnit The UNIT leading the FolllowGroupSet.
@@ -1000,7 +996,7 @@ function AI_FORMATION:SetFlightModeMission( FollowGroup )
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Mission ) FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Mission )
else else
self.FollowGroupSet:ForSomeGroupAlive( self.FollowGroupSet:ForSomeGroupAlive(
--- @param Core.Group#GROUP EscortGroup --- @param Wrapper.Group#GROUP EscortGroup
function( FollowGroup ) function( FollowGroup )
FollowGroup:SetState( FollowGroup, "PreviousMode", FollowGroup:GetState( FollowGroup, "Mode" ) ) FollowGroup:SetState( FollowGroup, "PreviousMode", FollowGroup:GetState( FollowGroup, "Mode" ) )
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Mission ) FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Mission )
@@ -1024,7 +1020,7 @@ function AI_FORMATION:SetFlightModeAttack( FollowGroup )
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Attack ) FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Attack )
else else
self.FollowGroupSet:ForSomeGroupAlive( self.FollowGroupSet:ForSomeGroupAlive(
--- @param Core.Group#GROUP EscortGroup --- @param Wrapper.Group#GROUP EscortGroup
function( FollowGroup ) function( FollowGroup )
FollowGroup:SetState( FollowGroup, "PreviousMode", FollowGroup:GetState( FollowGroup, "Mode" ) ) FollowGroup:SetState( FollowGroup, "PreviousMode", FollowGroup:GetState( FollowGroup, "Mode" ) )
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Attack ) FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Attack )
@@ -1048,7 +1044,7 @@ function AI_FORMATION:SetFlightModeFormation( FollowGroup )
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Formation ) FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Formation )
else else
self.FollowGroupSet:ForSomeGroupAlive( self.FollowGroupSet:ForSomeGroupAlive(
--- @param Core.Group#GROUP EscortGroup --- @param Wrapper.Group#GROUP EscortGroup
function( FollowGroup ) function( FollowGroup )
FollowGroup:SetState( FollowGroup, "PreviousMode", FollowGroup:GetState( FollowGroup, "Mode" ) ) FollowGroup:SetState( FollowGroup, "PreviousMode", FollowGroup:GetState( FollowGroup, "Mode" ) )
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Formation ) FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Formation )

View File

@@ -16,7 +16,7 @@
-- --
-- === -- ===
-- --
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/PAT%20-%20Patrolling) -- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_Patrol)
-- --
-- === -- ===
-- --
@@ -27,8 +27,8 @@
-- ### Author: **FlightControl** -- ### Author: **FlightControl**
-- ### Contributions: -- ### Contributions:
-- --
-- * **[Dutch_Baron](https://forums.eagle.ru/member.php?u=112075)**: Working together with James has resulted in the creation of the AI_BALANCER class. James has shared his ideas on balancing AI with air units, and together we made a first design which you can use now :-) -- * **Dutch_Baron**: Working together with James has resulted in the creation of the AI_BALANCER class. James has shared his ideas on balancing AI with air units, and together we made a first design which you can use now :-)
-- * **[Pikey](https://forums.eagle.ru/member.php?u=62835)**: Testing and API concept review. -- * **Pikey**: Testing and API concept review.
-- --
-- === -- ===
-- --
@@ -144,7 +144,12 @@
-- When the AI is damaged, it is required that a new AIControllable is started. However, damage cannon be foreseen early on. -- When the AI is damaged, it is required that a new AIControllable is started. However, damage cannon be foreseen early on.
-- Therefore, when the damage threshold is reached, the AI will return immediately to the home base (RTB). -- Therefore, when the damage threshold is reached, the AI will return immediately to the home base (RTB).
-- Use the method @{#AI_PATROL_ZONE.ManageDamage}() to have this process in place. -- Use the method @{#AI_PATROL_ZONE.ManageDamage}() to have this process in place.
--
-- # Developer Note
-- --
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- === -- ===
-- --
-- @field #AI_PATROL_ZONE -- @field #AI_PATROL_ZONE

View File

@@ -54,6 +54,11 @@ do -- ACT_ACCOUNT
-- The state transition method needs to start with the name **OnAfter + the name of the state**. -- The state transition method needs to start with the name **OnAfter + the name of the state**.
-- These state transition methods need to provide a return value, which is specified at the function description. -- These state transition methods need to provide a return value, which is specified at the function description.
-- --
-- # Developer Note
--
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- @type ACT_ACCOUNT -- @type ACT_ACCOUNT
-- @field Core.Set#SET_UNIT TargetSetUnit -- @field Core.Set#SET_UNIT TargetSetUnit
-- @extends Core.Fsm#FSM_PROCESS -- @extends Core.Fsm#FSM_PROCESS
@@ -137,7 +142,7 @@ end -- ACT_ACCOUNT
do -- ACT_ACCOUNT_DEADS do -- ACT_ACCOUNT_DEADS
--- # @{#ACT_ACCOUNT_DEADS} FSM class, extends @{Core.Fsm.Account#ACT_ACCOUNT} --- # @{#ACT_ACCOUNT_DEADS} FSM class, extends @{#ACT_ACCOUNT}
-- --
-- The ACT_ACCOUNT_DEADS class accounts (detects, counts and reports) successful kills of DCS units. -- The ACT_ACCOUNT_DEADS class accounts (detects, counts and reports) successful kills of DCS units.
-- The process is given a @{Core.Set} of units that will be tracked upon successful destruction. -- The process is given a @{Core.Set} of units that will be tracked upon successful destruction.

View File

@@ -52,9 +52,14 @@
-- The state transition method needs to start with the name **OnAfter + the name of the state**. -- The state transition method needs to start with the name **OnAfter + the name of the state**.
-- These state transition methods need to provide a return value, which is specified at the function description. -- These state transition methods need to provide a return value, which is specified at the function description.
-- --
-- # Developer Note
--
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- === -- ===
-- --
-- # 1) @{#ACT_ASSIGN_ACCEPT} class, extends @{Core.Fsm.Assign#ACT_ASSIGN} -- # 1) @{#ACT_ASSIGN_ACCEPT} class, extends @{Core.Fsm#ACT_ASSIGN}
-- --
-- The ACT_ASSIGN_ACCEPT class accepts by default a task for a player. No player intervention is allowed to reject the task. -- The ACT_ASSIGN_ACCEPT class accepts by default a task for a player. No player intervention is allowed to reject the task.
-- --
@@ -64,7 +69,7 @@
-- --
-- === -- ===
-- --
-- # 2) @{#ACT_ASSIGN_MENU_ACCEPT} class, extends @{Core.Fsm.Assign#ACT_ASSIGN} -- # 2) @{#ACT_ASSIGN_MENU_ACCEPT} class, extends @{Core.Fsm#ACT_ASSIGN}
-- --
-- The ACT_ASSIGN_MENU_ACCEPT class accepts a task when the player accepts the task through an added menu option. -- The ACT_ASSIGN_MENU_ACCEPT class accepts a task when the player accepts the task through an added menu option.
-- This assignment type is useful to conditionally allow the player to choose whether or not he would accept the task. -- This assignment type is useful to conditionally allow the player to choose whether or not he would accept the task.

View File

@@ -48,7 +48,7 @@
-- --
-- === -- ===
-- --
-- # 1) @{#ACT_ASSIST_SMOKE_TARGETS_ZONE} class, extends @{Core.Fsm.Route#ACT_ASSIST} -- # 1) @{#ACT_ASSIST_SMOKE_TARGETS_ZONE} class, extends @{#ACT_ASSIST}
-- --
-- The ACT_ASSIST_SMOKE_TARGETS_ZONE class implements the core functions to smoke targets in a @{Core.Zone}. -- The ACT_ASSIST_SMOKE_TARGETS_ZONE class implements the core functions to smoke targets in a @{Core.Zone}.
-- The targets are smoked within a certain range around each target, simulating a realistic smoking behaviour. -- The targets are smoked within a certain range around each target, simulating a realistic smoking behaviour.
@@ -58,6 +58,11 @@
-- --
-- * @{#ACT_ASSIST_SMOKE_TARGETS_ZONE.New}(): Creates a new ACT_ASSIST_SMOKE_TARGETS_ZONE object. -- * @{#ACT_ASSIST_SMOKE_TARGETS_ZONE.New}(): Creates a new ACT_ASSIST_SMOKE_TARGETS_ZONE object.
-- --
-- # Developer Note
--
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- === -- ===
-- --
-- @module Actions.Act_Assist -- @module Actions.Act_Assist

View File

@@ -60,7 +60,7 @@
-- --
-- === -- ===
-- --
-- # 1) @{#ACT_ROUTE_ZONE} class, extends @{Core.Fsm.Route#ACT_ROUTE} -- # 1) @{#ACT_ROUTE_ZONE} class, extends @{#ACT_ROUTE}
-- --
-- The ACT_ROUTE_ZONE class implements the core functions to route an AIR @{Wrapper.Controllable} player @{Wrapper.Unit} to a @{Core.Zone}. -- The ACT_ROUTE_ZONE class implements the core functions to route an AIR @{Wrapper.Controllable} player @{Wrapper.Unit} to a @{Core.Zone}.
-- The player receives on perioding times messages with the coordinates of the route to follow. -- The player receives on perioding times messages with the coordinates of the route to follow.
@@ -70,6 +70,11 @@
-- --
-- * @{#ACT_ROUTE_ZONE.New}(): Creates a new ACT_ROUTE_ZONE object. -- * @{#ACT_ROUTE_ZONE.New}(): Creates a new ACT_ROUTE_ZONE object.
-- --
-- # Developer Note
--
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- === -- ===
-- --
-- @module Actions.Act_Route -- @module Actions.Act_Route

View File

@@ -86,7 +86,7 @@
-- There are also dispatchers that make AI work together to transport cargo automatically!!! -- There are also dispatchers that make AI work together to transport cargo automatically!!!
-- --
-- - @{AI.AI_Cargo_Dispatcher_APC} derived classes will create for your dynamic cargo handlers controlled by AI ground vehicle groups (APCs) to transport cargo between sites. -- - @{AI.AI_Cargo_Dispatcher_APC} derived classes will create for your dynamic cargo handlers controlled by AI ground vehicle groups (APCs) to transport cargo between sites.
-- - @{AI.AI_Cargo_Dispatcher_Helicopters} derived classes will create for your dynamic cargo handlers controlled by AI helicopter groups to transport cargo between sites. -- - @{AI.AI_Cargo_Dispatcher_Helicopter} derived classes will create for your dynamic cargo handlers controlled by AI helicopter groups to transport cargo between sites.
-- --
-- ## 3.3) Cargo transportation tasking. -- ## 3.3) Cargo transportation tasking.
-- --
@@ -233,7 +233,12 @@
-- Note that this option is optional, so can be omitted. The default value of the RR is 250 meters. -- Note that this option is optional, so can be omitted. The default value of the RR is 250 meters.
-- * **NR=** Provide the maximum range in meters when the cargo units will be boarded within the carrier during boarding. -- * **NR=** Provide the maximum range in meters when the cargo units will be boarded within the carrier during boarding.
-- Note that this option is optional, so can be omitted. The default value of the RR is 10 meters. -- Note that this option is optional, so can be omitted. The default value of the RR is 10 meters.
--
-- # Developer Note
-- --
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- === -- ===
-- --
-- ### Author: **FlightControl** -- ### Author: **FlightControl**
@@ -365,7 +370,7 @@ CARGOS = {}
do -- CARGO do -- CARGO
--- @type CARGO -- @type CARGO
-- @extends Core.Fsm#FSM_PROCESS -- @extends Core.Fsm#FSM_PROCESS
-- @field #string Type A string defining the type of the cargo. eg. Engineers, Equipment, Screwdrivers. -- @field #string Type A string defining the type of the cargo. eg. Engineers, Equipment, Screwdrivers.
-- @field #string Name A string defining the name of the cargo. The name is the unique identifier of the cargo. -- @field #string Name A string defining the name of the cargo. The name is the unique identifier of the cargo.
@@ -393,7 +398,7 @@ do -- CARGO
-- --
-- * AI Armoured Personnel Carriers to transport cargo and engage in battles, using the @{AI.AI_Cargo_APC#AI_CARGO_APC} class. -- * AI Armoured Personnel Carriers to transport cargo and engage in battles, using the @{AI.AI_Cargo_APC#AI_CARGO_APC} class.
-- * AI Helicopters to transport cargo, using the @{AI.AI_Cargo_Helicopter#AI_CARGO_HELICOPTER} class. -- * AI Helicopters to transport cargo, using the @{AI.AI_Cargo_Helicopter#AI_CARGO_HELICOPTER} class.
-- * AI Planes to transport cargo, using the @{AI.AI_Cargo_Plane#AI_CARGO_PLANE} class. -- * AI Planes to transport cargo, using the @{AI.AI_Cargo_Airplane#AI_CARGO_AIRPLANE} class.
-- * AI Ships is planned. -- * AI Ships is planned.
-- --
-- The above cargo classes are also used by the TASK\_CARGO\_ classes to allow human players to transport cargo as part of a tasking: -- The above cargo classes are also used by the TASK\_CARGO\_ classes to allow human players to transport cargo as part of a tasking:
@@ -428,7 +433,7 @@ do -- CARGO
Reported = {}, Reported = {},
} }
--- @type CARGO.CargoObjects -- @type CARGO.CargoObjects
-- @map < #string, Wrapper.Positionable#POSITIONABLE > The alive POSITIONABLE objects representing the the cargo. -- @map < #string, Wrapper.Positionable#POSITIONABLE > The alive POSITIONABLE objects representing the the cargo.
--- CARGO Constructor. This class is an abstract class and should not be instantiated. --- CARGO Constructor. This class is an abstract class and should not be instantiated.
@@ -442,7 +447,7 @@ do -- CARGO
function CARGO:New( Type, Name, Weight, LoadRadius, NearRadius ) --R2.1 function CARGO:New( Type, Name, Weight, LoadRadius, NearRadius ) --R2.1
local self = BASE:Inherit( self, FSM:New() ) -- #CARGO local self = BASE:Inherit( self, FSM:New() ) -- #CARGO
self:F( { Type, Name, Weight, LoadRadius, NearRadius } ) self:T( { Type, Name, Weight, LoadRadius, NearRadius } )
self:SetStartState( "UnLoaded" ) self:SetStartState( "UnLoaded" )
self:AddTransition( { "UnLoaded", "Boarding" }, "Board", "Boarding" ) self:AddTransition( { "UnLoaded", "Boarding" }, "Board", "Boarding" )
@@ -706,7 +711,7 @@ do -- CARGO
-- @param #CARGO self -- @param #CARGO self
-- @return #CARGO -- @return #CARGO
function CARGO:Spawn( PointVec2 ) function CARGO:Spawn( PointVec2 )
self:F() self:T()
end end
@@ -807,7 +812,7 @@ do -- CARGO
-- @param Core.Point#COORDINATE Coordinate -- @param Core.Point#COORDINATE Coordinate
-- @return #boolean true if the CargoGroup is within the loading radius. -- @return #boolean true if the CargoGroup is within the loading radius.
function CARGO:IsInLoadRadius( Coordinate ) function CARGO:IsInLoadRadius( Coordinate )
self:F( { Coordinate, LoadRadius = self.LoadRadius } ) self:T( { Coordinate, LoadRadius = self.LoadRadius } )
local Distance = 0 local Distance = 0
if self:IsUnLoaded() then if self:IsUnLoaded() then
@@ -827,7 +832,7 @@ do -- CARGO
-- @param Core.Point#COORDINATE Coordinate -- @param Core.Point#COORDINATE Coordinate
-- @return #boolean true if the Cargo can report itself. -- @return #boolean true if the Cargo can report itself.
function CARGO:IsInReportRadius( Coordinate ) function CARGO:IsInReportRadius( Coordinate )
self:F( { Coordinate } ) self:T( { Coordinate } )
local Distance = 0 local Distance = 0
if self:IsUnLoaded() then if self:IsUnLoaded() then
@@ -848,23 +853,23 @@ do -- CARGO
-- @param #number NearRadius The radius when the cargo will board the Carrier (to avoid collision). -- @param #number NearRadius The radius when the cargo will board the Carrier (to avoid collision).
-- @return #boolean -- @return #boolean
function CARGO:IsNear( Coordinate, NearRadius ) function CARGO:IsNear( Coordinate, NearRadius )
--self:F( { PointVec2 = PointVec2, NearRadius = NearRadius } ) --self:T( { PointVec2 = PointVec2, NearRadius = NearRadius } )
if self.CargoObject:IsAlive() then if self.CargoObject:IsAlive() then
--local Distance = PointVec2:Get2DDistance( self.CargoObject:GetPointVec2() ) --local Distance = PointVec2:Get2DDistance( self.CargoObject:GetPointVec2() )
--self:F( { CargoObjectName = self.CargoObject:GetName() } ) --self:T( { CargoObjectName = self.CargoObject:GetName() } )
--self:F( { CargoObjectVec2 = self.CargoObject:GetVec2() } ) --self:T( { CargoObjectVec2 = self.CargoObject:GetVec2() } )
--self:F( { PointVec2 = PointVec2:GetVec2() } ) --self:T( { PointVec2 = PointVec2:GetVec2() } )
local Distance = Coordinate:Get2DDistance( self.CargoObject:GetCoordinate() ) local Distance = Coordinate:Get2DDistance( self.CargoObject:GetCoordinate() )
--self:F( { Distance = Distance, NearRadius = NearRadius or "nil" } ) --self:T( { Distance = Distance, NearRadius = NearRadius or "nil" } )
if Distance <= NearRadius then if Distance <= NearRadius then
--self:F( { PointVec2 = PointVec2, NearRadius = NearRadius, IsNear = true } ) --self:T( { PointVec2 = PointVec2, NearRadius = NearRadius, IsNear = true } )
return true return true
end end
end end
--self:F( { PointVec2 = PointVec2, NearRadius = NearRadius, IsNear = false } ) --self:T( { PointVec2 = PointVec2, NearRadius = NearRadius, IsNear = false } )
return false return false
end end
@@ -873,12 +878,12 @@ do -- CARGO
-- @param Core.Zone#ZONE_BASE Zone -- @param Core.Zone#ZONE_BASE Zone
-- @return #boolean **true** if cargo is in the Zone, **false** if cargo is not in the Zone. -- @return #boolean **true** if cargo is in the Zone, **false** if cargo is not in the Zone.
function CARGO:IsInZone( Zone ) function CARGO:IsInZone( Zone )
--self:F( { Zone } ) --self:T( { Zone } )
if self:IsLoaded() then if self:IsLoaded() then
return Zone:IsPointVec2InZone( self.CargoCarrier:GetPointVec2() ) return Zone:IsPointVec2InZone( self.CargoCarrier:GetPointVec2() )
else else
--self:F( { Size = self.CargoObject:GetSize(), Units = self.CargoObject:GetUnits() } ) --self:T( { Size = self.CargoObject:GetSize(), Units = self.CargoObject:GetUnits() } )
if self.CargoObject:GetSize() ~= 0 then if self.CargoObject:GetSize() ~= 0 then
return Zone:IsPointVec2InZone( self.CargoObject:GetPointVec2() ) return Zone:IsPointVec2InZone( self.CargoObject:GetPointVec2() )
else else
@@ -975,7 +980,7 @@ do -- CARGO
--- Report to a Carrier Group with a Flaring signal. --- Report to a Carrier Group with a Flaring signal.
-- @param #CARGO self -- @param #CARGO self
-- @param Utils#UTILS.FlareColor FlareColor the color of the flare. -- @param Utilities.Utils#UTILS.FlareColor FlareColor the color of the flare.
-- @return #CARGO -- @return #CARGO
function CARGO:ReportFlare( FlareColor ) function CARGO:ReportFlare( FlareColor )
@@ -984,7 +989,7 @@ do -- CARGO
--- Report to a Carrier Group with a Smoking signal. --- Report to a Carrier Group with a Smoking signal.
-- @param #CARGO self -- @param #CARGO self
-- @param Utils#UTILS.SmokeColor SmokeColor the color of the smoke. -- @param Utilities.Utils#UTILS.SmokeColor SmokeColor the color of the smoke.
-- @return #CARGO -- @return #CARGO
function CARGO:ReportSmoke( SmokeColor ) function CARGO:ReportSmoke( SmokeColor )
@@ -1029,7 +1034,7 @@ end -- CARGO
do -- CARGO_REPRESENTABLE do -- CARGO_REPRESENTABLE
--- @type CARGO_REPRESENTABLE -- @type CARGO_REPRESENTABLE
-- @extends #CARGO -- @extends #CARGO
-- @field test -- @field test
@@ -1051,7 +1056,7 @@ do -- CARGO_REPRESENTABLE
-- Inherit CARGO. -- Inherit CARGO.
local self = BASE:Inherit( self, CARGO:New( Type, Name, 0, LoadRadius, NearRadius ) ) -- #CARGO_REPRESENTABLE local self = BASE:Inherit( self, CARGO:New( Type, Name, 0, LoadRadius, NearRadius ) ) -- #CARGO_REPRESENTABLE
self:F( { Type, Name, LoadRadius, NearRadius } ) self:T( { Type, Name, LoadRadius, NearRadius } )
-- Descriptors. -- Descriptors.
local Desc=CargoObject:GetDesc() local Desc=CargoObject:GetDesc()
@@ -1081,7 +1086,7 @@ do -- CARGO_REPRESENTABLE
function CARGO_REPRESENTABLE:Destroy() function CARGO_REPRESENTABLE:Destroy()
-- Cargo objects are deleted from the _DATABASE and SET_CARGO objects. -- Cargo objects are deleted from the _DATABASE and SET_CARGO objects.
self:F( { CargoName = self:GetName() } ) self:T( { CargoName = self:GetName() } )
--_EVENTDISPATCHER:CreateEventDeleteCargo( self ) --_EVENTDISPATCHER:CreateEventDeleteCargo( self )
return self return self
@@ -1118,12 +1123,12 @@ do -- CARGO_REPRESENTABLE
CoordinateZone:Scan( { Object.Category.UNIT } ) CoordinateZone:Scan( { Object.Category.UNIT } )
for _, DCSUnit in pairs( CoordinateZone:GetScannedUnits() ) do for _, DCSUnit in pairs( CoordinateZone:GetScannedUnits() ) do
local NearUnit = UNIT:Find( DCSUnit ) local NearUnit = UNIT:Find( DCSUnit )
self:F({NearUnit=NearUnit}) self:T({NearUnit=NearUnit})
local NearUnitCoalition = NearUnit:GetCoalition() local NearUnitCoalition = NearUnit:GetCoalition()
local CargoCoalition = self:GetCoalition() local CargoCoalition = self:GetCoalition()
if NearUnitCoalition == CargoCoalition then if NearUnitCoalition == CargoCoalition then
local Attributes = NearUnit:GetDesc() local Attributes = NearUnit:GetDesc()
self:F({Desc=Attributes}) self:T({Desc=Attributes})
if NearUnit:HasAttribute( "Trucks" ) then if NearUnit:HasAttribute( "Trucks" ) then
MESSAGE:New( Message, 20, NearUnit:GetCallsign() .. " reporting - Cargo " .. self:GetName() ):ToGroup( TaskGroup ) MESSAGE:New( Message, 20, NearUnit:GetCallsign() .. " reporting - Cargo " .. self:GetName() ):ToGroup( TaskGroup )
break break
@@ -1137,7 +1142,7 @@ end -- CARGO_REPRESENTABLE
do -- CARGO_REPORTABLE do -- CARGO_REPORTABLE
--- @type CARGO_REPORTABLE -- @type CARGO_REPORTABLE
-- @extends #CARGO -- @extends #CARGO
CARGO_REPORTABLE = { CARGO_REPORTABLE = {
ClassName = "CARGO_REPORTABLE" ClassName = "CARGO_REPORTABLE"
@@ -1153,7 +1158,7 @@ do -- CARGO_REPORTABLE
-- @return #CARGO_REPORTABLE -- @return #CARGO_REPORTABLE
function CARGO_REPORTABLE:New( Type, Name, Weight, LoadRadius, NearRadius ) function CARGO_REPORTABLE:New( Type, Name, Weight, LoadRadius, NearRadius )
local self = BASE:Inherit( self, CARGO:New( Type, Name, Weight, LoadRadius, NearRadius ) ) -- #CARGO_REPORTABLE local self = BASE:Inherit( self, CARGO:New( Type, Name, Weight, LoadRadius, NearRadius ) ) -- #CARGO_REPORTABLE
self:F( { Type, Name, Weight, LoadRadius, NearRadius } ) self:T( { Type, Name, Weight, LoadRadius, NearRadius } )
return self return self
end end
@@ -1173,7 +1178,7 @@ end
do -- CARGO_PACKAGE do -- CARGO_PACKAGE
--- @type CARGO_PACKAGE -- @type CARGO_PACKAGE
-- @extends #CARGO_REPRESENTABLE -- @extends #CARGO_REPRESENTABLE
CARGO_PACKAGE = { CARGO_PACKAGE = {
ClassName = "CARGO_PACKAGE" ClassName = "CARGO_PACKAGE"
@@ -1190,7 +1195,7 @@ do -- CARGO_PACKAGE
-- @return #CARGO_PACKAGE -- @return #CARGO_PACKAGE
function CARGO_PACKAGE:New( CargoCarrier, Type, Name, Weight, LoadRadius, NearRadius ) function CARGO_PACKAGE:New( CargoCarrier, Type, Name, Weight, LoadRadius, NearRadius )
local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoCarrier, Type, Name, Weight, LoadRadius, NearRadius ) ) -- #CARGO_PACKAGE local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoCarrier, Type, Name, Weight, LoadRadius, NearRadius ) ) -- #CARGO_PACKAGE
self:F( { Type, Name, Weight, LoadRadius, NearRadius } ) self:T( { Type, Name, Weight, LoadRadius, NearRadius } )
self:T( CargoCarrier ) self:T( CargoCarrier )
self.CargoCarrier = CargoCarrier self.CargoCarrier = CargoCarrier
@@ -1208,7 +1213,7 @@ end
-- @param #number BoardDistance -- @param #number BoardDistance
-- @param #number Angle -- @param #number Angle
function CARGO_PACKAGE:onafterOnBoard( From, Event, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle ) function CARGO_PACKAGE:onafterOnBoard( From, Event, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
self:F() self:T()
self.CargoInAir = self.CargoCarrier:InAir() self.CargoInAir = self.CargoCarrier:InAir()
@@ -1241,7 +1246,7 @@ end
-- @param Wrapper.Unit#UNIT CargoCarrier -- @param Wrapper.Unit#UNIT CargoCarrier
-- @return #boolean -- @return #boolean
function CARGO_PACKAGE:IsNear( CargoCarrier ) function CARGO_PACKAGE:IsNear( CargoCarrier )
self:F() self:T()
local CargoCarrierPoint = CargoCarrier:GetCoordinate() local CargoCarrierPoint = CargoCarrier:GetCoordinate()
@@ -1266,7 +1271,7 @@ end
-- @param #number LoadDistance -- @param #number LoadDistance
-- @param #number Angle -- @param #number Angle
function CARGO_PACKAGE:onafterOnBoarded( From, Event, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle ) function CARGO_PACKAGE:onafterOnBoarded( From, Event, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
self:F() self:T()
if self:IsNear( CargoCarrier ) then if self:IsNear( CargoCarrier ) then
self:__Load( 1, CargoCarrier, Speed, LoadDistance, Angle ) self:__Load( 1, CargoCarrier, Speed, LoadDistance, Angle )
@@ -1287,7 +1292,7 @@ end
-- @param #number Radius -- @param #number Radius
-- @param #number Angle -- @param #number Angle
function CARGO_PACKAGE:onafterUnBoard( From, Event, To, CargoCarrier, Speed, UnLoadDistance, UnBoardDistance, Radius, Angle ) function CARGO_PACKAGE:onafterUnBoard( From, Event, To, CargoCarrier, Speed, UnLoadDistance, UnBoardDistance, Radius, Angle )
self:F() self:T()
self.CargoInAir = self.CargoCarrier:InAir() self.CargoInAir = self.CargoCarrier:InAir()
@@ -1326,7 +1331,7 @@ end
-- @param Wrapper.Unit#UNIT CargoCarrier -- @param Wrapper.Unit#UNIT CargoCarrier
-- @param #number Speed -- @param #number Speed
function CARGO_PACKAGE:onafterUnBoarded( From, Event, To, CargoCarrier, Speed ) function CARGO_PACKAGE:onafterUnBoarded( From, Event, To, CargoCarrier, Speed )
self:F() self:T()
if self:IsNear( CargoCarrier ) then if self:IsNear( CargoCarrier ) then
self:__UnLoad( 1, CargoCarrier, Speed ) self:__UnLoad( 1, CargoCarrier, Speed )
@@ -1345,7 +1350,7 @@ end
-- @param #number LoadDistance -- @param #number LoadDistance
-- @param #number Angle -- @param #number Angle
function CARGO_PACKAGE:onafterLoad( From, Event, To, CargoCarrier, Speed, LoadDistance, Angle ) function CARGO_PACKAGE:onafterLoad( From, Event, To, CargoCarrier, Speed, LoadDistance, Angle )
self:F() self:T()
self.CargoCarrier = CargoCarrier self.CargoCarrier = CargoCarrier
@@ -1373,7 +1378,7 @@ end
-- @param #number Distance -- @param #number Distance
-- @param #number Angle -- @param #number Angle
function CARGO_PACKAGE:onafterUnLoad( From, Event, To, CargoCarrier, Speed, Distance, Angle ) function CARGO_PACKAGE:onafterUnLoad( From, Event, To, CargoCarrier, Speed, Distance, Angle )
self:F() self:T()
local StartPointVec2 = self.CargoCarrier:GetPointVec2() local StartPointVec2 = self.CargoCarrier:GetPointVec2()
local CargoCarrierHeading = self.CargoCarrier:GetHeading() -- Get Heading of object in degrees. local CargoCarrierHeading = self.CargoCarrier:GetHeading() -- Get Heading of object in degrees.

View File

@@ -36,7 +36,12 @@ do -- CARGO_CRATE
-- --
-- * @{Tasking.Task_Cargo_Transport#TASK_CARGO_TRANSPORT} to transport cargo by human players. -- * @{Tasking.Task_Cargo_Transport#TASK_CARGO_TRANSPORT} to transport cargo by human players.
-- * @{Tasking.Task_Cargo_Transport#TASK_CARGO_CSAR} to transport downed pilots by human players. -- * @{Tasking.Task_Cargo_Transport#TASK_CARGO_CSAR} to transport downed pilots by human players.
--
-- # Developer Note
-- --
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- === -- ===
-- --
-- @field #CARGO_CRATE -- @field #CARGO_CRATE
@@ -54,7 +59,7 @@ do -- CARGO_CRATE
-- @return #CARGO_CRATE -- @return #CARGO_CRATE
function CARGO_CRATE:New( CargoStatic, Type, Name, LoadRadius, NearRadius ) function CARGO_CRATE:New( CargoStatic, Type, Name, LoadRadius, NearRadius )
local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoStatic, Type, Name, nil, LoadRadius, NearRadius ) ) -- #CARGO_CRATE local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoStatic, Type, Name, nil, LoadRadius, NearRadius ) ) -- #CARGO_CRATE
self:F( { Type, Name, NearRadius } ) self:T( { Type, Name, NearRadius } )
self.CargoObject = CargoStatic -- Wrapper.Static#STATIC self.CargoObject = CargoStatic -- Wrapper.Static#STATIC
@@ -111,7 +116,7 @@ do -- CARGO_CRATE
-- @param #string To -- @param #string To
-- @param Core.Point#POINT_VEC2 -- @param Core.Point#POINT_VEC2
function CARGO_CRATE:onenterUnLoaded( From, Event, To, ToPointVec2 ) function CARGO_CRATE:onenterUnLoaded( From, Event, To, ToPointVec2 )
--self:F( { ToPointVec2, From, Event, To } ) --self:T( { ToPointVec2, From, Event, To } )
local Angle = 180 local Angle = 180
local Speed = 10 local Speed = 10
@@ -148,7 +153,7 @@ do -- CARGO_CRATE
-- @param #string To -- @param #string To
-- @param Wrapper.Unit#UNIT CargoCarrier -- @param Wrapper.Unit#UNIT CargoCarrier
function CARGO_CRATE:onenterLoaded( From, Event, To, CargoCarrier ) function CARGO_CRATE:onenterLoaded( From, Event, To, CargoCarrier )
--self:F( { From, Event, To, CargoCarrier } ) --self:T( { From, Event, To, CargoCarrier } )
self.CargoCarrier = CargoCarrier self.CargoCarrier = CargoCarrier
@@ -185,7 +190,7 @@ do -- CARGO_CRATE
-- @param Core.Point#COORDINATE Coordinate -- @param Core.Point#COORDINATE Coordinate
-- @return #boolean true if the Cargo Crate is within the report radius. -- @return #boolean true if the Cargo Crate is within the report radius.
function CARGO_CRATE:IsInReportRadius( Coordinate ) function CARGO_CRATE:IsInReportRadius( Coordinate )
--self:F( { Coordinate, LoadRadius = self.LoadRadius } ) --self:T( { Coordinate, LoadRadius = self.LoadRadius } )
local Distance = 0 local Distance = 0
if self:IsUnLoaded() then if self:IsUnLoaded() then
@@ -205,7 +210,7 @@ do -- CARGO_CRATE
-- @param Core.Point#Coordinate Coordinate -- @param Core.Point#Coordinate Coordinate
-- @return #boolean true if the Cargo Crate is within the loading radius. -- @return #boolean true if the Cargo Crate is within the loading radius.
function CARGO_CRATE:IsInLoadRadius( Coordinate ) function CARGO_CRATE:IsInLoadRadius( Coordinate )
--self:F( { Coordinate, LoadRadius = self.NearRadius } ) --self:T( { Coordinate, LoadRadius = self.NearRadius } )
local Distance = 0 local Distance = 0
if self:IsUnLoaded() then if self:IsUnLoaded() then
@@ -226,7 +231,7 @@ do -- CARGO_CRATE
-- @return Core.Point#COORDINATE The current Coordinate of the first Cargo of the CargoGroup. -- @return Core.Point#COORDINATE The current Coordinate of the first Cargo of the CargoGroup.
-- @return #nil There is no valid Cargo in the CargoGroup. -- @return #nil There is no valid Cargo in the CargoGroup.
function CARGO_CRATE:GetCoordinate() function CARGO_CRATE:GetCoordinate()
--self:F() --self:T()
return self.CargoObject:GetCoordinate() return self.CargoObject:GetCoordinate()
end end
@@ -256,7 +261,7 @@ do -- CARGO_CRATE
-- @param #CARGO_CRATE self -- @param #CARGO_CRATE self
-- @param Core.Point#COORDINATE Coordinate -- @param Core.Point#COORDINATE Coordinate
function CARGO_CRATE:RouteTo( Coordinate ) function CARGO_CRATE:RouteTo( Coordinate )
self:F( {Coordinate = Coordinate } ) self:T( {Coordinate = Coordinate } )
end end
@@ -269,7 +274,7 @@ do -- CARGO_CRATE
-- @return #boolean The Cargo is near to the Carrier. -- @return #boolean The Cargo is near to the Carrier.
-- @return #nil The Cargo is not near to the Carrier. -- @return #nil The Cargo is not near to the Carrier.
function CARGO_CRATE:IsNear( CargoCarrier, NearRadius ) function CARGO_CRATE:IsNear( CargoCarrier, NearRadius )
self:F( {NearRadius = NearRadius } ) self:T( {NearRadius = NearRadius } )
return self:IsNear( CargoCarrier:GetCoordinate(), NearRadius ) return self:IsNear( CargoCarrier:GetCoordinate(), NearRadius )
end end
@@ -278,7 +283,7 @@ do -- CARGO_CRATE
-- @param #CARGO_CRATE self -- @param #CARGO_CRATE self
function CARGO_CRATE:Respawn() function CARGO_CRATE:Respawn()
self:F( { "Respawning crate " .. self:GetName() } ) self:T( { "Respawning crate " .. self:GetName() } )
-- Respawn the group... -- Respawn the group...
@@ -295,7 +300,7 @@ do -- CARGO_CRATE
-- @param #CARGO_CRATE self -- @param #CARGO_CRATE self
function CARGO_CRATE:onafterReset() function CARGO_CRATE:onafterReset()
self:F( { "Reset crate " .. self:GetName() } ) self:T( { "Reset crate " .. self:GetName() } )
-- Respawn the group... -- Respawn the group...

View File

@@ -38,7 +38,12 @@ do -- CARGO_GROUP
-- --
-- * @{Tasking.Task_Cargo_Transport#TASK_CARGO_TRANSPORT} to transport cargo by human players. -- * @{Tasking.Task_Cargo_Transport#TASK_CARGO_TRANSPORT} to transport cargo by human players.
-- * @{Tasking.Task_Cargo_Transport#TASK_CARGO_CSAR} to transport downed pilots by human players. -- * @{Tasking.Task_Cargo_Transport#TASK_CARGO_CSAR} to transport downed pilots by human players.
--
-- # Developer Note
-- --
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- @field #CARGO_GROUP CARGO_GROUP -- @field #CARGO_GROUP CARGO_GROUP
-- --
CARGO_GROUP = { CARGO_GROUP = {
@@ -59,7 +64,7 @@ do -- CARGO_GROUP
-- Inherit CAROG_REPORTABLE -- Inherit CAROG_REPORTABLE
local self = BASE:Inherit( self, CARGO_REPORTABLE:New( Type, Name, 0, LoadRadius, NearRadius ) ) -- #CARGO_GROUP local self = BASE:Inherit( self, CARGO_REPORTABLE:New( Type, Name, 0, LoadRadius, NearRadius ) ) -- #CARGO_GROUP
self:F( { Type, Name, LoadRadius } ) self:T( { Type, Name, LoadRadius } )
self.CargoSet = SET_CARGO:New() self.CargoSet = SET_CARGO:New()
self.CargoGroup = CargoGroup self.CargoGroup = CargoGroup
@@ -141,7 +146,7 @@ do -- CARGO_GROUP
-- @param #CARGO_GROUP self -- @param #CARGO_GROUP self
function CARGO_GROUP:Respawn() function CARGO_GROUP:Respawn()
self:F( { "Respawning" } ) self:T( { "Respawning" } )
for CargoID, CargoData in pairs( self.CargoSet:GetSet() ) do for CargoID, CargoData in pairs( self.CargoSet:GetSet() ) do
local Cargo = CargoData -- Cargo.Cargo#CARGO local Cargo = CargoData -- Cargo.Cargo#CARGO
@@ -222,7 +227,7 @@ do -- CARGO_GROUP
-- @param #CARGO_GROUP self -- @param #CARGO_GROUP self
function CARGO_GROUP:Regroup() function CARGO_GROUP:Regroup()
self:F("Regroup") self:T("Regroup")
if self.Grouped == false then if self.Grouped == false then
@@ -236,7 +241,7 @@ do -- CARGO_GROUP
for CargoUnitName, CargoUnit in pairs( self.CargoSet:GetSet() ) do for CargoUnitName, CargoUnit in pairs( self.CargoSet:GetSet() ) do
local CargoUnit = CargoUnit -- Cargo.CargoUnit#CARGO_UNIT local CargoUnit = CargoUnit -- Cargo.CargoUnit#CARGO_UNIT
self:F( { CargoUnit:GetName(), UnLoaded = CargoUnit:IsUnLoaded() } ) self:T( { CargoUnit:GetName(), UnLoaded = CargoUnit:IsUnLoaded() } )
if CargoUnit:IsUnLoaded() then if CargoUnit:IsUnLoaded() then
@@ -253,7 +258,7 @@ do -- CARGO_GROUP
-- Then we register the new group in the database -- Then we register the new group in the database
self.CargoGroup = GROUP:NewTemplate( GroupTemplate, GroupTemplate.CoalitionID, GroupTemplate.CategoryID, GroupTemplate.CountryID ) self.CargoGroup = GROUP:NewTemplate( GroupTemplate, GroupTemplate.CoalitionID, GroupTemplate.CategoryID, GroupTemplate.CountryID )
self:F( { "Regroup", GroupTemplate } ) self:T( { "Regroup", GroupTemplate } )
-- Now we spawn the new group based on the template created. -- Now we spawn the new group based on the template created.
self.CargoObject = _DATABASE:Spawn( GroupTemplate ) self.CargoObject = _DATABASE:Spawn( GroupTemplate )
@@ -266,7 +271,7 @@ do -- CARGO_GROUP
-- @param Core.Event#EVENTDATA EventData -- @param Core.Event#EVENTDATA EventData
function CARGO_GROUP:OnEventCargoDead( EventData ) function CARGO_GROUP:OnEventCargoDead( EventData )
self:E(EventData) self:T(EventData)
local Destroyed = false local Destroyed = false
@@ -291,7 +296,7 @@ do -- CARGO_GROUP
if Destroyed then if Destroyed then
self:Destroyed() self:Destroyed()
self:E( { "Cargo group destroyed" } ) self:T( { "Cargo group destroyed" } )
end end
end end
@@ -304,14 +309,14 @@ do -- CARGO_GROUP
-- @param Wrapper.Unit#UNIT CargoCarrier -- @param Wrapper.Unit#UNIT CargoCarrier
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier. -- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
function CARGO_GROUP:onafterBoard( From, Event, To, CargoCarrier, NearRadius, ... ) function CARGO_GROUP:onafterBoard( From, Event, To, CargoCarrier, NearRadius, ... )
self:F( { CargoCarrier.UnitName, From, Event, To, NearRadius = NearRadius } ) self:T( { CargoCarrier.UnitName, From, Event, To, NearRadius = NearRadius } )
NearRadius = NearRadius or self.NearRadius NearRadius = NearRadius or self.NearRadius
-- For each Cargo object within the CARGO_GROUPED, route each object to the CargoLoadPointVec2 -- For each Cargo object within the CARGO_GROUPED, route each object to the CargoLoadPointVec2
self.CargoSet:ForEach( self.CargoSet:ForEach(
function( Cargo, ... ) function( Cargo, ... )
self:F( { "Board Unit", Cargo:GetName( ), Cargo:IsDestroyed(), Cargo.CargoObject:IsAlive() } ) self:T( { "Board Unit", Cargo:GetName( ), Cargo:IsDestroyed(), Cargo.CargoObject:IsAlive() } )
local CargoGroup = Cargo.CargoObject --Wrapper.Group#GROUP local CargoGroup = Cargo.CargoObject --Wrapper.Group#GROUP
CargoGroup:OptionAlarmStateGreen() CargoGroup:OptionAlarmStateGreen()
Cargo:__Board( 1, CargoCarrier, NearRadius, ... ) Cargo:__Board( 1, CargoCarrier, NearRadius, ... )
@@ -329,7 +334,7 @@ do -- CARGO_GROUP
-- @param #string To -- @param #string To
-- @param Wrapper.Unit#UNIT CargoCarrier -- @param Wrapper.Unit#UNIT CargoCarrier
function CARGO_GROUP:onafterLoad( From, Event, To, CargoCarrier, ... ) function CARGO_GROUP:onafterLoad( From, Event, To, CargoCarrier, ... )
--self:F( { From, Event, To, CargoCarrier, ...} ) --self:T( { From, Event, To, CargoCarrier, ...} )
if From == "UnLoaded" then if From == "UnLoaded" then
-- For each Cargo object within the CARGO_GROUP, load each cargo to the CargoCarrier. -- For each Cargo object within the CARGO_GROUP, load each cargo to the CargoCarrier.
@@ -354,7 +359,7 @@ do -- CARGO_GROUP
-- @param Wrapper.Unit#UNIT CargoCarrier -- @param Wrapper.Unit#UNIT CargoCarrier
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier. -- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
function CARGO_GROUP:onafterBoarding( From, Event, To, CargoCarrier, NearRadius, ... ) function CARGO_GROUP:onafterBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
--self:F( { CargoCarrier.UnitName, From, Event, To } ) --self:T( { CargoCarrier.UnitName, From, Event, To } )
local Boarded = true local Boarded = true
local Cancelled = false local Cancelled = false
@@ -388,7 +393,7 @@ do -- CARGO_GROUP
if not Boarded then if not Boarded then
self:__Boarding( -5, CargoCarrier, NearRadius, ... ) self:__Boarding( -5, CargoCarrier, NearRadius, ... )
else else
self:F("Group Cargo is loaded") self:T("Group Cargo is loaded")
self:__Load( 1, CargoCarrier, ... ) self:__Load( 1, CargoCarrier, ... )
end end
else else
@@ -408,7 +413,7 @@ do -- CARGO_GROUP
-- @param Core.Point#POINT_VEC2 ToPointVec2 -- @param Core.Point#POINT_VEC2 ToPointVec2
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier. -- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
function CARGO_GROUP:onafterUnBoard( From, Event, To, ToPointVec2, NearRadius, ... ) function CARGO_GROUP:onafterUnBoard( From, Event, To, ToPointVec2, NearRadius, ... )
self:F( {From, Event, To, ToPointVec2, NearRadius } ) self:T( {From, Event, To, ToPointVec2, NearRadius } )
NearRadius = NearRadius or 25 NearRadius = NearRadius or 25
@@ -451,7 +456,7 @@ do -- CARGO_GROUP
-- @param Core.Point#POINT_VEC2 ToPointVec2 -- @param Core.Point#POINT_VEC2 ToPointVec2
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier. -- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
function CARGO_GROUP:onafterUnBoarding( From, Event, To, ToPointVec2, NearRadius, ... ) function CARGO_GROUP:onafterUnBoarding( From, Event, To, ToPointVec2, NearRadius, ... )
--self:F( { From, Event, To, ToPointVec2, NearRadius } ) --self:T( { From, Event, To, ToPointVec2, NearRadius } )
--local NearRadius = NearRadius or 25 --local NearRadius = NearRadius or 25
@@ -488,7 +493,7 @@ do -- CARGO_GROUP
-- @param #string To -- @param #string To
-- @param Core.Point#POINT_VEC2 ToPointVec2 -- @param Core.Point#POINT_VEC2 ToPointVec2
function CARGO_GROUP:onafterUnLoad( From, Event, To, ToPointVec2, ... ) function CARGO_GROUP:onafterUnLoad( From, Event, To, ToPointVec2, ... )
--self:F( { From, Event, To, ToPointVec2 } ) --self:T( { From, Event, To, ToPointVec2 } )
if From == "Loaded" then if From == "Loaded" then
@@ -606,7 +611,7 @@ do -- CARGO_GROUP
-- @param #CARGO_GROUP self -- @param #CARGO_GROUP self
-- @param Core.Point#COORDINATE Coordinate -- @param Core.Point#COORDINATE Coordinate
function CARGO_GROUP:RouteTo( Coordinate ) function CARGO_GROUP:RouteTo( Coordinate )
--self:F( {Coordinate = Coordinate } ) --self:T( {Coordinate = Coordinate } )
-- For each Cargo within the CargoSet, route each object to the Coordinate -- For each Cargo within the CargoSet, route each object to the Coordinate
self.CargoSet:ForEach( self.CargoSet:ForEach(
@@ -624,13 +629,13 @@ do -- CARGO_GROUP
-- @param #number NearRadius -- @param #number NearRadius
-- @return #boolean The Cargo is near to the Carrier or #nil if the Cargo is not near to the Carrier. -- @return #boolean The Cargo is near to the Carrier or #nil if the Cargo is not near to the Carrier.
function CARGO_GROUP:IsNear( CargoCarrier, NearRadius ) function CARGO_GROUP:IsNear( CargoCarrier, NearRadius )
self:F( {NearRadius = NearRadius } ) self:T( {NearRadius = NearRadius } )
for _, Cargo in pairs( self.CargoSet:GetSet() ) do for _, Cargo in pairs( self.CargoSet:GetSet() ) do
local Cargo = Cargo -- Cargo.Cargo#CARGO local Cargo = Cargo -- Cargo.Cargo#CARGO
if Cargo:IsAlive() then if Cargo:IsAlive() then
if Cargo:IsNear( CargoCarrier:GetCoordinate(), NearRadius ) then if Cargo:IsNear( CargoCarrier:GetCoordinate(), NearRadius ) then
self:F( "Near" ) self:T( "Near" )
return true return true
end end
end end
@@ -644,7 +649,7 @@ do -- CARGO_GROUP
-- @param Core.Point#COORDINATE Coordinate -- @param Core.Point#COORDINATE Coordinate
-- @return #boolean true if the Cargo Group is within the load radius. -- @return #boolean true if the Cargo Group is within the load radius.
function CARGO_GROUP:IsInLoadRadius( Coordinate ) function CARGO_GROUP:IsInLoadRadius( Coordinate )
--self:F( { Coordinate } ) --self:T( { Coordinate } )
local Cargo = self:GetFirstAlive() -- Cargo.Cargo#CARGO local Cargo = self:GetFirstAlive() -- Cargo.Cargo#CARGO
@@ -664,7 +669,7 @@ do -- CARGO_GROUP
return false return false
end end
self:F( { Distance = Distance, LoadRadius = self.LoadRadius } ) self:T( { Distance = Distance, LoadRadius = self.LoadRadius } )
if Distance <= self.LoadRadius then if Distance <= self.LoadRadius then
return true return true
else else
@@ -682,12 +687,12 @@ do -- CARGO_GROUP
-- @param Core.Point#Coordinate Coordinate -- @param Core.Point#Coordinate Coordinate
-- @return #boolean true if the Cargo Group is within the report radius. -- @return #boolean true if the Cargo Group is within the report radius.
function CARGO_GROUP:IsInReportRadius( Coordinate ) function CARGO_GROUP:IsInReportRadius( Coordinate )
--self:F( { Coordinate } ) --self:T( { Coordinate } )
local Cargo = self:GetFirstAlive() -- Cargo.Cargo#CARGO local Cargo = self:GetFirstAlive() -- Cargo.Cargo#CARGO
if Cargo then if Cargo then
self:F( { Cargo } ) self:T( { Cargo } )
local Distance = 0 local Distance = 0
if Cargo:IsUnLoaded() then if Cargo:IsUnLoaded() then
Distance = Coordinate:Get2DDistance( Cargo.CargoObject:GetCoordinate() ) Distance = Coordinate:Get2DDistance( Cargo.CargoObject:GetCoordinate() )
@@ -733,7 +738,7 @@ do -- CARGO_GROUP
-- @return #boolean **true** if the first element of the CargoGroup is in the Zone -- @return #boolean **true** if the first element of the CargoGroup is in the Zone
-- @return #boolean **false** if there is no element of the CargoGroup in the Zone. -- @return #boolean **false** if there is no element of the CargoGroup in the Zone.
function CARGO_GROUP:IsInZone( Zone ) function CARGO_GROUP:IsInZone( Zone )
--self:F( { Zone } ) --self:T( { Zone } )
local Cargo = self.CargoSet:GetFirst() -- Cargo.Cargo#CARGO local Cargo = self.CargoSet:GetFirst() -- Cargo.Cargo#CARGO

View File

@@ -29,7 +29,12 @@ do -- CARGO_SLINGLOAD
-- --
-- * @{Tasking.Task_Cargo_Transport#TASK_CARGO_TRANSPORT} to transport cargo by human players. -- * @{Tasking.Task_Cargo_Transport#TASK_CARGO_TRANSPORT} to transport cargo by human players.
-- * @{Tasking.Task_Cargo_Transport#TASK_CARGO_CSAR} to transport downed pilots by human players. -- * @{Tasking.Task_Cargo_Transport#TASK_CARGO_CSAR} to transport downed pilots by human players.
--
-- # Developer Note
-- --
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- === -- ===
-- --
-- @field #CARGO_SLINGLOAD -- @field #CARGO_SLINGLOAD
@@ -47,7 +52,7 @@ do -- CARGO_SLINGLOAD
-- @return #CARGO_SLINGLOAD -- @return #CARGO_SLINGLOAD
function CARGO_SLINGLOAD:New( CargoStatic, Type, Name, LoadRadius, NearRadius ) function CARGO_SLINGLOAD:New( CargoStatic, Type, Name, LoadRadius, NearRadius )
local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoStatic, Type, Name, nil, LoadRadius, NearRadius ) ) -- #CARGO_SLINGLOAD local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoStatic, Type, Name, nil, LoadRadius, NearRadius ) ) -- #CARGO_SLINGLOAD
self:F( { Type, Name, NearRadius } ) self:T( { Type, Name, NearRadius } )
self.CargoObject = CargoStatic self.CargoObject = CargoStatic
@@ -125,7 +130,7 @@ do -- CARGO_SLINGLOAD
-- @param Core.Point#COORDINATE Coordinate -- @param Core.Point#COORDINATE Coordinate
-- @return #boolean true if the Cargo Crate is within the report radius. -- @return #boolean true if the Cargo Crate is within the report radius.
function CARGO_SLINGLOAD:IsInReportRadius( Coordinate ) function CARGO_SLINGLOAD:IsInReportRadius( Coordinate )
--self:F( { Coordinate, LoadRadius = self.LoadRadius } ) --self:T( { Coordinate, LoadRadius = self.LoadRadius } )
local Distance = 0 local Distance = 0
if self:IsUnLoaded() then if self:IsUnLoaded() then
@@ -144,7 +149,7 @@ do -- CARGO_SLINGLOAD
-- @param Core.Point#COORDINATE Coordinate -- @param Core.Point#COORDINATE Coordinate
-- @return #boolean true if the Cargo Slingload is within the loading radius. -- @return #boolean true if the Cargo Slingload is within the loading radius.
function CARGO_SLINGLOAD:IsInLoadRadius( Coordinate ) function CARGO_SLINGLOAD:IsInLoadRadius( Coordinate )
--self:F( { Coordinate } ) --self:T( { Coordinate } )
local Distance = 0 local Distance = 0
if self:IsUnLoaded() then if self:IsUnLoaded() then
@@ -164,7 +169,7 @@ do -- CARGO_SLINGLOAD
-- @return Core.Point#COORDINATE The current Coordinate of the first Cargo of the CargoGroup. -- @return Core.Point#COORDINATE The current Coordinate of the first Cargo of the CargoGroup.
-- @return #nil There is no valid Cargo in the CargoGroup. -- @return #nil There is no valid Cargo in the CargoGroup.
function CARGO_SLINGLOAD:GetCoordinate() function CARGO_SLINGLOAD:GetCoordinate()
--self:F() --self:T()
return self.CargoObject:GetCoordinate() return self.CargoObject:GetCoordinate()
end end
@@ -194,7 +199,7 @@ do -- CARGO_SLINGLOAD
-- @param #CARGO_SLINGLOAD self -- @param #CARGO_SLINGLOAD self
-- @param Core.Point#COORDINATE Coordinate -- @param Core.Point#COORDINATE Coordinate
function CARGO_SLINGLOAD:RouteTo( Coordinate ) function CARGO_SLINGLOAD:RouteTo( Coordinate )
--self:F( {Coordinate = Coordinate } ) --self:T( {Coordinate = Coordinate } )
end end
@@ -207,7 +212,7 @@ do -- CARGO_SLINGLOAD
-- @return #boolean The Cargo is near to the Carrier. -- @return #boolean The Cargo is near to the Carrier.
-- @return #nil The Cargo is not near to the Carrier. -- @return #nil The Cargo is not near to the Carrier.
function CARGO_SLINGLOAD:IsNear( CargoCarrier, NearRadius ) function CARGO_SLINGLOAD:IsNear( CargoCarrier, NearRadius )
--self:F( {NearRadius = NearRadius } ) --self:T( {NearRadius = NearRadius } )
return self:IsNear( CargoCarrier:GetCoordinate(), NearRadius ) return self:IsNear( CargoCarrier:GetCoordinate(), NearRadius )
end end
@@ -217,7 +222,7 @@ do -- CARGO_SLINGLOAD
-- @param #CARGO_SLINGLOAD self -- @param #CARGO_SLINGLOAD self
function CARGO_SLINGLOAD:Respawn() function CARGO_SLINGLOAD:Respawn()
--self:F( { "Respawning slingload " .. self:GetName() } ) --self:T( { "Respawning slingload " .. self:GetName() } )
-- Respawn the group... -- Respawn the group...
@@ -234,7 +239,7 @@ do -- CARGO_SLINGLOAD
-- @param #CARGO_SLINGLOAD self -- @param #CARGO_SLINGLOAD self
function CARGO_SLINGLOAD:onafterReset() function CARGO_SLINGLOAD:onafterReset()
--self:F( { "Reset slingload " .. self:GetName() } ) --self:T( { "Reset slingload " .. self:GetName() } )
-- Respawn the group... -- Respawn the group...

View File

@@ -27,7 +27,12 @@ do -- CARGO_UNIT
-- Note that ground forces behave in a group, and thus, act in formation, regardless if one unit is commanded to move. -- Note that ground forces behave in a group, and thus, act in formation, regardless if one unit is commanded to move.
-- --
-- This class is used in CARGO_GROUP, and is not meant to be used by mission designers individually. -- This class is used in CARGO_GROUP, and is not meant to be used by mission designers individually.
--
-- # Developer Note
-- --
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- === -- ===
-- --
-- @field #CARGO_UNIT CARGO_UNIT -- @field #CARGO_UNIT CARGO_UNIT
@@ -70,7 +75,7 @@ do -- CARGO_UNIT
-- @param Core.Point#POINT_VEC2 ToPointVec2 -- @param Core.Point#POINT_VEC2 ToPointVec2
-- @param #number NearRadius (optional) Defaut 25 m. -- @param #number NearRadius (optional) Defaut 25 m.
function CARGO_UNIT:onenterUnBoarding( From, Event, To, ToPointVec2, NearRadius ) function CARGO_UNIT:onenterUnBoarding( From, Event, To, ToPointVec2, NearRadius )
self:F( { From, Event, To, ToPointVec2, NearRadius } ) self:T( { From, Event, To, ToPointVec2, NearRadius } )
local Angle = 180 local Angle = 180
local Speed = 60 local Speed = 60
@@ -109,7 +114,7 @@ do -- CARGO_UNIT
else else
self.CargoObject:ReSpawnAt( FromPointVec2, CargoDeployHeading ) self.CargoObject:ReSpawnAt( FromPointVec2, CargoDeployHeading )
end end
self:F( { "CargoUnits:", self.CargoObject:GetGroup():GetName() } ) self:T( { "CargoUnits:", self.CargoObject:GetGroup():GetName() } )
self.CargoCarrier = nil self.CargoCarrier = nil
local Points = {} local Points = {}
@@ -143,7 +148,7 @@ do -- CARGO_UNIT
-- @param Core.Point#POINT_VEC2 ToPointVec2 -- @param Core.Point#POINT_VEC2 ToPointVec2
-- @param #number NearRadius (optional) Defaut 100 m. -- @param #number NearRadius (optional) Defaut 100 m.
function CARGO_UNIT:onleaveUnBoarding( From, Event, To, ToPointVec2, NearRadius ) function CARGO_UNIT:onleaveUnBoarding( From, Event, To, ToPointVec2, NearRadius )
self:F( { From, Event, To, ToPointVec2, NearRadius } ) self:T( { From, Event, To, ToPointVec2, NearRadius } )
local Angle = 180 local Angle = 180
local Speed = 10 local Speed = 10
@@ -169,7 +174,7 @@ do -- CARGO_UNIT
-- @param Core.Point#POINT_VEC2 ToPointVec2 -- @param Core.Point#POINT_VEC2 ToPointVec2
-- @param #number NearRadius (optional) Defaut 100 m. -- @param #number NearRadius (optional) Defaut 100 m.
function CARGO_UNIT:onafterUnBoarding( From, Event, To, ToPointVec2, NearRadius ) function CARGO_UNIT:onafterUnBoarding( From, Event, To, ToPointVec2, NearRadius )
self:F( { From, Event, To, ToPointVec2, NearRadius } ) self:T( { From, Event, To, ToPointVec2, NearRadius } )
self.CargoInAir = self.CargoObject:InAir() self.CargoInAir = self.CargoObject:InAir()
@@ -194,7 +199,7 @@ do -- CARGO_UNIT
-- @param #string To -- @param #string To
-- @param Core.Point#POINT_VEC2 -- @param Core.Point#POINT_VEC2
function CARGO_UNIT:onenterUnLoaded( From, Event, To, ToPointVec2 ) function CARGO_UNIT:onenterUnLoaded( From, Event, To, ToPointVec2 )
self:F( { ToPointVec2, From, Event, To } ) self:T( { ToPointVec2, From, Event, To } )
local Angle = 180 local Angle = 180
local Speed = 10 local Speed = 10
@@ -231,7 +236,7 @@ do -- CARGO_UNIT
-- @param Wrapper.Group#GROUP CargoCarrier -- @param Wrapper.Group#GROUP CargoCarrier
-- @param #number NearRadius -- @param #number NearRadius
function CARGO_UNIT:onafterBoard( From, Event, To, CargoCarrier, NearRadius, ... ) function CARGO_UNIT:onafterBoard( From, Event, To, CargoCarrier, NearRadius, ... )
self:F( { From, Event, To, CargoCarrier, NearRadius = NearRadius } ) self:T( { From, Event, To, CargoCarrier, NearRadius = NearRadius } )
self.CargoInAir = self.CargoObject:InAir() self.CargoInAir = self.CargoObject:InAir()
@@ -239,7 +244,7 @@ do -- CARGO_UNIT
local MaxSpeed = Desc.speedMaxOffRoad local MaxSpeed = Desc.speedMaxOffRoad
local TypeName = Desc.typeName local TypeName = Desc.typeName
--self:F({Unit=self.CargoObject:GetName()}) --self:T({Unit=self.CargoObject:GetName()})
-- A cargo unit can only be boarded if it is not dead -- A cargo unit can only be boarded if it is not dead
@@ -293,9 +298,9 @@ do -- CARGO_UNIT
-- @param Wrapper.Client#CLIENT CargoCarrier -- @param Wrapper.Client#CLIENT CargoCarrier
-- @param #number NearRadius Default 25 m. -- @param #number NearRadius Default 25 m.
function CARGO_UNIT:onafterBoarding( From, Event, To, CargoCarrier, NearRadius, ... ) function CARGO_UNIT:onafterBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
self:F( { From, Event, To, CargoCarrier:GetName(), NearRadius = NearRadius } ) self:T( { From, Event, To, CargoCarrier:GetName(), NearRadius = NearRadius } )
self:F( { IsAlive=self.CargoObject:IsAlive() } ) self:T( { IsAlive=self.CargoObject:IsAlive() } )
if CargoCarrier and CargoCarrier:IsAlive() then -- and self.CargoObject and self.CargoObject:IsAlive() then if CargoCarrier and CargoCarrier:IsAlive() then -- and self.CargoObject and self.CargoObject:IsAlive() then
if (CargoCarrier:IsAir() and not CargoCarrier:InAir()) or true then if (CargoCarrier:IsAir() and not CargoCarrier:InAir()) or true then
@@ -316,7 +321,7 @@ do -- CARGO_UNIT
local Angle = 180 local Angle = 180
local Distance = 0 local Distance = 0
--self:F({Unit=self.CargoObject:GetName()}) --self:T({Unit=self.CargoObject:GetName()})
local CargoCarrierPointVec2 = CargoCarrier:GetPointVec2() local CargoCarrierPointVec2 = CargoCarrier:GetPointVec2()
local CargoCarrierHeading = CargoCarrier:GetHeading() -- Get Heading of object in degrees. local CargoCarrierHeading = CargoCarrier:GetHeading() -- Get Heading of object in degrees.
@@ -343,7 +348,7 @@ do -- CARGO_UNIT
self.CargoObject:SetCommand( self.CargoObject:CommandStopRoute( true ) ) self.CargoObject:SetCommand( self.CargoObject:CommandStopRoute( true ) )
end end
else else
self:E("Something is wrong") self:T("Something is wrong")
end end
end end
@@ -356,11 +361,11 @@ do -- CARGO_UNIT
-- @param #string To -- @param #string To
-- @param Wrapper.Unit#UNIT CargoCarrier -- @param Wrapper.Unit#UNIT CargoCarrier
function CARGO_UNIT:onenterLoaded( From, Event, To, CargoCarrier ) function CARGO_UNIT:onenterLoaded( From, Event, To, CargoCarrier )
self:F( { From, Event, To, CargoCarrier } ) self:T( { From, Event, To, CargoCarrier } )
self.CargoCarrier = CargoCarrier self.CargoCarrier = CargoCarrier
--self:F({Unit=self.CargoObject:GetName()}) --self:T({Unit=self.CargoObject:GetName()})
-- Only destroy the CargoObject if there is a CargoObject (packages don't have CargoObjects). -- Only destroy the CargoObject if there is a CargoObject (packages don't have CargoObjects).
if self.CargoObject then if self.CargoObject then

View File

@@ -112,7 +112,7 @@
-- --
-- # Calculate the Path -- # Calculate the Path
-- --
-- Finally, we have to calculate the path. This is done by the @{ASTAR.GetPath}(*ExcludeStart, ExcludeEnd*) function. This function returns a table of nodes, which -- Finally, we have to calculate the path. This is done by the @{#GetPath}(*ExcludeStart, ExcludeEnd*) function. This function returns a table of nodes, which
-- describe the optimal path from the start node to the end node. -- describe the optimal path from the start node to the end node.
-- --
-- By default, the start and end node are include in the table that is returned. -- By default, the start and end node are include in the table that is returned.

View File

@@ -34,7 +34,8 @@ local _TraceClassMethod = {}
local _ClassID = 0 local _ClassID = 0
--- @type BASE ---
-- @type BASE
-- @field ClassName The name of the class. -- @field ClassName The name of the class.
-- @field ClassID The ID number of the class. -- @field ClassID The ID number of the class.
-- @field ClassNameAndID The name of the class concatenated with the ID number of the class. -- @field ClassNameAndID The name of the class concatenated with the ID number of the class.
@@ -201,10 +202,10 @@ BASE = {
Scheduler = nil, Scheduler = nil,
} }
--- @field #BASE.__ -- @field #BASE.__
BASE.__ = {} BASE.__ = {}
--- @field #BASE._ -- @field #BASE._
BASE._ = { BASE._ = {
Schedules = {}, --- Contains the Schedulers Active Schedules = {}, --- Contains the Schedulers Active
} }
@@ -229,7 +230,7 @@ FORMATION = {
-- @param #BASE self -- @param #BASE self
-- @return #BASE -- @return #BASE
function BASE:New() function BASE:New()
--local self = routines.utils.deepCopy( self ) -- Create a new self instance --local self = UTILS.DeepCopy( self ) -- Create a new self instance
local self = UTILS.DeepCopy(self) local self = UTILS.DeepCopy(self)
_ClassID = _ClassID + 1 _ClassID = _ClassID + 1
@@ -252,7 +253,7 @@ end
function BASE:Inherit( Child, Parent ) function BASE:Inherit( Child, Parent )
-- Create child. -- Create child.
local Child = routines.utils.deepCopy( Child ) local Child = UTILS.DeepCopy( Child )
if Child ~= nil then if Child ~= nil then
@@ -1167,7 +1168,7 @@ function BASE:_F( Arguments, DebugInfoCurrentParam, DebugInfoFromParam )
if DebugInfoFrom then if DebugInfoFrom then
LineFrom = DebugInfoFrom.currentline LineFrom = DebugInfoFrom.currentline
end end
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "F", self.ClassName, self.ClassID, Function, routines.utils.oneLineSerialize( Arguments ) ) ) env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "F", self.ClassName, self.ClassID, Function, UTILS.BasicSerialize( Arguments ) ) )
end end
end end
end end
@@ -1241,7 +1242,7 @@ function BASE:_T( Arguments, DebugInfoCurrentParam, DebugInfoFromParam )
if DebugInfoFrom then if DebugInfoFrom then
LineFrom = DebugInfoFrom.currentline LineFrom = DebugInfoFrom.currentline
end end
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s", LineCurrent, LineFrom, "T", self.ClassName, self.ClassID, routines.utils.oneLineSerialize( Arguments ) ) ) env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s", LineCurrent, LineFrom, "T", self.ClassName, self.ClassID, UTILS.BasicSerialize( Arguments ) ) )
end end
end end
end end
@@ -1311,9 +1312,9 @@ function BASE:E( Arguments )
LineFrom = DebugInfoFrom.currentline LineFrom = DebugInfoFrom.currentline
end end
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "E", self.ClassName, self.ClassID, Function, routines.utils.oneLineSerialize( Arguments ) ) ) env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "E", self.ClassName, self.ClassID, Function, UTILS.BasicSerialize( Arguments ) ) )
else else
env.info( string.format( "%1s:%30s%05d(%s)", "E", self.ClassName, self.ClassID, routines.utils.oneLineSerialize( Arguments ) ) ) env.info( string.format( "%1s:%30s%05d(%s)", "E", self.ClassName, self.ClassID, UTILS.BasicSerialize( Arguments ) ) )
end end
end end
@@ -1338,9 +1339,9 @@ function BASE:I( Arguments )
LineFrom = DebugInfoFrom.currentline LineFrom = DebugInfoFrom.currentline
end end
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "I", self.ClassName, self.ClassID, Function, routines.utils.oneLineSerialize( Arguments ) ) ) env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "I", self.ClassName, self.ClassID, Function, UTILS.BasicSerialize( Arguments ) ) )
else else
env.info( string.format( "%1s:%30s%05d(%s)", "I", self.ClassName, self.ClassID, routines.utils.oneLineSerialize( Arguments ) ) ) env.info( string.format( "%1s:%30s%05d(%s)", "I", self.ClassName, self.ClassID, UTILS.BasicSerialize( Arguments ) ) )
end end
end end

View File

@@ -9,7 +9,7 @@
-- --
-- ## Example Missions: -- ## Example Missions:
-- --
-- Demo missions can be found on [github](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/OPS%20-%20Operation). -- Demo missions can be found on [github](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/Core/Condition).
-- --
-- === -- ===
-- --

View File

@@ -31,11 +31,12 @@
-- @module Core.Database -- @module Core.Database
-- @image Core_Database.JPG -- @image Core_Database.JPG
---
--- @type DATABASE -- @type DATABASE
-- @field #string ClassName Name of the class. -- @field #string ClassName Name of the class.
-- @field #table Templates Templates: Units, Groups, Statics, ClientsByName, ClientsByID. -- @field #table Templates Templates: Units, Groups, Statics, ClientsByName, ClientsByID.
-- @field #table CLIENTS Clients. -- @field #table CLIENTS Clients.
-- @field #table STORAGES DCS warehouse storages.
-- @extends Core.Base#BASE -- @extends Core.Base#BASE
--- Contains collections of wrapper objects defined within MOOSE that reflect objects within the simulator. --- Contains collections of wrapper objects defined within MOOSE that reflect objects within the simulator.
@@ -50,6 +51,7 @@
-- * PLAYERSJOINED -- * PLAYERSJOINED
-- * PLAYERS -- * PLAYERS
-- * CARGOS -- * CARGOS
-- * STORAGES (DCS warehouses)
-- --
-- On top, for internal MOOSE administration purposes, the DATABASE administers the Unit and Group TEMPLATES as defined within the Mission Editor. -- On top, for internal MOOSE administration purposes, the DATABASE administers the Unit and Group TEMPLATES as defined within the Mission Editor.
-- --
@@ -88,6 +90,9 @@ DATABASE = {
WAREHOUSES = {}, WAREHOUSES = {},
FLIGHTGROUPS = {}, FLIGHTGROUPS = {},
FLIGHTCONTROLS = {}, FLIGHTCONTROLS = {},
OPSZONES = {},
PATHLINES = {},
STORAGES = {},
} }
local _DATABASECoalition = local _DATABASECoalition =
@@ -121,6 +126,8 @@ function DATABASE:New()
self:SetEventPriority( 1 ) self:SetEventPriority( 1 )
self:HandleEvent( EVENTS.Birth, self._EventOnBirth ) self:HandleEvent( EVENTS.Birth, self._EventOnBirth )
-- DCS 2.9 fixed CA event for players -- TODO: reset unit when leaving
self:HandleEvent( EVENTS.PlayerEnterUnit, self._EventOnPlayerEnterUnit )
self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash ) self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash )
self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash ) self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash )
self:HandleEvent( EVENTS.RemoveUnit, self._EventOnDeadOrCrash ) self:HandleEvent( EVENTS.RemoveUnit, self._EventOnDeadOrCrash )
@@ -244,7 +251,39 @@ function DATABASE:FindAirbase( AirbaseName )
end end
do -- Zones
--- Adds a STORAGE (DCS warehouse wrapper) based on the Airbase Name to the DATABASE.
-- @param #DATABASE self
-- @param #string AirbaseName The name of the airbase.
-- @return Wrapper.Storage#STORAGE Storage object.
function DATABASE:AddStorage( AirbaseName )
if not self.STORAGES[AirbaseName] then
self.STORAGES[AirbaseName] = STORAGE:New( AirbaseName )
end
return self.STORAGES[AirbaseName]
end
--- Deletes a STORAGE from the DATABASE based on the name of the associated airbase.
-- @param #DATABASE self
-- @param #string AirbaseName The name of the airbase.
function DATABASE:DeleteStorage( AirbaseName )
self.STORAGES[AirbaseName] = nil
end
--- Finds an STORAGE based on the name of the associated airbase.
-- @param #DATABASE self
-- @param #string AirbaseName Name of the airbase.
-- @return Wrapper.Storage#STORAGE The found STORAGE.
function DATABASE:FindStorage( AirbaseName )
local storage = self.STORAGES[AirbaseName]
return storage
end
do -- Zones and Pathlines
--- Finds a @{Core.Zone} based on the zone name. --- Finds a @{Core.Zone} based on the zone name.
-- @param #DATABASE self -- @param #DATABASE self
@@ -267,7 +306,6 @@ do -- Zones
end end
end end
--- Deletes a @{Core.Zone} from the DATABASE based on the zone name. --- Deletes a @{Core.Zone} from the DATABASE based on the zone name.
-- @param #DATABASE self -- @param #DATABASE self
-- @param #string ZoneName The name of the zone. -- @param #string ZoneName The name of the zone.
@@ -277,6 +315,39 @@ do -- Zones
end end
--- Adds a @{Core.Pathline} based on its name in the DATABASE.
-- @param #DATABASE self
-- @param #string PathlineName The name of the pathline
-- @param Core.Pathline#PATHLINE Pathline The pathline.
function DATABASE:AddPathline( PathlineName, Pathline )
if not self.PATHLINES[PathlineName] then
self.PATHLINES[PathlineName]=Pathline
end
end
--- Finds a @{Core.Pathline} by its name.
-- @param #DATABASE self
-- @param #string PathlineName The name of the Pathline.
-- @return Core.Pathline#PATHLINE The found PATHLINE.
function DATABASE:FindPathline( PathlineName )
local pathline = self.PATHLINES[PathlineName]
return pathline
end
--- Deletes a @{Core.Pathline} from the DATABASE based on its name.
-- @param #DATABASE self
-- @param #string PathlineName The name of the PATHLINE.
function DATABASE:DeletePathline( PathlineName )
self.PATHLINES[PathlineName]=nil
return self
end
--- Private method that registers new ZONE_BASE derived objects within the DATABASE Object. --- Private method that registers new ZONE_BASE derived objects within the DATABASE Object.
-- @param #DATABASE self -- @param #DATABASE self
-- @return #DATABASE self -- @return #DATABASE self
@@ -370,60 +441,189 @@ do -- Zones
-- Add zone to DB. -- Add zone to DB.
self:AddZone( ZoneName, Zone_Polygon ) self:AddZone( ZoneName, Zone_Polygon )
end end
end end
-- Drawings as zones -- Drawings as zones
if env.mission.drawings and env.mission.drawings.layers then if env.mission.drawings and env.mission.drawings.layers then
-- Loop over layers. -- Loop over layers.
for layerID, layerData in pairs(env.mission.drawings.layers or {}) do for layerID, layerData in pairs(env.mission.drawings.layers or {}) do
-- Loop over objects in layers. -- Loop over objects in layers.
for objectID, objectData in pairs(layerData.objects or {}) do for objectID, objectData in pairs(layerData.objects or {}) do
-- Check for polygon which has at least 4 points (we would need 3 but the origin seems to be there twice) -- Check for polygon which has at least 4 points (we would need 3 but the origin seems to be there twice)
if objectData.polygonMode=="free" and objectData.points and #objectData.points>=4 then if objectData.polygonMode and (objectData.polygonMode=="free") and objectData.points and #objectData.points>=4 then
---
-- Drawing: Polygon free
---
-- Name of the zone. -- Name of the zone.
local ZoneName=objectData.name or "Unknown Drawing Zone" local ZoneName=objectData.name or "Unknown free Polygon Drawing"
-- Reference point. All other points need to be translated by this. -- Reference point. All other points need to be translated by this.
local vec2={x=objectData.mapX, y=objectData.mapY} local vec2={x=objectData.mapX, y=objectData.mapY}
-- Copy points array. -- Debug stuff.
--local vec3={x=objectData.mapX, y=0, z=objectData.mapY}
--local coord=COORDINATE:NewFromVec2(vec2):MarkToAll("MapX, MapY")
--trigger.action.markToAll(id, "mapXY", vec3)
-- Copy points array.
local points=UTILS.DeepCopy(objectData.points) local points=UTILS.DeepCopy(objectData.points)
-- Translate points. -- Translate points.
for i,_point in pairs(points) do for i,_point in pairs(points) do
local point=_point --DCS#Vec2 local point=_point --DCS#Vec2
points[i]=UTILS.Vec2Add(point, vec2) points[i]=UTILS.Vec2Add(point, vec2)
end end
-- Remove last point. -- Remove last point.
table.remove(points, #points) table.remove(points, #points)
-- Debug output -- Debug output
self:I(string.format("Register ZONE: %s (Polygon drawing with %d verticies)", ZoneName, #points)) self:I(string.format("Register ZONE: %s (Polygon (free) drawing with %d vertices)", ZoneName, #points))
-- Create new polygon zone. -- Create new polygon zone.
local Zone=ZONE_POLYGON:NewFromPointsArray(ZoneName, points) local Zone=ZONE_POLYGON:NewFromPointsArray(ZoneName, points)
--Zone.DrawID = objectID
-- Set color. -- Set color.
Zone:SetColor({1, 0, 0}, 0.15) Zone:SetColor({1, 0, 0}, 0.15)
Zone:SetFillColor({1, 0, 0}, 0.15)
if objectData.colorString then
-- eg colorString = 0xff0000ff
local color = string.gsub(objectData.colorString,"^0x","")
local r = tonumber(string.sub(color,1,2),16)/255
local g = tonumber(string.sub(color,3,4),16)/255
local b = tonumber(string.sub(color,5,6),16)/255
local a = tonumber(string.sub(color,7,8),16)/255
Zone:SetColor({r, g, b}, a)
end
if objectData.fillColorString then
-- eg fillColorString = 0xff00004b
local color = string.gsub(objectData.colorString,"^0x","")
local r = tonumber(string.sub(color,1,2),16)/255
local g = tonumber(string.sub(color,3,4),16)/255
local b = tonumber(string.sub(color,5,6),16)/255
local a = tonumber(string.sub(color,7,8),16)/255
Zone:SetFillColor({r, g, b}, a)
end
-- Store in DB. -- Store in DB.
self.ZONENAMES[ZoneName] = ZoneName self.ZONENAMES[ZoneName] = ZoneName
-- Add zone. -- Add zone.
self:AddZone(ZoneName, Zone) self:AddZone(ZoneName, Zone)
-- Check for polygon which has at least 4 points (we would need 3 but the origin seems to be there twice)
elseif objectData.polygonMode and objectData.polygonMode=="rect" then
---
-- Drawing: Polygon rect
---
-- Name of the zone.
local ZoneName=objectData.name or "Unknown rect Polygon Drawing"
-- Reference point (center of the rectangle).
local vec2={x=objectData.mapX, y=objectData.mapY}
-- For a rectangular polygon drawing, we have the width (y) and height (x).
local w=objectData.width
local h=objectData.height
-- Create points from center using with and height (width for y and height for x is a bit confusing, but this is how ED implemented it).
local points={}
points[1]={x=vec2.x-h/2, y=vec2.y+w/2} --Upper left
points[2]={x=vec2.x+h/2, y=vec2.y+w/2} --Upper right
points[3]={x=vec2.x+h/2, y=vec2.y-w/2} --Lower right
points[4]={x=vec2.x-h/2, y=vec2.y-w/2} --Lower left
--local coord=COORDINATE:NewFromVec2(vec2):MarkToAll("MapX, MapY")
-- Debug output
self:I(string.format("Register ZONE: %s (Polygon (rect) drawing with %d vertices)", ZoneName, #points))
-- Create new polygon zone.
local Zone=ZONE_POLYGON:NewFromPointsArray(ZoneName, points)
-- Set color.
Zone:SetColor({1, 0, 0}, 0.15)
end if objectData.colorString then
end -- eg colorString = 0xff0000ff
local color = string.gsub(objectData.colorString,"^0x","")
local r = tonumber(string.sub(color,1,2),16)/255
local g = tonumber(string.sub(color,3,4),16)/255
local b = tonumber(string.sub(color,5,6),16)/255
local a = tonumber(string.sub(color,7,8),16)/255
Zone:SetColor({r, g, b}, a)
end
if objectData.fillColorString then
-- eg fillColorString = 0xff00004b
local color = string.gsub(objectData.colorString,"^0x","")
local r = tonumber(string.sub(color,1,2),16)/255
local g = tonumber(string.sub(color,3,4),16)/255
local b = tonumber(string.sub(color,5,6),16)/255
local a = tonumber(string.sub(color,7,8),16)/255
Zone:SetFillColor({r, g, b}, a)
end
-- Store in DB.
self.ZONENAMES[ZoneName] = ZoneName
-- Add zone.
self:AddZone(ZoneName, Zone)
elseif objectData.lineMode and (objectData.lineMode=="segments" or objectData.lineMode=="segment" or objectData.lineMode=="free") and objectData.points and #objectData.points>=2 then
---
-- Drawing: Line (segments, segment or free)
---
-- Name of the zone.
local Name=objectData.name or "Unknown Line Drawing"
-- Reference point. All other points need to be translated by this.
local vec2={x=objectData.mapX, y=objectData.mapY}
-- Copy points array.
local points=UTILS.DeepCopy(objectData.points)
-- Translate points.
for i,_point in pairs(points) do
local point=_point --DCS#Vec2
points[i]=UTILS.Vec2Add(point, vec2)
end
-- Debug output
self:I(string.format("Register PATHLINE: %s (Line drawing with %d points)", Name, #points))
-- Create new polygon zone.
local Pathline=PATHLINE:NewFromVec2Array(Name, points)
-- Set color.
--Zone:SetColor({1, 0, 0}, 0.15)
-- Add zone.
self:AddPathline(Name,Pathline)
end
end
end end
end end
end end
end -- zone end -- zone
do -- Zone_Goal do -- Zone_Goal
@@ -459,6 +659,46 @@ do -- Zone_Goal
end end
end -- Zone_Goal end -- Zone_Goal
do -- OpsZone
--- Finds a @{Ops.OpsZone#OPSZONE} based on the zone name.
-- @param #DATABASE self
-- @param #string ZoneName The name of the zone.
-- @return Ops.OpsZone#OPSZONE The found OPSZONE.
function DATABASE:FindOpsZone( ZoneName )
local ZoneFound = self.OPSZONES[ZoneName]
return ZoneFound
end
--- Adds a @{Ops.OpsZone#OPSZONE} based on the zone name in the DATABASE.
-- @param #DATABASE self
-- @param Ops.OpsZone#OPSZONE OpsZone The zone.
function DATABASE:AddOpsZone( OpsZone )
if OpsZone then
local ZoneName=OpsZone:GetName()
if not self.OPSZONES[ZoneName] then
self.OPSZONES[ZoneName] = OpsZone
end
end
end
--- Deletes a @{Ops.OpsZone#OPSZONE} from the DATABASE based on the zone name.
-- @param #DATABASE self
-- @param #string ZoneName The name of the zone.
function DATABASE:DeleteOpsZone( ZoneName )
self.OPSZONES[ZoneName] = nil
end
end -- OpsZone
do -- cargo do -- cargo
--- Adds a Cargo based on the Cargo Name in the DATABASE. --- Adds a Cargo based on the Cargo Name in the DATABASE.
@@ -483,7 +723,7 @@ do -- cargo
--- Finds an CARGO based on the CargoName. --- Finds an CARGO based on the CargoName.
-- @param #DATABASE self -- @param #DATABASE self
-- @param #string CargoName -- @param #string CargoName
-- @return Wrapper.Cargo#CARGO The found CARGO. -- @return Cargo.Cargo#CARGO The found CARGO.
function DATABASE:FindCargo( CargoName ) function DATABASE:FindCargo( CargoName )
local CargoFound = self.CARGOS[CargoName] local CargoFound = self.CARGOS[CargoName]
@@ -557,7 +797,7 @@ end -- cargo
--- Finds a CLIENT based on the ClientName. --- Finds a CLIENT based on the ClientName.
-- @param #DATABASE self -- @param #DATABASE self
-- @param #string ClientName -- @param #string ClientName - Note this is the UNIT name of the client!
-- @return Wrapper.Client#CLIENT The found CLIENT. -- @return Wrapper.Client#CLIENT The found CLIENT.
function DATABASE:FindClient( ClientName ) function DATABASE:FindClient( ClientName )
@@ -613,6 +853,7 @@ function DATABASE:AddPlayer( UnitName, PlayerName )
self.PLAYERUNITS[PlayerName] = self:FindUnit( UnitName ) self.PLAYERUNITS[PlayerName] = self:FindUnit( UnitName )
self.PLAYERSJOINED[PlayerName] = PlayerName self.PLAYERSJOINED[PlayerName] = PlayerName
end end
end end
--- Deletes a player from the DATABASE based on the Player Name. --- Deletes a player from the DATABASE based on the Player Name.
@@ -962,7 +1203,7 @@ end
-- @param #string AirbaseName Name of the airbase. -- @param #string AirbaseName Name of the airbase.
-- @return #number Category. -- @return #number Category.
function DATABASE:GetCategoryFromAirbase( AirbaseName ) function DATABASE:GetCategoryFromAirbase( AirbaseName )
return self.AIRBASES[AirbaseName]:GetCategory() return self.AIRBASES[AirbaseName]:GetAirbaseCategory()
end end
@@ -1040,7 +1281,7 @@ function DATABASE:_RegisterClients()
for ClientName, ClientTemplate in pairs( self.Templates.ClientsByName ) do for ClientName, ClientTemplate in pairs( self.Templates.ClientsByName ) do
self:I(string.format("Register Client: %s", tostring(ClientName))) self:I(string.format("Register Client: %s", tostring(ClientName)))
local client=self:AddClient( ClientName ) local client=self:AddClient( ClientName )
client.SpawnCoord=COORDINATE:New(ClientTemplate.x, ClientTemplate.alt, ClientTemplate.y) client.SpawnCoord=COORDINATE:New(ClientTemplate.x, ClientTemplate.alt, ClientTemplate.y)
end end
return self return self
@@ -1090,7 +1331,7 @@ end
function DATABASE:_RegisterAirbase(airbase) function DATABASE:_RegisterAirbase(airbase)
if airbase then if airbase then
-- Get the airbase name. -- Get the airbase name.
local DCSAirbaseName = airbase:getName() local DCSAirbaseName = airbase:getName()
@@ -1102,9 +1343,17 @@ function DATABASE:_RegisterAirbase(airbase)
-- Unique ID. -- Unique ID.
local airbaseUID=airbase:GetID(true) local airbaseUID=airbase:GetID(true)
local typename = airbase:GetTypeName()
local category = airbase.category
if category == Airbase.Category.SHIP and typename == "FARP_SINGLE_01" then
category = Airbase.Category.HELIPAD
end
-- Debug output. -- Debug output.
local text=string.format("Register %s: %s (UID=%d), Runways=%d, Parking=%d [", AIRBASE.CategoryName[airbase.category], tostring(DCSAirbaseName), airbaseUID, #airbase.runways, airbase.NparkingTotal) local text=string.format("Register %s: %s (UID=%d), Runways=%d, Parking=%d [", AIRBASE.CategoryName[category], tostring(DCSAirbaseName), airbaseUID, #airbase.runways, airbase.NparkingTotal)
for _,terminalType in pairs(AIRBASE.TerminalType) do for _,terminalType in pairs(AIRBASE.TerminalType) do
if airbase.NparkingTerminal and airbase.NparkingTerminal[terminalType] then if airbase.NparkingTerminal and airbase.NparkingTerminal[terminalType] then
text=text..string.format("%d=%d ", terminalType, airbase.NparkingTerminal[terminalType]) text=text..string.format("%d=%d ", terminalType, airbase.NparkingTerminal[terminalType])
@@ -1171,7 +1420,7 @@ function DATABASE:_EventOnBirth( Event )
if PlayerName then if PlayerName then
-- Debug info. -- Debug info.
self:I(string.format("Player '%s' joint unit '%s' of group '%s'", tostring(PlayerName), tostring(Event.IniDCSUnitName), tostring(Event.IniDCSGroupName))) self:I(string.format("Player '%s' joined unit '%s' of group '%s'", tostring(PlayerName), tostring(Event.IniDCSUnitName), tostring(Event.IniDCSGroupName)))
-- Add client in case it does not exist already. -- Add client in case it does not exist already.
if not client then if not client then
@@ -1273,39 +1522,43 @@ function DATABASE:_EventOnDeadOrCrash( Event )
end end
--- Handles the OnPlayerEnterUnit event to fill the active players table (with the unit filter applied). --- Handles the OnPlayerEnterUnit event to fill the active players table for CA units (with the unit filter applied).
-- @param #DATABASE self -- @param #DATABASE self
-- @param Core.Event#EVENTDATA Event -- @param Core.Event#EVENTDATA Event
function DATABASE:_EventOnPlayerEnterUnit( Event ) function DATABASE:_EventOnPlayerEnterUnit( Event )
self:F2( { Event } ) self:F2( { Event } )
if Event.IniDCSUnit then if Event.IniDCSUnit then
if Event.IniObjectCategory == 1 then -- Player entering a CA slot
if Event.IniObjectCategory == 1 and Event.IniGroup and Event.IniGroup:IsGround() then
local IsPlayer = Event.IniDCSUnit:getPlayerName()
if IsPlayer then
-- Add unit. -- Debug info.
self:AddUnit( Event.IniDCSUnitName ) self:I(string.format("Player '%s' joined GROUND unit '%s' of group '%s'", tostring(Event.IniPlayerName), tostring(Event.IniDCSUnitName), tostring(Event.IniDCSGroupName)))
local client= self.CLIENTS[Event.IniDCSUnitName] --Wrapper.Client#CLIENT
-- Add client in case it does not exist already.
if not client then
client=self:AddClient(Event.IniDCSUnitName)
end
-- Add player.
client:AddPlayer(Event.IniPlayerName)
-- Ini unit. -- Add player.
Event.IniUnit = self:FindUnit( Event.IniDCSUnitName ) if not self.PLAYERS[Event.IniPlayerName] then
self:AddPlayer( Event.IniUnitName, Event.IniPlayerName )
-- Add group.
self:AddGroup( Event.IniDCSGroupName )
-- Get player unit.
local PlayerName = Event.IniDCSUnit:getPlayerName()
if PlayerName then
if not self.PLAYERS[PlayerName] then
self:AddPlayer( Event.IniDCSUnitName, PlayerName )
end end
local Settings = SETTINGS:Set( PlayerName ) -- Player settings.
Settings:SetPlayerMenu( Event.IniUnit ) local Settings = SETTINGS:Set( Event.IniPlayerName )
Settings:SetPlayerMenu(Event.IniUnit)
else
self:E("ERROR: getPlayerName() returned nil for event PlayerEnterUnit")
end end
end end
end end
end end
@@ -1316,15 +1569,26 @@ end
-- @param Core.Event#EVENTDATA Event -- @param Core.Event#EVENTDATA Event
function DATABASE:_EventOnPlayerLeaveUnit( Event ) function DATABASE:_EventOnPlayerLeaveUnit( Event )
self:F2( { Event } ) self:F2( { Event } )
local function FindPlayerName(UnitName)
local playername = nil
for _name,_unitname in pairs(self.PLAYERS) do
if _unitname == UnitName then
playername = _name
break
end
end
return playername
end
if Event.IniUnit then if Event.IniUnit then
if Event.IniObjectCategory == 1 then if Event.IniObjectCategory == 1 then
-- Try to get the player name. This can be buggy for multicrew aircraft! -- Try to get the player name. This can be buggy for multicrew aircraft!
local PlayerName = Event.IniUnit:GetPlayerName() local PlayerName = Event.IniUnit:GetPlayerName() or FindPlayerName(Event.IniUnitName)
if PlayerName then --and self.PLAYERS[PlayerName] then if PlayerName then
-- Debug info. -- Debug info.
self:I(string.format("Player '%s' left unit %s", tostring(PlayerName), tostring(Event.IniUnitName))) self:I(string.format("Player '%s' left unit %s", tostring(PlayerName), tostring(Event.IniUnitName)))
@@ -1478,10 +1742,10 @@ end
-- @param #DATABASE self -- @param #DATABASE self
-- @param #function IteratorFunction The function that will be called object in the database. The function needs to accept a CLIENT parameter. -- @param #function IteratorFunction The function that will be called object in the database. The function needs to accept a CLIENT parameter.
-- @return #DATABASE self -- @return #DATABASE self
function DATABASE:ForEachClient( IteratorFunction, ... ) function DATABASE:ForEachClient( IteratorFunction, FinalizeFunction, ... )
self:F2( arg ) self:F2( arg )
self:ForEach( IteratorFunction, arg, self.CLIENTS ) self:ForEach( IteratorFunction, FinalizeFunction, arg, self.CLIENTS )
return self return self
end end
@@ -1490,10 +1754,10 @@ end
-- @param #DATABASE self -- @param #DATABASE self
-- @param #function IteratorFunction The function that will be called for each object in the database. The function needs to accept a CLIENT parameter. -- @param #function IteratorFunction The function that will be called for each object in the database. The function needs to accept a CLIENT parameter.
-- @return #DATABASE self -- @return #DATABASE self
function DATABASE:ForEachCargo( IteratorFunction, ... ) function DATABASE:ForEachCargo( IteratorFunction, FinalizeFunction, ... )
self:F2( arg ) self:F2( arg )
self:ForEach( IteratorFunction, arg, self.CARGOS ) self:ForEach( IteratorFunction, FinalizeFunction, arg, self.CARGOS )
return self return self
end end
@@ -1637,7 +1901,7 @@ end
--- Add a flight control to the data base. --- Add a flight control to the data base.
-- @param #DATABASE self -- @param #DATABASE self
-- @param Ops.FlightControl#FLIGHTCONTROL flightcontrol -- @param OPS.FlightControl#FLIGHTCONTROL flightcontrol
function DATABASE:AddFlightControl(flightcontrol) function DATABASE:AddFlightControl(flightcontrol)
self:F2( { flightcontrol } ) self:F2( { flightcontrol } )
self.FLIGHTCONTROLS[flightcontrol.airbasename]=flightcontrol self.FLIGHTCONTROLS[flightcontrol.airbasename]=flightcontrol
@@ -1646,18 +1910,18 @@ end
--- Get a flight control object from the data base. --- Get a flight control object from the data base.
-- @param #DATABASE self -- @param #DATABASE self
-- @param #string airbasename Name of the associated airbase. -- @param #string airbasename Name of the associated airbase.
-- @return Ops.FlightControl#FLIGHTCONTROL The FLIGHTCONTROL object.s -- @return OPS.FlightControl#FLIGHTCONTROL The FLIGHTCONTROL object.s
function DATABASE:GetFlightControl(airbasename) function DATABASE:GetFlightControl(airbasename)
return self.FLIGHTCONTROLS[airbasename] return self.FLIGHTCONTROLS[airbasename]
end end
--- @param #DATABASE self -- @param #DATABASE self
function DATABASE:_RegisterTemplates() function DATABASE:_RegisterTemplates()
self:F2() self:F2()
self.Navpoints = {} self.Navpoints = {}
self.UNITS = {} self.UNITS = {}
--Build routines.db.units and self.Navpoints --Build self.Navpoints
for CoalitionName, coa_data in pairs(env.mission.coalition) do for CoalitionName, coa_data in pairs(env.mission.coalition) do
self:T({CoalitionName=CoalitionName}) self:T({CoalitionName=CoalitionName})
@@ -1679,7 +1943,7 @@ function DATABASE:_RegisterTemplates()
for nav_ind, nav_data in pairs(coa_data.nav_points) do for nav_ind, nav_data in pairs(coa_data.nav_points) do
if type(nav_data) == 'table' then if type(nav_data) == 'table' then
self.Navpoints[CoalitionName][nav_ind] = routines.utils.deepCopy(nav_data) self.Navpoints[CoalitionName][nav_ind] = UTILS.DeepCopy(nav_data)
self.Navpoints[CoalitionName][nav_ind]['name'] = nav_data.callsignStr -- name is a little bit more self-explanatory. self.Navpoints[CoalitionName][nav_ind]['name'] = nav_data.callsignStr -- name is a little bit more self-explanatory.
self.Navpoints[CoalitionName][nav_ind]['point'] = {} -- point is used by SSE, support it. self.Navpoints[CoalitionName][nav_ind]['point'] = {} -- point is used by SSE, support it.
@@ -1719,7 +1983,7 @@ function DATABASE:_RegisterTemplates()
if obj_type_name ~= "static" and Template and Template.units and type(Template.units) == 'table' then --making sure again- this is a valid group if obj_type_name ~= "static" and Template and Template.units and type(Template.units) == 'table' then --making sure again- this is a valid group
self:_RegisterGroupTemplate(Template, CoalitionSide, _DATABASECategory[string.lower(CategoryName)], CountryID) self:_RegisterGroupTemplate(Template, CoalitionSide, _DATABASECategory[string.lower(CategoryName)], CountryID)
else else
@@ -1808,8 +2072,6 @@ end
TargetPlayerName = Event.IniPlayerName TargetPlayerName = Event.IniPlayerName
TargetCoalition = Event.IniCoalition TargetCoalition = Event.IniCoalition
--TargetCategory = TargetUnit:getCategory()
--TargetCategory = TargetUnit:getDesc().category -- Workaround
TargetCategory = Event.IniCategory TargetCategory = Event.IniCategory
TargetType = Event.IniTypeName TargetType = Event.IniTypeName

View File

@@ -173,7 +173,8 @@
-- @image Core_Event.JPG -- @image Core_Event.JPG
--- @type EVENT ---
-- @type EVENT
-- @field #EVENT.Events Events -- @field #EVENT.Events Events
-- @extends Core.Base#BASE -- @extends Core.Base#BASE
@@ -260,6 +261,15 @@ EVENTS = {
SimulationStart = world.event.S_EVENT_SIMULATION_START or -1, SimulationStart = world.event.S_EVENT_SIMULATION_START or -1,
WeaponRearm = world.event.S_EVENT_WEAPON_REARM or -1, WeaponRearm = world.event.S_EVENT_WEAPON_REARM or -1,
WeaponDrop = world.event.S_EVENT_WEAPON_DROP or -1, WeaponDrop = world.event.S_EVENT_WEAPON_DROP or -1,
-- Added with DCS 2.9.0
UnitTaskTimeout = world.event.S_EVENT_UNIT_TASK_TIMEOUT or -1,
UnitTaskStage = world.event.S_EVENT_UNIT_TASK_STAGE or -1,
MacSubtaskScore = world.event.S_EVENT_MAC_SUBTASK_SCORE or -1,
MacExtraScore = world.event.S_EVENT_MAC_EXTRA_SCORE or -1,
MissionRestart = world.event.S_EVENT_MISSION_RESTART or -1,
MissionWinner = world.event.S_EVENT_MISSION_WINNER or -1,
PostponedTakeoff = world.event.S_EVENT_POSTPONED_TAKEOFF or -1,
PostponedLand = world.event.S_EVENT_POSTPONED_LAND or -1,
} }
--- The Event structure --- The Event structure
@@ -282,6 +292,7 @@ EVENTS = {
-- @field Wrapper.Group#GROUP IniGroup (UNIT) The initiating MOOSE wrapper @{Wrapper.Group#GROUP} of the initiator Group object. -- @field Wrapper.Group#GROUP IniGroup (UNIT) The initiating MOOSE wrapper @{Wrapper.Group#GROUP} of the initiator Group object.
-- @field #string IniGroupName UNIT) The initiating GROUP name (same as IniDCSGroupName). -- @field #string IniGroupName UNIT) The initiating GROUP name (same as IniDCSGroupName).
-- @field #string IniPlayerName (UNIT) The name of the initiating player in case the Unit is a client or player slot. -- @field #string IniPlayerName (UNIT) The name of the initiating player in case the Unit is a client or player slot.
-- @field #string IniPlayerUCID (UNIT) The UCID of the initiating player in case the Unit is a client or player slot and on a multi-player server.
-- @field DCS#coalition.side IniCoalition (UNIT) The coalition of the initiator. -- @field DCS#coalition.side IniCoalition (UNIT) The coalition of the initiator.
-- @field DCS#Unit.Category IniCategory (UNIT) The category of the initiator. -- @field DCS#Unit.Category IniCategory (UNIT) The category of the initiator.
-- @field #string IniTypeName (UNIT) The type name of the initiator. -- @field #string IniTypeName (UNIT) The type name of the initiator.
@@ -297,6 +308,7 @@ EVENTS = {
-- @field Wrapper.Group#GROUP TgtGroup (UNIT) The target MOOSE wrapper @{Wrapper.Group#GROUP} of the target Group object. -- @field Wrapper.Group#GROUP TgtGroup (UNIT) The target MOOSE wrapper @{Wrapper.Group#GROUP} of the target Group object.
-- @field #string TgtGroupName (UNIT) The target GROUP name (same as TgtDCSGroupName). -- @field #string TgtGroupName (UNIT) The target GROUP name (same as TgtDCSGroupName).
-- @field #string TgtPlayerName (UNIT) The name of the target player in case the Unit is a client or player slot. -- @field #string TgtPlayerName (UNIT) The name of the target player in case the Unit is a client or player slot.
-- @field #string TgtPlayerUCID (UNIT) The UCID of the target player in case the Unit is a client or player slot and on a multi-player server.
-- @field DCS#coalition.side TgtCoalition (UNIT) The coalition of the target. -- @field DCS#coalition.side TgtCoalition (UNIT) The coalition of the target.
-- @field DCS#Unit.Category TgtCategory (UNIT) The category of the target. -- @field DCS#Unit.Category TgtCategory (UNIT) The category of the target.
-- @field #string TgtTypeName (UNIT) The type name of the target. -- @field #string TgtTypeName (UNIT) The type name of the target.
@@ -305,15 +317,15 @@ EVENTS = {
-- @field Wrapper.Airbase#AIRBASE Place The MOOSE airbase object. -- @field Wrapper.Airbase#AIRBASE Place The MOOSE airbase object.
-- @field #string PlaceName The name of the airbase. -- @field #string PlaceName The name of the airbase.
-- --
-- @field #table weapon The weapon used during the event. -- @field DCS#Weapon weapon The weapon used during the event.
-- @field #table Weapon -- @field DCS#Weapon Weapon The weapon used during the event.
-- @field #string WeaponName Name of the weapon. -- @field #string WeaponName Name of the weapon.
-- @field DCS#Unit WeaponTgtDCSUnit Target DCS unit of the weapon. -- @field DCS#Unit WeaponTgtDCSUnit Target DCS unit of the weapon.
-- --
-- @field Cargo.Cargo#CARGO Cargo The cargo object. -- @field Cargo.Cargo#CARGO Cargo The cargo object.
-- @field #string CargoName The name of the cargo object. -- @field #string CargoName The name of the cargo object.
-- --
-- @field Core.ZONE#ZONE Zone The zone object. -- @field Core.Zone#ZONE Zone The zone object.
-- @field #string ZoneName The name of the zone. -- @field #string ZoneName The name of the zone.
@@ -633,6 +645,55 @@ local _EVENTMETA = {
Event = "OnEventWeaponDrop", Event = "OnEventWeaponDrop",
Text = "S_EVENT_WEAPON_DROP" Text = "S_EVENT_WEAPON_DROP"
}, },
-- DCS 2.9
[EVENTS.UnitTaskTimeout] = {
Order = 1,
Side = "I",
Event = "OnEventUnitTaskTimeout",
Text = "S_EVENT_UNIT_TASK_TIMEOUT "
},
[EVENTS.UnitTaskStage] = {
Order = 1,
Side = "I",
Event = "OnEventUnitTaskStage",
Text = "S_EVENT_UNIT_TASK_STAGE "
},
[EVENTS.MacSubtaskScore] = {
Order = 1,
Side = "I",
Event = "OnEventMacSubtaskScore",
Text = "S_EVENT_MAC_SUBTASK_SCORE"
},
[EVENTS.MacExtraScore] = {
Order = 1,
Side = "I",
Event = "OnEventMacExtraScore",
Text = "S_EVENT_MAC_EXTRA_SCOREP"
},
[EVENTS.MissionRestart] = {
Order = 1,
Side = "I",
Event = "OnEventMissionRestart",
Text = "S_EVENT_MISSION_RESTART"
},
[EVENTS.MissionWinner] = {
Order = 1,
Side = "I",
Event = "OnEventMissionWinner",
Text = "S_EVENT_MISSION_WINNER"
},
[EVENTS.PostponedTakeoff] = {
Order = 1,
Side = "I",
Event = "OnEventPostponedTakeoff",
Text = "S_EVENT_POSTPONED_TAKEOFF"
},
[EVENTS.PostponedLand] = {
Order = 1,
Side = "I",
Event = "OnEventPostponedLand",
Text = "S_EVENT_POSTPONED_LAND"
},
} }
--- The Events structure --- The Events structure
@@ -988,7 +1049,7 @@ do -- Event Creation
--- Creation of a New ZoneGoal Event. --- Creation of a New ZoneGoal Event.
-- @param #EVENT self -- @param #EVENT self
-- @param Core.Functional#ZONE_GOAL ZoneGoal The ZoneGoal created. -- @param Functional.ZoneGoal#ZONE_GOAL ZoneGoal The ZoneGoal created.
function EVENT:CreateEventNewZoneGoal( ZoneGoal ) function EVENT:CreateEventNewZoneGoal( ZoneGoal )
self:F( { ZoneGoal } ) self:F( { ZoneGoal } )
@@ -1080,9 +1141,9 @@ function EVENT:onEvent( Event )
if Event.initiator then if Event.initiator then
Event.IniObjectCategory = Event.initiator:getCategory() Event.IniObjectCategory = Object.getCategory(Event.initiator)
if Event.IniObjectCategory == Object.Category.STATIC then if Event.IniObjectCategory == Object.Category.STATIC then
--- ---
-- Static -- Static
--- ---
@@ -1118,10 +1179,9 @@ function EVENT:onEvent( Event )
local Unit=UNIT:FindByName(Event.IniDCSUnitName) local Unit=UNIT:FindByName(Event.IniDCSUnitName)
if Unit then if Unit then
Event.IniObjectCategory = Object.Category.UNIT Event.IniObjectCategory = Object.Category.UNIT
end end
end
if Event.IniObjectCategory == Object.Category.UNIT then elseif Event.IniObjectCategory == Object.Category.UNIT then
--- ---
-- Unit -- Unit
--- ---
@@ -1144,12 +1204,19 @@ function EVENT:onEvent( Event )
end end
Event.IniPlayerName = Event.IniDCSUnit:getPlayerName() Event.IniPlayerName = Event.IniDCSUnit:getPlayerName()
if Event.IniPlayerName then
-- get UUCID
local PID = NET.GetPlayerIDByName(nil,Event.IniPlayerName)
if PID then
Event.IniPlayerUCID = net.get_player_info(tonumber(PID), 'ucid')
--env.info("Event.IniPlayerUCID="..tostring(Event.IniPlayerUCID),false)
end
end
Event.IniCoalition = Event.IniDCSUnit:getCoalition() Event.IniCoalition = Event.IniDCSUnit:getCoalition()
Event.IniTypeName = Event.IniDCSUnit:getTypeName() Event.IniTypeName = Event.IniDCSUnit:getTypeName()
Event.IniCategory = Event.IniDCSUnit:getDesc().category Event.IniCategory = Event.IniDCSUnit:getDesc().category
end
if Event.IniObjectCategory == Object.Category.CARGO then elseif Event.IniObjectCategory == Object.Category.CARGO then
--- ---
-- Cargo -- Cargo
--- ---
@@ -1160,9 +1227,8 @@ function EVENT:onEvent( Event )
Event.IniCoalition = Event.IniDCSUnit:getCoalition() Event.IniCoalition = Event.IniDCSUnit:getCoalition()
Event.IniCategory = Event.IniDCSUnit:getDesc().category Event.IniCategory = Event.IniDCSUnit:getDesc().category
Event.IniTypeName = Event.IniDCSUnit:getTypeName() Event.IniTypeName = Event.IniDCSUnit:getTypeName()
end
if Event.IniObjectCategory == Object.Category.SCENERY then elseif Event.IniObjectCategory == Object.Category.SCENERY then
--- ---
-- Scenery -- Scenery
--- ---
@@ -1172,9 +1238,8 @@ function EVENT:onEvent( Event )
Event.IniUnit = SCENERY:Register( Event.IniDCSUnitName, Event.initiator ) Event.IniUnit = SCENERY:Register( Event.IniDCSUnitName, Event.initiator )
Event.IniCategory = Event.IniDCSUnit:getDesc().category Event.IniCategory = Event.IniDCSUnit:getDesc().category
Event.IniTypeName = Event.initiator:isExist() and Event.IniDCSUnit:getTypeName() or "SCENERY" Event.IniTypeName = Event.initiator:isExist() and Event.IniDCSUnit:getTypeName() or "SCENERY"
end
if Event.IniObjectCategory == Object.Category.BASE then elseif Event.IniObjectCategory == Object.Category.BASE then
--- ---
-- Base Object -- Base Object
--- ---
@@ -1201,9 +1266,12 @@ function EVENT:onEvent( Event )
--- ---
-- Target category. -- Target category.
Event.TgtObjectCategory = Event.target:getCategory() Event.TgtObjectCategory = Object.getCategory(Event.target)
if Event.TgtObjectCategory == Object.Category.UNIT then if Event.TgtObjectCategory == Object.Category.UNIT then
---
-- UNIT
---
Event.TgtDCSUnit = Event.target Event.TgtDCSUnit = Event.target
Event.TgtDCSGroup = Event.TgtDCSUnit:getGroup() Event.TgtDCSGroup = Event.TgtDCSUnit:getGroup()
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName() Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
@@ -1216,21 +1284,33 @@ function EVENT:onEvent( Event )
Event.TgtGroupName = Event.TgtDCSGroupName Event.TgtGroupName = Event.TgtDCSGroupName
end end
Event.TgtPlayerName = Event.TgtDCSUnit:getPlayerName() Event.TgtPlayerName = Event.TgtDCSUnit:getPlayerName()
if Event.TgtPlayerName then
-- get UUCID
local PID = NET.GetPlayerIDByName(nil,Event.TgtPlayerName)
if PID then
Event.TgtPlayerUCID = net.get_player_info(tonumber(PID), 'ucid')
--env.info("Event.TgtPlayerUCID="..tostring(Event.TgtPlayerUCID),false)
end
end
Event.TgtCoalition = Event.TgtDCSUnit:getCoalition() Event.TgtCoalition = Event.TgtDCSUnit:getCoalition()
Event.TgtCategory = Event.TgtDCSUnit:getDesc().category Event.TgtCategory = Event.TgtDCSUnit:getDesc().category
Event.TgtTypeName = Event.TgtDCSUnit:getTypeName() Event.TgtTypeName = Event.TgtDCSUnit:getTypeName()
end
if Event.TgtObjectCategory == Object.Category.STATIC then elseif Event.TgtObjectCategory == Object.Category.STATIC then
-- get base data ---
-- STATIC
---
Event.TgtDCSUnit = Event.target Event.TgtDCSUnit = Event.target
if Event.target:isExist() and Event.id ~= 33 and not Event.TgtObjectCategory == Object.Category.COORDINATE then -- leave out ejected seat object if Event.target:isExist() and Event.id ~= 33 then -- leave out ejected seat object
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName() Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
Event.TgtUnitName = Event.TgtDCSUnitName -- Workaround for borked target info on cruise missiles
Event.TgtUnit = STATIC:FindByName( Event.TgtDCSUnitName, false ) if Event.TgtDCSUnitName and Event.TgtDCSUnitName ~= "" then
Event.TgtCoalition = Event.TgtDCSUnit:getCoalition() Event.TgtUnitName = Event.TgtDCSUnitName
Event.TgtCategory = Event.TgtDCSUnit:getDesc().category Event.TgtUnit = STATIC:FindByName( Event.TgtDCSUnitName, false )
Event.TgtTypeName = Event.TgtDCSUnit:getTypeName() Event.TgtCoalition = Event.TgtDCSUnit:getCoalition()
Event.TgtCategory = Event.TgtDCSUnit:getDesc().category
Event.TgtTypeName = Event.TgtDCSUnit:getTypeName()
end
else else
Event.TgtDCSUnitName = string.format("No target object for Event ID %s", tostring(Event.id)) Event.TgtDCSUnitName = string.format("No target object for Event ID %s", tostring(Event.id))
Event.TgtUnitName = Event.TgtDCSUnitName Event.TgtUnitName = Event.TgtDCSUnitName
@@ -1249,9 +1329,11 @@ function EVENT:onEvent( Event )
Event.TgtTypeName = "Static" Event.TgtTypeName = "Static"
end end
end end
end
if Event.TgtObjectCategory == Object.Category.SCENERY then elseif Event.TgtObjectCategory == Object.Category.SCENERY then
---
-- SCENERY
---
Event.TgtDCSUnit = Event.target Event.TgtDCSUnit = Event.target
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName() Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
Event.TgtUnitName = Event.TgtDCSUnitName Event.TgtUnitName = Event.TgtDCSUnitName
@@ -1266,7 +1348,8 @@ function EVENT:onEvent( Event )
Event.Weapon = Event.weapon Event.Weapon = Event.weapon
Event.WeaponName = Event.Weapon:getTypeName() Event.WeaponName = Event.Weapon:getTypeName()
Event.WeaponUNIT = CLIENT:Find( Event.Weapon, '', true ) -- Sometimes, the weapon is a player unit! Event.WeaponUNIT = CLIENT:Find( Event.Weapon, '', true ) -- Sometimes, the weapon is a player unit!
Event.WeaponPlayerName = Event.WeaponUNIT and Event.Weapon:getPlayerName() Event.WeaponPlayerName = Event.WeaponUNIT and Event.Weapon.getPlayerName and Event.Weapon:getPlayerName()
--Event.WeaponPlayerName = Event.WeaponUNIT and Event.Weapon:getPlayerName()
Event.WeaponCoalition = Event.WeaponUNIT and Event.Weapon:getCoalition() Event.WeaponCoalition = Event.WeaponUNIT and Event.Weapon:getCoalition()
Event.WeaponCategory = Event.WeaponUNIT and Event.Weapon:getDesc().category Event.WeaponCategory = Event.WeaponUNIT and Event.Weapon:getDesc().category
Event.WeaponTypeName = Event.WeaponUNIT and Event.Weapon:getTypeName() Event.WeaponTypeName = Event.WeaponUNIT and Event.Weapon:getTypeName()
@@ -1281,7 +1364,7 @@ function EVENT:onEvent( Event )
-- However, this is not a big thing, as the aircraft the pilot ejected from is usually long crashed before the ejected pilot touches the ground. -- However, this is not a big thing, as the aircraft the pilot ejected from is usually long crashed before the ejected pilot touches the ground.
--Event.Place=UNIT:Find(Event.place) --Event.Place=UNIT:Find(Event.place)
else else
if Event.place:isExist() and Event.place:getCategory() ~= Object.Category.SCENERY then if Event.place:isExist() and Object.getCategory(Event.place) ~= Object.Category.SCENERY then
Event.Place=AIRBASE:Find(Event.place) Event.Place=AIRBASE:Find(Event.place)
Event.PlaceName=Event.Place:GetName() Event.PlaceName=Event.Place:GetName()
end end

View File

@@ -249,7 +249,7 @@ do -- FSM
-- --
-- ### Linear Transition Example -- ### Linear Transition Example
-- --
-- This example is fully implemented in the MOOSE test mission on GITHUB: [FSM-100 - Transition Explanation](https://github.com/FlightControl-Master/MOOSE/blob/master/Moose%20Test%20Missions/FSM%20-%20Finite%20State%20Machine/FSM-100%20-%20Transition%20Explanation/FSM-100%20-%20Transition%20Explanation.lua) -- This example is fully implemented in the MOOSE test mission on GitHub: [FSM-100 - Transition Explanation](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Core/FSM/FSM-100%20-%20Transition%20Explanation)
-- --
-- It models a unit standing still near Batumi, and flaring every 5 seconds while switching between a Green flare and a Red flare. -- It models a unit standing still near Batumi, and flaring every 5 seconds while switching between a Green flare and a Red flare.
-- The purpose of this example is not to show how exciting flaring is, but it demonstrates how a Linear Transition FSM can be build. -- The purpose of this example is not to show how exciting flaring is, but it demonstrates how a Linear Transition FSM can be build.
@@ -1260,7 +1260,7 @@ do -- FSM_PROCESS
--- Assign the process to a @{Wrapper.Unit} and activate the process. --- Assign the process to a @{Wrapper.Unit} and activate the process.
-- @param #FSM_PROCESS self -- @param #FSM_PROCESS self
-- @param Task.Tasking#TASK Task -- @param Tasking.Task#TASK Task
-- @param Wrapper.Unit#UNIT ProcessUnit -- @param Wrapper.Unit#UNIT ProcessUnit
-- @return #FSM_PROCESS self -- @return #FSM_PROCESS self
function FSM_PROCESS:Assign( ProcessUnit, Task ) function FSM_PROCESS:Assign( ProcessUnit, Task )

View File

@@ -17,7 +17,7 @@
-- ### Author: **Applevangelist** -- ### Author: **Applevangelist**
-- --
-- Date: 5 May 2021 -- Date: 5 May 2021
-- Last Update: Sep 2022 -- Last Update: Feb 2023
-- --
-- === -- ===
--- ---
@@ -50,7 +50,7 @@ MARKEROPS_BASE = {
ClassName = "MARKEROPS", ClassName = "MARKEROPS",
Tag = "mytag", Tag = "mytag",
Keywords = {}, Keywords = {},
version = "0.1.0", version = "0.1.1",
debug = false, debug = false,
Casesensitive = true, Casesensitive = true,
} }
@@ -124,7 +124,8 @@ function MARKEROPS_BASE:New(Tagname,Keywords,Casesensitive)
-- @param #string Text The text on the marker -- @param #string Text The text on the marker
-- @param #table Keywords Table of matching keywords found in the Event text -- @param #table Keywords Table of matching keywords found in the Event text
-- @param Core.Point#COORDINATE Coord Coordinate of the marker. -- @param Core.Point#COORDINATE Coord Coordinate of the marker.
-- @param #number idx DCS Marker ID
--- On after "MarkDeleted" event. Triggered when a Marker is deleted from the F10 map. --- On after "MarkDeleted" event. Triggered when a Marker is deleted from the F10 map.
-- @function [parent=#MARKEROPS_BASE] OnAfterMarkDeleted -- @function [parent=#MARKEROPS_BASE] OnAfterMarkDeleted
-- @param #MARKEROPS_BASE self -- @param #MARKEROPS_BASE self
@@ -172,7 +173,7 @@ function MARKEROPS_BASE:OnEventMark(Event)
if Eventtext~=nil then if Eventtext~=nil then
if self:_MatchTag(Eventtext) then if self:_MatchTag(Eventtext) then
local matchtable = self:_MatchKeywords(Eventtext) local matchtable = self:_MatchKeywords(Eventtext)
self:MarkChanged(Eventtext,matchtable,coord) self:MarkChanged(Eventtext,matchtable,coord,Event.idx)
end end
end end
elseif Event.id==world.event.S_EVENT_MARK_REMOVED then elseif Event.id==world.event.S_EVENT_MARK_REMOVED then

View File

@@ -513,7 +513,7 @@ do -- MENU_COALITION
--- @type MENU_COALITION --- @type MENU_COALITION
-- @extends Core.Menu#MENU_BASE -- @extends Core.Menu#MENU_BASE
--- Manages the main menus for @{DCS.coalition}s. --- Manages the main menus for DCS.coalition.
-- --
-- You can add menus with the @{#MENU_COALITION.New} method, which constructs a MENU_COALITION object and returns you the object reference. -- You can add menus with the @{#MENU_COALITION.New} method, which constructs a MENU_COALITION object and returns you the object reference.
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_COALITION.Remove}. -- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_COALITION.Remove}.

View File

@@ -52,7 +52,7 @@
-- === -- ===
-- --
-- ### Author: **FlightControl** -- ### Author: **FlightControl**
-- ### Contributions: -- ### Contributions: **Applevangelist**
-- --
-- === -- ===
-- --
@@ -73,7 +73,7 @@ MESSAGE.Type = {
Detailed = "Detailed Report", Detailed = "Detailed Report",
} }
--- Creates a new MESSAGE object. Note that these MESSAGE objects are not yet displayed on the display panel. You must use the functions @{ToClient} or @{ToCoalition} or @{ToAll} to send these Messages to the respective recipients. --- Creates a new MESSAGE object. Note that these MESSAGE objects are not yet displayed on the display panel. You must use the functions @{#MESSAGE.ToClient} or @{#MESSAGE.ToCoalition} or @{#MESSAGE.ToAll} to send these Messages to the respective recipients.
-- @param self -- @param self
-- @param #string MessageText is the text of the Message. -- @param #string MessageText is the text of the Message.
-- @param #number MessageDuration is a number in seconds of how long the MESSAGE should be shown on the display panel. -- @param #number MessageDuration is a number in seconds of how long the MESSAGE should be shown on the display panel.
@@ -127,7 +127,7 @@ end
--- Creates a new MESSAGE object of a certain type. --- Creates a new MESSAGE object of a certain type.
-- Note that these MESSAGE objects are not yet displayed on the display panel. -- Note that these MESSAGE objects are not yet displayed on the display panel.
-- You must use the functions @{ToClient} or @{ToCoalition} or @{ToAll} to send these Messages to the respective recipients. -- You must use the functions @{Core.Message#ToClient} or @{Core.Message#ToCoalition} or @{Core.Message#ToAll} to send these Messages to the respective recipients.
-- The message display times are automatically defined based on the timing settings in the @{Core.Settings} menu. -- The message display times are automatically defined based on the timing settings in the @{Core.Settings} menu.
-- @param self -- @param self
-- @param #string MessageText is the text of the Message. -- @param #string MessageText is the text of the Message.
@@ -343,7 +343,7 @@ end
--- Sends a MESSAGE to a Coalition. --- Sends a MESSAGE to a Coalition.
-- @param #MESSAGE self -- @param #MESSAGE self
-- @param #DCS.coalition.side CoalitionSide @{#DCS.coalition.side} to which the message is displayed. -- @param DCS#coalition.side CoalitionSide @{#DCS.coalition.side} to which the message is displayed.
-- @param Core.Settings#SETTINGS Settings (Optional) Settings for message display. -- @param Core.Settings#SETTINGS Settings (Optional) Settings for message display.
-- @return #MESSAGE Message object. -- @return #MESSAGE Message object.
-- @usage -- @usage
@@ -368,16 +368,18 @@ function MESSAGE:ToCoalition( CoalitionSide, Settings )
if CoalitionSide then if CoalitionSide then
if self.MessageDuration ~= 0 then if self.MessageDuration ~= 0 then
self:T( self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ) .. " / " .. self.MessageDuration ) self:T( self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ) .. " / " .. self.MessageDuration )
trigger.action.outTextForCoalition( CoalitionSide, self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ), self.MessageDuration, self.ClearScreen ) trigger.action.outTextForCoalition( CoalitionSide, self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ), self.MessageDuration, self.ClearScreen )
end end
end end
self.CoalitionSide = CoalitionSide
return self return self
end end
--- Sends a MESSAGE to a Coalition if the given Condition is true. --- Sends a MESSAGE to a Coalition if the given Condition is true.
-- @param #MESSAGE self -- @param #MESSAGE self
-- @param CoalitionSide needs to be filled out by the defined structure of the standard scripting engine @{coalition.side}. -- @param CoalitionSide needs to be filled out by the defined structure of the standard scripting engine @{#DCS.coalition.side}.
-- @param #boolean Condition Sends the message only if the condition is true. -- @param #boolean Condition Sends the message only if the condition is true.
-- @return #MESSAGE self -- @return #MESSAGE self
function MESSAGE:ToCoalitionIf( CoalitionSide, Condition ) function MESSAGE:ToCoalitionIf( CoalitionSide, Condition )
@@ -454,3 +456,169 @@ function MESSAGE:ToLogIf( Condition )
end end
return self return self
end end
_MESSAGESRS = {}
--- Set up MESSAGE generally to allow Text-To-Speech via SRS and TTS functions. `SetMSRS()` will try to use as many attributes configured with @{Sound.SRS#MSRS.LoadConfigFile}() as possible.
-- @param #string PathToSRS (optional) Path to SRS Folder, defaults to "C:\\\\Program Files\\\\DCS-SimpleRadio-Standalone" or your configuration file setting.
-- @param #number Port Port (optional) number of SRS, defaults to 5002 or your configuration file setting.
-- @param #string PathToCredentials (optional) Path to credentials file for Google.
-- @param #number Frequency Frequency in MHz. Can also be given as a #table of frequencies.
-- @param #number Modulation Modulation, i.e. radio.modulation.AM or radio.modulation.FM. Can also be given as a #table of modulations.
-- @param #string Gender (optional) Gender, i.e. "male" or "female", defaults to "female" or your configuration file setting.
-- @param #string Culture (optional) Culture, e.g. "en-US", defaults to "en-GB" or your configuration file setting.
-- @param #string Voice (optional) Voice. Will override gender and culture settings, e.g. MSRS.Voices.Microsoft.Hazel or MSRS.Voices.Google.Standard.de_DE_Standard_D. Hint on Microsoft voices - working voices are limited to Hedda, Hazel, David, Zira and Hortense. **Must** be installed on your Desktop or Server!
-- @param #number Coalition (optional) Coalition, can be coalition.side.RED, coalition.side.BLUE or coalition.side.NEUTRAL. Defaults to coalition.side.NEUTRAL.
-- @param #number Volume (optional) Volume, can be between 0.0 and 1.0 (loudest).
-- @param #string Label (optional) Label, defaults to "MESSAGE" or the Message Category set.
-- @param Core.Point#COORDINATE Coordinate (optional) Coordinate this messages originates from.
-- @usage
-- -- Mind the dot here, not using the colon this time around!
-- -- Needed once only
-- MESSAGE.SetMSRS("D:\\Program Files\\DCS-SimpleRadio-Standalone",5012,nil,127,radio.modulation.FM,"female","en-US",nil,coalition.side.BLUE)
-- -- later on in your code
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRS()
--
function MESSAGE.SetMSRS(PathToSRS,Port,PathToCredentials,Frequency,Modulation,Gender,Culture,Voice,Coalition,Volume,Label,Coordinate)
_MESSAGESRS.PathToSRS = PathToSRS or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone"
_MESSAGESRS.frequency = Frequency or MSRS.frequencies or 243
_MESSAGESRS.modulation = Modulation or MSRS.modulations or radio.modulation.AM
_MESSAGESRS.MSRS = MSRS:New(_MESSAGESRS.PathToSRS,_MESSAGESRS.frequency, _MESSAGESRS.modulation)
_MESSAGESRS.coalition = Coalition or MSRS.coalition or coalition.side.NEUTRAL
_MESSAGESRS.MSRS:SetCoalition(_MESSAGESRS.coalition)
_MESSAGESRS.coordinate = Coordinate
if Coordinate then
_MESSAGESRS.MSRS:SetCoordinate(Coordinate)
end
_MESSAGESRS.Culture = Culture or MSRS.culture or "en-GB"
_MESSAGESRS.MSRS:SetCulture(Culture)
_MESSAGESRS.Gender = Gender or MSRS.gender or "female"
_MESSAGESRS.MSRS:SetGender(Gender)
if PathToCredentials then
_MESSAGESRS.MSRS:SetProviderOptionsGoogle(PathToCredentials)
_MESSAGESRS.MSRS:SetProvider(MSRS.Provider.GOOGLE)
end
_MESSAGESRS.label = Label or MSRS.Label or "MESSAGE"
_MESSAGESRS.MSRS:SetLabel(Label or "MESSAGE")
_MESSAGESRS.port = Port or MSRS.port or 5002
_MESSAGESRS.MSRS:SetPort(Port or 5002)
_MESSAGESRS.volume = Volume or MSRS.volume or 1
_MESSAGESRS.MSRS:SetVolume(_MESSAGESRS.volume)
if Voice then _MESSAGESRS.MSRS:SetVoice(Voice) end
_MESSAGESRS.voice = Voice or MSRS.voice --or MSRS.Voices.Microsoft.Hedda
_MESSAGESRS.SRSQ = MSRSQUEUE:New(_MESSAGESRS.label)
end
--- Sends a message via SRS. `ToSRS()` will try to use as many attributes configured with @{Core.Message#MESSAGE.SetMSRS}() and @{Sound.SRS#MSRS.LoadConfigFile}() as possible.
-- @param #MESSAGE self
-- @param #number frequency (optional) Frequency in MHz. Can also be given as a #table of frequencies. Only needed if you want to override defaults set with `MESSAGE.SetMSRS()` for this one setting.
-- @param #number modulation (optional) Modulation, i.e. radio.modulation.AM or radio.modulation.FM. Can also be given as a #table of modulations. Only needed if you want to override defaults set with `MESSAGE.SetMSRS()` for this one setting.
-- @param #string gender (optional) Gender, i.e. "male" or "female". Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
-- @param #string culture (optional) Culture, e.g. "en-US". Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
-- @param #string voice (optional) Voice. Will override gender and culture settings. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
-- @param #number coalition (optional) Coalition, can be coalition.side.RED, coalition.side.BLUE or coalition.side.NEUTRAL. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
-- @param #number volume (optional) Volume, can be between 0.0 and 1.0 (loudest). Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
-- @param Core.Point#COORDINATE coordinate (optional) Coordinate this messages originates from. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
-- @return #MESSAGE self
-- @usage
-- -- Mind the dot here, not using the colon this time around!
-- -- Needed once only
-- MESSAGE.SetMSRS("D:\\Program Files\\DCS-SimpleRadio-Standalone",5012,nil,127,radio.modulation.FM,"female","en-US",nil,coalition.side.BLUE)
-- -- later on in your code
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRS()
--
function MESSAGE:ToSRS(frequency,modulation,gender,culture,voice,coalition,volume,coordinate)
local tgender = gender or _MESSAGESRS.Gender
if _MESSAGESRS.SRSQ then
if voice then
_MESSAGESRS.MSRS:SetVoice(voice or _MESSAGESRS.voice)
end
if coordinate then
_MESSAGESRS.MSRS:SetCoordinate(coordinate)
end
local category = string.gsub(self.MessageCategory,":","")
_MESSAGESRS.SRSQ:NewTransmission(self.MessageText,nil,_MESSAGESRS.MSRS,0.5,1,nil,nil,nil,frequency or _MESSAGESRS.frequency,modulation or _MESSAGESRS.modulation, gender or _MESSAGESRS.Gender,culture or _MESSAGESRS.Culture,nil,volume or _MESSAGESRS.volume,category,coordinate or _MESSAGESRS.coordinate)
end
return self
end
--- Sends a message via SRS on the blue coalition side.
-- @param #MESSAGE self
-- @param #number frequency (optional) Frequency in MHz. Can also be given as a #table of frequencies. Only needed if you want to override defaults set with `MESSAGE.SetMSRS()` for this one setting.
-- @param #number modulation (optional) Modulation, i.e. radio.modulation.AM or radio.modulation.FM. Can also be given as a #table of modulations. Only needed if you want to override defaults set with `MESSAGE.SetMSRS()` for this one setting.
-- @param #string gender (optional) Gender, i.e. "male" or "female". Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
-- @param #string culture (optional) Culture, e.g. "en-US. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
-- @param #string voice (optional) Voice. Will override gender and culture settings. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
-- @param #number volume (optional) Volume, can be between 0.0 and 1.0 (loudest). Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
-- @param Core.Point#COORDINATE coordinate (optional) Coordinate this messages originates from. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
-- @return #MESSAGE self
-- @usage
-- -- Mind the dot here, not using the colon this time around!
-- -- Needed once only
-- MESSAGE.SetMSRS("D:\\Program Files\\DCS-SimpleRadio-Standalone",5012,nil,127,radio.modulation.FM,"female","en-US",nil,coalition.side.BLUE)
-- -- later on in your code
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRSBlue()
--
function MESSAGE:ToSRSBlue(frequency,modulation,gender,culture,voice,volume,coordinate)
self:ToSRS(frequency,modulation,gender,culture,voice,coalition.side.BLUE,volume,coordinate)
return self
end
--- Sends a message via SRS on the red coalition side.
-- @param #MESSAGE self
-- @param #number frequency (optional) Frequency in MHz. Can also be given as a #table of frequencies. Only needed if you want to override defaults set with `MESSAGE.SetMSRS()` for this one setting.
-- @param #number modulation (optional) Modulation, i.e. radio.modulation.AM or radio.modulation.FM. Can also be given as a #table of modulations. Only needed if you want to override defaults set with `MESSAGE.SetMSRS()` for this one setting.
-- @param #string gender (optional) Gender, i.e. "male" or "female". Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
-- @param #string culture (optional) Culture, e.g. "en-US. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
-- @param #string voice (optional) Voice. Will override gender and culture settings. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
-- @param #number volume (optional) Volume, can be between 0.0 and 1.0 (loudest). Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
-- @param Core.Point#COORDINATE coordinate (optional) Coordinate this messages originates from. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
-- @return #MESSAGE self
-- @usage
-- -- Mind the dot here, not using the colon this time around!
-- -- Needed once only
-- MESSAGE.SetMSRS("D:\\Program Files\\DCS-SimpleRadio-Standalone",5012,nil,127,radio.modulation.FM,"female","en-US",nil,coalition.side.RED)
-- -- later on in your code
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRSRed()
--
function MESSAGE:ToSRSRed(frequency,modulation,gender,culture,voice,volume,coordinate)
self:ToSRS(frequency,modulation,gender,culture,voice,coalition.side.RED,volume,coordinate)
return self
end
--- Sends a message via SRS to all - via the neutral coalition side.
-- @param #MESSAGE self
-- @param #number frequency (optional) Frequency in MHz. Can also be given as a #table of frequencies. Only needed if you want to override defaults set with `MESSAGE.SetMSRS()` for this one setting.
-- @param #number modulation (optional) Modulation, i.e. radio.modulation.AM or radio.modulation.FM. Can also be given as a #table of modulations. Only needed if you want to override defaults set with `MESSAGE.SetMSRS()` for this one setting.
-- @param #string gender (optional) Gender, i.e. "male" or "female". Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
-- @param #string culture (optional) Culture, e.g. "en-US. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
-- @param #string voice (optional) Voice. Will override gender and culture settings. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
-- @param #number volume (optional) Volume, can be between 0.0 and 1.0 (loudest). Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
-- @param Core.Point#COORDINATE coordinate (optional) Coordinate this messages originates from. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`.
-- @return #MESSAGE self
-- @usage
-- -- Mind the dot here, not using the colon this time around!
-- -- Needed once only
-- MESSAGE.SetMSRS("D:\\Program Files\\DCS-SimpleRadio-Standalone",5012,nil,127,radio.modulation.FM,"female","en-US",nil,coalition.side.NEUTRAL)
-- -- later on in your code
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRSAll()
--
function MESSAGE:ToSRSAll(frequency,modulation,gender,culture,voice,volume,coordinate)
self:ToSRS(frequency,modulation,gender,culture,voice,coalition.side.NEUTRAL,volume,coordinate)
return self
end

View File

@@ -0,0 +1,370 @@
--- **Core** - Path from A to B.
--
-- **Main Features:**
--
-- * Path from A to B
-- * Arbitrary number of points
-- * Automatically from lines drawtool
--
-- ===
--
-- ### Author: **funkyfranky**
--
-- ===
-- @module Core.Pathline
-- @image CORE_Pathline.png
--- PATHLINE class.
-- @type PATHLINE
-- @field #string ClassName Name of the class.
-- @field #string lid Class id string for output to DCS log file.
-- @field #string name Name of the path line.
-- @field #table points List of 3D points defining the path.
-- @extends Core.Base#BASE
--- *The shortest distance between two points is a straight line.* -- Archimedes
--
-- ===
--
-- # The PATHLINE Concept
--
-- List of points defining a path from A to B. The pathline can consist of multiple points. Each point holds the information of its position, the surface type, the land height
-- and the water depth (if over sea).
--
-- Line drawings created in the mission editor are automatically registered as pathlines and stored in the MOOSE database.
-- They can be accessed with the @{#PATHLINE.FindByName) function.
--
-- # Constructor
--
-- The @{PATHLINE.New) function creates a new PATHLINE object. This does not hold any points. Points can be added with the @{#PATHLINE.AddPointFromVec2} and @{#PATHLINE.AddPointFromVec3}
--
-- For a given table of 2D or 3D positions, a new PATHLINE object can be created with the @{#PATHLINE.NewFromVec2Array} or @{#PATHLINE.NewFromVec3Array}, respectively.
--
-- # Line Drawings
--
-- The most convenient way to create a pathline is the draw panel feature in the DCS mission editor. You can select "Line" and then "Segments", "Segment" or "Free" to draw your lines.
-- These line drawings are then automatically added to the MOOSE database as PATHLINE objects and can be retrieved with the @{#PATHLINE.FindByName) function, where the name is the one
-- you specify in the draw panel.
--
-- # Mark on F10 map
--
-- The ponints of the PATHLINE can be marked on the F10 map with the @{#PATHLINE.MarkPoints}(`true`) function. The mark points contain information of the surface type, land height and
-- water depth.
--
-- To remove the marks, use @{#PATHLINE.MarkPoints}(`false`).
--
-- @field #PATHLINE
PATHLINE = {
ClassName = "PATHLINE",
lid = nil,
points = {},
}
--- Point of line.
-- @type PATHLINE.Point
-- @field DCS#Vec3 vec3 3D position.
-- @field DCS#Vec2 vec2 2D position.
-- @field #number surfaceType Surface type.
-- @field #number landHeight Land height in meters.
-- @field #number depth Water depth in meters.
-- @field #number markerID Marker ID.
--- PATHLINE class version.
-- @field #string version
PATHLINE.version="0.1.0"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO list
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO: A lot...
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Constructor
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Create a new PATHLINE object. Points need to be added later.
-- @param #PATHLINE self
-- @param #string Name Name of the path.
-- @return #PATHLINE self
function PATHLINE:New(Name)
-- Inherit everything from INTEL class.
local self=BASE:Inherit(self, BASE:New()) --#PATHLINE
self.name=Name or "Unknown Path"
self.lid=string.format("PATHLINE %s | ", Name)
return self
end
--- Create a new PATHLINE object from a given list of 2D points.
-- @param #PATHLINE self
-- @param #string Name Name of the pathline.
-- @param #table Vec2Array List of DCS#Vec2 points.
-- @return #PATHLINE self
function PATHLINE:NewFromVec2Array(Name, Vec2Array)
local self=PATHLINE:New(Name)
for i=1,#Vec2Array do
self:AddPointFromVec2(Vec2Array[i])
end
return self
end
--- Create a new PATHLINE object from a given list of 3D points.
-- @param #PATHLINE self
-- @param #string Name Name of the pathline.
-- @param #table Vec3Array List of DCS#Vec3 points.
-- @return #PATHLINE self
function PATHLINE:NewFromVec3Array(Name, Vec3Array)
local self=PATHLINE:New(Name)
for i=1,#Vec3Array do
self:AddPointFromVec3(Vec3Array[i])
end
return self
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- User functions
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Find a pathline in the database.
-- @param #PATHLINE self
-- @param #string Name The name of the pathline.
-- @return #PATHLINE self
function PATHLINE:FindByName(Name)
local pathline = _DATABASE:FindPathline(Name)
return pathline
end
--- Add a point to the path from a given 2D position. The third dimension is determined from the land height.
-- @param #PATHLINE self
-- @param DCS#Vec2 Vec2 The 2D vector (x,y) to add.
-- @return #PATHLINE self
function PATHLINE:AddPointFromVec2(Vec2)
if Vec2 then
local point=self:_CreatePoint(Vec2)
table.insert(self.points, point)
end
return self
end
--- Add a point to the path from a given 3D position.
-- @param #PATHLINE self
-- @param DCS#Vec3 Vec3 The 3D vector (x,y) to add.
-- @return #PATHLINE self
function PATHLINE:AddPointFromVec3(Vec3)
if Vec3 then
local point=self:_CreatePoint(Vec3)
table.insert(self.points, point)
end
return self
end
--- Get name of pathline.
-- @param #PATHLINE self
-- @return #string Name of the pathline.
function PATHLINE:GetName()
return self.name
end
--- Get number of points.
-- @param #PATHLINE self
-- @return #number Number of points.
function PATHLINE:GetNumberOfPoints()
local N=#self.points
return N
end
--- Get points of pathline. Not that points are tables, that contain more information as just the 2D or 3D position but also the surface type etc.
-- @param #PATHLINE self
-- @return #list <#PATHLINE.Point> List of points.
function PATHLINE:GetPoints()
return self.points
end
--- Get 3D points of pathline.
-- @param #PATHLINE self
-- @return <DCS#Vec3> List of DCS#Vec3 points.
function PATHLINE:GetPoints3D()
local vecs={}
for _,_point in pairs(self.points) do
local point=_point --#PATHLINE.Point
table.insert(vecs, point.vec3)
end
return vecs
end
--- Get 2D points of pathline.
-- @param #PATHLINE self
-- @return <DCS#Vec2> List of DCS#Vec2 points.
function PATHLINE:GetPoints2D()
local vecs={}
for _,_point in pairs(self.points) do
local point=_point --#PATHLINE.Point
table.insert(vecs, point.vec2)
end
return vecs
end
--- Get COORDINATES of pathline. Note that COORDINATE objects are created when calling this function. That does involve deep copy calls and can have an impact on performance if done too often.
-- @param #PATHLINE self
-- @return <Core.Point#COORDINATE> List of COORDINATES points.
function PATHLINE:GetCoordinats()
local vecs={}
for _,_point in pairs(self.points) do
local point=_point --#PATHLINE.Point
local coord=COORDINATE:NewFromVec3(point.vec3)
end
return vecs
end
--- Get the n-th point of the pathline.
-- @param #PATHLINE self
-- @param #number n The index of the point. Default is the first point.
-- @return #PATHLINE.Point Point.
function PATHLINE:GetPointFromIndex(n)
local N=self:GetNumberOfPoints()
n=n or 1
local point=nil --#PATHLINE.Point
if n>=1 and n<=N then
point=self.point[n]
else
self:E(self.lid..string.format("ERROR: No point in pathline for N=%s", tostring(n)))
end
return point
end
--- Get the 3D position of the n-th point.
-- @param #PATHLINE self
-- @param #number n The n-th point.
-- @return DCS#VEC3 Position in 3D.
function PATHLINE:GetPoint3DFromIndex(n)
local point=self:GetPointFromIndex(n)
if point then
return point.vec3
end
return nil
end
--- Get the 2D position of the n-th point.
-- @param #PATHLINE self
-- @param #number n The n-th point.
-- @return DCS#VEC2 Position in 3D.
function PATHLINE:GetPoint2DFromIndex(n)
local point=self:GetPointFromIndex(n)
if point then
return point.vec2
end
return nil
end
--- Mark points on F10 map.
-- @param #PATHLINE self
-- @param #boolean Switch If `true` or nil, set marks. If `false`, remove marks.
-- @return <DCS#Vec3> List of DCS#Vec3 points.
function PATHLINE:MarkPoints(Switch)
for i,_point in pairs(self.points) do
local point=_point --#PATHLINE.Point
if Switch==false then
if point.markerID then
UTILS.RemoveMark(point.markerID, Delay)
end
else
if point.markerID then
UTILS.RemoveMark(point.markerID)
end
point.markerID=UTILS.GetMarkID()
local text=string.format("Pathline %s: Point #%d\nSurface Type=%d\nHeight=%.1f m\nDepth=%.1f m", self.name, i, point.surfaceType, point.landHeight, point.depth)
trigger.action.markToAll(point.markerID, text, point.vec3, "")
end
end
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Private functions
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Get 3D points of pathline.
-- @param #PATHLINE self
-- @param DCS#Vec3 Vec Position vector. Can also be a DCS#Vec2 in which case the altitude at landheight is taken.
-- @return #PATHLINE.Point
function PATHLINE:_CreatePoint(Vec)
local point={} --#PATHLINE.Point
if Vec.z then
-- Given vec is 3D
point.vec3=UTILS.DeepCopy(Vec)
point.vec2={x=Vec.x, y=Vec.z}
else
-- Given vec is 2D
point.vec2=UTILS.DeepCopy(Vec)
point.vec3={x=Vec.x, y=land.getHeight(Vec), z=Vec.y}
end
-- Get surface type.
point.surfaceType=land.getSurfaceType(point.vec2)
-- Get land height and depth.
point.landHeight, point.depth=land.getSurfaceHeightWithSeabed(point.vec2)
point.markerID=nil
return point
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -8,22 +8,6 @@
-- --
-- === -- ===
-- --
-- # Demo Missions
--
-- ### [POINT_VEC Demo Missions source code]()
--
-- ### [POINT_VEC Demo Missions, only for beta testers]()
--
-- ### [ALL Demo Missions pack of the last release](https://github.com/FlightControl-Master/MOOSE_MISSIONS/releases)
--
-- ===
--
-- # YouTube Channel
--
-- ### [POINT_VEC YouTube Channel]()
--
-- ===
--
-- ### Authors: -- ### Authors:
-- --
-- * FlightControl (Design & Programming) -- * FlightControl (Design & Programming)
@@ -40,8 +24,9 @@
do -- COORDINATE do -- COORDINATE
--- @type COORDINATE ---
-- @type COORDINATE
-- @field #string ClassName Name of the class -- @field #string ClassName Name of the class
-- @field #number x Component of the 3D vector. -- @field #number x Component of the 3D vector.
-- @field #number y Component of the 3D vector. -- @field #number y Component of the 3D vector.
@@ -196,7 +181,7 @@ do -- COORDINATE
-- * @{#COORDINATE.ToStringBR}(): Generates a Bearing & Range text in the format of DDD for DI where DDD is degrees and DI is distance. -- * @{#COORDINATE.ToStringBR}(): Generates a Bearing & Range text in the format of DDD for DI where DDD is degrees and DI is distance.
-- * @{#COORDINATE.ToStringBRA}(): Generates a Bearing, Range & Altitude text. -- * @{#COORDINATE.ToStringBRA}(): Generates a Bearing, Range & Altitude text.
-- * @{#COORDINATE.ToStringBRAANATO}(): Generates a Generates a Bearing, Range, Aspect & Altitude text in NATOPS. -- * @{#COORDINATE.ToStringBRAANATO}(): Generates a Generates a Bearing, Range, Aspect & Altitude text in NATOPS.
-- * @{#COORDINATE.ToStringLL}(): Generates a Latutide & Longitude text. -- * @{#COORDINATE.ToStringLL}(): Generates a Latitude & Longitude text.
-- * @{#COORDINATE.ToStringLLDMS}(): Generates a Lat, Lon, Degree, Minute, Second text. -- * @{#COORDINATE.ToStringLLDMS}(): Generates a Lat, Lon, Degree, Minute, Second text.
-- * @{#COORDINATE.ToStringLLDDM}(): Generates a Lat, Lon, Degree, decimal Minute text. -- * @{#COORDINATE.ToStringLLDDM}(): Generates a Lat, Lon, Degree, decimal Minute text.
-- * @{#COORDINATE.ToStringMGRS}(): Generates a MGRS grid coordinate text. -- * @{#COORDINATE.ToStringMGRS}(): Generates a MGRS grid coordinate text.
@@ -540,11 +525,11 @@ do -- COORDINATE
local gotscenery=false local gotscenery=false
local function EvaluateZone(ZoneObject) local function EvaluateZone(ZoneObject)
BASE:T({ZoneObject})
if ZoneObject then if ZoneObject then
-- Get category of scanned object. -- Get category of scanned object.
local ObjectCategory = ZoneObject:getCategory() local ObjectCategory = Object.getCategory(ZoneObject)
-- Check for unit or static objects -- Check for unit or static objects
if ObjectCategory==Object.Category.UNIT and ZoneObject:isExist() then if ObjectCategory==Object.Category.UNIT and ZoneObject:isExist() then
@@ -603,6 +588,46 @@ do -- COORDINATE
return set return set
end end
--- Scan/find STATICS within a certain radius around the coordinate using the world.searchObjects() DCS API function.
-- @param #COORDINATE self
-- @param #number radius (Optional) Scan radius in meters. Default 100 m.
-- @return Core.Set#SET_UNIT Set of units.
function COORDINATE:ScanStatics(radius)
local _,_,_,_,statics=self:ScanObjects(radius, false, true, false)
local set=SET_STATIC:New()
for _,stat in pairs(statics) do
set:AddStatic(STATIC:Find(stat))
end
return set
end
--- Find the closest static to the COORDINATE within a certain radius.
-- @param #COORDINATE self
-- @param #number radius Scan radius in meters. Default 100 m.
-- @return Wrapper.Static#STATIC The closest static or #nil if no unit is inside the given radius.
function COORDINATE:FindClosestStatic(radius)
local units=self:ScanStatics(radius)
local umin=nil --Wrapper.Unit#UNIT
local dmin=math.huge
for _,_unit in pairs(units.Set) do
local unit=_unit --Wrapper.Static#STATIC
local coordinate=unit:GetCoordinate()
local d=self:Get2DDistance(coordinate)
if d<dmin then
dmin=d
umin=unit
end
end
return umin
end
--- Find the closest unit to the COORDINATE within a certain radius. --- Find the closest unit to the COORDINATE within a certain radius.
-- @param #COORDINATE self -- @param #COORDINATE self
@@ -880,7 +905,7 @@ do -- COORDINATE
end end
--- Return an angle in radians from the COORDINATE using a direction vector in Vec3 format. --- Return an angle in radians from the COORDINATE using a **direction vector in Vec3 format**.
-- @param #COORDINATE self -- @param #COORDINATE self
-- @param DCS#Vec3 DirectionVec3 The direction vector in Vec3 format. -- @param DCS#Vec3 DirectionVec3 The direction vector in Vec3 format.
-- @return #number DirectionRadians The angle in radians. -- @return #number DirectionRadians The angle in radians.
@@ -893,10 +918,12 @@ do -- COORDINATE
return DirectionRadians return DirectionRadians
end end
--- Return an angle in degrees from the COORDINATE using a direction vector in Vec3 format. --- Return an angle in degrees from the COORDINATE using a **direction vector in Vec3 format**.
-- @param #COORDINATE self -- @param #COORDINATE self
-- @param DCS#Vec3 DirectionVec3 The direction vector in Vec3 format. -- @param DCS#Vec3 DirectionVec3 The direction vector in Vec3 format.
-- @return #number DirectionRadians The angle in degrees. -- @return #number DirectionRadians The angle in degrees.
-- @usage
-- local directionAngle = currentCoordinate:GetAngleDegrees(currentCoordinate:GetDirectionVec3(sourceCoordinate:GetVec3()))
function COORDINATE:GetAngleDegrees( DirectionVec3 ) function COORDINATE:GetAngleDegrees( DirectionVec3 )
local AngleRadians = self:GetAngleRadians( DirectionVec3 ) local AngleRadians = self:GetAngleRadians( DirectionVec3 )
local Angle = UTILS.ToDegree( AngleRadians ) local Angle = UTILS.ToDegree( AngleRadians )
@@ -1054,28 +1081,55 @@ do -- COORDINATE
return heading return heading
end end
--- Returns the 3D wind direction vector. Note that vector points into the direction the wind in blowing to.
-- @param #COORDINATE self
-- @param #number height (Optional) parameter specifying the height ASL in meters. The minimum height will be always be the land height since the wind is zero below the ground.
-- @param #boolean turbulence (Optional) If `true`, include turbulence.
-- @return DCS#Vec3 Wind 3D vector. Components in m/s.
function COORDINATE:GetWindVec3(height, turbulence)
-- We at 0.1 meters to be sure to be above ground since wind is zero below ground level.
local landheight=self:GetLandHeight()+0.1
local point={x=self.x, y=math.max(height or self.y, landheight), z=self.z}
-- Get wind velocity vector.
local wind = nil --DCS#Vec3
if turbulence then
wind = atmosphere.getWindWithTurbulence(point)
else
wind = atmosphere.getWind(point)
end
return wind
end
--- Returns the wind direction (from) and strength. --- Returns the wind direction (from) and strength.
-- @param #COORDINATE self -- @param #COORDINATE self
-- @param height (Optional) parameter specifying the height ASL. The minimum height will be always be the land height since the wind is zero below the ground. -- @param #number height (Optional) parameter specifying the height ASL. The minimum height will be always be the land height since the wind is zero below the ground.
-- @return Direction the wind is blowing from in degrees. -- @param #boolean turbulence If `true`, include turbulence. If `false` or `nil`, wind without turbulence.
-- @return Wind strength in m/s. -- @return #number Direction the wind is blowing from in degrees.
function COORDINATE:GetWind(height) -- @return #number Wind strength in m/s.
local landheight=self:GetLandHeight()+0.1 -- we at 0.1 meters to be sure to be above ground since wind is zero below ground level. function COORDINATE:GetWind(height, turbulence)
local point={x=self.x, y=math.max(height or self.y, landheight), z=self.z}
-- get wind velocity vector -- Get wind velocity vector
local wind = atmosphere.getWind(point) local wind = self:GetWindVec3(height, turbulence)
local direction = math.deg(math.atan2(wind.z, wind.x))
if direction < 0 then -- Calculate the direction of the vector.
direction = 360 + direction local direction=UTILS.VecHdg(wind)
end
-- Convert to direction to from direction -- Invert "to" direction to "from" direction.
if direction > 180 then if direction > 180 then
direction = direction-180 direction = direction-180
else else
direction = direction+180 direction = direction+180
end end
local strength=math.sqrt((wind.x)^2+(wind.z)^2)
-- Return wind direction and strength km/h. -- Wind strength in m/s.
local strength=UTILS.VecNorm(wind) -- math.sqrt((wind.x)^2+(wind.z)^2)
-- Return wind direction and strength.
return direction, strength return direction, strength
end end
@@ -1133,12 +1187,15 @@ do -- COORDINATE
--- Return the 3D distance in meters between the target COORDINATE and the COORDINATE. --- Return the 3D distance in meters between the target COORDINATE and the COORDINATE.
-- @param #COORDINATE self -- @param #COORDINATE self
-- @param #COORDINATE TargetCoordinate The target COORDINATE. -- @param #COORDINATE TargetCoordinate The target COORDINATE. Can also be a DCS#Vec3.
-- @return DCS#Distance Distance The distance in meters. -- @return DCS#Distance Distance The distance in meters.
function COORDINATE:Get3DDistance( TargetCoordinate ) function COORDINATE:Get3DDistance( TargetCoordinate )
local TargetVec3 = TargetCoordinate:GetVec3() --local TargetVec3 = TargetCoordinate:GetVec3()
local TargetVec3 = {x=TargetCoordinate.x, y=TargetCoordinate.y, z=TargetCoordinate.z}
local SourceVec3 = self:GetVec3() local SourceVec3 = self:GetVec3()
return ( ( TargetVec3.x - SourceVec3.x ) ^ 2 + ( TargetVec3.y - SourceVec3.y ) ^ 2 + ( TargetVec3.z - SourceVec3.z ) ^ 2 ) ^ 0.5 --local dist=( ( TargetVec3.x - SourceVec3.x ) ^ 2 + ( TargetVec3.y - SourceVec3.y ) ^ 2 + ( TargetVec3.z - SourceVec3.z ) ^ 2 ) ^ 0.5
local dist=UTILS.VecDist3D(TargetVec3, SourceVec3)
return dist
end end
@@ -2319,7 +2376,6 @@ do -- COORDINATE
end end
--- Creates a free form shape on the F10 map. The first point is the current COORDINATE. The remaining points need to be specified. --- Creates a free form shape on the F10 map. The first point is the current COORDINATE. The remaining points need to be specified.
-- **NOTE**: A free form polygon must have **at least three points** in total and currently only **up to 15 points** in total are supported.
-- @param #COORDINATE self -- @param #COORDINATE self
-- @param #table Coordinates Table of coordinates of the remaining points of the shape. -- @param #table Coordinates Table of coordinates of the remaining points of the shape.
-- @param #number Coalition Coalition: All=-1, Neutral=0, Red=1, Blue=2. Default -1=All. -- @param #number Coalition Coalition: All=-1, Neutral=0, Red=1, Blue=2. Default -1=All.
@@ -2393,9 +2449,33 @@ do -- COORDINATE
vecs[11], vecs[12], vecs[13], vecs[14], vecs[15], vecs[11], vecs[12], vecs[13], vecs[14], vecs[15],
Color, FillColor, LineType, ReadOnly, Text or "") Color, FillColor, LineType, ReadOnly, Text or "")
else else
self:E("ERROR: Currently a free form polygon can only have 15 points in total!")
-- Unfortunately, unpack(vecs) does not work! So no idea how to generalize this :( -- Unfortunately, unpack(vecs) does not work! So no idea how to generalize this :(
trigger.action.markupToAll(7, Coalition, MarkID, unpack(vecs), Color, FillColor, LineType, ReadOnly, Text or "") --trigger.action.markupToAll(7, Coalition, MarkID, unpack(vecs), Color, FillColor, LineType, ReadOnly, Text or "")
-- Write command as string and execute that. Idea by Grimes https://forum.dcs.world/topic/324201-mark-to-all-function/#comment-5273793
local s=string.format("trigger.action.markupToAll(7, %d, %d,", Coalition, MarkID)
for _,vec in pairs(vecs) do
--s=s..string.format("%s,", UTILS._OneLineSerialize(vec))
s=s..string.format("{x=%.1f, y=%.1f, z=%.1f},", vec.x, vec.y, vec.z)
end
s=s..string.format("{%.3f, %.3f, %.3f, %.3f},", Color[1], Color[2], Color[3], Color[4])
s=s..string.format("{%.3f, %.3f, %.3f, %.3f},", FillColor[1], FillColor[2], FillColor[3], FillColor[4])
s=s..string.format("%d,", LineType or 1)
s=s..string.format("%s", tostring(ReadOnly))
if Text and type(Text)=="string" and string.len(Text)>0 then
s=s..string.format(", \"%s\"", tostring(Text))
end
s=s..")"
-- Execute string command
local success=UTILS.DoString(s)
if not success then
self:E("ERROR: Could not draw polygon")
env.info(s)
end
end end
return MarkID return MarkID
@@ -2475,7 +2555,7 @@ do -- COORDINATE
Offset=Offset or 2 Offset=Offset or 2
-- Measurement of visibility should not be from the ground, so Adding a hypotethical 2 meters to each Coordinate. -- Measurement of visibility should not be from the ground, so Adding a hypothetical 2 meters to each Coordinate.
local FromVec3 = self:GetVec3() local FromVec3 = self:GetVec3()
FromVec3.y = FromVec3.y + Offset FromVec3.y = FromVec3.y + Offset
@@ -2874,8 +2954,13 @@ do -- COORDINATE
if alt < 1 then if alt < 1 then
alttext = "very low" alttext = "very low"
end end
local track = UTILS.BearingToCardinal(bearing) or "North" -- corrected Track to be direction of travel of bogey (self in this case)
local track = "Maneuver"
if self.Heading then
track = UTILS.BearingToCardinal(self.Heading) or "North"
end
if rangeNM > 3 then if rangeNM > 3 then
if SSML then -- google says "oh" instead of zero, be aware if SSML then -- google says "oh" instead of zero, be aware
@@ -2926,6 +3011,16 @@ do -- COORDINATE
return BRAANATO return BRAANATO
end end
--- Return the BULLSEYE as COORDINATE Object
-- @param #number Coalition Coalition of the bulls eye to return, e.g. coalition.side.BLUE
-- @return #COORDINATE self
-- @usage
-- -- note the dot (.) here,not using the colon (:)
-- local redbulls = COORDINATE.GetBullseyeCoordinate(coalition.side.RED)
function COORDINATE.GetBullseyeCoordinate(Coalition)
return COORDINATE:NewFromVec3( coalition.getMainRefPoint( Coalition ) )
end
--- Return a BULLS string out of the BULLS of the coalition to the COORDINATE. --- Return a BULLS string out of the BULLS of the coalition to the COORDINATE.
-- @param #COORDINATE self -- @param #COORDINATE self
-- @param DCS#coalition.side Coalition The coalition. -- @param DCS#coalition.side Coalition The coalition.
@@ -2976,6 +3071,18 @@ do -- COORDINATE
return coord.LOtoLL( self:GetVec3() ) return coord.LOtoLL( self:GetVec3() )
end end
--- Get Latitude & Longitude text.
-- @param #COORDINATE self
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
-- @return #string LLText
function COORDINATE:ToStringLL( Settings )
local LL_Accuracy = Settings and Settings.LL_Accuracy or _SETTINGS.LL_Accuracy
local lat, lon = coord.LOtoLL( self:GetVec3() )
return string.format('%f', lat) .. ' ' .. string.format('%f', lon)
end
--- Provides a Lat Lon string in Degree Minute Second format. --- Provides a Lat Lon string in Degree Minute Second format.
-- @param #COORDINATE self -- @param #COORDINATE self
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object. -- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
@@ -3009,6 +3116,49 @@ do -- COORDINATE
local MGRS = coord.LLtoMGRS( lat, lon ) local MGRS = coord.LLtoMGRS( lat, lon )
return "MGRS " .. UTILS.tostringMGRS( MGRS, MGRS_Accuracy ) return "MGRS " .. UTILS.tostringMGRS( MGRS, MGRS_Accuracy )
end end
--- Provides a COORDINATE from an MGRS String
-- @param #COORDINATE self
-- @param #string MGRSString MGRS String, e.g. "MGRS 37T DK 12345 12345"
-- @return #COORDINATE self
function COORDINATE:NewFromMGRSString( MGRSString )
local myparts = UTILS.Split(MGRSString," ")
local northing = tostring(myparts[5]) or ""
local easting = tostring(myparts[4]) or ""
if string.len(easting) < 5 then easting = easting..string.rep("0",5-string.len(easting)) end
if string.len(northing) < 5 then northing = northing..string.rep("0",5-string.len(northing)) end
local MGRS = {
UTMZone = myparts[2],
MGRSDigraph = myparts[3],
Easting = easting,
Northing = northing,
}
local lat, lon = coord.MGRStoLL(MGRS)
local point = coord.LLtoLO(lat, lon, 0)
local coord = COORDINATE:NewFromVec2({x=point.x,y=point.z})
return coord
end
--- Provides a COORDINATE from an MGRS Coordinate
-- @param #COORDINATE self
-- @param #string UTMZone UTM Zone, e.g. "37T"
-- @param #string MGRSDigraph Digraph, e.g. "DK"
-- @param #string Easting Meters easting - string in order to allow for leading zeros, e.g. "01234". Should be 5 digits.
-- @param #string Northing Meters northing - string in order to allow for leading zeros, e.g. "12340". Should be 5 digits.
-- @return #COORDINATE self
function COORDINATE:NewFromMGRS( UTMZone, MGRSDigraph, Easting, Northing )
if string.len(Easting) < 5 then Easting = Easting..string.rep("0",5-string.len(Easting) )end
if string.len(Northing) < 5 then Northing = Northing..string.rep("0",5-string.len(Northing) )end
local MGRS = {
UTMZone = UTMZone,
MGRSDigraph = MGRSDigraph,
Easting = Easting,
Northing = Northing,
}
local lat, lon = coord.MGRStoLL(MGRS)
local point = coord.LLtoLO(lat, lon, 0)
local coord = COORDINATE:NewFromVec2({x=point.x,y=point.z})
end
--- Provides a coordinate string of the point, based on a coordinate format system: --- Provides a coordinate string of the point, based on a coordinate format system:
-- * Uses default settings in COORDINATE. -- * Uses default settings in COORDINATE.
@@ -3253,7 +3403,52 @@ do -- COORDINATE
return self:GetTemperatureText( nil, Settings ) return self:GetTemperatureText( nil, Settings )
end end
--- Function to check if a coordinate is in a steep (>8% elevation) area of the map
-- @param #COORDINATE self
-- @param #number Radius (Optional) Radius to check around the coordinate, defaults to 50m (100m diameter)
-- @param #number Minelevation (Optional) Elevation from which on a area is defined as steep, defaults to 8% (8m height gain across 100 meters)
-- @return #boolen IsSteep If true, area is steep
-- @return #number MaxElevation Elevation in meters measured over 100m
function COORDINATE:IsInSteepArea(Radius,Minelevation)
local steep = false
local elev = Minelevation or 8
local bdelta = 0
local h0 = self:GetLandHeight()
local radius = Radius or 50
local diam = radius * 2
for i=0,150,30 do
local polar = math.fmod(i+180,360)
local c1 = self:Translate(radius,i,false,false)
local c2 = self:Translate(radius,polar,false,false)
local h1 = c1:GetLandHeight()
local h2 = c2:GetLandHeight()
local d1 = math.abs(h1-h2)
local d2 = math.abs(h0-h1)
local d3 = math.abs(h0-h2)
local dm = d1 > d2 and d1 or d2
local dm1 = dm > d3 and dm or d3
bdelta = dm1 > bdelta and dm1 or bdelta
self:T(string.format("d1=%d, d2=%d, d3=%d, max delta=%d",d1,d2,d3,bdelta))
end
local steepness = bdelta / (radius / 100)
if steepness >= elev then steep = true end
return steep, math.floor(steepness)
end
--- Function to check if a coordinate is in a flat (<8% elevation) area of the map
-- @param #COORDINATE self
-- @param #number Radius (Optional) Radius to check around the coordinate, defaults to 50m (100m diameter)
-- @param #number Minelevation (Optional) Elevation from which on a area is defined as steep, defaults to 8% (8m height gain across 100 meters)
-- @return #boolen IsFlat If true, area is flat
-- @return #number MaxElevation Elevation in meters measured over 100m
function COORDINATE:IsInFlatArea(Radius,Minelevation)
local steep, elev = self:IsInSteepArea(Radius,Minelevation)
local flat = not steep
return flat, elev
end
end end
do -- POINT_VEC3 do -- POINT_VEC3
@@ -3477,7 +3672,7 @@ end
do -- POINT_VEC2 do -- POINT_VEC2
--- @type POINT_VEC2 -- @type POINT_VEC2
-- @field DCS#Distance x The x coordinate in meters. -- @field DCS#Distance x The x coordinate in meters.
-- @field DCS#Distance y the y coordinate in meters. -- @field DCS#Distance y the y coordinate in meters.
-- @extends Core.Point#COORDINATE -- @extends Core.Point#COORDINATE

View File

@@ -14,17 +14,13 @@
-- --
-- # Demo Missions -- # Demo Missions
-- --
-- ### [SCHEDULER Demo Missions source code](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SCH%20-%20Scheduler) -- ### [SCHEDULER Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Core/Scheduler)
--
-- ### [SCHEDULER Demo Missions, only for beta testers](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SCH%20-%20Scheduler)
--
-- ### [ALL Demo Missions pack of the last release](https://github.com/FlightControl-Master/MOOSE_MISSIONS/releases)
-- --
-- === -- ===
-- --
-- # YouTube Channel -- # YouTube Channel
-- --
-- ### [SCHEDULER YouTube Channel (none)]() -- ### None
-- --
-- === -- ===
-- --
@@ -52,7 +48,7 @@
-- --
-- A SCHEDULER can manage **multiple** (repeating) schedules. Each planned or executing schedule has a unique **ScheduleID**. -- A SCHEDULER can manage **multiple** (repeating) schedules. Each planned or executing schedule has a unique **ScheduleID**.
-- The ScheduleID is returned when the method @{#SCHEDULER.Schedule}() is called. -- The ScheduleID is returned when the method @{#SCHEDULER.Schedule}() is called.
-- It is recommended to store the ScheduleID in a variable, as it is used in the methods @{SCHEDULER.Start}() and @{SCHEDULER.Stop}(), -- It is recommended to store the ScheduleID in a variable, as it is used in the methods @{#SCHEDULER.Start}() and @{#SCHEDULER.Stop}(),
-- which can start and stop specific repeating schedules respectively within a SCHEDULER object. -- which can start and stop specific repeating schedules respectively within a SCHEDULER object.
-- --
-- ## SCHEDULER constructor -- ## SCHEDULER constructor
@@ -208,7 +204,7 @@ SCHEDULER = {
-- @param #number RandomizeFactor Specifies a randomization factor between 0 and 1 to randomize the Repeat. -- @param #number RandomizeFactor Specifies a randomization factor between 0 and 1 to randomize the Repeat.
-- @param #number Stop Specifies the amount of seconds when the scheduler will be stopped. -- @param #number Stop Specifies the amount of seconds when the scheduler will be stopped.
-- @return #SCHEDULER self. -- @return #SCHEDULER self.
-- @return #table The ScheduleID of the planned schedule. -- @return #string The ScheduleID of the planned schedule.
function SCHEDULER:New( MasterObject, SchedulerFunction, SchedulerArguments, Start, Repeat, RandomizeFactor, Stop ) function SCHEDULER:New( MasterObject, SchedulerFunction, SchedulerArguments, Start, Repeat, RandomizeFactor, Stop )
local self = BASE:Inherit( self, BASE:New() ) -- #SCHEDULER local self = BASE:Inherit( self, BASE:New() ) -- #SCHEDULER

File diff suppressed because it is too large Load Diff

View File

@@ -91,7 +91,7 @@
-- --
-- Will customize which display format is used to indicate A2G coordinates in text as part of the Command Center communications. -- Will customize which display format is used to indicate A2G coordinates in text as part of the Command Center communications.
-- --
-- - A2G BR: [Bearing Range](https://en.wikipedia.org/wiki/Bearing_(navigation)). -- - A2G BR: [Bearing Range](https://en.wikipedia.org/wiki/Bearing_\(navigation\)).
-- - A2G MGRS: The [Military Grid Reference System](https://en.wikipedia.org/wiki/Military_Grid_Reference_System). The accuracy can also be adapted. -- - A2G MGRS: The [Military Grid Reference System](https://en.wikipedia.org/wiki/Military_Grid_Reference_System). The accuracy can also be adapted.
-- - A2G LL DMS: Latitude Longitude [Degrees Minutes Seconds](https://en.wikipedia.org/wiki/Geographic_coordinate_conversion). The accuracy can also be adapted. -- - A2G LL DMS: Latitude Longitude [Degrees Minutes Seconds](https://en.wikipedia.org/wiki/Geographic_coordinate_conversion). The accuracy can also be adapted.
-- - A2G LL DDM: Latitude Longitude [Decimal Degrees Minutes](https://en.wikipedia.org/wiki/Decimal_degrees). The accuracy can also be adapted. -- - A2G LL DDM: Latitude Longitude [Decimal Degrees Minutes](https://en.wikipedia.org/wiki/Decimal_degrees). The accuracy can also be adapted.
@@ -105,9 +105,9 @@
-- There are different methods that can be used to change the **System settings** using the \_SETTINGS object. -- There are different methods that can be used to change the **System settings** using the \_SETTINGS object.
-- --
-- - @{#SETTINGS.SetA2G_BR}(): Enable the BR display formatting by default. -- - @{#SETTINGS.SetA2G_BR}(): Enable the BR display formatting by default.
-- - @{#SETTINGS.SetA2G_MGRS}(): Enable the MGRS display formatting by default. Use @{SETTINGS.SetMGRS_Accuracy}() to adapt the accuracy of the MGRS formatting. -- - @{#SETTINGS.SetA2G_MGRS}(): Enable the MGRS display formatting by default. Use @{#SETTINGS.SetMGRS_Accuracy}() to adapt the accuracy of the MGRS formatting.
-- - @{#SETTINGS.SetA2G_LL_DMS}(): Enable the LL DMS display formatting by default. Use @{SETTINGS.SetLL_Accuracy}() to adapt the accuracy of the Seconds formatting. -- - @{#SETTINGS.SetA2G_LL_DMS}(): Enable the LL DMS display formatting by default. Use @{#SETTINGS.SetLL_Accuracy}() to adapt the accuracy of the Seconds formatting.
-- - @{#SETTINGS.SetA2G_LL_DDM}(): Enable the LL DDM display formatting by default. Use @{SETTINGS.SetLL_Accuracy}() to adapt the accuracy of the Seconds formatting. -- - @{#SETTINGS.SetA2G_LL_DDM}(): Enable the LL DDM display formatting by default. Use @{#SETTINGS.SetLL_Accuracy}() to adapt the accuracy of the Seconds formatting.
-- --
-- ### 3.1.4) A2G coordinates setting - additional notes -- ### 3.1.4) A2G coordinates setting - additional notes
-- --
@@ -120,7 +120,7 @@
-- --
-- Will customize which display format is used to indicate A2A coordinates in text as part of the Command Center communications. -- Will customize which display format is used to indicate A2A coordinates in text as part of the Command Center communications.
-- --
-- - A2A BRAA: [Bearing Range Altitude Aspect](https://en.wikipedia.org/wiki/Bearing_(navigation)). -- - A2A BRAA: [Bearing Range Altitude Aspect](https://en.wikipedia.org/wiki/Bearing_\(navigation\)).
-- - A2A MGRS: The [Military Grid Reference System](https://en.wikipedia.org/wiki/Military_Grid_Reference_System). The accuracy can also be adapted. -- - A2A MGRS: The [Military Grid Reference System](https://en.wikipedia.org/wiki/Military_Grid_Reference_System). The accuracy can also be adapted.
-- - A2A LL DMS: Lattitude Longitude [Degrees Minutes Seconds](https://en.wikipedia.org/wiki/Geographic_coordinate_conversion). The accuracy can also be adapted. -- - A2A LL DMS: Lattitude Longitude [Degrees Minutes Seconds](https://en.wikipedia.org/wiki/Geographic_coordinate_conversion). The accuracy can also be adapted.
-- - A2A LL DDM: Lattitude Longitude [Decimal Degrees and Minutes](https://en.wikipedia.org/wiki/Decimal_degrees). The accuracy can also be adapted. -- - A2A LL DDM: Lattitude Longitude [Decimal Degrees and Minutes](https://en.wikipedia.org/wiki/Decimal_degrees). The accuracy can also be adapted.
@@ -135,9 +135,9 @@
-- There are different methods that can be used to change the **System settings** using the \_SETTINGS object. -- There are different methods that can be used to change the **System settings** using the \_SETTINGS object.
-- --
-- - @{#SETTINGS.SetA2A_BRAA}(): Enable the BR display formatting by default. -- - @{#SETTINGS.SetA2A_BRAA}(): Enable the BR display formatting by default.
-- - @{#SETTINGS.SetA2A_MGRS}(): Enable the MGRS display formatting by default. Use @{SETTINGS.SetMGRS_Accuracy}() to adapt the accuracy of the MGRS formatting. -- - @{#SETTINGS.SetA2A_MGRS}(): Enable the MGRS display formatting by default. Use @{#SETTINGS.SetMGRS_Accuracy}() to adapt the accuracy of the MGRS formatting.
-- - @{#SETTINGS.SetA2A_LL_DMS}(): Enable the LL DMS display formatting by default. Use @{SETTINGS.SetLL_Accuracy}() to adapt the accuracy of the Seconds formatting. -- - @{#SETTINGS.SetA2A_LL_DMS}(): Enable the LL DMS display formatting by default. Use @{#SETTINGS.SetLL_Accuracy}() to adapt the accuracy of the Seconds formatting.
-- - @{#SETTINGS.SetA2A_LL_DDM}(): Enable the LL DDM display formatting by default. Use @{SETTINGS.SetLL_Accuracy}() to adapt the accuracy of the Seconds formatting. -- - @{#SETTINGS.SetA2A_LL_DDM}(): Enable the LL DDM display formatting by default. Use @{#SETTINGS.SetLL_Accuracy}() to adapt the accuracy of the Seconds formatting.
-- - @{#SETTINGS.SetA2A_BULLS}(): Enable the BULLSeye display formatting by default. -- - @{#SETTINGS.SetA2A_BULLS}(): Enable the BULLSeye display formatting by default.
-- --
-- ### 3.2.4) A2A coordinates settings - additional notes -- ### 3.2.4) A2A coordinates settings - additional notes
@@ -190,8 +190,8 @@
-- --
-- There are different methods that can be used to change the **System settings** using the \_SETTINGS object. -- There are different methods that can be used to change the **System settings** using the \_SETTINGS object.
-- --
-- - @{#SETTINGS.SetMessageTime}(): Define for a specific @{Message.MESSAGE.MessageType} the duration to be displayed in seconds. -- - @{#SETTINGS.SetMessageTime}(): Define for a specific @{Core.Message#MESSAGE.MessageType} the duration to be displayed in seconds.
-- - @{#SETTINGS.GetMessageTime}(): Retrieves for a specific @{Message.MESSAGE.MessageType} the duration to be displayed in seconds. -- - @{#SETTINGS.GetMessageTime}(): Retrieves for a specific @{Core.Message#MESSAGE.MessageType} the duration to be displayed in seconds.
-- --
-- ## 3.5) **Era** of the battle -- ## 3.5) **Era** of the battle
-- --
@@ -283,21 +283,21 @@ do -- SETTINGS
function SETTINGS:SetMetric() function SETTINGS:SetMetric()
self.Metric = true self.Metric = true
end end
--- Sets the SETTINGS default text locale. --- Sets the SETTINGS default text locale.
-- @param #SETTINGS self -- @param #SETTINGS self
-- @param #string Locale -- @param #string Locale
function SETTINGS:SetLocale(Locale) function SETTINGS:SetLocale(Locale)
self.Locale = Locale or "en" self.Locale = Locale or "en"
end end
--- Gets the SETTINGS text locale. --- Gets the SETTINGS text locale.
-- @param #SETTINGS self -- @param #SETTINGS self
-- @return #string -- @return #string
function SETTINGS:GetLocale() function SETTINGS:GetLocale()
return self.Locale or _SETTINGS:GetLocale() return self.Locale or _SETTINGS:GetLocale()
end end
--- Gets if the SETTINGS is metric. --- Gets if the SETTINGS is metric.
-- @param #SETTINGS self -- @param #SETTINGS self
-- @return #boolean true if metric. -- @return #boolean true if metric.
@@ -744,7 +744,7 @@ do -- SETTINGS
self.PlayerMenu = PlayerMenu self.PlayerMenu = PlayerMenu
self:I( string.format( "Setting menu for player %s", tostring( PlayerName ) ) ) self:T( string.format( "Setting menu for player %s", tostring( PlayerName ) ) )
local submenu = MENU_GROUP:New( PlayerGroup, "LL Accuracy", PlayerMenu ) local submenu = MENU_GROUP:New( PlayerGroup, "LL Accuracy", PlayerMenu )
MENU_GROUP_COMMAND:New( PlayerGroup, "LL 0 Decimals", submenu, self.MenuGroupLL_DDM_AccuracySystem, self, PlayerUnit, PlayerGroup, PlayerName, 0 ) MENU_GROUP_COMMAND:New( PlayerGroup, "LL 0 Decimals", submenu, self.MenuGroupLL_DDM_AccuracySystem, self, PlayerUnit, PlayerGroup, PlayerName, 0 )
@@ -989,7 +989,7 @@ do -- SETTINGS
do do
--- @param #SETTINGS self --- @param #SETTINGS self
function SETTINGS:MenuGroupA2GSystem( PlayerUnit, PlayerGroup, PlayerName, A2GSystem ) function SETTINGS:MenuGroupA2GSystem( PlayerUnit, PlayerGroup, PlayerName, A2GSystem )
BASE:E( { self, PlayerUnit:GetName(), A2GSystem } ) --BASE:E( {PlayerUnit:GetName(), A2GSystem } )
self.A2GSystem = A2GSystem self.A2GSystem = A2GSystem
MESSAGE:New( string.format( "Settings: A2G format set to %s for player %s.", A2GSystem, PlayerName ), 5 ):ToGroup( PlayerGroup ) MESSAGE:New( string.format( "Settings: A2G format set to %s for player %s.", A2GSystem, PlayerName ), 5 ):ToGroup( PlayerGroup )
if _SETTINGS.MenuStatic == false then if _SETTINGS.MenuStatic == false then

View File

@@ -30,7 +30,7 @@
-- --
-- === -- ===
-- --
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SPA%20-%20Spawning) -- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Core/Spawn)
-- --
-- === -- ===
-- --
@@ -58,7 +58,7 @@
-- @field #SPAWN.SpawnZoneTable SpawnZoneTable -- @field #SPAWN.SpawnZoneTable SpawnZoneTable
-- @extends Core.Base#BASE -- @extends Core.Base#BASE
--- Allows to spawn dynamically new @{Core.Group}s. --- Allows to spawn dynamically new @{Wrapper.Group}s.
-- --
-- Each SPAWN object needs to be have related **template groups** setup in the Mission Editor (ME), -- Each SPAWN object needs to be have related **template groups** setup in the Mission Editor (ME),
-- which is a normal group with the **Late Activation** flag set. -- which is a normal group with the **Late Activation** flag set.
@@ -162,7 +162,17 @@
-- ### Array formation -- ### Array formation
-- --
-- * @{#SPAWN.InitArray}(): Make groups visible before they are actually activated, and order these groups like a battalion in an array. -- * @{#SPAWN.InitArray}(): Make groups visible before they are actually activated, and order these groups like a battalion in an array.
-- --
-- ### Group initial position - if wanted different from template position, for use with e.g. @{#SPAWN.SpawnScheduled}().
--
-- * @{#SPAWN.InitPositionCoordinate}(): Set initial position of group via a COORDINATE.
-- * @{#SPAWN.InitPositionVec2}(): Set initial position of group via a VEC2.
--
-- ### Set the positions of a group's units to absolute positions, or relative positions to unit No. 1
--
-- * @{#SPAWN.InitSetUnitRelativePositions}(): Spawn the UNITs of this group with individual relative positions to unit #1 and individual headings.
-- * @{#SPAWN.InitSetUnitAbsolutePositions}(): Spawn the UNITs of this group with individual absolute positions and individual headings.
--
-- ### Position randomization -- ### Position randomization
-- --
-- * @{#SPAWN.InitRandomizePosition}(): Randomizes the position of @{Wrapper.Group}s that are spawned within a **radius band**, given an Outer and Inner radius, from the point that the spawn happens. -- * @{#SPAWN.InitRandomizePosition}(): Randomizes the position of @{Wrapper.Group}s that are spawned within a **radius band**, given an Outer and Inner radius, from the point that the spawn happens.
@@ -268,7 +278,7 @@ SPAWN = {
-- @type SPAWN.Takeoff -- @type SPAWN.Takeoff
-- @extends Wrapper.Group#GROUP.Takeoff -- @extends Wrapper.Group#GROUP.Takeoff
--- @field #SPAWN.Takeoff Takeoff -- @field #SPAWN.Takeoff Takeoff
SPAWN.Takeoff = { SPAWN.Takeoff = {
Air = 1, Air = 1,
Runway = 2, Runway = 2,
@@ -276,7 +286,8 @@ SPAWN.Takeoff = {
Cold = 4, Cold = 4,
} }
--- @type SPAWN.SpawnZoneTable ---
-- @type SPAWN.SpawnZoneTable
-- @list <Core.Zone#ZONE_BASE> SpawnZone -- @list <Core.Zone#ZONE_BASE> SpawnZone
--- Creates the main object to spawn a @{Wrapper.Group} defined in the DCS ME. --- Creates the main object to spawn a @{Wrapper.Group} defined in the DCS ME.
@@ -309,7 +320,7 @@ function SPAWN:New( SpawnTemplatePrefix )
self.AIOnOff = true -- The AI is on by default when spawning a group. self.AIOnOff = true -- The AI is on by default when spawning a group.
self.SpawnUnControlled = false self.SpawnUnControlled = false
self.SpawnInitKeepUnitNames = false -- Overwrite unit names by default with group name. self.SpawnInitKeepUnitNames = false -- Overwrite unit names by default with group name.
self.DelayOnOff = false -- No intial delay when spawning the first group. self.DelayOnOff = false -- No initial delay when spawning the first group.
self.SpawnGrouping = nil -- No grouping. self.SpawnGrouping = nil -- No grouping.
self.SpawnInitLivery = nil -- No special livery. self.SpawnInitLivery = nil -- No special livery.
self.SpawnInitSkill = nil -- No special skill. self.SpawnInitSkill = nil -- No special skill.
@@ -317,8 +328,11 @@ function SPAWN:New( SpawnTemplatePrefix )
self.SpawnInitModu = nil -- No special modulation. self.SpawnInitModu = nil -- No special modulation.
self.SpawnInitRadio = nil -- No radio comms setting. self.SpawnInitRadio = nil -- No radio comms setting.
self.SpawnInitModex = nil self.SpawnInitModex = nil
self.SpawnInitModexPrefix = nil
self.SpawnInitModexPostfix = nil
self.SpawnInitAirbase = nil self.SpawnInitAirbase = nil
self.TweakedTemplate = false -- Check if the user is using self made template. self.TweakedTemplate = false -- Check if the user is using self made template.
self.SpawnRandomCallsign = false
self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned. self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned.
else else
@@ -335,7 +349,7 @@ end
-- @param #SPAWN self -- @param #SPAWN self
-- @param #string SpawnTemplatePrefix is the name of the Group in the ME that defines the Template. -- @param #string SpawnTemplatePrefix is the name of the Group in the ME that defines the Template.
-- @param #string SpawnAliasPrefix is the name that will be given to the Group at runtime. -- @param #string SpawnAliasPrefix is the name that will be given to the Group at runtime.
-- @return #SPAWN -- @return #SPAWN self
-- @usage -- @usage
-- -- NATO helicopters engaging in the battle field. -- -- NATO helicopters engaging in the battle field.
-- Spawn_BE_KA50 = SPAWN:NewWithAlias( 'BE KA-50@RAMP-Ground Defense', 'Helicopter Attacking a City' ) -- Spawn_BE_KA50 = SPAWN:NewWithAlias( 'BE KA-50@RAMP-Ground Defense', 'Helicopter Attacking a City' )
@@ -371,6 +385,8 @@ function SPAWN:NewWithAlias( SpawnTemplatePrefix, SpawnAliasPrefix )
self.SpawnInitModu = nil -- No special modulation. self.SpawnInitModu = nil -- No special modulation.
self.SpawnInitRadio = nil -- No radio communication setting. self.SpawnInitRadio = nil -- No radio communication setting.
self.SpawnInitModex = nil self.SpawnInitModex = nil
self.SpawnInitModexPrefix = nil
self.SpawnInitModexPostfix = nil
self.SpawnInitAirbase = nil self.SpawnInitAirbase = nil
self.TweakedTemplate = false -- Check if the user is using self made template. self.TweakedTemplate = false -- Check if the user is using self made template.
@@ -385,32 +401,129 @@ function SPAWN:NewWithAlias( SpawnTemplatePrefix, SpawnAliasPrefix )
return self return self
end end
--- Creates a new SPAWN instance to create new groups based on the provided template. --- Creates a new SPAWN instance to create new groups based on the provided template. This will also register the template for future use.
-- @param #SPAWN self -- @param #SPAWN self
-- @param #table SpawnTemplate is the Template of the Group. This must be a valid Group Template structure! -- @param #table SpawnTemplate is the Template of the Group. This must be a valid Group Template structure - see [Hoggit Wiki](https://wiki.hoggitworld.com/view/DCS_func_addGroup)!
-- @param #string SpawnTemplatePrefix is the name of the Group that will be given at each spawn. -- @param #string SpawnTemplatePrefix [Mandatory] is the name of the template and the prefix of the GROUP on spawn. The name in the template **will** be overwritten!
-- @param #string SpawnAliasPrefix is the name that will be given to the Group at runtime. -- @param #string SpawnAliasPrefix [Optional] is the prefix that will be given to the GROUP on spawn.
-- @return #SPAWN -- @param #boolean NoMooseNamingPostfix [Optional] If true, skip the Moose naming additions (like groupname#001-01) - **but** you need to ensure yourself no duplicate group names exist!
-- @return #SPAWN self
-- @usage -- @usage
-- -- Create a new SPAWN object based on a Group Template defined from scratch. -- -- Spawn a P51 Mustang from scratch
-- Spawn_BE_KA50 = SPAWN:NewWithAlias( 'BE KA-50@RAMP-Ground Defense', 'Helicopter Attacking a City' ) -- local ttemp =
-- @usage -- {
-- -- ["modulation"] = 0,
-- -- Create a new CSAR_Spawn object based on a normal Group Template to spawn a soldier. -- ["tasks"] =
-- local CSAR_Spawn = SPAWN:NewWithFromTemplate( Template, "CSAR", "Pilot" ) -- {
-- -- }, -- end of ["tasks"]
function SPAWN:NewFromTemplate( SpawnTemplate, SpawnTemplatePrefix, SpawnAliasPrefix ) -- ["task"] = "Reconnaissance",
local self = BASE:Inherit( self, BASE:New() ) -- ["uncontrolled"] = false,
self:F( { SpawnTemplate, SpawnTemplatePrefix, SpawnAliasPrefix } ) -- ["route"] =
if SpawnAliasPrefix == nil or SpawnAliasPrefix == "" then -- {
BASE:I( "ERROR: in function NewFromTemplate, required parameter SpawnAliasPrefix is not set" ) -- ["points"] =
-- {
-- [1] =
-- {
-- ["alt"] = 2000,
-- ["action"] = "Turning Point",
-- ["alt_type"] = "BARO",
-- ["speed"] = 125,
-- ["task"] =
-- {
-- ["id"] = "ComboTask",
-- ["params"] =
-- {
-- ["tasks"] =
-- {
-- }, -- end of ["tasks"]
-- }, -- end of ["params"]
-- }, -- end of ["task"]
-- ["type"] = "Turning Point",
-- ["ETA"] = 0,
-- ["ETA_locked"] = true,
-- ["y"] = 666285.71428571,
-- ["x"] = -312000,
-- ["formation_template"] = "",
-- ["speed_locked"] = true,
-- }, -- end of [1]
-- }, -- end of ["points"]
-- }, -- end of ["route"]
-- ["groupId"] = 1,
-- ["hidden"] = false,
-- ["units"] =
-- {
-- [1] =
-- {
-- ["alt"] = 2000,
-- ["alt_type"] = "BARO",
-- ["livery_id"] = "USAF 364th FS",
-- ["skill"] = "High",
-- ["speed"] = 125,
-- ["type"] = "TF-51D",
-- ["unitId"] = 1,
-- ["psi"] = 0,
-- ["y"] = 666285.71428571,
-- ["x"] = -312000,
-- ["name"] = "P51-1-1",
-- ["payload"] =
-- {
-- ["pylons"] =
-- {
-- }, -- end of ["pylons"]
-- ["fuel"] = 340.68,
-- ["flare"] = 0,
-- ["chaff"] = 0,
-- ["gun"] = 100,
-- }, -- end of ["payload"]
-- ["heading"] = 0,
-- ["callsign"] =
-- {
-- [1] = 1,
-- [2] = 1,
-- ["name"] = "Enfield11",
-- [3] = 1,
-- }, -- end of ["callsign"]
-- ["onboard_num"] = "010",
-- }, -- end of [1]
-- }, -- end of ["units"]
-- ["y"] = 666285.71428571,
-- ["x"] = -312000,
-- ["name"] = "P51",
-- ["communication"] = true,
-- ["start_time"] = 0,
-- ["frequency"] = 124,
-- }
--
--
-- local mustang = SPAWN:NewFromTemplate(ttemp,"P51D")
-- -- you MUST set the next three:
-- mustang:InitCountry(country.id.FRANCE)
-- mustang:InitCategory(Group.Category.AIRPLANE)
-- mustang:InitCoalition(coalition.side.BLUE)
-- mustang:OnSpawnGroup(
-- function(grp)
-- MESSAGE:New("Group Spawned: "..grp:GetName(),15,"SPAWN"):ToAll()
-- end
-- )
-- mustang:Spawn()
--
function SPAWN:NewFromTemplate( SpawnTemplate, SpawnTemplatePrefix, SpawnAliasPrefix, NoMooseNamingPostfix )
local self = BASE:Inherit( self, BASE:New() )
self:F( { SpawnTemplate, SpawnTemplatePrefix, SpawnAliasPrefix } )
--if SpawnAliasPrefix == nil or SpawnAliasPrefix == "" then
--BASE:I( "ERROR: in function NewFromTemplate, required parameter SpawnAliasPrefix is not set" )
--return nil
--end
if SpawnTemplatePrefix == nil or SpawnTemplatePrefix == "" then
BASE:I( "ERROR: in function NewFromTemplate, required parameter SpawnTemplatePrefix is not set" )
return nil return nil
end end
if SpawnTemplate then if SpawnTemplate then
self.SpawnTemplate = SpawnTemplate -- Contains the template structure for a Group Spawn from the Mission Editor. Note that this group must have lateActivation always on!!! self.SpawnTemplate = SpawnTemplate -- Contains the template structure for a Group Spawn from the Mission Editor. Note that this group must have lateActivation always on!!!
self.SpawnTemplatePrefix = SpawnTemplatePrefix self.SpawnTemplatePrefix = SpawnTemplatePrefix
self.SpawnAliasPrefix = SpawnAliasPrefix self.SpawnAliasPrefix = SpawnAliasPrefix or SpawnTemplatePrefix
self.SpawnTemplate.name = SpawnTemplatePrefix
self.SpawnIndex = 0 self.SpawnIndex = 0
self.SpawnCount = 0 -- The internal counter of the amount of spawning the has happened since SpawnStart. self.SpawnCount = 0 -- The internal counter of the amount of spawning the has happened since SpawnStart.
self.AliveUnits = 0 -- Contains the counter how many units are currently alive self.AliveUnits = 0 -- Contains the counter how many units are currently alive
@@ -433,9 +546,15 @@ function SPAWN:NewFromTemplate( SpawnTemplate, SpawnTemplatePrefix, SpawnAliasPr
self.SpawnInitModu = nil -- No special modulation. self.SpawnInitModu = nil -- No special modulation.
self.SpawnInitRadio = nil -- No radio communication setting. self.SpawnInitRadio = nil -- No radio communication setting.
self.SpawnInitModex = nil self.SpawnInitModex = nil
self.SpawnInitModexPrefix = nil
self.SpawnInitModexPostfix = nil
self.SpawnInitAirbase = nil self.SpawnInitAirbase = nil
self.TweakedTemplate = true -- Check if the user is using self made template. self.TweakedTemplate = true -- Check if the user is using self made template.
self.MooseNameing = true
if NoMooseNamingPostfix == true then
self.MooseNameing = false
end
self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned. self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned.
else else
error( "There is no template provided for SpawnTemplatePrefix = '" .. SpawnTemplatePrefix .. "'" ) error( "There is no template provided for SpawnTemplatePrefix = '" .. SpawnTemplatePrefix .. "'" )
@@ -700,12 +819,17 @@ end
--- Sets the modex of the first unit of the group. If more units are in the group, the number is increased by one with every unit. --- Sets the modex of the first unit of the group. If more units are in the group, the number is increased by one with every unit.
-- @param #SPAWN self -- @param #SPAWN self
-- @param #number modex Modex of the first unit. -- @param #number modex Modex of the first unit.
-- @param #string prefix (optional) String to prefix to modex, e.g. for French AdA Modex, eg. -L-102 then "-L-" would be the prefix.
-- @param #string postfix (optional) String to postfix to modex, example tbd.
-- @return #SPAWN self -- @return #SPAWN self
function SPAWN:InitModex( modex ) function SPAWN:InitModex( modex, prefix, postfix )
if modex then if modex then
self.SpawnInitModex = tonumber( modex ) self.SpawnInitModex = tonumber( modex )
end end
self.SpawnInitModexPrefix = prefix
self.SpawnInitModexPostfix = postfix
return self return self
end end
@@ -772,10 +896,8 @@ end
-- @usage -- @usage
-- --
-- -- NATO helicopters engaging in the battle field. -- -- NATO helicopters engaging in the battle field.
-- -- The KA-50 has waypoints Start point ( =0 or SP ), 1, 2, 3, 4, End point (= 5 or DP). -- -- UNIT positions of this group will be randomized around the base unit #1 in a circle of 50 to 500 meters.
-- -- Waypoints 2 and 3 will only be randomized. The others will remain on their original position with each new spawn of the helicopter. -- Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):InitRandomizeUnits( true, 500, 50 )
-- -- The randomization of waypoint 2 and 3 will take place within a radius of 2000 meters.
-- Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):InitRandomizeRoute( 2, 2, 2000 )
-- --
function SPAWN:InitRandomizeUnits( RandomizeUnits, OuterRadius, InnerRadius ) function SPAWN:InitRandomizeUnits( RandomizeUnits, OuterRadius, InnerRadius )
self:F( { self.SpawnTemplatePrefix, RandomizeUnits, OuterRadius, InnerRadius } ) self:F( { self.SpawnTemplatePrefix, RandomizeUnits, OuterRadius, InnerRadius } )
@@ -791,6 +913,46 @@ function SPAWN:InitRandomizeUnits( RandomizeUnits, OuterRadius, InnerRadius )
return self return self
end end
--- Spawn the UNITs of this group with individual relative positions to unit #1 and individual headings.
-- @param #SPAWN self
-- @param #table Positions Table of positions, needs to one entry per unit in the group(!). The table contains one table each for each unit, with x,y, and optionally z
-- relative positions, and optionally an individual heading.
-- @return #SPAWN
-- @usage
--
-- -- NATO helicopter group of three units engaging in the battle field.
-- local Positions = { [1] = {x = 0, y = 0, heading = 0}, [2] = {x = 50, y = 50, heading = 90}, [3] = {x = -50, y = 50, heading = 180} }
-- Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):InitSetUnitRelativePositions(Positions)
--
function SPAWN:InitSetUnitRelativePositions(Positions)
self:F({self.SpawnTemplatePrefix, Positions})
self.SpawnUnitsWithRelativePositions = true
self.UnitsRelativePositions = Positions
return self
end
--- Spawn the UNITs of this group with individual absolute positions and individual headings.
-- @param #SPAWN self
-- @param #table Positions Table of positions, needs to one entry per unit in the group(!). The table contains one table each for each unit, with x,y, and optionally z
-- absolute positions, and optionally an individual heading.
-- @return #SPAWN
-- @usage
--
-- -- NATO helicopter group of three units engaging in the battle field.
-- local Positions = { [1] = {x = 0, y = 0, heading = 0}, [2] = {x = 50, y = 50, heading = 90}, [3] = {x = -50, y = 50, heading = 180} }
-- Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):InitSetUnitAbsolutePositions(Positions)
--
function SPAWN:InitSetUnitAbsolutePositions(Positions)
self:F({self.SpawnTemplatePrefix, Positions})
self.SpawnUnitsWithAbsolutePositions = true
self.UnitsAbsolutePositions = Positions
return self
end
--- This method is rather complicated to understand. But I'll try to explain. --- This method is rather complicated to understand. But I'll try to explain.
-- This method becomes useful when you need to spawn groups with random templates of groups defined within the mission editor, -- This method becomes useful when you need to spawn groups with random templates of groups defined within the mission editor,
-- but they will all follow the same Template route and have the same prefix name. -- but they will all follow the same Template route and have the same prefix name.
@@ -908,7 +1070,7 @@ end
--- This method provides the functionality to randomize the spawning of the Groups at a given list of zones of different types. --- This method provides the functionality to randomize the spawning of the Groups at a given list of zones of different types.
-- @param #SPAWN self -- @param #SPAWN self
-- @param #table SpawnZoneTable A table with @{Core.Zone} objects. If this table is given, then each spawn will be executed within the given list of @{Core.Zone}s objects. -- @param #table SpawnZoneTable A table with @{Core.Zone} objects. If this table is given, then each spawn will be executed within the given list of @{Core.Zone}s objects.
-- @return #SPAWN -- @return #SPAWN self
-- @usage -- @usage
-- --
-- -- Create a zone table of the 2 zones. -- -- Create a zone table of the 2 zones.
@@ -938,6 +1100,55 @@ function SPAWN:InitRandomizeZones( SpawnZoneTable )
return self return self
end end
--- [AIR/Fighter only!] This method randomizes the callsign for a new group.
-- @param #SPAWN self
-- @return #SPAWN self
function SPAWN:InitRandomizeCallsign()
self.SpawnRandomCallsign = true
return self
end
--- [BLUE AIR only!] This method sets a specific callsign for a spawned group. Use for a group with one unit only!
-- @param #SPAWN self
-- @param #number ID ID of the callsign enumerator, e.g. CALLSIGN.Tanker.Texaco - - resulting in e.g. Texaco-2-1
-- @param #string Name Name of this callsign as it cannot be determined from the ID because of the dependency on the task type of the plane, and the plane type. E.g. "Texaco"
-- @param #number Minor Minor number, i.e. the unit number within the group, e.g 2 - resulting in e.g. Texaco-2-1
-- @param #number Major Major number, i.e. the group number of this name, e.g. 1 - resulting in e.g. Texaco-2-1
-- @return #SPAWN self
function SPAWN:InitCallSign(ID,Name,Minor,Major)
self.SpawnInitCallSign = true
self.SpawnInitCallSignID = ID or 1
self.SpawnInitCallSignMinor = Minor or 1
self.SpawnInitCallSignMajor = Major or 1
self.SpawnInitCallSignName = string.lower(Name) or "enfield"
return self
end
--- This method sets a spawn position for the group that is different from the location of the template.
-- @param #SPAWN self
-- @param Core.Point#COORDINATE Coordinate The position to spawn from
-- @return #SPAWN self
function SPAWN:InitPositionCoordinate(Coordinate)
self:T( { self.SpawnTemplatePrefix, Coordinate:GetVec2()} )
self:InitPositionVec2(Coordinate:GetVec2())
return self
end
--- This method sets a spawn position for the group that is different from the location of the template.
-- @param #SPAWN self
-- @param DCS#Vec2 Vec2 The position to spawn from
-- @return #SPAWN self
function SPAWN:InitPositionVec2(Vec2)
self:T( { self.SpawnTemplatePrefix, Vec2} )
self.SpawnInitPosition = Vec2
self.SpawnFromNewPosition = true
self:I("MaxGroups:"..self.SpawnMaxGroups)
for SpawnGroupID = 1, self.SpawnMaxGroups do
self:_SetInitialPosition( SpawnGroupID )
end
return self
end
--- For planes and helicopters, when these groups go home and land on their home airbases and FARPs, they normally would taxi to the parking spot, shut-down their engines and wait forever until the Group is removed by the runtime environment. --- For planes and helicopters, when these groups go home and land on their home airbases and FARPs, they normally would taxi to the parking spot, shut-down their engines and wait forever until the Group is removed by the runtime environment.
-- This method is used to re-spawn automatically (so no extra call is needed anymore) the same group after it has landed. -- This method is used to re-spawn automatically (so no extra call is needed anymore) the same group after it has landed.
-- This will enable a spawned group to be re-spawned after it lands, until it is destroyed... -- This will enable a spawned group to be re-spawned after it lands, until it is destroyed...
@@ -1028,7 +1239,6 @@ function SPAWN:InitCleanUp( SpawnCleanUpInterval )
local SpawnGroup, SpawnCursor = self:GetFirstAliveGroup() local SpawnGroup, SpawnCursor = self:GetFirstAliveGroup()
self:T( { "CleanUp Scheduler:", SpawnGroup } ) self:T( { "CleanUp Scheduler:", SpawnGroup } )
-- self.CleanUpFunction = routines.scheduleFunction( self._SpawnCleanUpScheduler, { self }, timer.getTime() + 1, SpawnCleanUpInterval )
self.CleanUpScheduler = SCHEDULER:New( self, self._SpawnCleanUpScheduler, {}, 1, SpawnCleanUpInterval, 0.2 ) self.CleanUpScheduler = SCHEDULER:New( self, self._SpawnCleanUpScheduler, {}, 1, SpawnCleanUpInterval, 0.2 )
return self return self
end end
@@ -1146,7 +1356,8 @@ do -- Delay methods
return self return self
end end
--- Turns the Delay On for the @{Wrapper.Group} when spawning. --- Turns the Delay On for the @{Wrapper.Group} when spawning with @{#SpawnScheduled}(). In effect then the 1st group will only be spawned
-- after the number of seconds given in SpawnScheduled as arguments, and not immediately.
-- @param #SPAWN self -- @param #SPAWN self
-- @return #SPAWN The SPAWN object -- @return #SPAWN The SPAWN object
function SPAWN:InitDelayOn() function SPAWN:InitDelayOn()
@@ -1236,12 +1447,18 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
self:F2( { SpawnTemplatePrefix = self.SpawnTemplatePrefix, SpawnIndex = SpawnIndex, AliveUnits = self.AliveUnits, SpawnMaxGroups = self.SpawnMaxGroups } ) self:F2( { SpawnTemplatePrefix = self.SpawnTemplatePrefix, SpawnIndex = SpawnIndex, AliveUnits = self.AliveUnits, SpawnMaxGroups = self.SpawnMaxGroups } )
if self:_GetSpawnIndex( SpawnIndex ) then if self:_GetSpawnIndex( SpawnIndex ) then
if self.SpawnFromNewPosition then
self:_SetInitialPosition( SpawnIndex )
end
if self.SpawnGroups[self.SpawnIndex].Visible then if self.SpawnGroups[self.SpawnIndex].Visible then
self.SpawnGroups[self.SpawnIndex].Group:Activate() self.SpawnGroups[self.SpawnIndex].Group:Activate()
else else
local SpawnTemplate = self.SpawnGroups[self.SpawnIndex].SpawnTemplate local SpawnTemplate = self.SpawnGroups[self.SpawnIndex].SpawnTemplate
local SpawnZone = self.SpawnGroups[self.SpawnIndex].SpawnZone
self:T( SpawnTemplate.name ) self:T( SpawnTemplate.name )
if SpawnTemplate then if SpawnTemplate then
@@ -1267,6 +1484,23 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
if self.SpawnRandomizeUnits then if self.SpawnRandomizeUnits then
for UnitID = 1, #SpawnTemplate.units do for UnitID = 1, #SpawnTemplate.units do
local RandomVec2 = PointVec3:GetRandomVec2InRadius( self.SpawnOuterRadius, self.SpawnInnerRadius ) local RandomVec2 = PointVec3:GetRandomVec2InRadius( self.SpawnOuterRadius, self.SpawnInnerRadius )
if (SpawnZone) then
local inZone = SpawnZone:IsVec2InZone(RandomVec2)
local numTries = 1
while (not inZone) and (numTries < 20) do
if not inZone then
RandomVec2 = PointVec3:GetRandomVec2InRadius( self.SpawnOuterRadius, self.SpawnInnerRadius )
numTries = numTries + 1
inZone = SpawnZone:IsVec2InZone(RandomVec2)
self:I("Retrying " .. numTries .. "spawn " .. SpawnTemplate.name .. " in Zone " .. SpawnZone:GetName() .. "!")
self:I(SpawnZone)
end
end
if (not inZone) then
self:I("Could not place unit within zone and within radius!")
RandomVec2 = SpawnZone:GetRandomVec2()
end
end
SpawnTemplate.units[UnitID].x = RandomVec2.x SpawnTemplate.units[UnitID].x = RandomVec2.x
SpawnTemplate.units[UnitID].y = RandomVec2.y SpawnTemplate.units[UnitID].y = RandomVec2.y
self:T( 'SpawnTemplate.units[' .. UnitID .. '].x = ' .. SpawnTemplate.units[UnitID].x .. ', SpawnTemplate.units[' .. UnitID .. '].y = ' .. SpawnTemplate.units[UnitID].y ) self:T( 'SpawnTemplate.units[' .. UnitID .. '].x = ' .. SpawnTemplate.units[UnitID].x .. ', SpawnTemplate.units[' .. UnitID .. '].y = ' .. SpawnTemplate.units[UnitID].y )
@@ -1318,12 +1552,14 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
for UnitID = 1, #SpawnTemplate.units do for UnitID = 1, #SpawnTemplate.units do
if UnitID > 1 then -- don't rotate position of unit #1 if not self.SpawnRandomizeUnits then
local unitXOff = SpawnTemplate.units[UnitID].x - pivotX -- rotate position offset around unit #1 if UnitID > 1 then -- don't rotate position of unit #1
local unitYOff = SpawnTemplate.units[UnitID].y - pivotY local unitXOff = SpawnTemplate.units[UnitID].x - pivotX -- rotate position offset around unit #1
local unitYOff = SpawnTemplate.units[UnitID].y - pivotY
SpawnTemplate.units[UnitID].x = pivotX + (unitXOff * cosHeading) - (unitYOff * sinHeading) SpawnTemplate.units[UnitID].x = pivotX + (unitXOff * cosHeading) - (unitYOff * sinHeading)
SpawnTemplate.units[UnitID].y = pivotY + (unitYOff * cosHeading) + (unitXOff * sinHeading) SpawnTemplate.units[UnitID].y = pivotY + (unitYOff * cosHeading) + (unitXOff * sinHeading)
end
end end
-- adjust heading of all units, including unit #1 -- adjust heading of all units, including unit #1
@@ -1342,7 +1578,38 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
SpawnTemplate.units[UnitID].psi = -SpawnTemplate.units[UnitID].heading SpawnTemplate.units[UnitID].psi = -SpawnTemplate.units[UnitID].heading
end end
end end
-- Individual relative unit positions + heading
if self.SpawnUnitsWithRelativePositions and self.UnitsRelativePositions then
local BaseX = SpawnTemplate.units[1].x or 0
local BaseY = SpawnTemplate.units[1].y or 0
local BaseZ = SpawnTemplate.units[1].z or 0
for UnitID = 1, #SpawnTemplate.units do
if self.UnitsRelativePositions[UnitID].heading then
SpawnTemplate.units[UnitID].heading = math.rad(self.UnitsRelativePositions[UnitID].heading or 0)
end
SpawnTemplate.units[UnitID].x = BaseX + (self.UnitsRelativePositions[UnitID].x or 0)
SpawnTemplate.units[UnitID].y = BaseY + (self.UnitsRelativePositions[UnitID].y or 0)
if self.UnitsRelativePositions[UnitID].z then
SpawnTemplate.units[UnitID].z = BaseZ + (self.UnitsRelativePositions[UnitID].z or 0)
end
end
end
-- Individual asbolute unit positions + heading
if self.SpawnUnitsWithAbsolutePositions and self.UnitsAbsolutePositions then
for UnitID = 1, #SpawnTemplate.units do
if self.UnitsAbsolutePositions[UnitID].heading then
SpawnTemplate.units[UnitID].heading = math.rad(self.UnitsAbsolutePositions[UnitID].heading or 0)
end
SpawnTemplate.units[UnitID].x = self.UnitsAbsolutePositions[UnitID].x or 0
SpawnTemplate.units[UnitID].y = self.UnitsAbsolutePositions[UnitID].y or 0
if self.UnitsAbsolutePositions[UnitID].z then
SpawnTemplate.units[UnitID].z = self.UnitsAbsolutePositions[UnitID].z or 0
end
end
end
-- Set livery. -- Set livery.
if self.SpawnInitLivery then if self.SpawnInitLivery then
for UnitID = 1, #SpawnTemplate.units do for UnitID = 1, #SpawnTemplate.units do
@@ -1360,7 +1627,10 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
-- Set tail number. -- Set tail number.
if self.SpawnInitModex then if self.SpawnInitModex then
for UnitID = 1, #SpawnTemplate.units do for UnitID = 1, #SpawnTemplate.units do
SpawnTemplate.units[UnitID].onboard_num = string.format( "%03d", self.SpawnInitModex + (UnitID - 1) ) local modexnumber = string.format( "%03d", self.SpawnInitModex + (UnitID - 1) )
if self.SpawnInitModexPrefix then modexnumber = self.SpawnInitModexPrefix..modexnumber end
if self.SpawnInitModexPostfix then modexnumber = modexnumber..self.SpawnInitModexPostfix end
SpawnTemplate.units[UnitID].onboard_num = modexnumber
end end
end end
@@ -1443,6 +1713,8 @@ end
-- @param #number SpawnTime The time interval defined in seconds between each new spawn of new groups. -- @param #number SpawnTime The time interval defined in seconds between each new spawn of new groups.
-- @param #number SpawnTimeVariation The variation to be applied on the defined time interval between each new spawn. -- @param #number SpawnTimeVariation The variation to be applied on the defined time interval between each new spawn.
-- The variation is a number between 0 and 1, representing the % of variation to be applied on the time interval. -- The variation is a number between 0 and 1, representing the % of variation to be applied on the time interval.
-- @param #boolean WithDelay Do not spawn the **first** group immediately, but delay the spawn as per the calculation below.
-- Effectively the same as @{#InitDelayOn}().
-- @return #SPAWN self -- @return #SPAWN self
-- @usage -- @usage
-- -- NATO helicopters engaging in the battle field. -- -- NATO helicopters engaging in the battle field.
@@ -1453,17 +1725,20 @@ end
-- -- High limit: 600 * ( 1 + 0.5 / 2 ) = 750 -- -- High limit: 600 * ( 1 + 0.5 / 2 ) = 750
-- -- Between these two values, a random amount of seconds will be chosen for each new spawn of the helicopters. -- -- Between these two values, a random amount of seconds will be chosen for each new spawn of the helicopters.
-- Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):SpawnScheduled( 600, 0.5 ) -- Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):SpawnScheduled( 600, 0.5 )
function SPAWN:SpawnScheduled( SpawnTime, SpawnTimeVariation ) function SPAWN:SpawnScheduled( SpawnTime, SpawnTimeVariation, WithDelay )
self:F( { SpawnTime, SpawnTimeVariation } ) self:F( { SpawnTime, SpawnTimeVariation } )
local SpawnTime = SpawnTime or 60
local SpawnTimeVariation = SpawnTimeVariation or 0.5
if SpawnTime ~= nil and SpawnTimeVariation ~= nil then if SpawnTime ~= nil and SpawnTimeVariation ~= nil then
local InitialDelay = 0 local InitialDelay = 0
if self.DelayOnOff == true then if WithDelay or self.DelayOnOff == true then
InitialDelay = math.random( SpawnTime - SpawnTime * SpawnTimeVariation, SpawnTime + SpawnTime * SpawnTimeVariation ) InitialDelay = math.random( SpawnTime - SpawnTime * SpawnTimeVariation, SpawnTime + SpawnTime * SpawnTimeVariation )
end end
self.SpawnScheduler = SCHEDULER:New( self, self._Scheduler, {}, InitialDelay, SpawnTime, SpawnTimeVariation ) self.SpawnScheduler = SCHEDULER:New( self, self._Scheduler, {}, InitialDelay, SpawnTime, SpawnTimeVariation )
end end
return self return self
end end
@@ -1962,14 +2237,18 @@ end
-- @param #table Spots Table of parking spot IDs. Note that these in general are different from the numbering in the mission editor! -- @param #table Spots Table of parking spot IDs. Note that these in general are different from the numbering in the mission editor!
-- @param #SPAWN.Takeoff Takeoff (Optional) Takeoff type, i.e. either SPAWN.Takeoff.Cold or SPAWN.Takeoff.Hot. Default is Hot. -- @param #SPAWN.Takeoff Takeoff (Optional) Takeoff type, i.e. either SPAWN.Takeoff.Cold or SPAWN.Takeoff.Hot. Default is Hot.
-- @return Wrapper.Group#GROUP The group that was spawned or nil when nothing was spawned. -- @return Wrapper.Group#GROUP The group that was spawned or nil when nothing was spawned.
function SPAWN:SpawnAtParkingSpot( Airbase, Spots, Takeoff ) -- R2.5 function SPAWN:SpawnAtParkingSpot( Airbase, Spots, Takeoff )
self:F( { Airbase = Airbase, Spots = Spots, Takeoff = Takeoff } ) self:F( { Airbase = Airbase, Spots = Spots, Takeoff = Takeoff } )
-- Ensure that Spots parameter is a table. -- Ensure that Spots parameter is a table.
if type( Spots ) ~= "table" then if type( Spots ) ~= "table" then
Spots = { Spots } Spots = { Spots }
end end
if type(Airbase) == "string" then
Airbase = AIRBASE:FindByName(Airbase)
end
-- Get template group. -- Get template group.
local group = GROUP:FindByName( self.SpawnTemplatePrefix ) local group = GROUP:FindByName( self.SpawnTemplatePrefix )
@@ -2549,7 +2828,7 @@ end
-- @return Wrapper.Group#GROUP that was spawned or #nil if nothing was spawned. -- @return Wrapper.Group#GROUP that was spawned or #nil if nothing was spawned.
-- @usage -- @usage
-- --
-- local SpawnPointVec2 = ZONE:New( ZoneName ):GetPointVec2() -- local SpawnPointVec2 = ZONE:New( ZoneName ):GetPointVec2()
-- --
-- -- Spawn at the zone center position at the height specified in the ME of the group template! -- -- Spawn at the zone center position at the height specified in the ME of the group template!
-- SpawnAirplanes:SpawnFromPointVec2( SpawnPointVec2 ) -- SpawnAirplanes:SpawnFromPointVec2( SpawnPointVec2 )
@@ -2951,7 +3230,11 @@ function SPAWN:_GetTemplate( SpawnTemplatePrefix )
self:F( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, SpawnTemplatePrefix } ) self:F( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, SpawnTemplatePrefix } )
local SpawnTemplate = nil local SpawnTemplate = nil
if _DATABASE.Templates.Groups[SpawnTemplatePrefix] == nil then
error( 'No Template exists for SpawnTemplatePrefix = ' .. SpawnTemplatePrefix )
end
local Template = _DATABASE.Templates.Groups[SpawnTemplatePrefix].Template local Template = _DATABASE.Templates.Groups[SpawnTemplatePrefix].Template
self:F( { Template = Template } ) self:F( { Template = Template } )
@@ -2985,6 +3268,11 @@ function SPAWN:_Prepare( SpawnTemplatePrefix, SpawnIndex ) -- R2.2
if self.TweakedTemplate ~= nil and self.TweakedTemplate == true then if self.TweakedTemplate ~= nil and self.TweakedTemplate == true then
BASE:I( "WARNING: You are using a tweaked template." ) BASE:I( "WARNING: You are using a tweaked template." )
SpawnTemplate = self.SpawnTemplate SpawnTemplate = self.SpawnTemplate
if self.MooseNameing == true then
SpawnTemplate.name = self:SpawnGroupName( SpawnIndex )
else
SpawnTemplate.name = self:SpawnGroupName()
end
else else
SpawnTemplate = self:_GetTemplate( SpawnTemplatePrefix ) SpawnTemplate = self:_GetTemplate( SpawnTemplatePrefix )
SpawnTemplate.name = self:SpawnGroupName( SpawnIndex ) SpawnTemplate.name = self:SpawnGroupName( SpawnIndex )
@@ -3032,22 +3320,156 @@ function SPAWN:_Prepare( SpawnTemplatePrefix, SpawnIndex ) -- R2.2
end end
-- Callsign -- Callsign
if self.SpawnRandomCallsign and SpawnTemplate.units[1].callsign then
if type( SpawnTemplate.units[1].callsign ) ~= "number" then
-- change callsign
local min = 1
local max = 8
local ctable = CALLSIGN.Aircraft
if string.find(SpawnTemplate.units[1].type, "A-10",1,true) then
max = 12
end
if string.find(SpawnTemplate.units[1].type, "18",1,true) then
min = 9
max = 20
ctable = CALLSIGN.F18
end
if string.find(SpawnTemplate.units[1].type, "16",1,true) then
min = 9
max = 20
ctable = CALLSIGN.F16
end
if SpawnTemplate.units[1].type == "F-15E" then
min = 9
max = 18
ctable = CALLSIGN.F15E
end
local callsignnr = math.random(min,max)
local callsignname = "Enfield"
for name, value in pairs(ctable) do
if value==callsignnr then
callsignname = name
end
end
for UnitID = 1, #SpawnTemplate.units do
SpawnTemplate.units[UnitID].callsign[1] = callsignnr
SpawnTemplate.units[UnitID].callsign[2] = UnitID
SpawnTemplate.units[UnitID].callsign[3] = "1"
SpawnTemplate.units[UnitID].callsign["name"] = tostring(callsignname)..tostring(UnitID).."1"
-- UTILS.PrintTableToLog(SpawnTemplate.units[UnitID].callsign,1)
end
else
-- Russkis
for UnitID = 1, #SpawnTemplate.units do
SpawnTemplate.units[UnitID].callsign = math.random(1,999)
end
end
end
if self.SpawnInitCallSign then
for UnitID = 1, #SpawnTemplate.units do
local Callsign = SpawnTemplate.units[UnitID].callsign
if Callsign and type( Callsign ) ~= "number" then
SpawnTemplate.units[UnitID].callsign[1] = self.SpawnInitCallSignID
SpawnTemplate.units[UnitID].callsign[2] = self.SpawnInitCallSignMinor
SpawnTemplate.units[UnitID].callsign[3] = self.SpawnInitCallSignMajor
SpawnTemplate.units[UnitID].callsign["name"] = string.format("%s%d%d",self.SpawnInitCallSignName,self.SpawnInitCallSignMinor,self.SpawnInitCallSignMajor)
--UTILS.PrintTableToLog(SpawnTemplate.units[UnitID].callsign,1)
end
end
end
for UnitID = 1, #SpawnTemplate.units do for UnitID = 1, #SpawnTemplate.units do
local Callsign = SpawnTemplate.units[UnitID].callsign local Callsign = SpawnTemplate.units[UnitID].callsign
if Callsign then if Callsign then
if type( Callsign ) ~= "number" then -- blue callsign if type( Callsign ) ~= "number" and not self.SpawnInitCallSign then -- blue callsign
-- UTILS.PrintTableToLog(Callsign,1)
Callsign[2] = ((SpawnIndex - 1) % 10) + 1 Callsign[2] = ((SpawnIndex - 1) % 10) + 1
local CallsignName = SpawnTemplate.units[UnitID].callsign["name"] -- #string local CallsignName = SpawnTemplate.units[UnitID].callsign["name"] -- #string
CallsignName = string.match(CallsignName,"^(%a+)") -- 2.8 - only the part w/o numbers CallsignName = string.match(CallsignName,"^(%a+)") -- 2.8 - only the part w/o numbers
local CallsignLen = CallsignName:len() local CallsignLen = CallsignName:len()
SpawnTemplate.units[UnitID].callsign[2] = UnitID
SpawnTemplate.units[UnitID].callsign["name"] = CallsignName:sub( 1, CallsignLen ) .. SpawnTemplate.units[UnitID].callsign[2] .. SpawnTemplate.units[UnitID].callsign[3] SpawnTemplate.units[UnitID].callsign["name"] = CallsignName:sub( 1, CallsignLen ) .. SpawnTemplate.units[UnitID].callsign[2] .. SpawnTemplate.units[UnitID].callsign[3]
else elseif type( Callsign ) == "number" then
SpawnTemplate.units[UnitID].callsign = Callsign + SpawnIndex SpawnTemplate.units[UnitID].callsign = Callsign + SpawnIndex
end end
end end
-- Link16
local AddProps = SpawnTemplate.units[UnitID].AddPropAircraft
if AddProps then
if SpawnTemplate.units[UnitID].AddPropAircraft.STN_L16 then
-- 4 digit octal with leading 0
if tonumber(SpawnTemplate.units[UnitID].AddPropAircraft.STN_L16) ~= nil then
local octal = SpawnTemplate.units[UnitID].AddPropAircraft.STN_L16
local decimal = UTILS.OctalToDecimal(octal)+UnitID-1
SpawnTemplate.units[UnitID].AddPropAircraft.STN_L16 = string.format("%05d",UTILS.DecimalToOctal(decimal))
else -- ED bug - chars in here
local STN = math.floor(UTILS.RandomGaussian(4088/2,nil,1000,4088))
STN = STN+UnitID-1
local OSTN = UTILS.DecimalToOctal(STN)
SpawnTemplate.units[UnitID].AddPropAircraft.STN_L16 = string.format("%05d",OSTN)
end
end
-- A10CII
if SpawnTemplate.units[UnitID].AddPropAircraft.SADL_TN then
-- 3 digit octal with leading 0
if tonumber(SpawnTemplate.units[UnitID].AddPropAircraft.SADL_TN) ~= nil then
local octal = SpawnTemplate.units[UnitID].AddPropAircraft.SADL_TN
local decimal = UTILS.OctalToDecimal(octal)+UnitID-1
SpawnTemplate.units[UnitID].AddPropAircraft.SADL_TN = string.format("%04d",UTILS.DecimalToOctal(decimal))
else -- ED bug - chars in here
local STN = math.floor(UTILS.RandomGaussian(504/2,nil,100,504))
STN = STN+UnitID-1
local OSTN = UTILS.DecimalToOctal(STN)
SpawnTemplate.units[UnitID].AddPropAircraft.SADL_TN = string.format("%04d",OSTN)
end
end
-- VoiceCallsignNumber
if SpawnTemplate.units[UnitID].AddPropAircraft.VoiceCallsignNumber and type( Callsign ) ~= "number" then
SpawnTemplate.units[UnitID].AddPropAircraft.VoiceCallsignNumber = SpawnTemplate.units[UnitID].callsign[2] .. SpawnTemplate.units[UnitID].callsign[3]
end
-- VoiceCallsignLabel
if SpawnTemplate.units[UnitID].AddPropAircraft.VoiceCallsignLabel and type( Callsign ) ~= "number" then
local CallsignName = SpawnTemplate.units[UnitID].callsign["name"] -- #string
CallsignName = string.match(CallsignName,"^(%a+)") -- 2.8 - only the part w/o numbers
local label = "NY" -- Navy One exception
if not string.find(CallsignName," ") then
label = string.upper(string.match(CallsignName,"^%a")..string.match(CallsignName,"%a$"))
end
SpawnTemplate.units[UnitID].AddPropAircraft.VoiceCallsignLabel = label
end
-- UTILS.PrintTableToLog(SpawnTemplate.units[UnitID].AddPropAircraft,1)
-- FlightLead
if SpawnTemplate.units[UnitID].datalinks and SpawnTemplate.units[UnitID].datalinks.Link16 and SpawnTemplate.units[UnitID].datalinks.Link16.settings then
SpawnTemplate.units[UnitID].datalinks.Link16.settings.flightLead = UnitID == 1 and true or false
end
-- A10CII
if SpawnTemplate.units[UnitID].datalinks and SpawnTemplate.units[UnitID].datalinks.SADL and SpawnTemplate.units[UnitID].datalinks.SADL.settings then
SpawnTemplate.units[UnitID].datalinks.SADL.settings.flightLead = UnitID == 1 and true or false
end
-- UTILS.PrintTableToLog(SpawnTemplate.units[UnitID].datalinks,1)
end
end
-- Link16 team members
for UnitID = 1, #SpawnTemplate.units do
if SpawnTemplate.units[UnitID].datalinks and SpawnTemplate.units[UnitID].datalinks.Link16 and SpawnTemplate.units[UnitID].datalinks.Link16.network then
local team = {}
local isF16 = string.find(SpawnTemplate.units[UnitID].type,"F-16",1,true) and true or false
for ID = 1, #SpawnTemplate.units do
local member = {}
member.missionUnitId = ID
if isF16 then
member.TDOA = true
end
table.insert(team,member)
end
SpawnTemplate.units[UnitID].datalinks.Link16.network.teamMembers = team
end
end end
self:T3( { "Template:", SpawnTemplate } ) self:T3( { "Template:", SpawnTemplate } )
--UTILS.PrintTableToLog(SpawnTemplate,1)
return SpawnTemplate return SpawnTemplate
end end
@@ -3115,6 +3537,57 @@ function SPAWN:_RandomizeTemplate( SpawnIndex )
return self return self
end end
--- Private method that sets the DCS#Vec2 where the Group will be spawned.
-- @param #SPAWN self
-- @param #number SpawnIndex
-- @return #SPAWN self
function SPAWN:_SetInitialPosition( SpawnIndex )
self:T( { self.SpawnTemplatePrefix, SpawnIndex, self.SpawnRandomizeZones } )
if self.SpawnFromNewPosition then
self:T( "Preparing Spawn at Vec2 ", self.SpawnInitPosition )
local SpawnVec2 = self.SpawnInitPosition
self:T( { SpawnVec2 = SpawnVec2 } )
local SpawnTemplate = self.SpawnGroups[SpawnIndex].SpawnTemplate
SpawnTemplate.route = SpawnTemplate.route or {}
SpawnTemplate.route.points = SpawnTemplate.route.points or {}
SpawnTemplate.route.points[1] = SpawnTemplate.route.points[1] or {}
SpawnTemplate.route.points[1].x = SpawnTemplate.route.points[1].x or 0
SpawnTemplate.route.points[1].y = SpawnTemplate.route.points[1].y or 0
self:T( { Route = SpawnTemplate.route } )
for UnitID = 1, #SpawnTemplate.units do
local UnitTemplate = SpawnTemplate.units[UnitID]
self:T( 'Before Translation SpawnTemplate.units[' .. UnitID .. '].x = ' .. UnitTemplate.x .. ', SpawnTemplate.units[' .. UnitID .. '].y = ' .. UnitTemplate.y )
local SX = UnitTemplate.x
local SY = UnitTemplate.y
local BX = SpawnTemplate.route.points[1].x
local BY = SpawnTemplate.route.points[1].y
local TX = SpawnVec2.x + (SX - BX)
local TY = SpawnVec2.y + (SY - BY)
UnitTemplate.x = TX
UnitTemplate.y = TY
-- TODO: Manage altitude based on landheight...
-- SpawnTemplate.units[UnitID].alt = SpawnVec2:
self:T( 'After Translation SpawnTemplate.units[' .. UnitID .. '].x = ' .. UnitTemplate.x .. ', SpawnTemplate.units[' .. UnitID .. '].y = ' .. UnitTemplate.y )
end
SpawnTemplate.route.points[1].x = SpawnVec2.x
SpawnTemplate.route.points[1].y = SpawnVec2.y
SpawnTemplate.x = SpawnVec2.x
SpawnTemplate.y = SpawnVec2.y
end
return self
end
--- Private method that randomizes the @{Core.Zone}s where the Group will be spawned. --- Private method that randomizes the @{Core.Zone}s where the Group will be spawned.
-- @param #SPAWN self -- @param #SPAWN self
-- @param #number SpawnIndex -- @param #number SpawnIndex
@@ -3138,6 +3611,7 @@ function SPAWN:_RandomizeZones( SpawnIndex )
self:T( { SpawnVec2 = SpawnVec2 } ) self:T( { SpawnVec2 = SpawnVec2 } )
local SpawnTemplate = self.SpawnGroups[SpawnIndex].SpawnTemplate local SpawnTemplate = self.SpawnGroups[SpawnIndex].SpawnTemplate
self.SpawnGroups[SpawnIndex].SpawnZone = SpawnZone
self:T( { Route = SpawnTemplate.route } ) self:T( { Route = SpawnTemplate.route } )
@@ -3234,7 +3708,7 @@ end
-- TODO Need to delete this... _DATABASE does this now ... -- TODO Need to delete this... _DATABASE does this now ...
--- @param #SPAWN self -- @param #SPAWN self
-- @param Core.Event#EVENTDATA EventData -- @param Core.Event#EVENTDATA EventData
function SPAWN:_OnBirth( EventData ) function SPAWN:_OnBirth( EventData )
self:F( self.SpawnTemplatePrefix ) self:F( self.SpawnTemplatePrefix )
@@ -3254,7 +3728,7 @@ function SPAWN:_OnBirth( EventData )
end end
--- @param #SPAWN self -- @param #SPAWN self
-- @param Core.Event#EVENTDATA EventData -- @param Core.Event#EVENTDATA EventData
function SPAWN:_OnDeadOrCrash( EventData ) function SPAWN:_OnDeadOrCrash( EventData )
self:F( self.SpawnTemplatePrefix ) self:F( self.SpawnTemplatePrefix )
@@ -3328,7 +3802,7 @@ function SPAWN:_OnLand( EventData )
end end
--- Will detect AIR Units shutting down their engines ... --- Will detect AIR Units shutting down their engines ...
-- When the event takes place, and the method @{RepeatOnEngineShutDown} was called, the spawned Group will Re-SPAWN. -- When the event takes place, and the method @{#InitRepeatOnEngineShutDown} was called, the spawned Group will Re-SPAWN.
-- But only when the Unit was registered to have landed. -- But only when the Unit was registered to have landed.
-- @param #SPAWN self -- @param #SPAWN self
-- @param Core.Event#EVENTDATA EventData -- @param Core.Event#EVENTDATA EventData

View File

@@ -15,14 +15,14 @@
-- --
-- # Demo Missions -- # Demo Missions
-- --
-- ## [SPAWNSTATIC Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SPS%20-%20Spawning%20Statics) -- ## [SPAWNSTATIC Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Core/SpawnStatic)
-- --
-- --
-- === -- ===
-- --
-- # YouTube Channel -- # YouTube Channel
-- --
-- ## [SPAWNSTATIC YouTube Channel]() [No videos yet!] -- ## No videos yet!
-- --
-- === -- ===
-- --

View File

@@ -5,7 +5,7 @@
-- SPOT implements the DCS Spot class functionality, but adds additional luxury to be able to: -- SPOT implements the DCS Spot class functionality, but adds additional luxury to be able to:
-- --
-- * Spot for a defined duration. -- * Spot for a defined duration.
-- * Updates of laer spot position every 0.2 seconds for moving targets. -- * Updates of laser spot position every 0.2 seconds for moving targets.
-- * Wiggle the spot at the target. -- * Wiggle the spot at the target.
-- * Provide a @{Wrapper.Unit} as a target, instead of a point. -- * Provide a @{Wrapper.Unit} as a target, instead of a point.
-- * Implement a status machine, LaseOn, LaseOff. -- * Implement a status machine, LaseOn, LaseOff.
@@ -13,27 +13,17 @@
-- === -- ===
-- --
-- # Demo Missions -- # Demo Missions
--
-- ### [SPOT Demo Missions source code]()
--
-- ### [SPOT Demo Missions, only for beta testers]()
-- --
-- ### [ALL Demo Missions pack of the last release](https://github.com/FlightControl-Master/MOOSE_MISSIONS/releases) -- ### [Demo Missions on GitHub](https://github.com/FlightControl-Master/MOOSE_MISSIONS)
--
-- ===
--
-- # YouTube Channel
--
-- ### [SPOT YouTube Channel]()
-- --
-- === -- ===
-- --
-- ### Author: **FlightControl** -- ### Author: **FlightControl**
-- ### Contributions: -- ### Contributions:
-- --
-- * [**Ciribob**](https://forums.eagle.ru/member.php?u=112175): Showing the way how to lase targets + how laser codes work!!! Explained the autolase script. -- * **Ciribob**: Showing the way how to lase targets + how laser codes work!!! Explained the autolase script.
-- * [**EasyEB**](https://forums.eagle.ru/member.php?u=112055): Ideas and Beta Testing -- * **EasyEB**: Ideas and Beta Testing
-- * [**Wingthor**](https://forums.eagle.ru/member.php?u=123698): Beta Testing -- * **Wingthor**: Beta Testing
-- --
-- === -- ===
-- --
@@ -43,21 +33,22 @@
do do
--- @type SPOT ---
-- @type SPOT
-- @extends Core.Fsm#FSM -- @extends Core.Fsm#FSM
--- Implements the target spotting or marking functionality, but adds additional luxury to be able to: --- Implements the target spotting or marking functionality, but adds additional luxury to be able to:
-- --
-- * Mark targets for a defined duration. -- * Mark targets for a defined duration.
-- * Updates of laer spot position every 0.2 seconds for moving targets. -- * Updates of laser spot position every 0.25 seconds for moving targets.
-- * Wiggle the spot at the target. -- * Wiggle the spot at the target.
-- * Provide a @{Wrapper.Unit} as a target, instead of a point. -- * Provide a @{Wrapper.Unit} as a target, instead of a point.
-- * Implement a status machine, LaseOn, LaseOff. -- * Implement a status machine, LaseOn, LaseOff.
-- --
-- ## 1. SPOT constructor -- ## 1. SPOT constructor
-- --
-- * @{#SPOT.New}(..\Presentations\SPOT\Dia2.JPG): Creates a new SPOT object. -- * @{#SPOT.New}(): Creates a new SPOT object.
-- --
-- ## 2. SPOT is a FSM -- ## 2. SPOT is a FSM
-- --
@@ -217,6 +208,8 @@ do
self.Recce = Recce self.Recce = Recce
self.RecceName = self.Recce:GetName()
self.LaseScheduler = SCHEDULER:New( self ) self.LaseScheduler = SCHEDULER:New( self )
@@ -236,13 +229,17 @@ do
-- @param #number LaserCode Laser code. -- @param #number LaserCode Laser code.
-- @param #number Duration Duration of lasing in seconds. -- @param #number Duration Duration of lasing in seconds.
function SPOT:onafterLaseOn( From, Event, To, Target, LaserCode, Duration ) function SPOT:onafterLaseOn( From, Event, To, Target, LaserCode, Duration )
self:F( { "LaseOn", Target, LaserCode, Duration } ) self:T({From, Event, To})
self:T2( { "LaseOn", Target, LaserCode, Duration } )
local function StopLase( self ) local function StopLase( self )
self:LaseOff() self:LaseOff()
end end
self.Target = Target self.Target = Target
self.TargetName = Target:GetName()
self.LaserCode = LaserCode self.LaserCode = LaserCode
self.Lasing = true self.Lasing = true
@@ -261,6 +258,8 @@ do
self:HandleEvent( EVENTS.Dead ) self:HandleEvent( EVENTS.Dead )
self:__Lasing( -1 ) self:__Lasing( -1 )
return self
end end
@@ -273,7 +272,7 @@ do
-- @param #number LaserCode Laser code. -- @param #number LaserCode Laser code.
-- @param #number Duration Duration of lasing in seconds. -- @param #number Duration Duration of lasing in seconds.
function SPOT:onafterLaseOnCoordinate(From, Event, To, Coordinate, LaserCode, Duration) function SPOT:onafterLaseOnCoordinate(From, Event, To, Coordinate, LaserCode, Duration)
self:F( { "LaseOnCoordinate", Coordinate, LaserCode, Duration } ) self:T2( { "LaseOnCoordinate", Coordinate, LaserCode, Duration } )
local function StopLase( self ) local function StopLase( self )
self:LaseOff() self:LaseOff()
@@ -295,55 +294,72 @@ do
end end
self:__Lasing(-1) self:__Lasing(-1)
return self
end end
--- @param #SPOT self ---
-- @param #SPOT self
-- @param Core.Event#EVENTDATA EventData -- @param Core.Event#EVENTDATA EventData
function SPOT:OnEventDead(EventData) function SPOT:OnEventDead(EventData)
self:F( { Dead = EventData.IniDCSUnitName, Target = self.Target } ) self:T2( { Dead = EventData.IniDCSUnitName, Target = self.Target } )
if self.Target then if self.Target then
if EventData.IniDCSUnitName == self.Target:GetName() then if EventData.IniDCSUnitName == self.TargetName then
self:F( {"Target dead ", self.Target:GetName() } ) self:F( {"Target dead ", self.TargetName } )
self:Destroyed() self:Destroyed()
self:LaseOff() self:LaseOff()
end end
end end
if self.Recce then
if EventData.IniDCSUnitName == self.RecceName then
self:F( {"Recce dead ", self.RecceName } )
self:LaseOff()
end
end
return self
end end
--- @param #SPOT self ---
-- @param #SPOT self
-- @param From -- @param From
-- @param Event -- @param Event
-- @param To -- @param To
function SPOT:onafterLasing( From, Event, To ) function SPOT:onafterLasing( From, Event, To )
self:T({From, Event, To})
if self.Target and self.Target:IsAlive() then
self.SpotIR:setPoint( self.Target:GetPointVec3():AddY(1):AddY(math.random(-100,100)/100):AddX(math.random(-100,100)/100):GetVec3() )
self.SpotLaser:setPoint( self.Target:GetPointVec3():AddY(1):GetVec3() )
self:__Lasing( -0.2 )
elseif self.TargetCoord then
-- Wiggle the IR spot a bit. if self.Lasing then
local irvec3={x=self.TargetCoord.x+math.random(-100,100)/100, y=self.TargetCoord.y+math.random(-100,100)/100, z=self.TargetCoord.z} --#DCS.Vec3 if self.Target and self.Target:IsAlive() then
local lsvec3={x=self.TargetCoord.x, y=self.TargetCoord.y, z=self.TargetCoord.z} --#DCS.Vec3
self.SpotIR:setPoint( self.Target:GetPointVec3():AddY(1):AddY(math.random(-100,100)/200):AddX(math.random(-100,100)/200):GetVec3() )
self.SpotLaser:setPoint( self.Target:GetPointVec3():AddY(1):GetVec3() )
self:__Lasing(0.2)
elseif self.TargetCoord then
self.SpotIR:setPoint(irvec3) -- Wiggle the IR spot a bit.
self.SpotLaser:setPoint(lsvec3) local irvec3={x=self.TargetCoord.x+math.random(-100,100)/200, y=self.TargetCoord.y+math.random(-100,100)/200, z=self.TargetCoord.z} --#DCS.Vec3
local lsvec3={x=self.TargetCoord.x, y=self.TargetCoord.y, z=self.TargetCoord.z} --#DCS.Vec3
self:__Lasing(-0.25)
else self.SpotIR:setPoint(irvec3)
self:F( { "Target is not alive", self.Target:IsAlive() } ) self.SpotLaser:setPoint(lsvec3)
self:__Lasing(0.2)
else
self:F( { "Target is not alive", self.Target:IsAlive() } )
end
end end
return self
end end
--- @param #SPOT self ---
-- @param #SPOT self
-- @param From -- @param From
-- @param Event -- @param Event
-- @param To -- @param To
-- @return #SPOT -- @return #SPOT
function SPOT:onafterLaseOff( From, Event, To ) function SPOT:onafterLaseOff( From, Event, To )
self:T({From, Event, To})
self:F( {"Stopped lasing for ", self.Target and self.Target:GetName() or "coord", SpotIR = self.SportIR, SpotLaser = self.SpotLaser } )
self:T2( {"Stopped lasing for ", self.Target and self.Target:GetName() or "coord", SpotIR = self.SportIR, SpotLaser = self.SpotLaser } )
self.Lasing = false self.Lasing = false

View File

@@ -107,7 +107,7 @@ _TIMERID=0
--- TIMER class version. --- TIMER class version.
-- @field #string version -- @field #string version
TIMER.version="0.1.2" TIMER.version="0.2.0"
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO list -- TODO list
@@ -222,7 +222,20 @@ function TIMER:Stop(Delay)
-- Remove timer function. -- Remove timer function.
self:T(self.lid..string.format("Stopping timer by removing timer function after %d calls!", self.ncalls)) self:T(self.lid..string.format("Stopping timer by removing timer function after %d calls!", self.ncalls))
timer.removeFunction(self.tid)
-- We use a pcall here because if the DCS timer does not exist any more, it crashes the whole script!
local status=pcall(
function ()
timer.removeFunction(self.tid)
end
)
-- Debug messages.
if status then
self:T2(self.lid..string.format("Stopped timer!"))
else
self:E(self.lid..string.format("WARNING: Could not remove timer function! isrunning=%s", tostring(self.isrunning)))
end
-- Not running any more. -- Not running any more.
self.isrunning=false self.isrunning=false

File diff suppressed because it is too large Load Diff

View File

@@ -135,6 +135,22 @@ do -- env
end -- env end -- env
do -- radio
---@type radio
-- @field #radio.modulation modulation
---
-- @type radio.modulation
-- @field AM
-- @field FM
radio = {}
radio.modulation = {}
radio.modulation.AM = 0
radio.modulation.FM = 1
end
do -- timer do -- timer
@@ -193,21 +209,29 @@ do -- land
--- [Type of surface enumerator](https://wiki.hoggitworld.com/view/DCS_singleton_land) --- [Type of surface enumerator](https://wiki.hoggitworld.com/view/DCS_singleton_land)
-- @type land.SurfaceType -- @type land.SurfaceType
-- @field LAND -- @field LAND Land=1
-- @field SHALLOW_WATER -- @field SHALLOW_WATER Shallow water=2
-- @field WATER -- @field WATER Water=3
-- @field ROAD -- @field ROAD Road=4
-- @field RUNWAY -- @field RUNWAY Runway=5
--- Returns altitude MSL of the point. --- Returns the distance from sea level (y-axis) of a given vec2 point.
-- @function [parent=#land] getHeight -- @function [parent=#land] getHeight
-- @param #Vec2 point point on the ground. -- @param #Vec2 point Point on the ground.
-- @return #Distance -- @return #number Height in meters.
--- Returns the surface height and depth of a point. Useful for checking if the path is deep enough to support a given ship.
-- Both values are positive. When checked over water at sea level the first value is always zero.
-- When checked over water at altitude, for example the reservoir of the Inguri Dam, the first value is the corresponding altitude the water level is at.
-- @function [parent=#land] getSurfaceHeightWithSeabed
-- @param #Vec2 point Position where to check.
-- @return #number Height in meters.
-- @return #number Depth in meters.
--- returns surface type at the given point. --- Returns surface type at the given point.
-- @function [parent=#land] getSurfaceType -- @function [parent=#land] getSurfaceType
-- @param #Vec2 point Point on the land. -- @param #Vec2 point Point on the land.
-- @return #land.SurfaceType -- @return #number Enumerator value from `land.SurfaceType` (LAND=1, SHALLOW_WATER=2, WATER=3, ROAD=4, RUNWAY=5)
--- [DCS Singleton land](https://wiki.hoggitworld.com/view/DCS_singleton_land) --- [DCS Singleton land](https://wiki.hoggitworld.com/view/DCS_singleton_land)
land = {} --#land land = {} --#land
@@ -321,11 +345,11 @@ end -- country
do -- Command do -- Command
--- @type Command -- @type Command
-- @field #string id -- @field #string id
-- @field #Command.params params -- @field #Command.params params
--- @type Command.params -- @type Command.params
end -- Command end -- Command
@@ -366,7 +390,7 @@ end -- coalition
do -- Types do -- Types
--- @type Desc -- @type Desc
-- @field #number speedMax0 Max speed in meters/second at zero altitude. -- @field #number speedMax0 Max speed in meters/second at zero altitude.
-- @field #number massEmpty Empty mass in kg. -- @field #number massEmpty Empty mass in kg.
-- @field #number tankerType Type of refueling system: 0=boom, 1=probe. -- @field #number tankerType Type of refueling system: 0=boom, 1=probe.
@@ -427,8 +451,8 @@ do -- Types
--- Vec3 type is a 3D-vector. --- Vec3 type is a 3D-vector.
-- DCS world has 3-dimensional coordinate system. DCS ground is an infinite plain. -- DCS world has 3-dimensional coordinate system. DCS ground is an infinite plain.
-- @type Vec3 -- @type Vec3
-- @field #Distance x is directed to the north -- @field #Distance x is directed to the North
-- @field #Distance z is directed to the east -- @field #Distance z is directed to the East
-- @field #Distance y is directed up -- @field #Distance y is directed up
--- Vec2 is a 2D-vector for the ground plane as a reference plane. --- Vec2 is a 2D-vector for the ground plane as a reference plane.
@@ -463,16 +487,16 @@ do -- Types
-- @type AttributeNameArray -- @type AttributeNameArray
-- @list <#AttributeName> -- @list <#AttributeName>
--- @type Zone -- @type Zone
-- @field DCSVec3#Vec3 point -- @field DCSVec3#Vec3 point
-- @field #number radius -- @field #number radius
Zone = {} Zone = {}
--- @type ModelTime -- @type ModelTime
-- @extends #number -- @extends #number
--- @type Time -- @type Time
-- @extends #number -- @extends #number
--- A task descriptor (internal structure for DCS World). See [https://wiki.hoggitworld.com/view/Category:Tasks](https://wiki.hoggitworld.com/view/Category:Tasks). --- A task descriptor (internal structure for DCS World). See [https://wiki.hoggitworld.com/view/Category:Tasks](https://wiki.hoggitworld.com/view/Category:Tasks).
@@ -481,7 +505,7 @@ do -- Types
-- @field #string id -- @field #string id
-- @field #Task.param param -- @field #Task.param param
--- @type Task.param -- @type Task.param
--- List of @{#Task} --- List of @{#Task}
-- @type TaskArray -- @type TaskArray
@@ -528,7 +552,7 @@ do -- Object
-- @field SCENERY -- @field SCENERY
-- @field CARGO -- @field CARGO
--- @type Object.Desc -- @type Object.Desc
-- @extends #Desc -- @extends #Desc
-- @field #number life initial life level -- @field #number life initial life level
-- @field #Box3 box bounding box of collision geometry -- @field #Box3 box bounding box of collision geometry
@@ -679,10 +703,11 @@ do -- Weapon
--- Weapon.Category enum that stores weapon categories. --- Weapon.Category enum that stores weapon categories.
-- @type Weapon.Category -- @type Weapon.Category
-- @field SHELL -- @field #number SHELL Shell.
-- @field MISSILE -- @field #number MISSILE Missile
-- @field ROCKET -- @field #number ROCKET Rocket.
-- @field BOMB -- @field #number BOMB Bomb.
-- @field #number TORPEDO Torpedo.
--- Weapon.GuidanceType enum that stores guidance methods. Available only for guided weapon (Weapon.Category.MISSILE and some Weapon.Category.BOMB). --- Weapon.GuidanceType enum that stores guidance methods. Available only for guided weapon (Weapon.Category.MISSILE and some Weapon.Category.BOMB).
@@ -784,11 +809,118 @@ do -- Airbase
-- @function [parent=#Airbase] getDesc -- @function [parent=#Airbase] getDesc
-- @param self -- @param self
-- @return #Airbase.Desc -- @return #Airbase.Desc
--- Returns the warehouse object associated with the airbase object. Can then be used to call the warehouse class functions to modify the contents of the warehouse.
-- @function [parent=#Airbase] getWarehouse
-- @param self
-- @return #Warehouse The DCS warehouse object of this airbase.
--- Enables or disables the airbase and FARP auto capture game mechanic where ownership of a base can change based on the presence of ground forces or the
-- default setting assigned in the editor.
-- @function [parent=#Airbase] autoCapture
-- @param self
-- @param #boolean setting `true` : enables autoCapture behavior, `false` : disables autoCapture behavior
--- Returns the current autoCapture setting for the passed base.
-- @function [parent=#Airbase] autoCaptureIsOn
-- @param self
-- @return #boolean `true` if autoCapture behavior is enabled and `false` otherwise.
--- Changes the passed airbase object's coalition to the set value. Must be used with Airbase.autoCapture to disable auto capturing of the base,
-- otherwise the base can revert back to a different coalition depending on the situation and built in game capture rules.
-- @function [parent=#Airbase] setCoalition
-- @param self
-- @param #number coa The new owner coalition: 0=neutra, 1=red, 2=blue.
--- Returns the wsType of every object that exists in DCS. A wsType is a table consisting of 4 entries indexed numerically.
-- It can be used to broadly categorize object types. The table can be broken down as: {mainCategory, subCat1, subCat2, index}
-- @function [parent=#Airbase] getResourceMap
-- @param self
-- @return #table wsType of every object that exists in DCS.
Airbase = {} --#Airbase Airbase = {} --#Airbase
end -- Airbase end -- Airbase
do -- Warehouse
--- [DCS Class Warehouse](https://wiki.hoggitworld.com/view/DCS_Class_Warehouse)
-- The warehouse class gives control over warehouses that exist in airbase objects. These warehouses can limit the aircraft, munitions, and fuel available to coalition aircraft.
-- @type Warehouse
--- Get a warehouse by passing its name.
-- @function [parent=#Warehouse] getByName
-- @param #string Name Name of the warehouse.
-- @return #Warehouse The warehouse object.
--- Adds the passed amount of a given item to the warehouse.
-- itemName is the typeName associated with the item: "weapons.missiles.AIM_54C_Mk47"
-- A wsType table can also be used, however the last digit with wsTypes has been known to change. {4, 4, 7, 322}
-- @function [parent=#Warehouse] addItem
-- @param self
-- @param #string itemName Name of the item.
-- @param #number count Number of items to add.
--- Returns the number of the passed type of item currently in a warehouse object.
-- @function [parent=#Warehouse] getItemCount
-- @param self
-- @param #string itemName Name of the item.
--- Sets the passed amount of a given item to the warehouse.
-- @function [parent=#Warehouse] setItem
-- @param self
-- @param #string itemName Name of the item.
-- @param #number count Number of items to add.
--- Removes the amount of the passed item from the warehouse.
-- @function [parent=#Warehouse] removeItem
-- @param self
-- @param #string itemName Name of the item.
-- @param #number count Number of items to be removed.
--- Adds the passed amount of a liquid fuel into the warehouse inventory.
-- @function [parent=#Warehouse] addLiquid
-- @param self
-- @param #number liquidType Type of liquid to add: 0=jetfuel, 1=aviation gasoline, 2=MW50, 3=Diesel.
-- @param #number count Amount of liquid to add.
--- Returns the amount of the passed liquid type within a given warehouse.
-- @function [parent=#Warehouse] getLiquidAmount
-- @param self
-- @param #number liquidType Type of liquid to add: 0=jetfuel, 1=aviation gasoline, 2=MW50, 3=Diesel.
-- @return #number Amount of liquid.
--- Sets the passed amount of a liquid fuel into the warehouse inventory.
-- @function [parent=#Warehouse] setLiquidAmount
-- @param self
-- @param #number liquidType Type of liquid to add: 0=jetfuel, 1=aviation gasoline, 2=MW50, 3=Diesel.
-- @param #number count Amount of liquid.
--- Removes the set amount of liquid from the inventory in a warehouse.
-- @function [parent=#Warehouse] setLiquidAmount
-- @param self
-- @param #number liquidType Type of liquid to add: 0=jetfuel, 1=aviation gasoline, 2=MW50, 3=Diesel.
-- @param #number count Amount of liquid.
--- Returns the airbase object associated with the warehouse object.
-- @function [parent=#Warehouse] getOwner
-- @param self
-- @return #Airbase The airbase object owning this warehouse.
--- Returns a full itemized list of everything currently in a warehouse. If a category is set to unlimited then the table will be returned empty.
-- Aircraft and weapons are indexed by strings. Liquids are indexed by number.
-- @function [parent=#Warehouse] getInventory
-- @param self
-- @param #string itemName Name of the item.
-- @return #table Itemized list of everything currently in a warehouse
Warehouse = {} --#Warehouse
end
do -- Spot do -- Spot
--- [DCS Class Spot](https://wiki.hoggitworld.com/view/DCS_Class_Spot) --- [DCS Class Spot](https://wiki.hoggitworld.com/view/DCS_Class_Spot)
@@ -851,7 +983,7 @@ do -- Spot
end -- Spot end -- Spot
do -- Controller 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. --- Controller is an object that performs A.I.-tasks. 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.
-- --
-- This class has 2 types of functions: -- This class has 2 types of functions:
-- --
@@ -969,7 +1101,7 @@ end -- Controller
do -- Unit do -- Unit
--- @type Unit -- @type Unit
-- @extends #CoalitionObject -- @extends #CoalitionObject
-- @field ID Identifier of an unit. It assigned to an unit by the Mission Editor automatically. -- @field ID Identifier of an unit. It assigned to an unit by the Mission Editor automatically.
-- @field #Unit.Category Category -- @field #Unit.Category Category
@@ -1001,8 +1133,8 @@ do -- Unit
--- Enum that stores aircraft refueling system types. --- Enum that stores aircraft refueling system types.
-- @type Unit.RefuelingSystem -- @type Unit.RefuelingSystem
-- @field BOOM_AND_RECEPTACLE -- @field BOOM_AND_RECEPTACLE Tanker with a boom.
-- @field PROBE_AND_DROGUE -- @field PROBE_AND_DROGUE Tanker with a probe.
--- Enum that stores sensor types. --- Enum that stores sensor types.
-- @type Unit.SensorType -- @type Unit.SensorType
@@ -1084,15 +1216,18 @@ do -- Unit
-- @field #Distance detectionDistanceHRM detection distance for RCS=1m^2 in high-resolution mapping mode, nil if radar has no HRM -- @field #Distance detectionDistanceHRM detection distance for RCS=1m^2 in high-resolution mapping mode, nil if radar has no HRM
-- @field #Unit.Radar.detectionDistanceAir detectionDistanceAir detection distance for RCS=1m^2 airborne target, nil if radar doesn't support air search -- @field #Unit.Radar.detectionDistanceAir detectionDistanceAir detection distance for RCS=1m^2 airborne target, nil if radar doesn't support air search
--- @type Unit.Radar.detectionDistanceAir --- A radar.
-- @type Unit.Radar.detectionDistanceAir
-- @field #Unit.Radar.detectionDistanceAir.upperHemisphere upperHemisphere -- @field #Unit.Radar.detectionDistanceAir.upperHemisphere upperHemisphere
-- @field #Unit.Radar.detectionDistanceAir.lowerHemisphere lowerHemisphere -- @field #Unit.Radar.detectionDistanceAir.lowerHemisphere lowerHemisphere
--- @type Unit.Radar.detectionDistanceAir.upperHemisphere --- A radar.
-- @type Unit.Radar.detectionDistanceAir.upperHemisphere
-- @field #Distance headOn -- @field #Distance headOn
-- @field #Distance tailOn -- @field #Distance tailOn
--- @type Unit.Radar.detectionDistanceAir.lowerHemisphere --- A radar.
-- @type Unit.Radar.detectionDistanceAir.lowerHemisphere
-- @field #Distance headOn -- @field #Distance headOn
-- @field #Distance tailOn -- @field #Distance tailOn
@@ -1394,22 +1529,26 @@ do -- AI
-- @field IR_POINTER -- @field IR_POINTER
-- @field LASER -- @field LASER
--- @type AI.Task.WaypointType ---
-- @type AI.Task.WaypointType
-- @field TAKEOFF -- @field TAKEOFF
-- @field TAKEOFF_PARKING -- @field TAKEOFF_PARKING
-- @field TURNING_POINT -- @field TURNING_POINT
-- @field TAKEOFF_PARKING_HOT -- @field TAKEOFF_PARKING_HOT
-- @field LAND -- @field LAND
--- @type AI.Task.TurnMethod ---
-- @type AI.Task.TurnMethod
-- @field FLY_OVER_POINT -- @field FLY_OVER_POINT
-- @field FIN_POINT -- @field FIN_POINT
--- @type AI.Task.AltitudeType ---
-- @type AI.Task.AltitudeType
-- @field BARO -- @field BARO
-- @field RADIO -- @field RADIO
--- @type AI.Task.VehicleFormation ---
-- @type AI.Task.VehicleFormation
-- @field OFF_ROAD -- @field OFF_ROAD
-- @field ON_ROAD -- @field ON_ROAD
-- @field RANK -- @field RANK
@@ -1419,27 +1558,30 @@ do -- AI
-- @field ECHELON_LEFT -- @field ECHELON_LEFT
-- @field ECHELON_RIGHT -- @field ECHELON_RIGHT
--- @type AI.Option ---
-- @type AI.Option
-- @field #AI.Option.Air Air -- @field #AI.Option.Air Air
-- @field #AI.Option.Ground Ground -- @field #AI.Option.Ground Ground
-- @field #AI.Option.Naval Naval -- @field #AI.Option.Naval Naval
--- @type AI.Option.Air ---
-- @type AI.Option.Air
-- @field #AI.Option.Air.id id -- @field #AI.Option.Air.id id
-- @field #AI.Option.Air.val val -- @field #AI.Option.Air.val val
--- @type AI.Option.Ground ---
-- @type AI.Option.Ground
-- @field #AI.Option.Ground.id id -- @field #AI.Option.Ground.id id
-- @field #AI.Option.Ground.val val -- @field #AI.Option.Ground.val val
-- @field #AI.Option.Ground.mid mid -- @field #AI.Option.Ground.mid mid
-- @field #AI.Option.Ground.mval mval -- @field #AI.Option.Ground.mval mval
-- --
--- @type AI.Option.Naval -- @type AI.Option.Naval
-- @field #AI.Option.Naval.id id -- @field #AI.Option.Naval.id id
-- @field #AI.Option.Naval.val val -- @field #AI.Option.Naval.val val
---
--- @type AI.Option.Air.id -- @type AI.Option.Air.id
-- @field NO_OPTION -- @field NO_OPTION
-- @field ROE -- @field ROE
-- @field REACTION_ON_THREAT -- @field REACTION_ON_THREAT
@@ -1461,73 +1603,61 @@ do -- AI
-- @field OPTION_RADIO_USAGE_KILL -- @field OPTION_RADIO_USAGE_KILL
-- @field JETT_TANKS_IF_EMPTY -- @field JETT_TANKS_IF_EMPTY
-- @field FORCED_ATTACK -- @field FORCED_ATTACK
--- @type AI.Option.Air.id.FORMATION
-- @field LINE_ABREAST
-- @field TRAIL
-- @field WEDGE
-- @field ECHELON_RIGHT
-- @field ECHELON_LEFT
-- @field FINGER_FOUR
-- @field SPREAD_FOUR
-- @field WW2_BOMBER_ELEMENT
-- @field WW2_BOMBER_ELEMENT_HEIGHT
-- @field WW2_FIGHTER_VIC
-- @field HEL_WEDGE
-- @field HEL_ECHELON
-- @field HEL_FRONT
-- @field HEL_COLUMN
-- @field COMBAT_BOX
-- @field JAVELIN_DOWN
---
--- @type AI.Option.Air.val -- @type AI.Option.Air.val
-- @field #AI.Option.Air.val.ROE ROE -- @field #AI.Option.Air.val.ROE ROE
-- @field #AI.Option.Air.val.REACTION_ON_THREAT REACTION_ON_THREAT -- @field #AI.Option.Air.val.REACTION_ON_THREAT REACTION_ON_THREAT
-- @field #AI.Option.Air.val.RADAR_USING RADAR_USING -- @field #AI.Option.Air.val.RADAR_USING RADAR_USING
-- @field #AI.Option.Air.val.FLARE_USING FLARE_USING -- @field #AI.Option.Air.val.FLARE_USING FLARE_USING
--- @type AI.Option.Air.val.ROE ---
-- @type AI.Option.Air.val.ROE
-- @field WEAPON_FREE -- @field WEAPON_FREE
-- @field OPEN_FIRE_WEAPON_FREE -- @field OPEN_FIRE_WEAPON_FREE
-- @field OPEN_FIRE -- @field OPEN_FIRE
-- @field RETURN_FIRE -- @field RETURN_FIRE
-- @field WEAPON_HOLD -- @field WEAPON_HOLD
--- @type AI.Option.Air.val.REACTION_ON_THREAT ---
-- @type AI.Option.Air.val.REACTION_ON_THREAT
-- @field NO_REACTION -- @field NO_REACTION
-- @field PASSIVE_DEFENCE -- @field PASSIVE_DEFENCE
-- @field EVADE_FIRE -- @field EVADE_FIRE
-- @field BYPASS_AND_ESCAPE -- @field BYPASS_AND_ESCAPE
-- @field ALLOW_ABORT_MISSION -- @field ALLOW_ABORT_MISSION
--- @type AI.Option.Air.val.RADAR_USING ---
-- @type AI.Option.Air.val.RADAR_USING
-- @field NEVER -- @field NEVER
-- @field FOR_ATTACK_ONLY -- @field FOR_ATTACK_ONLY
-- @field FOR_SEARCH_IF_REQUIRED -- @field FOR_SEARCH_IF_REQUIRED
-- @field FOR_CONTINUOUS_SEARCH -- @field FOR_CONTINUOUS_SEARCH
--- @type AI.Option.Air.val.FLARE_USING ---
-- @type AI.Option.Air.val.FLARE_USING
-- @field NEVER -- @field NEVER
-- @field AGAINST_FIRED_MISSILE -- @field AGAINST_FIRED_MISSILE
-- @field WHEN_FLYING_IN_SAM_WEZ -- @field WHEN_FLYING_IN_SAM_WEZ
-- @field WHEN_FLYING_NEAR_ENEMIES -- @field WHEN_FLYING_NEAR_ENEMIES
--- @type AI.Option.Air.val.ECM_USING ---
-- @type AI.Option.Air.val.ECM_USING
-- @field NEVER_USE -- @field NEVER_USE
-- @field USE_IF_ONLY_LOCK_BY_RADAR -- @field USE_IF_ONLY_LOCK_BY_RADAR
-- @field USE_IF_DETECTED_LOCK_BY_RADAR -- @field USE_IF_DETECTED_LOCK_BY_RADAR
-- @field ALWAYS_USE -- @field ALWAYS_USE
--- @type AI.Option.Air.val.MISSILE_ATTACK ---
-- @type AI.Option.Air.val.MISSILE_ATTACK
-- @field MAX_RANGE -- @field MAX_RANGE
-- @field NEZ_RANGE -- @field NEZ_RANGE
-- @field HALF_WAY_RMAX_NEZ -- @field HALF_WAY_RMAX_NEZ
-- @field TARGET_THREAT_EST -- @field TARGET_THREAT_EST
-- @field RANDOM_RANGE -- @field RANDOM_RANGE
---
--- @type AI.Option.Ground.id -- @type AI.Option.Ground.id
-- @field NO_OPTION -- @field NO_OPTION
-- @field ROE @{#AI.Option.Ground.val.ROE} -- @field ROE @{#AI.Option.Ground.val.ROE}
-- @field FORMATION -- @field FORMATION
@@ -1536,42 +1666,51 @@ do -- AI
-- @field ENGAGE_AIR_WEAPONS -- @field ENGAGE_AIR_WEAPONS
-- @field AC_ENGAGEMENT_RANGE_RESTRICTION -- @field AC_ENGAGEMENT_RANGE_RESTRICTION
--- @type AI.Option.Ground.mid -- Moose added ---
-- @type AI.Option.Ground.mid -- Moose added
-- @field RESTRICT_AAA_MIN 27 -- @field RESTRICT_AAA_MIN 27
-- @field RESTRICT_AAA_MAX 29 -- @field RESTRICT_AAA_MAX 29
-- @field RESTRICT_TARGETS @{#AI.Option.Ground.mval.ENGAGE_TARGETS} 28 -- @field RESTRICT_TARGETS @{#AI.Option.Ground.mval.ENGAGE_TARGETS} 28
--- @type AI.Option.Ground.val ---
-- @type AI.Option.Ground.val
-- @field #AI.Option.Ground.val.ROE ROE -- @field #AI.Option.Ground.val.ROE ROE
-- @field #AI.Option.Ground.val.ALARM_STATE ALARM_STATE -- @field #AI.Option.Ground.val.ALARM_STATE ALARM_STATE
-- @field #AI.Option.Ground.val.ENGAGE_TARGETS RESTRICT_TARGETS -- @field #AI.Option.Ground.val.ENGAGE_TARGETS RESTRICT_TARGETS
--- @type AI.Option.Ground.val.ROE ---
-- @type AI.Option.Ground.val.ROE
-- @field OPEN_FIRE -- @field OPEN_FIRE
-- @field RETURN_FIRE -- @field RETURN_FIRE
-- @field WEAPON_HOLD -- @field WEAPON_HOLD
--- @type AI.Option.Ground.mval -- Moose added ---
-- @type AI.Option.Ground.mval -- Moose added
-- @field #AI.Option.Ground.mval.ENGAGE_TARGETS ENGAGE_TARGETS -- @field #AI.Option.Ground.mval.ENGAGE_TARGETS ENGAGE_TARGETS
--- @type AI.Option.Ground.mval.ENGAGE_TARGETS -- Moose added ---
-- @type AI.Option.Ground.mval.ENGAGE_TARGETS -- Moose added
-- @field ANY_TARGET -- 0 -- @field ANY_TARGET -- 0
-- @field AIR_UNITS_ONLY -- 1 -- @field AIR_UNITS_ONLY -- 1
-- @field GROUND_UNITS_ONLY -- 2 -- @field GROUND_UNITS_ONLY -- 2
--- @type AI.Option.Ground.val.ALARM_STATE ---
-- @type AI.Option.Ground.val.ALARM_STATE
-- @field AUTO -- @field AUTO
-- @field GREEN -- @field GREEN
-- @field RED -- @field RED
--- @type AI.Option.Naval.id ---
-- @type AI.Option.Naval.id
-- @field NO_OPTION -- @field NO_OPTION
-- @field ROE -- @field ROE
--- @type AI.Option.Naval.val ---
-- @type AI.Option.Naval.val
-- @field #AI.Option.Naval.val.ROE ROE -- @field #AI.Option.Naval.val.ROE ROE
--- @type AI.Option.Naval.val.ROE ---
-- @type AI.Option.Naval.val.ROE
-- @field OPEN_FIRE -- @field OPEN_FIRE
-- @field RETURN_FIRE -- @field RETURN_FIRE
-- @field WEAPON_HOLD -- @field WEAPON_HOLD

View File

@@ -10,9 +10,7 @@
-- --
-- === -- ===
-- --
-- ## Missions: -- ## Missions: None
--
-- [ABP - Airbase Police](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/ABP%20-%20Airbase%20Police)
-- --
-- === -- ===
-- --
@@ -20,13 +18,15 @@
-- ### Author: FlightControl - Framework Design & Programming -- ### Author: FlightControl - Framework Design & Programming
-- ### Refactoring to use the Runway auto-detection: Applevangelist -- ### Refactoring to use the Runway auto-detection: Applevangelist
-- @date August 2022 -- @date August 2022
-- Last Update Nov 2023
-- --
-- === -- ===
-- --
-- @module Functional.ATC_Ground -- @module Functional.ATC_Ground
-- @image Air_Traffic_Control_Ground_Operations.JPG -- @image Air_Traffic_Control_Ground_Operations.JPG
--- @type ATC_GROUND ---
-- @type ATC_GROUND
-- @field Core.Set#SET_CLIENT SetClient -- @field Core.Set#SET_CLIENT SetClient
-- @extends Core.Base#BASE -- @extends Core.Base#BASE
@@ -39,7 +39,8 @@ ATC_GROUND = {
AirbaseNames = nil, AirbaseNames = nil,
} }
--- @type ATC_GROUND.AirbaseNames ---
-- @type ATC_GROUND.AirbaseNames
-- @list <#string> -- @list <#string>
@@ -51,7 +52,7 @@ function ATC_GROUND:New( Airbases, AirbaseList )
-- Inherits from BASE -- Inherits from BASE
local self = BASE:Inherit( self, BASE:New() ) -- #ATC_GROUND local self = BASE:Inherit( self, BASE:New() ) -- #ATC_GROUND
self:E( { self.ClassName, Airbases } ) self:T( { self.ClassName, Airbases } )
self.Airbases = Airbases self.Airbases = Airbases
self.AirbaseList = AirbaseList self.AirbaseList = AirbaseList
@@ -82,7 +83,7 @@ function ATC_GROUND:New( Airbases, AirbaseList )
end end
self.SetClient:ForEachClient( self.SetClient:ForEachClient(
--- @param Wrapper.Client#CLIENT Client -- @param Wrapper.Client#CLIENT Client
function( Client ) function( Client )
Client:SetState( self, "Speeding", false ) Client:SetState( self, "Speeding", false )
Client:SetState( self, "Warnings", 0) Client:SetState( self, "Warnings", 0)
@@ -246,11 +247,11 @@ function ATC_GROUND:SetMaximumKickSpeedMiph( MaximumKickSpeedMiph, Airbase )
return self return self
end end
--- @param #ATC_GROUND self -- @param #ATC_GROUND self
function ATC_GROUND:_AirbaseMonitor() function ATC_GROUND:_AirbaseMonitor()
self.SetClient:ForEachClient( self.SetClient:ForEachClient(
--- @param Wrapper.Client#CLIENT Client -- @param Wrapper.Client#CLIENT Client
function( Client ) function( Client )
if Client:IsAlive() then if Client:IsAlive() then
@@ -258,7 +259,7 @@ function ATC_GROUND:_AirbaseMonitor()
local IsOnGround = Client:InAir() == false local IsOnGround = Client:InAir() == false
for AirbaseID, AirbaseMeta in pairs( self.Airbases ) do for AirbaseID, AirbaseMeta in pairs( self.Airbases ) do
self:E( AirbaseID, AirbaseMeta.KickSpeed ) self:T( AirbaseID, AirbaseMeta.KickSpeed )
if AirbaseMeta.Monitor == true and Client:IsInZone( AirbaseMeta.ZoneBoundary ) then if AirbaseMeta.Monitor == true and Client:IsInZone( AirbaseMeta.ZoneBoundary ) then
@@ -271,7 +272,7 @@ function ATC_GROUND:_AirbaseMonitor()
if IsOnGround then if IsOnGround then
local Taxi = Client:GetState( self, "Taxi" ) local Taxi = Client:GetState( self, "Taxi" )
self:E( Taxi ) self:T( Taxi )
if Taxi == false then if Taxi == false then
local Velocity = VELOCITY:New( AirbaseMeta.KickSpeed or self.KickSpeed ) local Velocity = VELOCITY:New( AirbaseMeta.KickSpeed or self.KickSpeed )
Client:Message( "Welcome to " .. AirbaseID .. ". The maximum taxiing speed is " .. Client:Message( "Welcome to " .. AirbaseID .. ". The maximum taxiing speed is " ..
@@ -331,7 +332,7 @@ function ATC_GROUND:_AirbaseMonitor()
Client:SetState( self, "Warnings", SpeedingWarnings + 1 ) Client:SetState( self, "Warnings", SpeedingWarnings + 1 )
else else
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll() MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
--- @param Wrapper.Client#CLIENT Client -- @param Wrapper.Client#CLIENT Client
Client:Destroy() Client:Destroy()
Client:SetState( self, "Speeding", false ) Client:SetState( self, "Speeding", false )
Client:SetState( self, "Warnings", 0 ) Client:SetState( self, "Warnings", 0 )
@@ -363,7 +364,7 @@ function ATC_GROUND:_AirbaseMonitor()
Client:SetState( self, "OffRunwayWarnings", OffRunwayWarnings + 1 ) Client:SetState( self, "OffRunwayWarnings", OffRunwayWarnings + 1 )
else else
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll() MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
--- @param Wrapper.Client#CLIENT Client -- @param Wrapper.Client#CLIENT Client
Client:Destroy() Client:Destroy()
Client:SetState( self, "IsOffRunway", false ) Client:SetState( self, "IsOffRunway", false )
Client:SetState( self, "OffRunwayWarnings", 0 ) Client:SetState( self, "OffRunwayWarnings", 0 )
@@ -424,13 +425,20 @@ ATC_GROUND_UNIVERSAL = {
--- Creates a new ATC\_GROUND\_UNIVERSAL object. This works on any map. --- Creates a new ATC\_GROUND\_UNIVERSAL object. This works on any map.
-- @param #ATC_GROUND_UNIVERSAL self -- @param #ATC_GROUND_UNIVERSAL self
-- @param AirbaseList (Optional) A table of Airbase Names. -- @param AirbaseList A table of Airbase Names. Leave empty to cover **all** airbases of the map.
-- @return #ATC_GROUND_UNIVERSAL self -- @return #ATC_GROUND_UNIVERSAL self
-- @usage
-- -- define monitoring for one airbase
-- local atc=ATC_GROUND_UNIVERSAL:New({AIRBASE.Syria.Gecitkale})
-- -- set kick speed
-- atc:SetKickSpeed(UTILS.KnotsToMps(20))
-- -- start monitoring evey 10 secs
-- atc:Start(10)
function ATC_GROUND_UNIVERSAL:New(AirbaseList) function ATC_GROUND_UNIVERSAL:New(AirbaseList)
-- Inherits from BASE -- Inherits from BASE
local self = BASE:Inherit( self, BASE:New() ) -- #ATC_GROUND local self = BASE:Inherit( self, BASE:New() ) -- #ATC_GROUND
self:E( { self.ClassName } ) self:T( { self.ClassName } )
self.Airbases = {} self.Airbases = {}
@@ -440,6 +448,13 @@ function ATC_GROUND_UNIVERSAL:New(AirbaseList)
self.AirbaseList = AirbaseList self.AirbaseList = AirbaseList
if not self.AirbaseList then
self.AirbaseList = {}
for _name,_ in pairs(_DATABASE.AIRBASES) do
self.AirbaseList[_name]=_name
end
end
self.SetClient = SET_CLIENT:New():FilterCategories( "plane" ):FilterStart() self.SetClient = SET_CLIENT:New():FilterCategories( "plane" ):FilterStart()
@@ -460,8 +475,9 @@ function ATC_GROUND_UNIVERSAL:New(AirbaseList)
self.Airbases[AirbaseName].Monitor = true self.Airbases[AirbaseName].Monitor = true
end end
self.SetClient:ForEachClient( self.SetClient:ForEachClient(
--- @param Wrapper.Client#CLIENT Client -- @param Wrapper.Client#CLIENT Client
function( Client ) function( Client )
Client:SetState( self, "Speeding", false ) Client:SetState( self, "Speeding", false )
Client:SetState( self, "Warnings", 0) Client:SetState( self, "Warnings", 0)
@@ -679,9 +695,10 @@ end
-- @param #ATC_GROUND_UNIVERSAL self -- @param #ATC_GROUND_UNIVERSAL self
-- @return #ATC_GROUND_UNIVERSAL self -- @return #ATC_GROUND_UNIVERSAL self
function ATC_GROUND_UNIVERSAL:_AirbaseMonitor() function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
self:I("_AirbaseMonitor")
self.SetClient:ForEachClient( self.SetClient:ForEachClient(
--- @param Wrapper.Client#CLIENT Client --- Nameless function
-- @param Wrapper.Client#CLIENT Client
function( Client ) function( Client )
if Client:IsAlive() then if Client:IsAlive() then
@@ -689,7 +706,7 @@ function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
local IsOnGround = Client:InAir() == false local IsOnGround = Client:InAir() == false
for AirbaseID, AirbaseMeta in pairs( self.Airbases ) do for AirbaseID, AirbaseMeta in pairs( self.Airbases ) do
self:E( AirbaseID, AirbaseMeta.KickSpeed ) self:T( AirbaseID, AirbaseMeta.KickSpeed )
if AirbaseMeta.Monitor == true and Client:IsInZone( AirbaseMeta.ZoneBoundary ) then if AirbaseMeta.Monitor == true and Client:IsInZone( AirbaseMeta.ZoneBoundary ) then
@@ -706,7 +723,7 @@ function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
if IsOnGround then if IsOnGround then
local Taxi = Client:GetState( self, "Taxi" ) local Taxi = Client:GetState( self, "Taxi" )
self:E( Taxi ) self:T( Taxi )
if Taxi == false then if Taxi == false then
local Velocity = VELOCITY:New( AirbaseMeta.KickSpeed or self.KickSpeed ) local Velocity = VELOCITY:New( AirbaseMeta.KickSpeed or self.KickSpeed )
Client:Message( "Welcome to " .. AirbaseID .. ". The maximum taxiing speed is " .. Client:Message( "Welcome to " .. AirbaseID .. ". The maximum taxiing speed is " ..
@@ -766,7 +783,7 @@ function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
Client:SetState( self, "Warnings", SpeedingWarnings + 1 ) Client:SetState( self, "Warnings", SpeedingWarnings + 1 )
else else
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll() MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
--- @param Wrapper.Client#CLIENT Client -- @param Wrapper.Client#CLIENT Client
Client:Destroy() Client:Destroy()
Client:SetState( self, "Speeding", false ) Client:SetState( self, "Speeding", false )
Client:SetState( self, "Warnings", 0 ) Client:SetState( self, "Warnings", 0 )
@@ -798,7 +815,7 @@ function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
Client:SetState( self, "OffRunwayWarnings", OffRunwayWarnings + 1 ) Client:SetState( self, "OffRunwayWarnings", OffRunwayWarnings + 1 )
else else
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll() MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
--- @param Wrapper.Client#CLIENT Client -- @param Wrapper.Client#CLIENT Client
Client:Destroy() Client:Destroy()
Client:SetState( self, "IsOffRunway", false ) Client:SetState( self, "IsOffRunway", false )
Client:SetState( self, "OffRunwayWarnings", 0 ) Client:SetState( self, "OffRunwayWarnings", 0 )
@@ -838,15 +855,16 @@ end
--- Start SCHEDULER for ATC_GROUND_UNIVERSAL object. --- Start SCHEDULER for ATC_GROUND_UNIVERSAL object.
-- @param #ATC_GROUND_UNIVERSAL self -- @param #ATC_GROUND_UNIVERSAL self
-- @param RepeatScanSeconds Time in second for defining occurency of alerts. -- @param RepeatScanSeconds Time in second for defining schedule of alerts.
-- @return #ATC_GROUND_UNIVERSAL self -- @return #ATC_GROUND_UNIVERSAL self
function ATC_GROUND_UNIVERSAL:Start( RepeatScanSeconds ) function ATC_GROUND_UNIVERSAL:Start( RepeatScanSeconds )
RepeatScanSeconds = RepeatScanSeconds or 0.05 RepeatScanSeconds = RepeatScanSeconds or 0.05
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, 2, RepeatScanSeconds ) self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, RepeatScanSeconds )
return self return self
end end
--- @type ATC_GROUND_CAUCASUS ---
-- @type ATC_GROUND_CAUCASUS
-- @extends #ATC_GROUND -- @extends #ATC_GROUND
--- # ATC\_GROUND\_CAUCASUS, extends @{#ATC_GROUND_UNIVERSAL} --- # ATC\_GROUND\_CAUCASUS, extends @{#ATC_GROUND_UNIVERSAL}
@@ -981,12 +999,12 @@ end
-- @return nothing -- @return nothing
function ATC_GROUND_CAUCASUS:Start( RepeatScanSeconds ) function ATC_GROUND_CAUCASUS:Start( RepeatScanSeconds )
RepeatScanSeconds = RepeatScanSeconds or 0.05 RepeatScanSeconds = RepeatScanSeconds or 0.05
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, 2, RepeatScanSeconds ) self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, RepeatScanSeconds )
end end
---
--- @type ATC_GROUND_NEVADA -- @type ATC_GROUND_NEVADA
-- @extends #ATC_GROUND -- @extends #ATC_GROUND
@@ -1120,11 +1138,11 @@ end
-- @return nothing -- @return nothing
function ATC_GROUND_NEVADA:Start( RepeatScanSeconds ) function ATC_GROUND_NEVADA:Start( RepeatScanSeconds )
RepeatScanSeconds = RepeatScanSeconds or 0.05 RepeatScanSeconds = RepeatScanSeconds or 0.05
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, 2, RepeatScanSeconds ) self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, RepeatScanSeconds )
end end
---
--- @type ATC_GROUND_NORMANDY -- @type ATC_GROUND_NORMANDY
-- @extends #ATC_GROUND -- @extends #ATC_GROUND
@@ -1277,10 +1295,11 @@ end
-- @return nothing -- @return nothing
function ATC_GROUND_NORMANDY:Start( RepeatScanSeconds ) function ATC_GROUND_NORMANDY:Start( RepeatScanSeconds )
RepeatScanSeconds = RepeatScanSeconds or 0.05 RepeatScanSeconds = RepeatScanSeconds or 0.05
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, 2, RepeatScanSeconds ) self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, RepeatScanSeconds )
end end
--- @type ATC_GROUND_PERSIANGULF ---
-- @type ATC_GROUND_PERSIANGULF
-- @extends #ATC_GROUND -- @extends #ATC_GROUND
@@ -1419,11 +1438,11 @@ end
-- @return nothing -- @return nothing
function ATC_GROUND_PERSIANGULF:Start( RepeatScanSeconds ) function ATC_GROUND_PERSIANGULF:Start( RepeatScanSeconds )
RepeatScanSeconds = RepeatScanSeconds or 0.05 RepeatScanSeconds = RepeatScanSeconds or 0.05
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, 2, RepeatScanSeconds ) self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, RepeatScanSeconds )
end end
--- @type ATC_GROUND_MARIANAISLANDS -- @type ATC_GROUND_MARIANAISLANDS
-- @extends #ATC_GROUND -- @extends #ATC_GROUND
@@ -1517,7 +1536,7 @@ end
-- * @{#ATC_GROUND.SetMaximumKickSpeedKmph}(): Set the maximum speed allowed at an airbase in kilometers per hour. -- * @{#ATC_GROUND.SetMaximumKickSpeedKmph}(): Set the maximum speed allowed at an airbase in kilometers per hour.
-- * @{#ATC_GROUND.SetMaximumKickSpeedMiph}(): Set the maximum speed allowed at an airbase in miles per hour. -- * @{#ATC_GROUND.SetMaximumKickSpeedMiph}(): Set the maximum speed allowed at an airbase in miles per hour.
-- --
---- @field #ATC_GROUND_MARIANAISLANDS -- @field #ATC_GROUND_MARIANAISLANDS
ATC_GROUND_MARIANAISLANDS = { ATC_GROUND_MARIANAISLANDS = {
ClassName = "ATC_GROUND_MARIANAISLANDS", ClassName = "ATC_GROUND_MARIANAISLANDS",
} }
@@ -1529,7 +1548,7 @@ ATC_GROUND_MARIANAISLANDS = {
function ATC_GROUND_MARIANAISLANDS:New( AirbaseNames ) function ATC_GROUND_MARIANAISLANDS:New( AirbaseNames )
-- Inherits from BASE -- Inherits from BASE
local self = BASE:Inherit( self, ATC_GROUND_UNIVERSAL:New( self.Airbases, AirbaseNames ) ) local self = BASE:Inherit( self, ATC_GROUND_UNIVERSAL:New( AirbaseNames ) )
self:SetKickSpeedKmph( 50 ) self:SetKickSpeedKmph( 50 )
self:SetMaximumKickSpeedKmph( 150 ) self:SetMaximumKickSpeedKmph( 150 )
@@ -1543,5 +1562,5 @@ end
-- @return nothing -- @return nothing
function ATC_GROUND_MARIANAISLANDS:Start( RepeatScanSeconds ) function ATC_GROUND_MARIANAISLANDS:Start( RepeatScanSeconds )
RepeatScanSeconds = RepeatScanSeconds or 0.05 RepeatScanSeconds = RepeatScanSeconds or 0.05
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, 2, RepeatScanSeconds ) self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, RepeatScanSeconds )
end end

View File

@@ -25,9 +25,9 @@
-- --
-- === -- ===
-- --
-- ### Author: **[funkyfranky](https://forums.eagle.ru/member.php?u=115026)** -- ### Author: **funkyfranky**
-- --
-- ### Contributions: [FlightControl](https://forums.eagle.ru/member.php?u=89536) -- ### Contributions: FlightControl
-- --
-- ==== -- ====
-- @module Functional.Artillery -- @module Functional.Artillery
@@ -103,6 +103,7 @@
-- @field #number coalition The coalition of the arty group. -- @field #number coalition The coalition of the arty group.
-- @field #boolean respawnafterdeath Respawn arty group after all units are dead. -- @field #boolean respawnafterdeath Respawn arty group after all units are dead.
-- @field #number respawndelay Respawn delay in seconds. -- @field #number respawndelay Respawn delay in seconds.
-- @field #number dtTrack Time interval in seconds for weapon tracking.
-- @extends Core.Fsm#FSM_CONTROLLABLE -- @extends Core.Fsm#FSM_CONTROLLABLE
--- Enables mission designers easily to assign targets for artillery units. Since the implementation is based on a Finite State Model (FSM), the mission designer can --- Enables mission designers easily to assign targets for artillery units. Since the implementation is based on a Finite State Model (FSM), the mission designer can
@@ -290,14 +291,14 @@
-- ### Illumination Shells -- ### Illumination Shells
-- --
-- ARTY groups that possess shells can fire shells with illumination bombs. First, the group needs to be equipped with this weapon. This is done by the -- ARTY groups that possess shells can fire shells with illumination bombs. First, the group needs to be equipped with this weapon. This is done by the
-- function @{ARTY.SetIlluminationShells}(*n*, *power*), where *n* is the number of shells the group has available and *power* the illumination power in mega candela (mcd). -- function @{#ARTY.SetIlluminationShells}(*n*, *power*), where *n* is the number of shells the group has available and *power* the illumination power in mega candela (mcd).
-- --
-- In order to execute an engagement with illumination shells one has to use the weapon type *ARTY.WeaponType.IlluminationShells* in the -- In order to execute an engagement with illumination shells one has to use the weapon type *ARTY.WeaponType.IlluminationShells* in the
-- @{#ARTY.AssignTargetCoord}() function. -- @{#ARTY.AssignTargetCoord}() function.
-- --
-- In the simulation, the explosive shell that is fired is destroyed once it gets close to the target point but before it can actually impact. -- In the simulation, the explosive shell that is fired is destroyed once it gets close to the target point but before it can actually impact.
-- At this position an illumination bomb is triggered at a random altitude between 500 and 1000 meters. This interval can be set by the function -- At this position an illumination bomb is triggered at a random altitude between 500 and 1000 meters. This interval can be set by the function
-- @{ARTY.SetIlluminationMinMaxAlt}(*minalt*, *maxalt*). -- @{#ARTY.SetIlluminationMinMaxAlt}(*minalt*, *maxalt*).
-- --
-- ### Smoke Shells -- ### Smoke Shells
-- --
@@ -693,7 +694,7 @@ ARTY.db={
--- Arty script version. --- Arty script version.
-- @field #string version -- @field #string version
ARTY.version="1.2.0" ARTY.version="1.3.0"
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -801,6 +802,9 @@ function ARTY:New(group, alias)
else else
self.ismobile=false self.ismobile=false
end end
-- Set track time interval.
self.dtTrack=0.2
-- Set speed to 0.7 of maximum. -- Set speed to 0.7 of maximum.
self.Speed=self.SpeedMax * 0.7 self.Speed=self.SpeedMax * 0.7
@@ -1497,6 +1501,15 @@ function ARTY:SetStatusInterval(interval)
return self return self
end end
--- Set time interval for weapon tracking.
-- @param #ARTY self
-- @param #number interval Time interval in seconds. Default 0.2 seconds.
-- @return self
function ARTY:SetTrackInterval(interval)
self.dtTrack=interval or 0.2
return self
end
--- Set time how it is waited a unit the first shot event happens. If no shot is fired after this time, the task to fire is aborted and the target removed. --- Set time how it is waited a unit the first shot event happens. If no shot is fired after this time, the task to fire is aborted and the target removed.
-- @param #ARTY self -- @param #ARTY self
-- @param #number waittime Time in seconds. Default 300 seconds. -- @param #number waittime Time in seconds. Default 300 seconds.
@@ -2129,6 +2142,95 @@ end
-- Event Handling -- Event Handling
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Function called during tracking of weapon.
-- @param Wrapper.Weapon#WEAPON weapon Weapon object.
-- @param #ARTY self ARTY object.
-- @param #ARTY.Target target Target of the weapon.
function ARTY._FuncTrack(weapon, self, target)
-- Coordinate and distance to target.
local _coord=weapon.coordinate
local _dist=_coord:Get2DDistance(target.coord)
local _destroyweapon=false
-- Debug
self:T3(self.lid..string.format("ARTY %s weapon to target dist = %d m", self.groupname,_dist))
if target.weapontype==ARTY.WeaponType.IlluminationShells then
-- Check if within distace.
if _dist<target.radius then
-- Get random coordinate within certain radius of the target.
local _cr=target.coord:GetRandomCoordinateInRadius(target.radius)
-- Get random altitude over target.
local _alt=_cr:GetLandHeight()+math.random(self.illuMinalt, self.illuMaxalt)
-- Adjust explosion height of coordinate.
local _ci=COORDINATE:New(_cr.x,_alt,_cr.z)
-- Create illumination flare.
_ci:IlluminationBomb(self.illuPower)
-- Destroy actual shell.
_destroyweapon=true
end
elseif target.weapontype==ARTY.WeaponType.SmokeShells then
if _dist<target.radius then
-- Get random coordinate within a certain radius.
local _cr=_coord:GetRandomCoordinateInRadius(_data.target.radius)
-- Fire smoke at this coordinate.
_cr:Smoke(self.smokeColor)
-- Destroy actual shell.
_destroyweapon=true
end
end
if _destroyweapon then
self:T2(self.lid..string.format("ARTY %s destroying shell, stopping timer.", self.groupname))
-- Destroy weapon and stop timer.
weapon:Destroy()
-- No more tracking.
weapon.tracking=false
end
end
--- Function called after impact of weapon.
-- @param Wrapper.Weapon#WEAPON weapon Weapon object.
-- @param #ARTY self ARTY object.
-- @param #ARTY.Target target Target of the weapon.
function ARTY._FuncImpact(weapon, self, target)
-- Debug info.
self:I(self.lid..string.format("ARTY %s weapon NOT ALIVE any more.", self.groupname))
-- Get impact coordinate.
local _impactcoord=weapon:GetImpactCoordinate()
-- Create a "nuclear" explosion and blast at the impact point.
if target.weapontype==ARTY.WeaponType.TacticalNukes then
self:T(self.lid..string.format("ARTY %s triggering nuclear explosion in one second.", self.groupname))
--SCHEDULER:New(nil, ARTY._NuclearBlast, {self,_impactcoord}, 1.0)
self:ScheduleOnce(1.0, ARTY._NuclearBlast, self, _impactcoord)
end
end
--- Eventhandler for shot event. --- Eventhandler for shot event.
-- @param #ARTY self -- @param #ARTY self
-- @param Core.Event#EVENTDATA EventData -- @param Core.Event#EVENTDATA EventData
@@ -2162,128 +2264,32 @@ function ARTY:OnEventShot(EventData)
self:T(self.lid..text) self:T(self.lid..text)
MESSAGE:New(text, 5):Clear():ToAllIf(self.report or self.Debug) MESSAGE:New(text, 5):Clear():ToAllIf(self.report or self.Debug)
-- Last known position of the weapon fired.
local _lastpos={x=0, y=0, z=0}
--- Track the position of the weapon if it is supposed to model a tac nuke, illumination or smoke shell.
-- @param #table _weapon
local function _TrackWeapon(_data)
-- When the pcall status returns false the weapon has hit.
local _weaponalive,_currpos = pcall(
function()
return _data.weapon:getPoint()
end)
-- Debug
self:T3(self.lid..string.format("ARTY %s: Weapon still in air: %s", self.groupname, tostring(_weaponalive)))
-- Destroy weapon before impact.
local _destroyweapon=false
if _weaponalive then
-- Update last position.
_lastpos={x=_currpos.x, y=_currpos.y, z=_currpos.z}
-- Coordinate and distance to target.
local _coord=COORDINATE:NewFromVec3(_lastpos)
local _dist=_coord:Get2DDistance(_data.target.coord)
-- Debug
self:T3(self.lid..string.format("ARTY %s weapon to target dist = %d m", self.groupname,_dist))
if _data.target.weapontype==ARTY.WeaponType.IlluminationShells then
-- Check if within distace.
if _dist<_data.target.radius then
-- Get random coordinate within certain radius of the target.
local _cr=_data.target.coord:GetRandomCoordinateInRadius(_data.target.radius)
-- Get random altitude over target.
local _alt=_cr:GetLandHeight()+math.random(self.illuMinalt, self.illuMaxalt)
-- Adjust explosion height of coordinate.
local _ci=COORDINATE:New(_cr.x,_alt,_cr.z)
-- Create illumination flare.
_ci:IlluminationBomb(self.illuPower)
-- Destroy actual shell.
_destroyweapon=true
end
elseif _data.target.weapontype==ARTY.WeaponType.SmokeShells then
if _dist<_data.target.radius then
-- Get random coordinate within a certain radius.
local _cr=_coord:GetRandomCoordinateInRadius(_data.target.radius)
-- Fire smoke at this coordinate.
_cr:Smoke(self.smokeColor)
-- Destroy actual shell.
_destroyweapon=true
end
end
if _destroyweapon then
self:T2(self.lid..string.format("ARTY %s destroying shell, stopping timer.", self.groupname))
-- Destroy weapon and stop timer.
_data.weapon:destroy()
return nil
else
-- TODO: Make dt input parameter.
local dt=0.02
self:T3(self.lid..string.format("ARTY %s tracking weapon again in %.3f seconds", self.groupname, dt))
-- Check again in 0.05 seconds.
return timer.getTime() + dt
end
else
-- Get impact coordinate.
local _impactcoord=COORDINATE:NewFromVec3(_lastpos)
self:I(self.lid..string.format("ARTY %s weapon NOT ALIVE any more.", self.groupname))
-- Create a "nuclear" explosion and blast at the impact point.
if _data.target.weapontype==ARTY.WeaponType.TacticalNukes then
self:T(self.lid..string.format("ARTY %s triggering nuclear explosion in one second.", self.groupname))
SCHEDULER:New(nil, ARTY._NuclearBlast, {self,_impactcoord}, 1.0)
end
-- Stop timer.
return nil
end
end
-- Start track the shell if we want to model a tactical nuke. -- Start track the shell if we want to model a tactical nuke.
local _tracknuke = self.currentTarget.weapontype==ARTY.WeaponType.TacticalNukes and self.Nukes>0 local _tracknuke = self.currentTarget.weapontype==ARTY.WeaponType.TacticalNukes and self.Nukes>0
local _trackillu = self.currentTarget.weapontype==ARTY.WeaponType.IlluminationShells and self.Nillu>0 local _trackillu = self.currentTarget.weapontype==ARTY.WeaponType.IlluminationShells and self.Nillu>0
local _tracksmoke = self.currentTarget.weapontype==ARTY.WeaponType.SmokeShells and self.Nsmoke>0 local _tracksmoke = self.currentTarget.weapontype==ARTY.WeaponType.SmokeShells and self.Nsmoke>0
if _tracknuke or _trackillu or _tracksmoke then if _tracknuke or _trackillu or _tracksmoke then
self:T(self.lid..string.format("ARTY %s: Tracking of weapon starts in two seconds.", self.groupname)) -- Debug info.
self:T(self.lid..string.format("ARTY %s: Tracking of weapon starts in two seconds.", self.groupname))
local _peter={}
_peter.weapon=EventData.weapon -- Create a weapon object.
_peter.target=UTILS.DeepCopy(self.currentTarget) local weapon=WEAPON:New(EventData.weapon)
timer.scheduleFunction(_TrackWeapon, _peter, timer.getTime() + 2.0) -- Set time step for tracking.
weapon:SetTimeStepTrack(self.dtTrack)
-- Copy target. We need a copy because it might already be overwritten with the next target during flight of weapon.
local target=UTILS.DeepCopy(self.currentTarget)
-- Set callback functions.
weapon:SetFuncTrack(ARTY._FuncTrack, self, target)
weapon:SetFuncImpact(ARTY._FuncImpact, self, target)
-- Start tracking in 2 sec (arty ammo should fly a bit).
weapon:StartTrack(2)
end end
-- Get current ammo. -- Get current ammo.
@@ -3540,9 +3546,7 @@ end
-- @param #string To To state. -- @param #string To To state.
function ARTY:onafterRespawn(Controllable, From, Event, To) function ARTY:onafterRespawn(Controllable, From, Event, To)
self:_EventFromTo("onafterRespawn", Event, From, To) self:_EventFromTo("onafterRespawn", Event, From, To)
self:I("Respawning arty group")
env.info("FF Respawning arty group")
local group=self.Controllable --Wrapper.Group#GROUP local group=self.Controllable --Wrapper.Group#GROUP
-- Respawn group. -- Respawn group.
@@ -3931,9 +3935,10 @@ function ARTY:GetAmmo(display)
return nammo, nshells, nrockets, nmissiles return nammo, nshells, nrockets, nmissiles
end end
for _,unit in pairs(units) do for _,_unit in pairs(units) do
local unit=_unit --Wrapper.Unit#UNIT
if unit and unit:IsAlive() then if unit then
-- Output. -- Output.
local text=string.format("ARTY group %s - unit %s:\n", self.groupname, unit:GetName()) local text=string.format("ARTY group %s - unit %s:\n", self.groupname, unit:GetName())

View File

@@ -14,7 +14,7 @@
-- --
-- ## Missions: -- ## Missions:
-- --
-- [CLA - CleanUp Airbase](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/CLA%20-%20CleanUp%20Airbase) -- [CLA - CleanUp Airbase](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/CleanUp)
-- --
-- === -- ===
-- --

View File

@@ -15,10 +15,12 @@
-- --
-- === -- ===
-- --
-- ## Missions: -- ## Additional Material:
-- --
-- [DES - Designation](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/DES%20-%20Designation) -- * **Demo Missions:** [GitHub](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/Designate)
-- -- * **YouTube videos:** None
-- * **Guides:** None
--
-- === -- ===
-- --
-- Targets detected by recce will be communicated to a group of attacking players. -- Targets detected by recce will be communicated to a group of attacking players.
@@ -167,9 +169,9 @@
-- --
-- ### Contributions: -- ### Contributions:
-- --
-- * [**Ciribob**](https://forums.eagle.ru/member.php?u=112175): Showing the way how to lase targets + how laser codes work!!! Explained the autolase script. -- * **Ciribob**: Showing the way how to lase targets + how laser codes work!!! Explained the autolase script.
-- * [**EasyEB**](https://forums.eagle.ru/member.php?u=112055): Ideas and Beta Testing -- * **EasyEB**: Ideas and Beta Testing
-- * [**Wingthor**](https://forums.eagle.ru/member.php?u=123698): Beta Testing -- * **Wingthor**: Beta Testing
-- --
-- ### Authors: -- ### Authors:
-- --

View File

@@ -15,7 +15,7 @@
-- --
-- ## Missions: -- ## Missions:
-- --
-- [DET - Detection](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/DET%20-%20Detection) -- [DET - Detection](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/Functional/Detection)
-- --
-- === -- ===
-- --
@@ -38,8 +38,9 @@
-- @image Detection.JPG -- @image Detection.JPG
do -- DETECTION_BASE do -- DETECTION_BASE
--- @type DETECTION_BASE ---
-- @type DETECTION_BASE
-- @field Core.Set#SET_GROUP DetectionSetGroup The @{Core.Set} of GROUPs in the Forward Air Controller role. -- @field Core.Set#SET_GROUP DetectionSetGroup The @{Core.Set} of GROUPs in the Forward Air Controller role.
-- @field DCS#Distance DetectionRange The range till which targets are accepted to be detected. -- @field DCS#Distance DetectionRange The range till which targets are accepted to be detected.
-- @field #DETECTION_BASE.DetectedObjects DetectedObjects The list of detected objects. -- @field #DETECTION_BASE.DetectedObjects DetectedObjects The list of detected objects.
@@ -91,6 +92,11 @@ do -- DETECTION_BASE
-- --
-- DetectionObject:FilterCategories( { Unit.Category.AIRPLANE, Unit.Category.HELICOPTER } ) -- DetectionObject:FilterCategories( { Unit.Category.AIRPLANE, Unit.Category.HELICOPTER } )
-- --
--
-- ## Radar Blur - use to make the radar less exact, e.g. for WWII scenarios
--
-- * @{#DETECTION_BASE.SetRadarBlur}(): Set the radar blur to be used.
--
-- ## **DETECTION_ derived classes** group the detected units into a **DetectedItems[]** list -- ## **DETECTION_ derived classes** group the detected units into a **DetectedItems[]** list
-- --
-- DETECTION_BASE derived classes build a list called DetectedItems[], which is essentially a first later -- DETECTION_BASE derived classes build a list called DetectedItems[], which is essentially a first later
@@ -268,11 +274,13 @@ do -- DETECTION_BASE
DetectedItems = {}, DetectedItems = {},
DetectedItemsByIndex = {}, DetectedItemsByIndex = {},
} }
--- @type DETECTION_BASE.DetectedObjects ---
-- @type DETECTION_BASE.DetectedObjects
-- @list <#DETECTION_BASE.DetectedObject> -- @list <#DETECTION_BASE.DetectedObject>
--- @type DETECTION_BASE.DetectedObject ---
-- @type DETECTION_BASE.DetectedObject
-- @field #string Name -- @field #string Name
-- @field #boolean IsVisible -- @field #boolean IsVisible
-- @field #boolean KnowType -- @field #boolean KnowType
@@ -283,8 +291,9 @@ do -- DETECTION_BASE
-- @field #number LastTime -- @field #number LastTime
-- @field #boolean LastPos -- @field #boolean LastPos
-- @field #number LastVelocity -- @field #number LastVelocity
--- @type DETECTION_BASE.DetectedItems ---
-- @type DETECTION_BASE.DetectedItems
-- @list <#DETECTION_BASE.DetectedItem> -- @list <#DETECTION_BASE.DetectedItem>
--- Detected item data structure. --- Detected item data structure.
@@ -474,7 +483,7 @@ do -- DETECTION_BASE
-- @param #string From The From State string. -- @param #string From The From State string.
-- @param #string Event The Event string. -- @param #string Event The Event string.
-- @param #string To The To State string. -- @param #string To The To State string.
-- @param #table DetectedItem The DetectedItem. -- @param #DetectedItem DetectedItem The DetectedItem data structure.
self:AddTransition( "*", "Stop", "Stopped" ) self:AddTransition( "*", "Stop", "Stopped" )
@@ -522,7 +531,7 @@ do -- DETECTION_BASE
do -- State Transition Handling do -- State Transition Handling
--- @param #DETECTION_BASE self -- @param #DETECTION_BASE self
-- @param #string From The From State string. -- @param #string From The From State string.
-- @param #string Event The Event string. -- @param #string Event The Event string.
-- @param #string To The To State string. -- @param #string To The To State string.
@@ -530,7 +539,7 @@ do -- DETECTION_BASE
self:__Detect( 1 ) self:__Detect( 1 )
end end
--- @param #DETECTION_BASE self -- @param #DETECTION_BASE self
-- @param #string From The From State string. -- @param #string From The From State string.
-- @param #string Event The Event string. -- @param #string Event The Event string.
-- @param #string To The To State string. -- @param #string To The To State string.
@@ -570,7 +579,7 @@ do -- DETECTION_BASE
end end
--- @param #DETECTION_BASE self -- @param #DETECTION_BASE self
-- @param #number The amount of alive recce. -- @param #number The amount of alive recce.
function DETECTION_BASE:CountAliveRecce() function DETECTION_BASE:CountAliveRecce()
@@ -578,7 +587,7 @@ do -- DETECTION_BASE
end end
--- @param #DETECTION_BASE self -- @param #DETECTION_BASE self
function DETECTION_BASE:ForEachAliveRecce( IteratorFunction, ... ) function DETECTION_BASE:ForEachAliveRecce( IteratorFunction, ... )
self:F2( arg ) self:F2( arg )
@@ -587,7 +596,7 @@ do -- DETECTION_BASE
return self return self
end end
--- @param #DETECTION_BASE self -- @param #DETECTION_BASE self
-- @param #string From The From State string. -- @param #string From The From State string.
-- @param #string Event The Event string. -- @param #string Event The Event string.
-- @param #string To The To State string. -- @param #string To The To State string.
@@ -712,6 +721,31 @@ do -- DETECTION_BASE
end end
end end
-- Calculate radar blur probability
if self.RadarBlur then
MESSAGE:New("Radar Blur",10):ToLogIf(self.debug):ToAllIf(self.verbose)
local minheight = self.RadarBlurMinHeight or 250 -- meters
local thresheight = self.RadarBlurThresHeight or 90 -- 10% chance to find a low flying group
local thresblur = self.RadarBlurThresBlur or 85 -- 25% chance to escape the radar overall
local dist = math.floor(Distance)
if dist <= self.RadarBlurClosing then
thresheight = (((dist*dist)/self.RadarBlurClosingSquare)*thresheight)
thresblur = (((dist*dist)/self.RadarBlurClosingSquare)*thresblur)
end
local fheight = math.floor(math.random(1,10000)/100)
local fblur = math.floor(math.random(1,10000)/100)
local unit = UNIT:FindByName(DetectedObjectName)
if unit and unit:IsAlive() then
local AGL = unit:GetAltitude(true)
MESSAGE:New("Unit "..DetectedObjectName.." is at "..math.floor(AGL).."m. Distance "..math.floor(Distance).."km.",10):ToLogIf(self.debug):ToAllIf(self.verbose)
MESSAGE:New(string.format("fheight = %d/%d | fblur = %d/%d",fheight,thresheight,fblur,thresblur),10):ToLogIf(self.debug):ToAllIf(self.verbose)
if fblur > thresblur then DetectionAccepted = false end
if AGL <= minheight and fheight < thresheight then DetectionAccepted = false end
MESSAGE:New("Detection Accepted = "..tostring(DetectionAccepted),10):ToLogIf(self.debug):ToAllIf(self.verbose)
end
end
-- Calculate additional probabilities -- Calculate additional probabilities
if not self.DetectedObjects[DetectedObjectName] and TargetIsVisible and self.DistanceProbability then if not self.DetectedObjects[DetectedObjectName] and TargetIsVisible and self.DistanceProbability then
@@ -1011,7 +1045,24 @@ do -- DETECTION_BASE
return self return self
end end
--- Method to make the radar detection less accurate, e.g. for WWII scenarios.
-- @param #DETECTION_BASE self
-- @param #number minheight Minimum flight height to be detected, in meters AGL (above ground)
-- @param #number thresheight Threshold to escape the radar if flying below minheight, defaults to 90 (90% escape chance)
-- @param #number thresblur Threshold to be detected by the radar overall, defaults to 85 (85% chance to be found)
-- @param #number closing Closing-in in km - the limit of km from which on it becomes increasingly difficult to escape radar detection if flying towards the radar position. Should be about 1/3 of the radar detection radius in kilometers, defaults to 20.
-- @return #DETECTION_BASE self
function DETECTION_BASE:SetRadarBlur(minheight,thresheight,thresblur,closing)
self.RadarBlur = true
self.RadarBlurMinHeight = minheight or 250 -- meters
self.RadarBlurThresHeight = thresheight or 90 -- 10% chance to find a low flying group
self.RadarBlurThresBlur = thresblur or 85 -- 25% chance to escape the radar overall
self.RadarBlurClosing = closing or 20 -- 20km
self.RadarBlurClosingSquare = self.RadarBlurClosing * self.RadarBlurClosing
return self
end
end end
do do
@@ -1354,7 +1405,7 @@ do -- DETECTION_BASE
} }
} }
--- @param DCS#Unit FoundDCSUnit -- @param DCS#Unit FoundDCSUnit
-- @param Wrapper.Group#GROUP ReportGroup -- @param Wrapper.Group#GROUP ReportGroup
-- @param Core.Set#SET_GROUP ReportSetGroup -- @param Core.Set#SET_GROUP ReportSetGroup
local FindNearByFriendlies = function( FoundDCSUnit, ReportGroupData ) local FindNearByFriendlies = function( FoundDCSUnit, ReportGroupData )
@@ -1419,7 +1470,7 @@ do -- DETECTION_BASE
DetectedItem.PlayersNearBy = nil DetectedItem.PlayersNearBy = nil
_DATABASE:ForEachPlayer( _DATABASE:ForEachPlayer(
--- @param Wrapper.Unit#UNIT PlayerUnit -- @param Wrapper.Unit#UNIT PlayerUnit
function( PlayerUnitName ) function( PlayerUnitName )
local PlayerUnit = UNIT:FindByName( PlayerUnitName ) local PlayerUnit = UNIT:FindByName( PlayerUnitName )
@@ -1975,8 +2026,9 @@ do -- DETECTION_BASE
end end
do -- DETECTION_UNITS do -- DETECTION_UNITS
--- @type DETECTION_UNITS ---
-- @type DETECTION_UNITS
-- @field DCS#Distance DetectionRange The range till which targets are detected. -- @field DCS#Distance DetectionRange The range till which targets are detected.
-- @extends Functional.Detection#DETECTION_BASE -- @extends Functional.Detection#DETECTION_BASE
@@ -2231,8 +2283,9 @@ do -- DETECTION_UNITS
end end
do -- DETECTION_TYPES do -- DETECTION_TYPES
--- @type DETECTION_TYPES ---
-- @type DETECTION_TYPES
-- @extends Functional.Detection#DETECTION_BASE -- @extends Functional.Detection#DETECTION_BASE
--- Will detect units within the battle zone. --- Will detect units within the battle zone.
@@ -2354,6 +2407,7 @@ do -- DETECTION_TYPES
if not DetectedItem then if not DetectedItem then
DetectedItem = self:AddDetectedItem( "TYPE", DetectedTypeName ) DetectedItem = self:AddDetectedItem( "TYPE", DetectedTypeName )
DetectedItem.TypeName = DetectedTypeName DetectedItem.TypeName = DetectedTypeName
DetectedItem.Name = DetectedUnitName -- fix by @Nocke
end end
DetectedItem.Set:AddUnit( DetectedUnit ) DetectedItem.Set:AddUnit( DetectedUnit )
@@ -2433,8 +2487,9 @@ do -- DETECTION_TYPES
end end
do -- DETECTION_AREAS do -- DETECTION_AREAS
--- @type DETECTION_AREAS ---
-- @type DETECTION_AREAS
-- @field DCS#Distance DetectionZoneRange The range till which targets are grouped upon the first detected target. -- @field DCS#Distance DetectionZoneRange The range till which targets are grouped upon the first detected target.
-- @field #DETECTION_BASE.DetectedItems DetectedItems A list of areas containing the set of @{Wrapper.Unit}s, @{Core.Zone}s, the center @{Wrapper.Unit} within the zone, and ID of each area that was detected within a DetectionZoneRange. -- @field #DETECTION_BASE.DetectedItems DetectedItems A list of areas containing the set of @{Wrapper.Unit}s, @{Core.Zone}s, the center @{Wrapper.Unit} within the zone, and ID of each area that was detected within a DetectionZoneRange.
-- @extends Functional.Detection#DETECTION_BASE -- @extends Functional.Detection#DETECTION_BASE
@@ -2451,7 +2506,7 @@ do -- DETECTION_AREAS
-- --
-- Retrieve the DetectedItems[].Set with the method @{Functional.Detection#DETECTION_BASE.GetDetectedSet}(). A @{Core.Set#SET_UNIT} object will be returned. -- Retrieve the DetectedItems[].Set with the method @{Functional.Detection#DETECTION_BASE.GetDetectedSet}(). A @{Core.Set#SET_UNIT} object will be returned.
-- --
-- Retrieve the formed @{Zone@ZONE_UNIT}s as a result of the grouping the detected units within the DetectionZoneRange, use the method @{Functional.Detection#DETECTION_AREAS.GetDetectionZones}(). -- Retrieve the formed @{Core.Zone@ZONE_UNIT}s as a result of the grouping the detected units within the DetectionZoneRange, use the method @{Functional.Detection#DETECTION_AREAS.GetDetectionZones}().
-- To understand the amount of zones created, use the method @{Functional.Detection#DETECTION_AREAS.GetDetectionZoneCount}(). -- To understand the amount of zones created, use the method @{Functional.Detection#DETECTION_AREAS.GetDetectionZoneCount}().
-- If you want to obtain a specific zone from the DetectedZones, use the method @{Functional.Detection#DETECTION_AREAS.GetDetectionZoneByID}() with a given index. -- If you want to obtain a specific zone from the DetectedZones, use the method @{Functional.Detection#DETECTION_AREAS.GetDetectionZoneByID}() with a given index.
-- --
@@ -2478,14 +2533,14 @@ do -- DETECTION_AREAS
--- DETECTION_AREAS constructor. --- DETECTION_AREAS constructor.
-- @param #DETECTION_AREAS self -- @param #DETECTION_AREAS self
-- @param Core.Set#SET_GROUP DetectionSetGroup The @{Core.Set} of GROUPs in the Forward Air Controller role. -- @param Core.Set#SET_GROUP DetectionSetGroup The @{Core.Set} of GROUPs in the Forward Air Controller role.
-- @param DCS#Distance DetectionZoneRange The range till which targets are grouped upon the first detected target. -- @param #number DetectionZoneRange The range in meters within which targets are grouped upon the first detected target. Default 5000m.
-- @return #DETECTION_AREAS -- @return #DETECTION_AREAS
function DETECTION_AREAS:New( DetectionSetGroup, DetectionZoneRange ) function DETECTION_AREAS:New( DetectionSetGroup, DetectionZoneRange )
-- Inherits from DETECTION_BASE -- Inherits from DETECTION_BASE
local self = BASE:Inherit( self, DETECTION_BASE:New( DetectionSetGroup ) ) local self = BASE:Inherit( self, DETECTION_BASE:New( DetectionSetGroup ) )
self.DetectionZoneRange = DetectionZoneRange self.DetectionZoneRange = DetectionZoneRange or 5000
self._SmokeDetectedUnits = false self._SmokeDetectedUnits = false
self._FlareDetectedUnits = false self._FlareDetectedUnits = false
@@ -2960,7 +3015,7 @@ do -- DETECTION_AREAS
-- DetectedSet:Flush( self ) -- DetectedSet:Flush( self )
DetectedSet:ForEachUnit( --- @param Wrapper.Unit#UNIT DetectedUnit DetectedSet:ForEachUnit( -- @param Wrapper.Unit#UNIT DetectedUnit
function( DetectedUnit ) function( DetectedUnit )
if DetectedUnit:IsAlive() then if DetectedUnit:IsAlive() then
-- self:T( "Detected Set #" .. DetectedItem.ID .. ":" .. DetectedUnit:GetName() ) -- self:T( "Detected Set #" .. DetectedItem.ID .. ":" .. DetectedUnit:GetName() )
@@ -2988,4 +3043,3 @@ do -- DETECTION_AREAS
end end
end end

View File

@@ -21,7 +21,7 @@ do -- DETECTION_ZONES
-- --
-- Retrieve the DetectedItems[].Set with the method @{Functional.Detection#DETECTION_BASE.GetDetectedSet}(). A @{Core.Set#SET_UNIT} object will be returned. -- Retrieve the DetectedItems[].Set with the method @{Functional.Detection#DETECTION_BASE.GetDetectedSet}(). A @{Core.Set#SET_UNIT} object will be returned.
-- --
-- Retrieve the formed @{Zone@ZONE_UNIT}s as a result of the grouping the detected units within the DetectionZoneRange, use the method @{Functional.Detection#DETECTION_BASE.GetDetectionZones}(). -- Retrieve the formed @{Core.Zone#ZONE_UNIT}s as a result of the grouping the detected units within the DetectionZoneRange, use the method @{Functional.Detection#DETECTION_BASE.GetDetectionZones}().
-- To understand the amount of zones created, use the method @{Functional.Detection#DETECTION_BASE.GetDetectionZoneCount}(). -- To understand the amount of zones created, use the method @{Functional.Detection#DETECTION_BASE.GetDetectionZoneCount}().
-- If you want to obtain a specific zone from the DetectedZones, use the method @{Functional.Detection#DETECTION_BASE.GetDetectionZone}() with a given index. -- If you want to obtain a specific zone from the DetectedZones, use the method @{Functional.Detection#DETECTION_BASE.GetDetectionZone}() with a given index.
-- --

View File

@@ -16,11 +16,13 @@
-- * Escort tactical situation reporting. -- * Escort tactical situation reporting.
-- --
-- === -- ===
-- --
-- ## Missions: -- ## Additional Material:
-- --
-- [ESC - Escorting](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/ESC%20-%20Escorting) -- * **Demo Missions:** [GitHub](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/Escort)
-- -- * **YouTube videos:** None
-- * **Guides:** None
--
-- === -- ===
-- --
-- Allows you to interact with escorting AI on your flight and take the lead. -- Allows you to interact with escorting AI on your flight and take the lead.
@@ -108,8 +110,8 @@
-- @image Escorting.JPG -- @image Escorting.JPG
---
--- @type ESCORT -- @type ESCORT
-- @extends Core.Base#BASE -- @extends Core.Base#BASE
-- @field Wrapper.Client#CLIENT EscortClient -- @field Wrapper.Client#CLIENT EscortClient
-- @field Wrapper.Group#GROUP EscortGroup -- @field Wrapper.Group#GROUP EscortGroup
@@ -252,7 +254,7 @@ end
--- Set a Detection method for the EscortClient to be reported upon. --- Set a Detection method for the EscortClient to be reported upon.
-- Detection methods are based on the derived classes from DETECTION_BASE. -- Detection methods are based on the derived classes from DETECTION_BASE.
-- @param #ESCORT self -- @param #ESCORT self
-- @param Function.Detection#DETECTION_BASE Detection -- @param Functional.Detection#DETECTION_BASE Detection
function ESCORT:SetDetection( Detection ) function ESCORT:SetDetection( Detection )
self.Detection = Detection self.Detection = Detection
@@ -600,7 +602,7 @@ function ESCORT:MenuReportTargets( Seconds )
self.EscortMenuAttackNearbyTargets = MENU_GROUP:New( self.EscortClient:GetGroup(), "Attack targets", self.EscortMenu ) self.EscortMenuAttackNearbyTargets = MENU_GROUP:New( self.EscortClient:GetGroup(), "Attack targets", self.EscortMenu )
self.ReportTargetsScheduler = SCHEDULER:New( self, self._ReportTargetsScheduler, {}, 1, Seconds ) self.ReportTargetsScheduler, self.ReportTargetsSchedulerID = SCHEDULER:New( self, self._ReportTargetsScheduler, {}, 1, Seconds )
return self return self
end end
@@ -693,7 +695,7 @@ function ESCORT:MenuResumeMission()
end end
--- @param #MENUPARAM MenuParam -- @param #MENUPARAM MenuParam
function ESCORT:_HoldPosition( OrbitGroup, OrbitHeight, OrbitSeconds ) function ESCORT:_HoldPosition( OrbitGroup, OrbitHeight, OrbitSeconds )
local EscortGroup = self.EscortGroup local EscortGroup = self.EscortGroup
@@ -733,7 +735,7 @@ function ESCORT:_HoldPosition( OrbitGroup, OrbitHeight, OrbitSeconds )
end end
--- @param #MENUPARAM MenuParam -- @param #MENUPARAM MenuParam
function ESCORT:_JoinUpAndFollow( Distance ) function ESCORT:_JoinUpAndFollow( Distance )
local EscortGroup = self.EscortGroup local EscortGroup = self.EscortGroup
@@ -766,7 +768,7 @@ function ESCORT:JoinUpAndFollow( EscortGroup, EscortClient, Distance )
EscortGroup:MessageToClient( "Rejoining and Following at " .. Distance .. "!", 30, EscortClient ) EscortGroup:MessageToClient( "Rejoining and Following at " .. Distance .. "!", 30, EscortClient )
end end
--- @param #MENUPARAM MenuParam -- @param #MENUPARAM MenuParam
function ESCORT:_Flare( Color, Message ) function ESCORT:_Flare( Color, Message )
local EscortGroup = self.EscortGroup local EscortGroup = self.EscortGroup
@@ -776,7 +778,7 @@ function ESCORT:_Flare( Color, Message )
EscortGroup:MessageToClient( Message, 10, EscortClient ) EscortGroup:MessageToClient( Message, 10, EscortClient )
end end
--- @param #MENUPARAM MenuParam -- @param #MENUPARAM MenuParam
function ESCORT:_Smoke( Color, Message ) function ESCORT:_Smoke( Color, Message )
local EscortGroup = self.EscortGroup local EscortGroup = self.EscortGroup
@@ -787,7 +789,7 @@ function ESCORT:_Smoke( Color, Message )
end end
--- @param #MENUPARAM MenuParam -- @param #MENUPARAM MenuParam
function ESCORT:_ReportNearbyTargetsNow() function ESCORT:_ReportNearbyTargetsNow()
local EscortGroup = self.EscortGroup local EscortGroup = self.EscortGroup
@@ -809,12 +811,12 @@ function ESCORT:_SwitchReportNearbyTargets( ReportTargets )
self.ReportTargetsScheduler:Schedule( self, self._ReportTargetsScheduler, {}, 1, 30 ) self.ReportTargetsScheduler:Schedule( self, self._ReportTargetsScheduler, {}, 1, 30 )
end end
else else
routines.removeFunction( self.ReportTargetsScheduler ) self.ReportTargetsScheduler:Remove(self.ReportTargetsSchedulerID)
self.ReportTargetsScheduler = nil self.ReportTargetsScheduler = nil
end end
end end
--- @param #MENUPARAM MenuParam -- @param #MENUPARAM MenuParam
function ESCORT:_ScanTargets( ScanDuration ) function ESCORT:_ScanTargets( ScanDuration )
local EscortGroup = self.EscortGroup -- Wrapper.Group#GROUP local EscortGroup = self.EscortGroup -- Wrapper.Group#GROUP
@@ -844,7 +846,7 @@ function ESCORT:_ScanTargets( ScanDuration )
end end
--- @param Wrapper.Group#GROUP EscortGroup -- @param Wrapper.Group#GROUP EscortGroup
function _Resume( EscortGroup ) function _Resume( EscortGroup )
env.info( '_Resume' ) env.info( '_Resume' )
@@ -856,7 +858,7 @@ function _Resume( EscortGroup )
end end
--- @param #ESCORT self -- @param #ESCORT self
-- @param Functional.Detection#DETECTION_BASE.DetectedItem DetectedItem -- @param Functional.Detection#DETECTION_BASE.DetectedItem DetectedItem
function ESCORT:_AttackTarget( DetectedItem ) function ESCORT:_AttackTarget( DetectedItem )
@@ -877,7 +879,7 @@ function ESCORT:_AttackTarget( DetectedItem )
local Tasks = {} local Tasks = {}
DetectedSet:ForEachUnit( DetectedSet:ForEachUnit(
--- @param Wrapper.Unit#UNIT DetectedUnit -- @param Wrapper.Unit#UNIT DetectedUnit
function( DetectedUnit, Tasks ) function( DetectedUnit, Tasks )
if DetectedUnit:IsAlive() then if DetectedUnit:IsAlive() then
Tasks[#Tasks+1] = EscortGroup:TaskAttackUnit( DetectedUnit ) Tasks[#Tasks+1] = EscortGroup:TaskAttackUnit( DetectedUnit )
@@ -900,7 +902,7 @@ function ESCORT:_AttackTarget( DetectedItem )
local Tasks = {} local Tasks = {}
DetectedSet:ForEachUnit( DetectedSet:ForEachUnit(
--- @param Wrapper.Unit#UNIT DetectedUnit -- @param Wrapper.Unit#UNIT DetectedUnit
function( DetectedUnit, Tasks ) function( DetectedUnit, Tasks )
if DetectedUnit:IsAlive() then if DetectedUnit:IsAlive() then
Tasks[#Tasks+1] = EscortGroup:TaskFireAtPoint( DetectedUnit:GetVec2(), 50 ) Tasks[#Tasks+1] = EscortGroup:TaskFireAtPoint( DetectedUnit:GetVec2(), 50 )
@@ -921,7 +923,7 @@ function ESCORT:_AttackTarget( DetectedItem )
end end
--- ---
--- @param #ESCORT self -- @param #ESCORT self
-- @param Functional.Detection#DETECTION_BASE.DetectedItem DetectedItem -- @param Functional.Detection#DETECTION_BASE.DetectedItem DetectedItem
function ESCORT:_AssistTarget( EscortGroupAttack, DetectedItem ) function ESCORT:_AssistTarget( EscortGroupAttack, DetectedItem )
@@ -939,7 +941,7 @@ function ESCORT:_AssistTarget( EscortGroupAttack, DetectedItem )
local Tasks = {} local Tasks = {}
DetectedSet:ForEachUnit( DetectedSet:ForEachUnit(
--- @param Wrapper.Unit#UNIT DetectedUnit -- @param Wrapper.Unit#UNIT DetectedUnit
function( DetectedUnit, Tasks ) function( DetectedUnit, Tasks )
if DetectedUnit:IsAlive() then if DetectedUnit:IsAlive() then
Tasks[#Tasks+1] = EscortGroupAttack:TaskAttackUnit( DetectedUnit ) Tasks[#Tasks+1] = EscortGroupAttack:TaskAttackUnit( DetectedUnit )
@@ -961,7 +963,7 @@ function ESCORT:_AssistTarget( EscortGroupAttack, DetectedItem )
local Tasks = {} local Tasks = {}
DetectedSet:ForEachUnit( DetectedSet:ForEachUnit(
--- @param Wrapper.Unit#UNIT DetectedUnit -- @param Wrapper.Unit#UNIT DetectedUnit
function( DetectedUnit, Tasks ) function( DetectedUnit, Tasks )
if DetectedUnit:IsAlive() then if DetectedUnit:IsAlive() then
Tasks[#Tasks+1] = EscortGroupAttack:TaskFireAtPoint( DetectedUnit:GetVec2(), 50 ) Tasks[#Tasks+1] = EscortGroupAttack:TaskFireAtPoint( DetectedUnit:GetVec2(), 50 )
@@ -981,7 +983,7 @@ function ESCORT:_AssistTarget( EscortGroupAttack, DetectedItem )
end end
--- @param #MENUPARAM MenuParam -- @param #MENUPARAM MenuParam
function ESCORT:_ROE( EscortROEFunction, EscortROEMessage ) function ESCORT:_ROE( EscortROEFunction, EscortROEMessage )
local EscortGroup = self.EscortGroup local EscortGroup = self.EscortGroup
@@ -991,7 +993,7 @@ function ESCORT:_ROE( EscortROEFunction, EscortROEMessage )
EscortGroup:MessageToClient( EscortROEMessage, 10, EscortClient ) EscortGroup:MessageToClient( EscortROEMessage, 10, EscortClient )
end end
--- @param #MENUPARAM MenuParam -- @param #MENUPARAM MenuParam
function ESCORT:_ROT( EscortROTFunction, EscortROTMessage ) function ESCORT:_ROT( EscortROTFunction, EscortROTMessage )
local EscortGroup = self.EscortGroup local EscortGroup = self.EscortGroup
@@ -1001,7 +1003,7 @@ function ESCORT:_ROT( EscortROTFunction, EscortROTMessage )
EscortGroup:MessageToClient( EscortROTMessage, 10, EscortClient ) EscortGroup:MessageToClient( EscortROTMessage, 10, EscortClient )
end end
--- @param #MENUPARAM MenuParam -- @param #MENUPARAM MenuParam
function ESCORT:_ResumeMission( WayPoint ) function ESCORT:_ResumeMission( WayPoint )
local EscortGroup = self.EscortGroup local EscortGroup = self.EscortGroup
@@ -1036,7 +1038,7 @@ function ESCORT:RegisterRoute()
return TaskPoints return TaskPoints
end end
--- @param Functional.Escort#ESCORT self -- @param Functional.Escort#ESCORT self
function ESCORT:_FollowScheduler() function ESCORT:_FollowScheduler()
self:F( { self.FollowDistance } ) self:F( { self.FollowDistance } )

View File

@@ -26,6 +26,7 @@
--- FOX class. --- FOX class.
-- @type FOX -- @type FOX
-- @field #string ClassName Name of the class. -- @field #string ClassName Name of the class.
-- @field #number verbose Verbosity level.
-- @field #boolean Debug Debug mode. Messages to all about status. -- @field #boolean Debug Debug mode. Messages to all about status.
-- @field #string lid Class id string for output to DCS log file. -- @field #string lid Class id string for output to DCS log file.
-- @field #table menuadded Table of groups the menu was added for. -- @field #table menuadded Table of groups the menu was added for.
@@ -57,7 +58,7 @@
-- --
-- # The FOX Concept -- # The FOX Concept
-- --
-- As you probably know [Fox](https://en.wikipedia.org/wiki/Fox_(code_word)) is a NATO brevity code for launching air-to-air munition. Therefore, the class name is not 100% accurate as this -- As you probably know [Fox](https://en.wikipedia.org/wiki/Fox_\(code_word\)) is a NATO brevity code for launching air-to-air munition. Therefore, the class name is not 100% accurate as this
-- script handles air-to-air but also surface-to-air missiles. -- script handles air-to-air but also surface-to-air missiles.
-- --
-- # Basic Script -- # Basic Script
@@ -112,18 +113,14 @@
-- -- Start missile trainer. -- -- Start missile trainer.
-- fox:Start() -- fox:Start()
-- --
-- # Fine Tuning -- # Notes
--
-- Todo!
--
-- # Special Events
--
-- Todo!
-- --
-- The script needs to be running before you enter an airplane slot. If FOX is not available to you, go back to observers and then join a slot again.
-- --
-- @field #FOX -- @field #FOX
FOX = { FOX = {
ClassName = "FOX", ClassName = "FOX",
verbose = 0,
Debug = false, Debug = false,
lid = nil, lid = nil,
menuadded = {}, menuadded = {},
@@ -168,7 +165,7 @@ FOX = {
--- Missile data table. --- Missile data table.
-- @type FOX.MissileData -- @type FOX.MissileData
-- @field Wrapper.Unit#UNIT weapon Missile weapon unit. -- @field DCS#Weapon weapon Missile weapon object.
-- @field #boolean active If true the missile is active. -- @field #boolean active If true the missile is active.
-- @field #string missileType Type of missile. -- @field #string missileType Type of missile.
-- @field #string missileName Name of missile. -- @field #string missileName Name of missile.
@@ -185,6 +182,8 @@ FOX = {
-- @field #string targetName Name of the target unit or "unknown". -- @field #string targetName Name of the target unit or "unknown".
-- @field #string targetOrig Name of the "original" target, i.e. the one right after launched. -- @field #string targetOrig Name of the "original" target, i.e. the one right after launched.
-- @field #FOX.PlayerData targetPlayer Player that was targeted or nil. -- @field #FOX.PlayerData targetPlayer Player that was targeted or nil.
-- @field Core.Point#COORDINATE missileCoord Missile coordinate during tracking.
-- @field Wrapper.Weapon#WEAPON Weapon Weapon object.
--- Main radio menu on group level. --- Main radio menu on group level.
-- @field #table MenuF10 Root menu table on group level. -- @field #table MenuF10 Root menu table on group level.
@@ -196,7 +195,7 @@ FOX.MenuF10Root=nil
--- FOX class version. --- FOX class version.
-- @field #string version -- @field #string version
FOX.version="0.6.1" FOX.version="0.8.0"
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- ToDo list -- ToDo list
@@ -500,6 +499,7 @@ function FOX:SetDisableF10Menu()
return self return self
end end
--- Enable F10 menu for all players. --- Enable F10 menu for all players.
-- @param #FOX self -- @param #FOX self
-- @return #FOX self -- @return #FOX self
@@ -510,6 +510,15 @@ function FOX:SetEnableF10Menu()
return self return self
end end
--- Set verbosity level.
-- @param #FOX self
-- @param #number VerbosityLevel Level of output (higher=more). Default 0.
-- @return #FOX self
function FOX:SetVerbosity(VerbosityLevel)
self.verbose=VerbosityLevel or 0
return self
end
--- Set default player setting for missile destruction. --- Set default player setting for missile destruction.
-- @param #FOX self -- @param #FOX self
-- @param #boolean switch If true missiles are destroyed. If false/nil missiles are not destroyed. -- @param #boolean switch If true missiles are destroyed. If false/nil missiles are not destroyed.
@@ -605,7 +614,9 @@ function FOX:onafterStatus(From, Event, To)
local clock=UTILS.SecondsToClock(time) local clock=UTILS.SecondsToClock(time)
-- Status. -- Status.
self:I(self.lid..string.format("Missile trainer status %s: %s", clock, fsmstate)) if self.verbose>=1 then
self:I(self.lid..string.format("Missile trainer status %s: %s", clock, fsmstate))
end
-- Check missile status. -- Check missile status.
self:_CheckMissileStatus() self:_CheckMissileStatus()
@@ -713,7 +724,9 @@ function FOX:_CheckMissileStatus()
if #self.missiles==0 then if #self.missiles==0 then
text=text.." none" text=text.." none"
end end
self:I(self.lid..text) if self.verbose>=2 then
self:I(self.lid..text)
end
-- Remove inactive missiles. -- Remove inactive missiles.
for i=#self.missiles,1,-1 do for i=#self.missiles,1,-1 do
@@ -743,7 +756,7 @@ function FOX:_IsProtected(targetunit)
if targetgroup then if targetgroup then
local targetname=targetgroup:GetName() local targetname=targetgroup:GetName()
for _,_group in pairs(self.protectedset:GetSetObjects()) do for _,_group in pairs(self.protectedset:GetSet()) do
local group=_group --Wrapper.Group#GROUP local group=_group --Wrapper.Group#GROUP
if group then if group then
@@ -762,6 +775,277 @@ function FOX:_IsProtected(targetunit)
return false return false
end end
--- Function called from weapon tracking.
-- @param Wrapper.Weapon#WEAPON weapon Weapon object.
-- @param #FOX self FOX object.
-- @param #FOX.MissileData missile Fired missile
function FOX._FuncTrack(weapon, self, missile)
-- Missile coordinate.
local missileCoord= missile.missileCoord:UpdateFromVec3(weapon.vec3) --COORDINATE:NewFromVec3(_lastBombPos)
-- Missile velocity in m/s.
local missileVelocity=weapon:GetSpeed() --UTILS.VecNorm(_ordnance:getVelocity())
-- Update missile target if necessary.
self:GetMissileTarget(missile)
-- Target unit of the missile.
local target=nil --Wrapper.Unit#UNIT
if missile.targetUnit then
-----------------------------------
-- Missile has a specific target --
-----------------------------------
if missile.targetPlayer then
-- Target is a player.
if missile.targetPlayer.destroy==true then
target=missile.targetUnit
end
else
-- Check if unit is protected.
if self:_IsProtected(missile.targetUnit) then
target=missile.targetUnit
end
end
else
------------------------------------
-- Missile has NO specific target --
------------------------------------
-- TODO: This might cause a problem with wingman. Even if the shooter itself is excluded from the check, it's wingmen are not.
-- That would trigger the distance check right after missile launch if things to wrong.
--
-- Possible solutions:
-- * Time check: enable this check after X seconds after missile was fired. What is X?
-- * Coalition check. But would not work in training situations where blue on blue is valid!
-- * At least enable it for surface-to-air missiles.
local function _GetTarget(_unit)
local unit=_unit --Wrapper.Unit#UNIT
-- Player position.
local playerCoord=unit:GetCoordinate()
-- Distance.
local dist=missileCoord:Get3DDistance(playerCoord)
-- Update mindist if necessary. Only include players in range of missile + 50% safety margin.
if dist<=self.explosiondist then
return unit
end
end
-- Distance to closest player.
local mindist=nil
-- Loop over players.
for _,_player in pairs(self.players) do
local player=_player --#FOX.PlayerData
-- Check that player was not the one who launched the missile.
if player.unitname~=missile.shooterName then
-- Player position.
local playerCoord=player.unit:GetCoordinate()
-- Distance.
local dist=missileCoord:Get3DDistance(playerCoord)
-- Distance from shooter to player.
local Dshooter2player=playerCoord:Get3DDistance(missile.shotCoord)
-- Update mindist if necessary. Only include players in range of missile + 50% safety margin.
if (mindist==nil or dist<mindist) and (Dshooter2player<=missile.missileRange*1.5 or dist<=self.explosiondist) then
mindist=dist
target=player.unit
end
end
end
if self.protectedset then
-- Distance to closest protected unit.
mindist=nil
for _,_group in pairs(self.protectedset:GetSet()) do
local group=_group --Wrapper.Group#GROUP
for _,_unit in pairs(group:GetUnits()) do
local unit=_unit --Wrapper.Unit#UNIT
if unit and unit:IsAlive() then
-- Check that player was not the one who launched the missile.
if unit:GetName()~=missile.shooterName then
-- Player position.
local playerVec3=unit:GetVec3()
-- Distance.
local dist=missileCoord:Get3DDistance(playerVec3)
-- Distance from shooter to player.
local Dshooter2player=missile.shotCoord:Get3DDistance(playerVec3)
-- Update mindist if necessary. Only include players in range of missile + 50% safety margin.
if (mindist==nil or dist<mindist) and (Dshooter2player<=missile.missileRange*1.5 or dist<=self.explosiondist) then
mindist=dist
target=unit
end
end
end
end
end
end
if target then
self:T(self.lid..string.format("Missile %s with NO explicit target got closest unit to missile as target %s. Dist=%s m", missile.missileType, target:GetName(), tostring(mindist)))
end
end
-- Check if missile has a valid target.
if target then
-- Target coordinate.
local targetVec3=target:GetVec3() --target:GetCoordinate()
-- Distance from missile to target.
local distance=missileCoord:Get3DDistance(targetVec3)
-- Distance missile to shooter.
local distShooter=nil
if missile.shooterUnit and missile.shooterUnit:IsAlive() then
distShooter=missileCoord:Get3DDistance(missile.shooterUnit:GetVec3())
end
-- Debug output.
if self.Debug then
local bearing=missileCoord:HeadingTo(targetVec3)
local eta=distance/missileVelocity
-- Debug distance check.
self:I(self.lid..string.format("Missile %s Target %s: Distance = %.1f m, v=%.1f m/s, bearing=%03d°, ETA=%.1f sec", missile.missileType, target:GetName(), distance, missileVelocity, bearing, eta))
end
-- Distroy missile if it's getting too close.
local destroymissile=distance<=self.explosiondist
-- Check BIG missiles.
if self.explosiondist2 and distance<=self.explosiondist2 and not destroymissile then
destroymissile=missile.explosive>=self.bigmissilemass
end
-- If missile is 150 m from target ==> destroy missile if in safe zone.
if destroymissile and self:_CheckCoordSafe(targetVec3) then
-- Destroy missile.
self:I(self.lid..string.format("Destroying missile %s(%s) fired by %s aimed at %s [player=%s] at distance %.1f m",
missile.missileType, missile.missileName, missile.shooterName, target:GetName(), tostring(missile.targetPlayer~=nil), distance))
weapon:Destroy()
-- Missile is not active any more.
missile.active=false
-- Debug smoke.
if self.Debug then
missileCoord:SmokeRed()
end
-- Create event.
self:MissileDestroyed(missile)
-- Little explosion for the visual effect.
if self.explosionpower>0 and distance>50 and (distShooter==nil or (distShooter and distShooter>50)) then
missileCoord:Explosion(self.explosionpower)
end
-- Target was a player.
if missile.targetPlayer then
-- Message to target.
local text=string.format("Destroying missile. %s", self:_DeadText())
MESSAGE:New(text, 10):ToGroup(target:GetGroup())
-- Increase dead counter.
missile.targetPlayer.dead=missile.targetPlayer.dead+1
end
-- We could disable the tracking here but then the impact function would not be called.
--weapon.tracking=false
else
-- Time step.
local dt=1.0
if distance>50000 then
-- > 50 km
dt=self.dt50 --=5.0
elseif distance>10000 then
-- 10-50 km
dt=self.dt10 --=1.0
elseif distance>5000 then
-- 5-10 km
dt=self.dt05 --0.5
elseif distance>1000 then
-- 1-5 km
dt=self.dt01 --0.1
else
-- < 1 km
dt=self.dt00 --0.01
end
-- Set time step.
weapon:SetTimeStepTrack(dt)
end
else
-- No current target.
self:T(self.lid..string.format("Missile %s(%s) fired by %s has no current target. Checking back in 0.1 sec.", missile.missileType, missile.missileName, missile.shooterName))
weapon:SetTimeStepTrack(0.1)
end
end
--- Callback function on impact or destroy otherwise.
-- @param Wrapper.Weapon#WEAPON weapon Weapon object.
-- @param #FOX self FOX object.
-- @param #FOX.MissileData missile Fired missile.
function FOX._FuncImpact(weapon, self, missile)
if missile.targetPlayer then
-- Get human player.
local player=missile.targetPlayer
-- Check for player and distance < 10 km.
if player and player.unit:IsAlive() then -- and missileCoord and player.unit:GetCoordinate():Get3DDistance(missileCoord)<10*1000 then
local text=string.format("Missile defeated. Well done, %s!", player.name)
MESSAGE:New(text, 10):ToClient(player.client)
-- Increase defeated counter.
player.defeated=player.defeated+1
end
end
-- Missile is not active any more.
missile.active=false
--Terminate the timer.
self:T(FOX.lid..string.format("Terminating missile track timer."))
weapon.tracking=false
end
--- Missle launch event. --- Missle launch event.
-- @param #FOX self -- @param #FOX self
-- @param #string From From state. -- @param #string From From state.
@@ -818,304 +1102,19 @@ function FOX:onafterMissileLaunch(From, Event, To, missile)
end end
end end
end end
-- Init missile position. -- Set callback function for tracking.
local _lastBombPos = {x=0,y=0,z=0} missile.Weapon:SetFuncTrack(FOX._FuncTrack, self, missile)
-- Missile coordinate. -- Set callback function for impact.
local missileCoord = nil --Core.Point#COORDINATE missile.Weapon:SetFuncImpact(FOX._FuncImpact, self, missile)
-- Target unit of the missile.
local target=nil --Wrapper.Unit#UNIT
--- Function monitoring the position of a bomb until impact.
local function trackMissile(_ordnance)
-- When the pcall returns a failure the weapon has hit.
local _status,_bombPos = pcall(
function()
return _ordnance:getPoint()
end)
-- Check if status is not nil. If so, we have a valid point.
if _status then
----------------------------------------------
-- Still in the air. Remember this position --
----------------------------------------------
-- Missile position.
_lastBombPos = {x=_bombPos.x, y=_bombPos.y, z=_bombPos.z}
-- Missile coordinate.
missileCoord=COORDINATE:NewFromVec3(_lastBombPos)
-- Missile velocity in m/s.
local missileVelocity=UTILS.VecNorm(_ordnance:getVelocity())
-- Update missile target if necessary.
self:GetMissileTarget(missile)
if missile.targetUnit then
-----------------------------------
-- Missile has a specific target --
-----------------------------------
if missile.targetPlayer then
-- Target is a player.
if missile.targetPlayer.destroy==true then
target=missile.targetUnit
end
else
-- Check if unit is protected.
if self:_IsProtected(missile.targetUnit) then
target=missile.targetUnit
end
end
else
------------------------------------
-- Missile has NO specific target --
------------------------------------
-- TODO: This might cause a problem with wingman. Even if the shooter itself is excluded from the check, it's wingmen are not.
-- That would trigger the distance check right after missile launch if things to wrong.
--
-- Possible solutions:
-- * Time check: enable this check after X seconds after missile was fired. What is X?
-- * Coalition check. But would not work in training situations where blue on blue is valid!
-- * At least enable it for surface-to-air missiles.
local function _GetTarget(_unit)
local unit=_unit --Wrapper.Unit#UNIT
-- Player position.
local playerCoord=unit:GetCoordinate()
-- Distance.
local dist=missileCoord:Get3DDistance(playerCoord)
-- Update mindist if necessary. Only include players in range of missile + 50% safety margin.
if dist<=self.explosiondist then
return unit
end
end
-- Distance to closest player.
local mindist=nil
-- Loop over players.
for _,_player in pairs(self.players) do
local player=_player --#FOX.PlayerData
-- Check that player was not the one who launched the missile.
if player.unitname~=missile.shooterName then
-- Player position.
local playerCoord=player.unit:GetCoordinate()
-- Distance.
local dist=missileCoord:Get3DDistance(playerCoord)
-- Distance from shooter to player.
local Dshooter2player=playerCoord:Get3DDistance(missile.shotCoord)
-- Update mindist if necessary. Only include players in range of missile + 50% safety margin.
if (mindist==nil or dist<mindist) and (Dshooter2player<=missile.missileRange*1.5 or dist<=self.explosiondist) then
mindist=dist
target=player.unit
end
end
end
if self.protectedset then
-- Distance to closest protected unit.
mindist=nil
for _,_group in pairs(self.protectedset:GetSet()) do
local group=_group --Wrapper.Group#GROUP
for _,_unit in pairs(group:GetUnits()) do
local unit=_unit --Wrapper.Unit#UNIT
if unit and unit:IsAlive() then
-- Check that player was not the one who launched the missile.
if unit:GetName()~=missile.shooterName then
-- Player position.
local playerCoord=unit:GetCoordinate()
-- Distance.
local dist=missileCoord:Get3DDistance(playerCoord)
-- Distance from shooter to player.
local Dshooter2player=playerCoord:Get3DDistance(missile.shotCoord)
-- Update mindist if necessary. Only include players in range of missile + 50% safety margin.
if (mindist==nil or dist<mindist) and (Dshooter2player<=missile.missileRange*1.5 or dist<=self.explosiondist) then
mindist=dist
target=unit
end
end
end
end
end
end
if target then
self:T(self.lid..string.format("Missile %s with NO explicit target got closest unit to missile as target %s. Dist=%s m", missile.missileType, target:GetName(), tostring(mindist)))
end
end
-- Check if missile has a valid target.
if target then
-- Target coordinate.
local targetCoord=target:GetCoordinate()
-- Distance from missile to target.
local distance=missileCoord:Get3DDistance(targetCoord)
-- Distance missile to shooter.
local distShooter=nil
if missile.shooterUnit and missile.shooterUnit:IsAlive() then
distShooter=missileCoord:Get3DDistance(missile.shooterUnit:GetCoordinate())
end
-- Debug output.
if self.Debug then
local bearing=targetCoord:HeadingTo(missileCoord)
local eta=distance/missileVelocity
-- Debug distance check.
self:I(self.lid..string.format("Missile %s Target %s: Distance = %.1f m, v=%.1f m/s, bearing=%03d°, ETA=%.1f sec", missile.missileType, target:GetName(), distance, missileVelocity, bearing, eta))
end
-- Distroy missile if it's getting too close.
local destroymissile=distance<=self.explosiondist
-- Check BIG missiles.
if self.explosiondist2 and distance<=self.explosiondist2 and not destroymissile then
destroymissile=missile.explosive>=self.bigmissilemass
end
-- If missile is 150 m from target ==> destroy missile if in safe zone.
if destroymissile and self:_CheckCoordSafe(targetCoord) then
-- Destroy missile.
self:I(self.lid..string.format("Destroying missile %s(%s) fired by %s aimed at %s [player=%s] at distance %.1f m",
missile.missileType, missile.missileName, missile.shooterName, target:GetName(), tostring(missile.targetPlayer~=nil), distance))
_ordnance:destroy()
-- Missile is not active any more.
missile.active=false
-- Debug smoke.
if self.Debug then
missileCoord:SmokeRed()
targetCoord:SmokeGreen()
end
-- Create event.
self:MissileDestroyed(missile)
-- Little explosion for the visual effect.
if self.explosionpower>0 and distance>50 and (distShooter==nil or (distShooter and distShooter>50)) then
missileCoord:Explosion(self.explosionpower)
end
-- Target was a player.
if missile.targetPlayer then
-- Message to target.
local text=string.format("Destroying missile. %s", self:_DeadText())
MESSAGE:New(text, 10):ToGroup(target:GetGroup())
-- Increase dead counter.
missile.targetPlayer.dead=missile.targetPlayer.dead+1
end
-- Terminate timer.
return nil
else
-- Time step.
local dt=1.0
if distance>50000 then
-- > 50 km
dt=self.dt50 --=5.0
elseif distance>10000 then
-- 10-50 km
dt=self.dt10 --=1.0
elseif distance>5000 then
-- 5-10 km
dt=self.dt05 --0.5
elseif distance>1000 then
-- 1-5 km
dt=self.dt01 --0.1
else
-- < 1 km
dt=self.dt00 --0.01
end
-- Check again in dt seconds.
return timer.getTime()+dt
end
else
-- Destroy missile.
self:T(self.lid..string.format("Missile %s(%s) fired by %s has no current target. Checking back in 0.1 sec.", missile.missileType, missile.missileName, missile.shooterName))
return timer.getTime()+0.1
-- No target ==> terminate timer.
--return nil
end
else
-------------------------------------
-- Missile does not exist any more --
-------------------------------------
if target then
-- Get human player.
local player=self:_GetPlayerFromUnit(target)
-- Check for player and distance < 10 km.
if player and player.unit:IsAlive() then -- and missileCoord and player.unit:GetCoordinate():Get3DDistance(missileCoord)<10*1000 then
local text=string.format("Missile defeated. Well done, %s!", player.name)
MESSAGE:New(text, 10):ToClient(player.client)
-- Increase defeated counter.
player.defeated=player.defeated+1
end
end
-- Missile is not active any more.
missile.active=false
--Terminate the timer.
self:T(FOX.lid..string.format("Terminating missile track timer."))
return nil
end -- _status check
end -- end function trackBomb
-- Weapon is not yet "alife" just yet. Start timer with a little delay. -- Weapon is not yet "alife" just yet. Start timer with a little delay.
self:T(FOX.lid..string.format("Tracking of missile starts in 0.0001 seconds.")) self:T(FOX.lid..string.format("Tracking of missile starts in 0.0001 seconds."))
timer.scheduleFunction(trackMissile, missile.weapon, timer.getTime()+0.0001) --timer.scheduleFunction(trackMissile, missile.weapon, timer.getTime()+0.0001)
missile.Weapon:StartTrack(0.0001)
end end
@@ -1246,30 +1245,29 @@ end
-- @param Core.Event#EVENTDATA EventData -- @param Core.Event#EVENTDATA EventData
function FOX:OnEventShot(EventData) function FOX:OnEventShot(EventData)
self:T2({eventshot=EventData}) self:T2({eventshot=EventData})
-- Nil checks.
if EventData.Weapon==nil or EventData.IniDCSUnit==nil or EventData.weapon==nil then
return
end
if EventData.Weapon==nil then -- Create a weapon object.
return local weapon=WEAPON:New(EventData.weapon)
end
if EventData.IniDCSUnit==nil then
return
end
-- Weapon data. -- Weapon data.
local _weapon = EventData.WeaponName local _weapon = weapon:GetTypeName()
local _target = EventData.Weapon:getTarget() local _target = EventData.Weapon:getTarget()
local _targetName = "unknown" local _targetName = "unknown"
local _targetUnit = nil --Wrapper.Unit#UNIT local _targetUnit = nil --Wrapper.Unit#UNIT
-- Weapon descriptor. -- Weapon descriptor.
local desc=EventData.Weapon:getDesc() local desc=weapon.desc
self:T2({desc=desc}) self:T2({desc=desc})
-- Weapon category: 0=Shell, 1=Missile, 2=Rocket, 3=BOMB
local weaponcategory=desc.category
-- Missile category: 1=AAM, 2=SAM, 6=OTHER -- Missile category: 1=AAM, 2=SAM, 6=OTHER
local missilecategory=desc.missileCategory local missilecategory=desc.missileCategory
-- Missile range.
local missilerange=nil local missilerange=nil
if missilecategory then if missilecategory then
missilerange=desc.rangeMaxAltMax missilerange=desc.rangeMaxAltMax
@@ -1279,8 +1277,8 @@ function FOX:OnEventShot(EventData)
self:T2(FOX.lid.."EVENT SHOT: FOX") self:T2(FOX.lid.."EVENT SHOT: FOX")
self:T2(FOX.lid..string.format("EVENT SHOT: Ini unit = %s", tostring(EventData.IniUnitName))) self:T2(FOX.lid..string.format("EVENT SHOT: Ini unit = %s", tostring(EventData.IniUnitName)))
self:T2(FOX.lid..string.format("EVENT SHOT: Ini group = %s", tostring(EventData.IniGroupName))) self:T2(FOX.lid..string.format("EVENT SHOT: Ini group = %s", tostring(EventData.IniGroupName)))
self:T2(FOX.lid..string.format("EVENT SHOT: Weapon type = %s", tostring(_weapon))) self:T2(FOX.lid..string.format("EVENT SHOT: Weapon type = %s", tostring(weapon:GetTypeName())))
self:T2(FOX.lid..string.format("EVENT SHOT: Weapon categ = %s", tostring(weaponcategory))) self:T2(FOX.lid..string.format("EVENT SHOT: Weapon categ = %s", tostring(weapon:GetCategory())))
self:T2(FOX.lid..string.format("EVENT SHOT: Missil categ = %s", tostring(missilecategory))) self:T2(FOX.lid..string.format("EVENT SHOT: Missil categ = %s", tostring(missilecategory)))
self:T2(FOX.lid..string.format("EVENT SHOT: Missil range = %s", tostring(missilerange))) self:T2(FOX.lid..string.format("EVENT SHOT: Missil range = %s", tostring(missilerange)))
@@ -1292,7 +1290,7 @@ function FOX:OnEventShot(EventData)
end end
-- Track missiles of type AAM=1, SAM=2 or OTHER=6 -- Track missiles of type AAM=1, SAM=2 or OTHER=6
local _track = weaponcategory==1 and missilecategory and (missilecategory==1 or missilecategory==2 or missilecategory==6) local _track = weapon:IsMissile() and missilecategory and (missilecategory==1 or missilecategory==2 or missilecategory==6)
-- Only track missiles -- Only track missiles
if _track then if _track then
@@ -1301,6 +1299,7 @@ function FOX:OnEventShot(EventData)
missile.active=true missile.active=true
missile.weapon=EventData.weapon missile.weapon=EventData.weapon
missile.Weapon=weapon
missile.missileType=_weapon missile.missileType=_weapon
missile.missileRange=missilerange missile.missileRange=missilerange
missile.missileName=EventData.weapon:getName() missile.missileName=EventData.weapon:getName()
@@ -1313,6 +1312,7 @@ function FOX:OnEventShot(EventData)
missile.fuseDist=desc.fuseDist missile.fuseDist=desc.fuseDist
missile.explosive=desc.warhead.explosiveMass or desc.warhead.shapedExplosiveMass missile.explosive=desc.warhead.explosiveMass or desc.warhead.shapedExplosiveMass
missile.targetOrig=missile.targetName missile.targetOrig=missile.targetName
missile.missileCoord=COORDINATE:New(0,0,0)
-- Set missile target name, unit and player. -- Set missile target name, unit and player.
self:GetMissileTarget(missile) self:GetMissileTarget(missile)
@@ -1631,7 +1631,7 @@ end
--- Check if a coordinate lies within a safe training zone. --- Check if a coordinate lies within a safe training zone.
-- @param #FOX self -- @param #FOX self
-- @param Core.Point#COORDINATE coord Coordinate to check. -- @param Core.Point#COORDINATE coord Coordinate to check. Can also be a DCS#Vec3.
-- @return #boolean True if safe. -- @return #boolean True if safe.
function FOX:_CheckCoordSafe(coord) function FOX:_CheckCoordSafe(coord)
@@ -1643,7 +1643,9 @@ function FOX:_CheckCoordSafe(coord)
-- Loop over all zones. -- Loop over all zones.
for _,_zone in pairs(self.safezones) do for _,_zone in pairs(self.safezones) do
local zone=_zone --Core.Zone#ZONE local zone=_zone --Core.Zone#ZONE
local inzone=zone:IsCoordinateInZone(coord) local Vec2={x=coord.x, y=coord.z}
local inzone=zone:IsVec2InZone(Vec2)
--local inzone=zone:IsCoordinateInZone(coord)
if inzone then if inzone then
return true return true
end end
@@ -1654,7 +1656,7 @@ end
--- Check if a coordinate lies within a launch zone. --- Check if a coordinate lies within a launch zone.
-- @param #FOX self -- @param #FOX self
-- @param Core.Point#COORDINATE coord Coordinate to check. -- @param Core.Point#COORDINATE coord Coordinate to check. Can also be a DCS#Vec2.
-- @return #boolean True if in launch zone. -- @return #boolean True if in launch zone.
function FOX:_CheckCoordLaunch(coord) function FOX:_CheckCoordLaunch(coord)
@@ -1666,7 +1668,9 @@ function FOX:_CheckCoordLaunch(coord)
-- Loop over all zones. -- Loop over all zones.
for _,_zone in pairs(self.launchzones) do for _,_zone in pairs(self.launchzones) do
local zone=_zone --Core.Zone#ZONE local zone=_zone --Core.Zone#ZONE
local inzone=zone:IsCoordinateInZone(coord) local Vec2={x=coord.x, y=coord.z}
local inzone=zone:IsVec2InZone(Vec2)
--local inzone=zone:IsCoordinateInZone(coord)
if inzone then if inzone then
return true return true
end end

View File

@@ -13,7 +13,7 @@
-- --
-- ## Missions: -- ## Missions:
-- --
-- ### [MANTIS - Modular, Automatic and Network capable Targeting and Interception System](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/MTS%20-%20Mantis/MTS-010%20-%20Basic%20Mantis%20Demo) -- ### [MANTIS - Modular, Automatic and Network capable Targeting and Interception System](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/Mantis)
-- --
-- === -- ===
-- --
@@ -22,7 +22,7 @@
-- @module Functional.Mantis -- @module Functional.Mantis
-- @image Functional.Mantis.jpg -- @image Functional.Mantis.jpg
-- --
-- Last Update: Oct 2022 -- Last Update: Dec 2023
------------------------------------------------------------------------- -------------------------------------------------------------------------
--- **MANTIS** class, extends Core.Base#BASE --- **MANTIS** class, extends Core.Base#BASE
@@ -94,7 +94,7 @@
-- Known SAM types at the time of writing are: -- Known SAM types at the time of writing are:
-- --
-- * Avenger -- * Avenger
-- * Chaparrel -- * Chaparral
-- * Hawk -- * Hawk
-- * Linebacker -- * Linebacker
-- * NASAMS -- * NASAMS
@@ -103,10 +103,15 @@
-- * Roland -- * Roland
-- * Silkworm (though strictly speaking this is a surface to ship missile) -- * Silkworm (though strictly speaking this is a surface to ship missile)
-- * SA-2, SA-3, SA-5, SA-6, SA-7, SA-8, SA-9, SA-10, SA-11, SA-13, SA-15, SA-19 -- * SA-2, SA-3, SA-5, SA-6, SA-7, SA-8, SA-9, SA-10, SA-11, SA-13, SA-15, SA-19
-- * From IDF mod: STUNNER IDFA, TAMIR IDFA (Note all caps!)
-- * From HDS (see note on HDS below): SA-2, SA-3, SA-10B, SA-10C, SA-12, SA-17, SA-20A, SA-20B, SA-23, HQ-2 -- * From HDS (see note on HDS below): SA-2, SA-3, SA-10B, SA-10C, SA-12, SA-17, SA-20A, SA-20B, SA-23, HQ-2
--
-- * From SMA: RBS98M, RBS70, RBS90, RBS90M, RBS103A, RBS103B, RBS103AM, RBS103BM, Lvkv9040M -- * From SMA: RBS98M, RBS70, RBS90, RBS90M, RBS103A, RBS103B, RBS103AM, RBS103BM, Lvkv9040M
-- **NOTE** If you are using the Swedish Military Assets (SMA), please note that the **group name** for RBS-SAM types also needs to contain the keyword "SMA" -- **NOTE** If you are using the Swedish Military Assets (SMA), please note that the **group name** for RBS-SAM types also needs to contain the keyword "SMA"
-- --
-- * From CH: 2S38, PantsirS1, PantsirS2, PGL-625, HQ-17A, M903PAC2, M903PAC3, TorM2, TorM2K, TorM2M, NASAMS3-AMRAAMER, NASAMS3-AIM9X2, C-RAM, PGZ-09, S350-9M100, S350-9M96D
-- **NOTE** If you are using the Military Assets by Currenthill (CH), please note that the **group name** for CH-SAM types also needs to contain the keyword "CHM"
--
-- Following the example started above, an SA-6 site group name should start with "Red SAM SA-6" then, or a blue Patriot installation with e.g. "Blue SAM Patriot". -- Following the example started above, an SA-6 site group name should start with "Red SAM SA-6" then, or a blue Patriot installation with e.g. "Blue SAM Patriot".
-- **NOTE** If you are using the High-Digit-Sam Mod, please note that the **group name** for the following SAM types also needs to contain the keyword "HDS": -- **NOTE** If you are using the High-Digit-Sam Mod, please note that the **group name** for the following SAM types also needs to contain the keyword "HDS":
-- --
@@ -360,7 +365,7 @@ MANTIS.SamData = {
["SA-15"] = { Range=11, Blindspot=0, Height=6, Type="Short", Radar="Tor 9A331" }, ["SA-15"] = { Range=11, Blindspot=0, Height=6, Type="Short", Radar="Tor 9A331" },
["SA-13"] = { Range=5, Blindspot=0, Height=3, Type="Short", Radar="Strela" }, ["SA-13"] = { Range=5, Blindspot=0, Height=3, Type="Short", Radar="Strela" },
["Avenger"] = { Range=4, Blindspot=0, Height=3, Type="Short", Radar="Avenger" }, ["Avenger"] = { Range=4, Blindspot=0, Height=3, Type="Short", Radar="Avenger" },
["Chaparrel"] = { Range=8, Blindspot=0, Height=3, Type="Short", Radar="Chaparral" }, ["Chaparral"] = { Range=8, Blindspot=0, Height=3, Type="Short", Radar="Chaparral" },
["Linebacker"] = { Range=4, Blindspot=0, Height=3, Type="Short", Radar="Linebacker" }, ["Linebacker"] = { Range=4, Blindspot=0, Height=3, Type="Short", Radar="Linebacker" },
["Silkworm"] = { Range=90, Blindspot=1, Height=0.2, Type="Long", Radar="Silkworm" }, ["Silkworm"] = { Range=90, Blindspot=1, Height=0.2, Type="Long", Radar="Silkworm" },
-- units from HDS Mod, multi launcher options is tricky -- units from HDS Mod, multi launcher options is tricky
@@ -369,6 +374,9 @@ MANTIS.SamData = {
["SA-20A"] = { Range=150, Blindspot=5, Height=27, Type="Long" , Radar="S-300PMU1"}, ["SA-20A"] = { Range=150, Blindspot=5, Height=27, Type="Long" , Radar="S-300PMU1"},
["SA-20B"] = { Range=200, Blindspot=4, Height=27, Type="Long" , Radar="S-300PMU2"}, ["SA-20B"] = { Range=200, Blindspot=4, Height=27, Type="Long" , Radar="S-300PMU2"},
["HQ-2"] = { Range=50, Blindspot=6, Height=35, Type="Medium", Radar="HQ_2_Guideline_LN" }, ["HQ-2"] = { Range=50, Blindspot=6, Height=35, Type="Medium", Radar="HQ_2_Guideline_LN" },
["SHORAD"] = { Range=3, Blindspot=0, Height=3, Type="Short", Radar="Igla" },
["TAMIR IDFA"] = { Range=20, Blindspot=0.6, Height=12.3, Type="Short", Radar="IRON_DOME_LN" },
["STUNNER IDFA"] = { Range=250, Blindspot=1, Height=45, Type="Long", Radar="DAVID_SLING_LN" },
} }
--- SAM data HDS --- SAM data HDS
@@ -415,6 +423,37 @@ MANTIS.SamDataSMA = {
["Lvkv9040M SMA"] = { Range=4, Blindspot=0, Height=2.5, Type="Short", Radar="LvKv9040" }, ["Lvkv9040M SMA"] = { Range=4, Blindspot=0, Height=2.5, Type="Short", Radar="LvKv9040" },
} }
--- SAM data CH
-- @type MANTIS.SamDataCH
-- @field #number Range Max firing range in km
-- @field #number Blindspot no-firing range (green circle)
-- @field #number Height Max firing height in km
-- @field #string Type #MANTIS.SamType of SAM, i.e. SHORT, MEDIUM or LONG (range)
-- @field #string Radar Radar typename on unit level (used as key)
MANTIS.SamDataCH = {
-- units from CH (Military Assets by Currenthill)
-- https://www.currenthill.com/
-- group name MUST contain CHM to ID launcher type correctly!
["2S38 CH"] = { Range=8, Blindspot=0.5, Height=6, Type="Short", Radar="2S38" },
["PantsirS1 CH"] = { Range=20, Blindspot=1.2, Height=15, Type="Short", Radar="PantsirS1" },
["PantsirS2 CH"] = { Range=30, Blindspot=1.2, Height=18, Type="Medium", Radar="PantsirS2" },
["PGL-625 CH"] = { Range=10, Blindspot=0.5, Height=5, Type="Short", Radar="PGL_625" },
["HQ-17A CH"] = { Range=20, Blindspot=1.5, Height=10, Type="Short", Radar="HQ17A" },
["M903PAC2 CH"] = { Range=160, Blindspot=3, Height=24.5, Type="Long", Radar="MIM104_M903_PAC2" },
["M903PAC3 CH"] = { Range=120, Blindspot=1, Height=40, Type="Long", Radar="MIM104_M903_PAC3" },
["TorM2 CH"] = { Range=12, Blindspot=1, Height=10, Type="Short", Radar="TorM2" },
["TorM2K CH"] = { Range=12, Blindspot=1, Height=10, Type="Short", Radar="TorM2K" },
["TorM2M CH"] = { Range=16, Blindspot=1, Height=10, Type="Short", Radar="TorM2M" },
["NASAMS3-AMRAAMER CH"] = { Range=50, Blindspot=2, Height=35.7, Type="Medium", Radar="CH_NASAMS3_LN_AMRAAM_ER" },
["NASAMS3-AIM9X2 CH"] = { Range=20, Blindspot=0.2, Height=18, Type="Short", Radar="CH_NASAMS3_LN_AIM9X2" },
["C-RAM CH"] = { Range=2, Blindspot=0, Height=2, Type="Short", Radar="CH_Centurion_C_RAM" },
["PGZ-09 CH"] = { Range=4, Blindspot=0, Height=3, Type="Short", Radar="CH_PGZ09" },
["S350-9M100 CH"] = { Range=15, Blindspot=1.5, Height=8, Type="Short", Radar="CH_S350_50P6_9M100" },
["S350-9M96D CH"] = { Range=150, Blindspot=2.5, Height=30, Type="Long", Radar="CH_S350_50P6_9M96D" },
["LAV-AD CH"] = { Range=8, Blindspot=0.2, Height=4.8, Type="Short", Radar="CH_LAVAD" },
["HQ-22 CH"] = { Range=170, Blindspot=5, Height=27, Type="Long", Radar="CH_HQ22_LN" },
}
----------------------------------------------------------------------- -----------------------------------------------------------------------
-- MANTIS System -- MANTIS System
----------------------------------------------------------------------- -----------------------------------------------------------------------
@@ -431,6 +470,7 @@ do
--@param #string awacs Group name of your Awacs (optional) --@param #string awacs Group name of your Awacs (optional)
--@param #boolean EmOnOff Make MANTIS switch Emissions on and off instead of changing the alarm state between RED and GREEN (optional) --@param #boolean EmOnOff Make MANTIS switch Emissions on and off instead of changing the alarm state between RED and GREEN (optional)
--@param #number Padding For #SEAD - Extra number of seconds to add to radar switch-back-on time (optional) --@param #number Padding For #SEAD - Extra number of seconds to add to radar switch-back-on time (optional)
--@param #table Zones Table of Core.Zone#ZONE Zones Consider SAM groups in this zone(s) only for this MANTIS instance, must be handed as #table of Zone objects
--@return #MANTIS self --@return #MANTIS self
--@usage Start up your MANTIS with a basic setting --@usage Start up your MANTIS with a basic setting
-- --
@@ -449,8 +489,12 @@ do
-- mybluemantis = MANTIS:New("bluemantis","Blue SAM","Blue EWR",nil,"blue",false,"Blue Awacs") -- mybluemantis = MANTIS:New("bluemantis","Blue SAM","Blue EWR",nil,"blue",false,"Blue Awacs")
-- mybluemantis:Start() -- mybluemantis:Start()
-- --
function MANTIS:New(name,samprefix,ewrprefix,hq,coalition,dynamic,awacs, EmOnOff, Padding) function MANTIS:New(name,samprefix,ewrprefix,hq,coalition,dynamic,awacs, EmOnOff, Padding, Zones)
-- Inherit everything from BASE class.
local self = BASE:Inherit(self, FSM:New()) -- #MANTIS
-- DONE: Create some user functions for these -- DONE: Create some user functions for these
-- DONE: Make HQ useful -- DONE: Make HQ useful
-- DONE: Set SAMs to auto if EWR dies -- DONE: Set SAMs to auto if EWR dies
@@ -510,6 +554,11 @@ do
self.maxclassic = 6 self.maxclassic = 6
self.autoshorad = true self.autoshorad = true
self.ShoradGroupSet = SET_GROUP:New() -- Core.Set#SET_GROUP self.ShoradGroupSet = SET_GROUP:New() -- Core.Set#SET_GROUP
self.FilterZones = Zones
self.SkateZones = nil
self.SkateNumber = 3
self.shootandscoot = false
self.UseEmOnOff = true self.UseEmOnOff = true
if EmOnOff == false then if EmOnOff == false then
@@ -522,9 +571,6 @@ do
self.advAwacs = false self.advAwacs = false
end end
-- Inherit everything from BASE class.
local self = BASE:Inherit(self, FSM:New()) -- #MANTIS
-- Set the string id for output to DCS.log file. -- Set the string id for output to DCS.log file.
self.lid=string.format("MANTIS %s | ", self.name) self.lid=string.format("MANTIS %s | ", self.name)
@@ -559,16 +605,23 @@ do
self:T({self.ewr_templates}) self:T({self.ewr_templates})
self.SAM_Group = SET_GROUP:New():FilterPrefixes(self.SAM_Templates_Prefix):FilterCoalitions(self.Coalition)
self.EWR_Group = SET_GROUP:New():FilterPrefixes(self.ewr_templates):FilterCoalitions(self.Coalition)
if self.FilterZones then
self.SAM_Group:FilterZones(self.FilterZones)
end
if self.dynamic then if self.dynamic then
-- Set SAM SET_GROUP -- Set SAM SET_GROUP
self.SAM_Group = SET_GROUP:New():FilterPrefixes(self.SAM_Templates_Prefix):FilterCoalitions(self.Coalition):FilterStart() self.SAM_Group:FilterStart()
-- Set EWR SET_GROUP -- Set EWR SET_GROUP
self.EWR_Group = SET_GROUP:New():FilterPrefixes(self.ewr_templates):FilterCoalitions(self.Coalition):FilterStart() self.EWR_Group:FilterStart()
else else
-- Set SAM SET_GROUP -- Set SAM SET_GROUP
self.SAM_Group = SET_GROUP:New():FilterPrefixes(self.SAM_Templates_Prefix):FilterCoalitions(self.Coalition):FilterOnce() self.SAM_Group:FilterOnce()
-- Set EWR SET_GROUP -- Set EWR SET_GROUP
self.EWR_Group = SET_GROUP:New():FilterPrefixes(self.ewr_templates):FilterCoalitions(self.Coalition):FilterOnce() self.EWR_Group:FilterOnce()
end end
-- set up CC -- set up CC
@@ -578,7 +631,7 @@ do
-- TODO Version -- TODO Version
-- @field #string version -- @field #string version
self.version="0.8.9" self.version="0.8.16"
self:I(string.format("***** Starting MANTIS Version %s *****", self.version)) self:I(string.format("***** Starting MANTIS Version %s *****", self.version))
--- FSM Functions --- --- FSM Functions ---
@@ -742,6 +795,23 @@ do
return self return self
end end
--- Add a SET_ZONE of zones for Shoot&Scoot - SHORAD units will move around
-- @param #MANTIS self
-- @param Core.Set#SET_ZONE ZoneSet Set of zones to be used. Units will move around to the next (random) zone between 100m and 3000m away.
-- @param #number Number Number of closest zones to be considered, defaults to 3.
-- @param #boolean Random If true, use a random coordinate inside the next zone to scoot to.
-- @param #string Formation Formation to use, defaults to "Cone". See mission editor dropdown for options.
-- @return #MANTIS self
function MANTIS:AddScootZones(ZoneSet, Number, Random, Formation)
self:T(self.lid .. " AddScootZones")
self.SkateZones = ZoneSet
self.SkateNumber = Number or 3
self.shootandscoot = true
self.ScootRandom = Random
self.ScootFormation = Formation or "Cone"
return self
end
--- Function to set accept and reject zones. --- Function to set accept and reject zones.
-- @param #MANTIS self -- @param #MANTIS self
-- @param #table AcceptZones Table of @{Core.Zone#ZONE} objects -- @param #table AcceptZones Table of @{Core.Zone#ZONE} objects
@@ -848,7 +918,7 @@ do
--- Function to get the HQ object for further use --- Function to get the HQ object for further use
-- @param #MANTIS self -- @param #MANTIS self
-- @return Wrapper.GROUP#GROUP The HQ #GROUP object or *nil* if it doesn't exist -- @return Wrapper.Group#GROUP The HQ #GROUP object or *nil* if it doesn't exist
function MANTIS:GetCommandCenter() function MANTIS:GetCommandCenter()
self:T(self.lid .. "GetCommandCenter") self:T(self.lid .. "GetCommandCenter")
if self.HQ_CC then if self.HQ_CC then
@@ -884,7 +954,7 @@ do
--- Function to set the HQ object for further use --- Function to set the HQ object for further use
-- @param #MANTIS self -- @param #MANTIS self
-- @param Wrapper.GROUP#GROUP group The #GROUP object to be set as HQ -- @param Wrapper.Group#GROUP group The #GROUP object to be set as HQ
function MANTIS:SetCommandCenter(group) function MANTIS:SetCommandCenter(group)
self:T(self.lid .. "SetCommandCenter") self:T(self.lid .. "SetCommandCenter")
local group = group or nil local group = group or nil
@@ -946,7 +1016,7 @@ do
--- Set using your own #INTEL_DLINK object instead of #DETECTION --- Set using your own #INTEL_DLINK object instead of #DETECTION
-- @param #MANTIS self -- @param #MANTIS self
-- @param Ops.Intelligence#INTEL_DLINK DLink The data link object to be used. -- @param Ops.Intel#INTEL_DLINK DLink The data link object to be used.
function MANTIS:SetUsingDLink(DLink) function MANTIS:SetUsingDLink(DLink)
self:T(self.lid .. "SetUsingDLink") self:T(self.lid .. "SetUsingDLink")
self.DLink = true self.DLink = true
@@ -1079,7 +1149,7 @@ do
--self:T(self.lid.." Relocating HQ") --self:T(self.lid.." Relocating HQ")
local text = self.lid.." Relocating HQ" local text = self.lid.." Relocating HQ"
--local m= MESSAGE:New(text,10,"MANTIS"):ToAll() --local m= MESSAGE:New(text,10,"MANTIS"):ToAll()
_hqgrp:RelocateGroundRandomInRadius(20,500,true,true) _hqgrp:RelocateGroundRandomInRadius(20,500,true,true,nil,true)
end end
--relocate EWR --relocate EWR
-- TODO: maybe dependent on AlarmState? Observed: SA11 SR only relocates if no objects in reach -- TODO: maybe dependent on AlarmState? Observed: SA11 SR only relocates if no objects in reach
@@ -1093,7 +1163,7 @@ do
local text = self.lid.." Relocating EWR ".._grp:GetName() local text = self.lid.." Relocating EWR ".._grp:GetName()
local m= MESSAGE:New(text,10,"MANTIS"):ToAllIf(self.debug) local m= MESSAGE:New(text,10,"MANTIS"):ToAllIf(self.debug)
if self.verbose then self:I(text) end if self.verbose then self:I(text) end
_grp:RelocateGroundRandomInRadius(20,500,true,true) _grp:RelocateGroundRandomInRadius(20,500,true,true,nil,true)
end end
end end
end end
@@ -1299,11 +1369,12 @@ do
-- @param #string grpname Name of the group -- @param #string grpname Name of the group
-- @param #boolean mod HDS mod flag -- @param #boolean mod HDS mod flag
-- @param #boolean sma SMA mod flag -- @param #boolean sma SMA mod flag
-- @param #boolean chm CH mod flag
-- @return #number range Max firing range -- @return #number range Max firing range
-- @return #number height Max firing height -- @return #number height Max firing height
-- @return #string type Long, medium or short range -- @return #string type Long, medium or short range
-- @return #number blind "blind" spot -- @return #number blind "blind" spot
function MANTIS:_GetSAMDataFromUnits(grpname,mod,sma) function MANTIS:_GetSAMDataFromUnits(grpname,mod,sma,chm)
self:T(self.lid.."_GetSAMRangeFromUnits") self:T(self.lid.."_GetSAMRangeFromUnits")
local found = false local found = false
local range = self.checkradius local range = self.checkradius
@@ -1318,8 +1389,10 @@ do
SAMData = self.SamDataHDS SAMData = self.SamDataHDS
elseif sma then elseif sma then
SAMData = self.SamDataSMA SAMData = self.SamDataSMA
elseif chm then
SAMData = self.SamDataCH
end end
--self:I("Looking to auto-match for "..grpname) --self:T("Looking to auto-match for "..grpname)
for _,_unit in pairs(units) do for _,_unit in pairs(units) do
local unit = _unit -- Wrapper.Unit#UNIT local unit = _unit -- Wrapper.Unit#UNIT
local type = string.lower(unit:GetTypeName()) local type = string.lower(unit:GetTypeName())
@@ -1364,10 +1437,13 @@ do
local found = false local found = false
local HDSmod = false local HDSmod = false
local SMAMod = false local SMAMod = false
local CHMod = false
if string.find(grpname,"HDS",1,true) then if string.find(grpname,"HDS",1,true) then
HDSmod = true HDSmod = true
elseif string.find(grpname,"SMA",1,true) then elseif string.find(grpname,"SMA",1,true) then
SMAMod = true SMAMod = true
elseif string.find(grpname,"CHM",1,true) then
CHMod = true
end end
if self.automode then if self.automode then
for idx,entry in pairs(self.SamData) do for idx,entry in pairs(self.SamData) do
@@ -1386,8 +1462,8 @@ do
end end
end end
-- secondary filter if not found -- secondary filter if not found
if (not found and self.automode) or HDSmod or SMAMod then if (not found and self.automode) or HDSmod or SMAMod or CHMod then
range, height, type = self:_GetSAMDataFromUnits(grpname,HDSmod,SMAMod) range, height, type = self:_GetSAMDataFromUnits(grpname,HDSmod,SMAMod,CHMod)
elseif not found then elseif not found then
self:E(self.lid .. string.format("*****Could not match radar data for %s! Will default to midrange values!",grpname)) self:E(self.lid .. string.format("*****Could not match radar data for %s! Will default to midrange values!",grpname))
end end
@@ -1735,6 +1811,10 @@ do
self.Shorad:SetDefenseLimits(80,95) self.Shorad:SetDefenseLimits(80,95)
self.ShoradLink = true self.ShoradLink = true
self.Shorad.Groupset=self.ShoradGroupSet self.Shorad.Groupset=self.ShoradGroupSet
self.Shorad.debug = self.debug
end
if self.shootandscoot and self.SkateZones and self.Shorad then
self.Shorad:AddScootZones(self.SkateZones,self.SkateNumber or 3,self.ScootRandom,self.ScootFormation)
end end
self:__Status(-math.random(1,10)) self:__Status(-math.random(1,10))
return self return self

View File

@@ -14,7 +14,7 @@
-- --
-- ## Missions: -- ## Missions:
-- --
-- [MIT - Missile Trainer](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/MIT%20-%20Missile%20Trainer) -- [MIT - Missile Trainer](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/MissileTrainer)
-- --
-- === -- ===
-- --
@@ -50,6 +50,11 @@
-- * **100 meter**: Destroys the missile when the distance to the aircraft is below or equal to 100 meter. -- * **100 meter**: Destroys the missile when the distance to the aircraft is below or equal to 100 meter.
-- * **150 meter**: Destroys the missile when the distance to the aircraft is below or equal to 150 meter. -- * **150 meter**: Destroys the missile when the distance to the aircraft is below or equal to 150 meter.
-- * **200 meter**: Destroys the missile when the distance to the aircraft is below or equal to 200 meter. -- * **200 meter**: Destroys the missile when the distance to the aircraft is below or equal to 200 meter.
--
-- # Developer Note
--
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE.
-- Therefore, this class is considered to be deprecated and superseded by the [Functional.Fox](https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Functional.Fox.html) class, which provides the same functionality.
-- --
-- === -- ===
-- --
@@ -67,8 +72,8 @@
-- @module Functional.MissileTrainer -- @module Functional.MissileTrainer
-- @image Missile_Trainer.JPG -- @image Missile_Trainer.JPG
---
--- @type MISSILETRAINER -- @type MISSILETRAINER
-- @field Core.Set#SET_CLIENT DBClients -- @field Core.Set#SET_CLIENT DBClients
-- @extends Core.Base#BASE -- @extends Core.Base#BASE
@@ -97,6 +102,11 @@
-- * @{#MISSILETRAINER.InitRangeOnOff}: Sets by default the display of range information of missiles ON of OFF. -- * @{#MISSILETRAINER.InitRangeOnOff}: Sets by default the display of range information of missiles ON of OFF.
-- * @{#MISSILETRAINER.InitBearingOnOff}: Sets by default the display of bearing information of missiles ON of OFF. -- * @{#MISSILETRAINER.InitBearingOnOff}: Sets by default the display of bearing information of missiles ON of OFF.
-- * @{#MISSILETRAINER.InitMenusOnOff}: Allows to configure the options through the radio menu. -- * @{#MISSILETRAINER.InitMenusOnOff}: Allows to configure the options through the radio menu.
--
-- # Developer Note
--
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE.
-- Therefore, this class is considered to be deprecated and superseded by the [Functional.Fox](https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Functional.Fox.html) class, which provides the same functionality.
-- --
-- @field #MISSILETRAINER -- @field #MISSILETRAINER
MISSILETRAINER = { MISSILETRAINER = {
@@ -205,7 +215,7 @@ function MISSILETRAINER:New( Distance, Briefing )
-- self.DB:ForEachClient( -- self.DB:ForEachClient(
-- --- @param Wrapper.Client#CLIENT Client -- -- @param Wrapper.Client#CLIENT Client
-- function( Client ) -- function( Client )
-- --
-- ... actions ... -- ... actions ...
@@ -555,7 +565,7 @@ function MISSILETRAINER:_AddBearing( Client, TrainerWeapon )
local DirectionVector = { x = PositionMissile.x - TargetVec3.x, y = PositionMissile.y - TargetVec3.y, z = PositionMissile.z - TargetVec3.z } local DirectionVector = { x = PositionMissile.x - TargetVec3.x, y = PositionMissile.y - TargetVec3.y, z = PositionMissile.z - TargetVec3.z }
local DirectionRadians = math.atan2( DirectionVector.z, DirectionVector.x ) local DirectionRadians = math.atan2( DirectionVector.z, DirectionVector.x )
--DirectionRadians = DirectionRadians + routines.getNorthCorrection( PositionTarget )
if DirectionRadians < 0 then if DirectionRadians < 0 then
DirectionRadians = DirectionRadians + 2 * math.pi DirectionRadians = DirectionRadians + 2 * math.pi
end end

View File

@@ -10,7 +10,8 @@
-- @module Functional.Movement -- @module Functional.Movement
-- @image MOOSE.JPG -- @image MOOSE.JPG
--- @type MOVEMENT ---
-- @type MOVEMENT
-- @extends Core.Base#BASE -- @extends Core.Base#BASE
--- ---
@@ -55,7 +56,6 @@ end
--- Call this function to start the MOVEMENT scheduling. --- Call this function to start the MOVEMENT scheduling.
function MOVEMENT:ScheduleStart() function MOVEMENT:ScheduleStart()
self:F() self:F()
--self.MoveFunction = routines.scheduleFunction( self._Scheduler, { self }, timer.getTime() + 1, 120 )
self.MoveFunction = SCHEDULER:New( self, self._Scheduler, {}, 1, 120 ) self.MoveFunction = SCHEDULER:New( self, self._Scheduler, {}, 1, 120 )
end end

View File

@@ -26,9 +26,9 @@
-- --
-- === -- ===
-- --
-- ### Author: **[funkyfranky](https://forums.eagle.ru/member.php?u=115026)** -- ### Author: **funkyfranky**
-- --
-- ### Contributions: [FlightControl](https://forums.eagle.ru/member.php?u=89536) -- ### Contributions: FlightControl, Applevangelist
-- --
-- ==== -- ====
-- @module Functional.PseudoATC -- @module Functional.PseudoATC
@@ -44,7 +44,7 @@
-- @field #number mrefresh Interval in seconds after which the F10 menu is refreshed. E.g. by the closest airports. Default is 120 sec. -- @field #number mrefresh Interval in seconds after which the F10 menu is refreshed. E.g. by the closest airports. Default is 120 sec.
-- @field #number talt Interval in seconds between reporting altitude until touchdown. Default 3 sec. -- @field #number talt Interval in seconds between reporting altitude until touchdown. Default 3 sec.
-- @field #boolean chatty Display some messages on events like take-off and touchdown. -- @field #boolean chatty Display some messages on events like take-off and touchdown.
-- @field #boolean eventsmoose If true, events are handled by MOOSE. If false, events are handled directly by DCS eventhandler. -- @field #boolean eventsmoose [Deprecated] If true, events are handled by MOOSE. If false, events are handled directly by DCS eventhandler.
-- @field #boolean reportplayername If true, use playername not callsign on callouts -- @field #boolean reportplayername If true, use playername not callsign on callouts
-- @extends Core.Base#BASE -- @extends Core.Base#BASE
@@ -100,13 +100,14 @@ PSEUDOATC.id="PseudoATC | "
--- PSEUDOATC version. --- PSEUDOATC version.
-- @field #number version -- @field #number version
PSEUDOATC.version="0.9.5" PSEUDOATC.version="0.10.5"
----------------------------------------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------------------------------------------------
-- TODO list -- TODO list
-- DONE: Add takeoff event. -- DONE: Add takeoff event.
-- DONE: Add user functions. -- DONE: Add user functions.
-- DONE: Refactor to use Moose event handling only
----------------------------------------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------------------------------------------------
@@ -131,23 +132,14 @@ function PSEUDOATC:Start()
self:F() self:F()
-- Debug info -- Debug info
self:E(PSEUDOATC.id.."Starting PseudoATC") self:I(PSEUDOATC.id.."Starting PseudoATC")
-- Handle events. -- Handle events.
if self.eventsmoose then self:HandleEvent(EVENTS.Birth, self._OnBirth)
self:T(PSEUDOATC.id.."Events are handled by MOOSE.") self:HandleEvent(EVENTS.Land, self._PlayerLanded)
self:HandleEvent(EVENTS.Birth, self._OnBirth) self:HandleEvent(EVENTS.Takeoff, self._PlayerTakeOff)
self:HandleEvent(EVENTS.Land, self._PlayerLanded) self:HandleEvent(EVENTS.PlayerLeaveUnit, self._PlayerLeft)
self:HandleEvent(EVENTS.Takeoff, self._PlayerTakeOff) self:HandleEvent(EVENTS.Crash, self._PlayerLeft)
self:HandleEvent(EVENTS.PlayerLeaveUnit, self._PlayerLeft)
self:HandleEvent(EVENTS.Crash, self._PlayerLeft)
--self:HandleEvent(EVENTS.Ejection, self._PlayerLeft)
--self:HandleEvent(EVENTS.PilotDead, self._PlayerLeft)
else
self:T(PSEUDOATC.id.."Events are handled by DCS.")
-- Events are handled directly by DCS.
world.addEventHandler(self)
end
end end
@@ -199,7 +191,7 @@ function PSEUDOATC:SetMenuRefresh(interval)
self.mrefresh=interval or 120 self.mrefresh=interval or 120
end end
--- Enable/disable event handling by MOOSE or DCS. --- [Deprecated] Enable/disable event handling by MOOSE or DCS.
-- @param #PSEUDOATC self -- @param #PSEUDOATC self
-- @param #boolean switch If true, events are handled by MOOSE (default). If false, events are handled directly by DCS. -- @param #boolean switch If true, events are handled by MOOSE (default). If false, events are handled directly by DCS.
function PSEUDOATC:SetEventsMoose(switch) function PSEUDOATC:SetEventsMoose(switch)
@@ -216,84 +208,6 @@ end
----------------------------------------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------------------------------------------------
-- Event Handling -- Event Handling
--- Event handler for suppressed groups.
--@param #PSEUDOATC self
--@param #table Event Event data table. Holds event.id, event.initiator and event.target etc.
function PSEUDOATC:onEvent(Event)
if Event == nil or Event.initiator == nil or Unit.getByName(Event.initiator:getName()) == nil then
return true
end
local DCSiniunit = Event.initiator
local DCSplace = Event.place
local DCSsubplace = Event.subplace
local EventData={}
local _playerunit=nil
local _playername=nil
if Event.initiator then
EventData.IniUnitName = Event.initiator:getName()
EventData.IniDCSGroup = Event.initiator:getGroup()
EventData.IniGroupName = Event.initiator:getGroup():getName()
-- Get player unit and name. This returns nil,nil if the event was not fired by a player unit. And these are the only events we are interested in.
_playerunit, _playername = self:_GetPlayerUnitAndName(EventData.IniUnitName)
end
if Event.place then
EventData.Place=Event.place
EventData.PlaceName=Event.place:getName()
end
if Event.subplace then
EventData.SubPlace=Event.subplace
EventData.SubPlaceName=Event.subplace:getName()
end
-- Event info.
self:T3(PSEUDOATC.id..string.format("EVENT: Event in onEvent with ID = %s", tostring(Event.id)))
self:T3(PSEUDOATC.id..string.format("EVENT: Ini unit = %s" , tostring(EventData.IniUnitName)))
self:T3(PSEUDOATC.id..string.format("EVENT: Ini group = %s" , tostring(EventData.IniGroupName)))
self:T3(PSEUDOATC.id..string.format("EVENT: Ini player = %s" , tostring(_playername)))
self:T3(PSEUDOATC.id..string.format("EVENT: Place = %s" , tostring(EventData.PlaceName)))
self:T3(PSEUDOATC.id..string.format("EVENT: SubPlace = %s" , tostring(EventData.SubPlaceName)))
-- Event birth.
if Event.id == world.event.S_EVENT_BIRTH and _playername then
self:_OnBirth(EventData)
end
-- Event takeoff.
if Event.id == world.event.S_EVENT_TAKEOFF and _playername and EventData.Place then
self:_PlayerTakeOff(EventData)
end
-- Event land.
if Event.id == world.event.S_EVENT_LAND and _playername and EventData.Place then
self:_PlayerLanded(EventData)
end
-- Event player left unit
if Event.id == world.event.S_EVENT_PLAYER_LEAVE_UNIT and _playername then
self:_PlayerLeft(EventData)
end
-- Event crash ==> player left unit
if Event.id == world.event.S_EVENT_CRASH and _playername then
self:_PlayerLeft(EventData)
end
--[[
-- Event eject ==> player left unit
if Event.id == world.event.S_EVENT_EJECTION and _playername then
self:_PlayerLeft(EventData)
end
-- Event pilot dead ==> player left unit
if Event.id == world.event.S_EVENT_PILOT_DEAD and _playername then
self:_PlayerLeft(EventData)
end
]]
end
--- Function called my MOOSE event handler when a player enters a unit. --- Function called my MOOSE event handler when a player enters a unit.
-- @param #PSEUDOATC self -- @param #PSEUDOATC self
@@ -303,7 +217,9 @@ function PSEUDOATC:_OnBirth(EventData)
-- Get unit and player. -- Get unit and player.
local _unitName=EventData.IniUnitName local _unitName=EventData.IniUnitName
local _unit, _playername=self:_GetPlayerUnitAndName(_unitName) --local _unit, _playername=self:_GetPlayerUnitAndName(_unitName)
local _unit = EventData.IniUnit
local _playername = EventData.IniPlayerName
-- Check if a player entered. -- Check if a player entered.
if _unit and _playername then if _unit and _playername then
@@ -320,7 +236,10 @@ function PSEUDOATC:_PlayerLeft(EventData)
-- Get unit and player. -- Get unit and player.
local _unitName=EventData.IniUnitName local _unitName=EventData.IniUnitName
local _unit, _playername=self:_GetPlayerUnitAndName(_unitName) --local _unit, _playername=self:_GetPlayerUnitAndName(_unitName)
local _unit = EventData.IniUnit
local _playername = EventData.IniPlayerName
-- Check if a player left. -- Check if a player left.
if _unit and _playername then if _unit and _playername then
@@ -335,18 +254,16 @@ function PSEUDOATC:_PlayerLanded(EventData)
self:F({EventData=EventData}) self:F({EventData=EventData})
-- Get unit, player and place. -- Get unit, player and place.
local _unitName=EventData.IniUnitName local _unitName=EventData.IniUnitName
local _unit, _playername=self:_GetPlayerUnitAndName(_unitName) local _unit = EventData.IniUnit
local _playername = EventData.IniPlayerName
--local _unit, _playername=self:_GetPlayerUnitAndName(_unitName)
local _base=nil local _base=nil
local _baseName=nil local _baseName=nil
if EventData.place then if EventData.place then
_base=EventData.place _base=EventData.place
_baseName=EventData.place:getName() _baseName=EventData.place:getName()
end end
-- if EventData.subplace then
-- local _subPlace=EventData.subplace
-- local _subPlaceName=EventData.subplace:getName()
-- end
-- Call landed function. -- Call landed function.
if _unit and _playername and _base then if _unit and _playername and _base then
@@ -361,8 +278,10 @@ function PSEUDOATC:_PlayerTakeOff(EventData)
self:F({EventData=EventData}) self:F({EventData=EventData})
-- Get unit, player and place. -- Get unit, player and place.
local _unitName=EventData.IniUnitName local _unitName=EventData.IniUnitName
local _unit,_playername=self:_GetPlayerUnitAndName(_unitName) local _unit = EventData.IniUnit
local _playername = EventData.IniPlayerName
--local _unit,_playername=self:_GetPlayerUnitAndName(_unitName)
local _base=nil local _base=nil
local _baseName=nil local _baseName=nil
if EventData.place then if EventData.place then
@@ -450,9 +369,6 @@ function PSEUDOATC:PlayerLanded(unit, place)
local group=unit:GetGroup() local group=unit:GetGroup()
local GID=group:GetID() local GID=group:GetID()
local UID=unit:GetDCSObject():getID() local UID=unit:GetDCSObject():getID()
--local PlayerName=self.group[GID].player[UID].playername
--local UnitName=self.group[GID].player[UID].unitname
--local GroupName=self.group[GID].player[UID].groupname
local PlayerName = unit:GetPlayerName() or "Ghost" local PlayerName = unit:GetPlayerName() or "Ghost"
local UnitName = unit:GetName() or "Ghostplane" local UnitName = unit:GetName() or "Ghostplane"
local GroupName = group:GetName() or "Ghostgroup" local GroupName = group:GetName() or "Ghostgroup"
@@ -483,12 +399,6 @@ function PSEUDOATC:PlayerTakeOff(unit, place)
-- Gather some information. -- Gather some information.
local group=unit:GetGroup() local group=unit:GetGroup()
--local GID=group:GetID()
--local UID=unit:GetDCSObject():getID()
--local PlayerName=self.group[GID].player[UID].playername
--local CallSign=self.group[GID].player[UID].callsign
--local UnitName=self.group[GID].player[UID].unitname
--local GroupName=self.group[GID].player[UID].groupname
local PlayerName = unit:GetPlayerName() or "Ghost" local PlayerName = unit:GetPlayerName() or "Ghost"
local UnitName = unit:GetName() or "Ghostplane" local UnitName = unit:GetName() or "Ghostplane"
local GroupName = group:GetName() or "Ghostgroup" local GroupName = group:GetName() or "Ghostgroup"
@@ -926,7 +836,7 @@ function PSEUDOATC:AltitudeTimeStart(GID, UID)
self:T(PSEUDOATC.id..string.format("Starting altitude report timer for player ID %d.", UID)) self:T(PSEUDOATC.id..string.format("Starting altitude report timer for player ID %d.", UID))
-- Start timer. Altitude is reported every ~3 seconds. -- Start timer. Altitude is reported every ~3 seconds.
self.group[GID].player[UID].altimer, self.group[GID].player[UID].altimerid=SCHEDULER:New(nil, self.ReportHeight, {self, GID, UID, 0.1, true}, 1, 3) self.group[GID].player[UID].altimer, self.group[GID].player[UID].altimerid=SCHEDULER:New(nil, self.ReportHeight, {self, GID, UID, 1, true}, 1, 3)
end end
--- Stop/destroy DCS scheduler function for reporting altitude. --- Stop/destroy DCS scheduler function for reporting altitude.

View File

@@ -33,22 +33,17 @@
-- --
-- === -- ===
-- --
-- ## Missions: -- ## Additional Material:
-- --
-- ### [RAT - Random Air Traffic](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/RAT%20-%20Random%20Air%20Traffic) -- * **Demo Missions:** [GitHub](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/RAT)
-- * **YouTube videos:** [Random Air Traffic](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl0u4Zxywtg-mx_ov4vi68CO)
-- * **Guides:** None
-- --
-- === -- ===
-- --
-- # YouTube Channel -- ### Author: **funkyfranky**
-- --
-- ### [MOOSE YouTube Channel](https://www.youtube.com/channel/UCjrA9j5LQoWsG4SpS8i79Qg) -- ### Contributions: FlightControl
-- ### [MOOSE - RAT - Random Air Traffic](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl0u4Zxywtg-mx_ov4vi68CO)
--
-- ===
--
-- ### Author: **[funkyfranky](https://forums.eagle.ru/member.php?u=115026)**
--
-- ### Contributions: [FlightControl](https://forums.eagle.ru/member.php?u=89536)
-- --
-- === -- ===
-- @module Functional.RAT -- @module Functional.RAT
@@ -170,7 +165,7 @@
-- --
-- * A specific departure and/or destination airport can be chosen. -- * A specific departure and/or destination airport can be chosen.
-- * Valid coalitions can be set, e.g. only red, blue or neutral, all three "colours". -- * Valid coalitions can be set, e.g. only red, blue or neutral, all three "colours".
-- * It is possible to start in air within a zone defined in the mission editor or within a zone above an airport of the map. -- * It is possible to start in air within a zone or within a zone above an airport of the map.
-- --
-- ## Flight Plan -- ## Flight Plan
-- --
@@ -225,7 +220,7 @@
-- --
-- * Landing: When an aircraft tries to land at an airport where it does not have a valid parking spot, it is immidiately despawned the moment its wheels touch the runway, i.e. -- * Landing: When an aircraft tries to land at an airport where it does not have a valid parking spot, it is immidiately despawned the moment its wheels touch the runway, i.e.
-- when a landing event is triggered. This leads to the loss of the RAT aircraft. On possible way to circumvent the this problem is to let another RAT aircraft spawn at landing -- when a landing event is triggered. This leads to the loss of the RAT aircraft. On possible way to circumvent the this problem is to let another RAT aircraft spawn at landing
-- and not when it shuts down its engines. See the @{RAT.RespawnAfterLanding}() function. -- and not when it shuts down its engines. See the @{#RAT.RespawnAfterLanding}() function.
-- * Spawning: When a big aircraft is dynamically spawned on a small airbase a few things can go wrong. For example, it could be spawned at a parking spot with a shelter. -- * Spawning: When a big aircraft is dynamically spawned on a small airbase a few things can go wrong. For example, it could be spawned at a parking spot with a shelter.
-- Or it could be damaged by a scenery object when it is taxiing out to the runway, or it could overlap with other aircraft on parking spots near by. -- Or it could be damaged by a scenery object when it is taxiing out to the runway, or it could overlap with other aircraft on parking spots near by.
-- --
@@ -1179,13 +1174,13 @@ function RAT:SetTakeoffAir()
return self return self
end end
--- Set possible departure ports. This can be an airport or a zone defined in the mission editor. --- Set possible departure ports. This can be an airport or a zone.
-- @param #RAT self -- @param #RAT self
-- @param #string departurenames Name or table of names of departure airports or zones. -- @param #string departurenames Name or table of names of departure airports or zones.
-- @return #RAT RAT self object. -- @return #RAT RAT self object.
-- @usage RAT:SetDeparture("Sochi-Adler") will spawn RAT objects at Sochi-Adler airport. -- @usage RAT:SetDeparture("Sochi-Adler") will spawn RAT objects at Sochi-Adler airport.
-- @usage RAT:SetDeparture({"Sochi-Adler", "Gudauta"}) will spawn RAT aircraft radomly at Sochi-Adler or Gudauta airport. -- @usage RAT:SetDeparture({"Sochi-Adler", "Gudauta"}) will spawn RAT aircraft radomly at Sochi-Adler or Gudauta airport.
-- @usage RAT:SetDeparture({"Zone A", "Gudauta"}) will spawn RAT aircraft in air randomly within Zone A, which has to be defined in the mission editor, or within a zone around Gudauta airport. Note that this also requires RAT:takeoff("air") to be set. -- @usage RAT:SetDeparture({"Zone A", "Gudauta"}) will spawn RAT aircraft in air randomly within Zone A, or within a zone around Gudauta airport. Note that this also requires RAT:takeoff("air") to be set.
function RAT:SetDeparture(departurenames) function RAT:SetDeparture(departurenames)
self:F2(departurenames) self:F2(departurenames)
@@ -2474,11 +2469,11 @@ end
-- @param #RAT self -- @param #RAT self
-- @param #number takeoff Takeoff type. Could also be air start. -- @param #number takeoff Takeoff type. Could also be air start.
-- @param #number landing Landing type. Could also be a destination in air. -- @param #number landing Landing type. Could also be a destination in air.
-- @param Wrapper.Airport#AIRBASE _departure (Optional) Departure airbase. -- @param Wrapper.Airbase#AIRBASE _departure (Optional) Departure airbase.
-- @param Wrapper.Airport#AIRBASE _destination (Optional) Destination airbase. -- @param Wrapper.Airbase#AIRBASE _destination (Optional) Destination airbase.
-- @param #table _waypoint Initial waypoint. -- @param #table _waypoint Initial waypoint.
-- @return Wrapper.Airport#AIRBASE Departure airbase. -- @return Wrapper.Airbase#AIRBASE Departure airbase.
-- @return Wrapper.Airport#AIRBASE Destination airbase. -- @return Wrapper.Airbase#AIRBASE Destination airbase.
-- @return #table Table of flight plan waypoints. -- @return #table Table of flight plan waypoints.
-- @return #nil If no valid departure or destination airport could be found. -- @return #nil If no valid departure or destination airport could be found.
function RAT:_SetRoute(takeoff, landing, _departure, _destination, _waypoint) function RAT:_SetRoute(takeoff, landing, _departure, _destination, _waypoint)
@@ -2537,7 +2532,7 @@ function RAT:_SetRoute(takeoff, landing, _departure, _destination, _waypoint)
end end
elseif self:_ZoneExists(_departure) then elseif self:_ZoneExists(_departure) then
-- If it's not an airport, check whether it's a zone. -- If it's not an airport, check whether it's a zone.
departure=ZONE:New(_departure) departure=ZONE:FindByName(_departure)
else else
local text=string.format("ERROR! Specified departure airport %s does not exist for %s.", _departure, self.alias) local text=string.format("ERROR! Specified departure airport %s does not exist for %s.", _departure, self.alias)
self:E(RAT.id..text) self:E(RAT.id..text)
@@ -2635,7 +2630,7 @@ function RAT:_SetRoute(takeoff, landing, _departure, _destination, _waypoint)
end end
elseif self:_ZoneExists(_destination) then elseif self:_ZoneExists(_destination) then
destination=ZONE:New(_destination) destination=ZONE:FindByName(_destination)
else else
local text=string.format("ERROR: Specified destination airport/zone %s does not exist for %s!", _destination, self.alias) local text=string.format("ERROR: Specified destination airport/zone %s does not exist for %s!", _destination, self.alias)
self:E(RAT.id.."ERROR: "..text) self:E(RAT.id.."ERROR: "..text)
@@ -3142,7 +3137,7 @@ function RAT:_PickDeparture(takeoff)
end end
elseif self:_ZoneExists(name) then elseif self:_ZoneExists(name) then
if takeoff==RAT.wp.air then if takeoff==RAT.wp.air then
dep=ZONE:New(name) dep=ZONE:FindByName(name)
else else
self:E(RAT.id..string.format("ERROR! Takeoff is not in air. Cannot use %s as departure.", name)) self:E(RAT.id..string.format("ERROR! Takeoff is not in air. Cannot use %s as departure.", name))
end end
@@ -3254,7 +3249,7 @@ function RAT:_PickDestination(departure, q, minrange, maxrange, random, landing)
end end
elseif self:_ZoneExists(name) then elseif self:_ZoneExists(name) then
if landing==RAT.wp.air then if landing==RAT.wp.air then
dest=ZONE:New(name) dest=ZONE:FindByName(name)
else else
self:E(RAT.id..string.format("ERROR! Landing is not in air. Cannot use zone %s as destination!", name)) self:E(RAT.id..string.format("ERROR! Landing is not in air. Cannot use zone %s as destination!", name))
end end
@@ -3483,7 +3478,7 @@ function RAT:Status(message, forID)
-- Get group. -- Get group.
local group=ratcraft.group --Wrapper.Group#GROUP local group=ratcraft.group --Wrapper.Group#GROUP
if group and group:IsAlive() then if group and group:IsAlive() and (group:GetCoordinate() or group:GetVec3()) then
nalive=nalive+1 nalive=nalive+1
-- Gather some information. -- Gather some information.
@@ -3491,8 +3486,11 @@ function RAT:Status(message, forID)
local life=self:_GetLife(group) local life=self:_GetLife(group)
local fuel=group:GetFuel()*100.0 local fuel=group:GetFuel()*100.0
local airborne=group:InAir() local airborne=group:InAir()
local coords=group:GetCoordinate() local coords=group:GetCoordinate() or group:GetVec3()
local alt=coords.y or 1000 local alt=1000
if coords then
alt=coords.y or 1000
end
--local vel=group:GetVelocityKMH() --local vel=group:GetVelocityKMH()
local departure=ratcraft.departure:GetName() local departure=ratcraft.departure:GetName()
local destination=ratcraft.destination:GetName() local destination=ratcraft.destination:GetName()
@@ -4602,7 +4600,7 @@ function RAT:_TaskHolding(P1, Altitude, Speed, Duration)
end end
--- Function which is called after passing every waypoint. Info on waypoint is given and special functions are executed. --- Function which is called after passing every waypoint. Info on waypoint is given and special functions are executed.
-- @param Core.Group#GROUP group Group of aircraft. -- @param Wrapper.Group#GROUP group Group of aircraft.
-- @param #RAT rat RAT object. -- @param #RAT rat RAT object.
-- @param #number wp Waypoint index. Running number of the waypoints. Determines the actions to be executed. -- @param #number wp Waypoint index. Running number of the waypoints. Determines the actions to be executed.
function RAT._WaypointFunction(group, rat, wp) function RAT._WaypointFunction(group, rat, wp)
@@ -4927,12 +4925,12 @@ function RAT:_AirportExists(name)
return false return false
end end
--- Test if a trigger zone defined in the mission editor exists. --- Test if a zone exists.
-- @param #RAT self -- @param #RAT self
-- @param #string name -- @param #string name
-- @return #boolean True if zone exsits, false otherwise. -- @return #boolean True if zone exsits, false otherwise.
function RAT:_ZoneExists(name) function RAT:_ZoneExists(name)
local z=trigger.misc.getZone(name) local z=ZONE:FindByName(name) --trigger.misc.getZone(name) as suggested by @Viking on MOOSE discord #rat
if z then if z then
return true return true
end end
@@ -5490,7 +5488,7 @@ function RAT:_ATCInit(airports_map)
if not RAT.ATC.init then if not RAT.ATC.init then
local text local text
text="Starting RAT ATC.\nSimultanious = "..RAT.ATC.Nclearance.."\n".."Delay = "..RAT.ATC.delay text="Starting RAT ATC.\nSimultanious = "..RAT.ATC.Nclearance.."\n".."Delay = "..RAT.ATC.delay
BASE:T(RAT.id..text) BASE:T(RAT.id..text)
RAT.ATC.init=true RAT.ATC.init=true
for _,ap in pairs(airports_map) do for _,ap in pairs(airports_map) do
local name=ap:GetName() local name=ap:GetName()
@@ -5671,9 +5669,9 @@ function RAT:_ATCClearForLanding(airport, flight)
-- Debug message. -- Debug message.
local text1=string.format("ATC %s: Flight %s cleared for landing (flag=%d).", airport, flight, flagvalue) local text1=string.format("ATC %s: Flight %s cleared for landing (flag=%d).", airport, flight, flagvalue)
if string.find(flight,"#") then if string.find(flight,"#") then
flight = string.match(flight,"^(.+)#") flight = string.match(flight,"^(.+)#")
end end
local text2=string.format("ATC %s: Flight %s you are cleared for landing.", airport, flight) local text2=string.format("ATC %s: Flight %s you are cleared for landing.", airport, flight)
BASE:T( RAT.id..text1) BASE:T( RAT.id..text1)
MESSAGE:New(text2, 10):ToAllIf(RAT.ATC.messages) MESSAGE:New(text2, 10):ToAllIf(RAT.ATC.messages)
@@ -5716,9 +5714,9 @@ function RAT:_ATCFlightLanded(name)
local text1=string.format("ATC %s: Flight %s landed. Tholding = %i:%02d, Tfinal = %i:%02d.", dest, name, Thold/60, Thold%60, Tfinal/60, Tfinal%60) local text1=string.format("ATC %s: Flight %s landed. Tholding = %i:%02d, Tfinal = %i:%02d.", dest, name, Thold/60, Thold%60, Tfinal/60, Tfinal%60)
local text2=string.format("ATC %s: Number of flights still on final %d.", dest, RAT.ATC.airport[dest].Nonfinal) local text2=string.format("ATC %s: Number of flights still on final %d.", dest, RAT.ATC.airport[dest].Nonfinal)
local text3=string.format("ATC %s: Traffic report: Number of planes landed in total %d. Flights/hour = %3.2f.", dest, RAT.ATC.airport[dest].traffic, TrafficPerHour) local text3=string.format("ATC %s: Traffic report: Number of planes landed in total %d. Flights/hour = %3.2f.", dest, RAT.ATC.airport[dest].traffic, TrafficPerHour)
if string.find(name,"#") then if string.find(name,"#") then
name = string.match(name,"^(.+)#") name = string.match(name,"^(.+)#")
end end
local text4=string.format("ATC %s: Flight %s landed. Welcome to %s.", dest, name, dest) local text4=string.format("ATC %s: Flight %s landed. Welcome to %s.", dest, name, dest)
BASE:T(RAT.id..text1) BASE:T(RAT.id..text1)
BASE:T(RAT.id..text2) BASE:T(RAT.id..text2)
@@ -5832,6 +5830,7 @@ RATMANAGER={
rat={}, rat={},
name={}, name={},
alive={}, alive={},
planned={},
min={}, min={},
nrat=0, nrat=0,
ntot=nil, ntot=nil,
@@ -5880,6 +5879,7 @@ function RATMANAGER:Add(ratobject,min)
self.rat[self.nrat]=ratobject self.rat[self.nrat]=ratobject
self.alive[self.nrat]=0 self.alive[self.nrat]=0
self.planned[self.nrat]=0
self.name[self.nrat]=ratobject.alias self.name[self.nrat]=ratobject.alias
self.min[self.nrat]=min or 1 self.min[self.nrat]=min or 1
@@ -6020,11 +6020,25 @@ function RATMANAGER:_Manage()
for i=1,self.nrat do for i=1,self.nrat do
for j=1,N[i] do for j=1,N[i] do
time=time+self.dTspawn time=time+self.dTspawn
SCHEDULER:New(nil, RAT._SpawnWithRoute, {self.rat[i]}, time) self.planned[i]=self.planned[i]+1
SCHEDULER:New(nil, RATMANAGER._Spawn, {self, i}, time)
end end
end end
end end
--- Instantly starts the RAT manager and spawns the initial random number RAT groups for each RAT object.
-- @param #RATMANAGER self
-- @param #RATMANAGER RATMANAGER self object.
-- @param #number i Index.
function RATMANAGER:_Spawn(i)
local rat=self.rat[i] --#RAT
rat:_SpawnWithRoute()
self.planned[i]=self.planned[i]-1
end
--- Counts the number of alive RAT objects. --- Counts the number of alive RAT objects.
-- @param #RATMANAGER self -- @param #RATMANAGER self
function RATMANAGER:_Count() function RATMANAGER:_Count()
@@ -6053,7 +6067,7 @@ function RATMANAGER:_Count()
ntotal=ntotal+n ntotal=ntotal+n
-- Debug output. -- Debug output.
local text=string.format("Number of alive groups of %s = %d", self.name[i], n) local text=string.format("Number of alive groups of %s = %d, planned=%d", self.name[i], n, self.planned[i])
self:T(RATMANAGER.id..text) self:T(RATMANAGER.id..text)
end end
@@ -6083,9 +6097,10 @@ function RATMANAGER:_RollDice(nrat,ntot,min,alive)
local M={} local M={}
local P={} local P={}
for i=1,nrat do for i=1,nrat do
local a=alive[i]+self.planned[i]
N[#N+1]=0 N[#N+1]=0
M[#M+1]=math.max(alive[i], min[i]) M[#M+1]=math.max(a, min[i])
P[#P+1]=math.max(min[i]-alive[i],0) P[#P+1]=math.max(min[i]-a,0)
end end
-- Min/max group arrays. -- Min/max group arrays.
@@ -6102,7 +6117,7 @@ function RATMANAGER:_RollDice(nrat,ntot,min,alive)
-- Number of new groups to be added. -- Number of new groups to be added.
local nnew=ntot local nnew=ntot
for i=1,nrat do for i=1,nrat do
nnew=nnew-alive[i] nnew=nnew-alive[i]-self.planned[i]
end end
for i=1,nrat-1 do for i=1,nrat-1 do
@@ -6134,7 +6149,7 @@ function RATMANAGER:_RollDice(nrat,ntot,min,alive)
end end
-- Debug info -- Debug info
self:T3(string.format("RATMANAGER: i=%d, alive=%d, min=%d, mini=%d, maxi=%d, add=%d, sumN=%d, sumP=%d", j, alive[j], min[j], mini[j], maxi[j], N[j],sN, sP)) self:T3(string.format("RATMANAGER: i=%d, alive=%d, planned=%d, min=%d, mini=%d, maxi=%d, add=%d, sumN=%d, sumP=%d", j, alive[j], self.planned[i], min[j], mini[j], maxi[j], N[j],sN, sP))
end end
@@ -6149,7 +6164,7 @@ function RATMANAGER:_RollDice(nrat,ntot,min,alive)
-- Debug info -- Debug info
local text=RATMANAGER.id.."\n" local text=RATMANAGER.id.."\n"
for i=1,nrat do for i=1,nrat do
text=text..string.format("%s: i=%d, alive=%d, min=%d, mini=%d, maxi=%d, add=%d\n", self.name[i], i, alive[i], min[i], mini[i], maxi[i], N[i]) text=text..string.format("%s: i=%d, alive=%d, planned=%d, min=%d, mini=%d, maxi=%d, add=%d\n", self.name[i], i, alive[i], self.planned[i], min[i], mini[i], maxi[i], N[i])
end end
text=text..string.format("Total # of groups to add = %d", sum(N, done)) text=text..string.format("Total # of groups to add = %d", sum(N, done))
self:T(text) self:T(text)

File diff suppressed because it is too large Load Diff

View File

@@ -19,7 +19,7 @@
-- --
-- ## Missions: -- ## Missions:
-- --
-- [SCO - Scoring](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SCO%20-%20Scoring) -- [SCO - Scoring](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/Scoring)
-- --
-- === -- ===
-- --
@@ -27,7 +27,7 @@
-- and creates a CSV file logging the scoring events and results for use at team or squadron websites. -- and creates a CSV file logging the scoring events and results for use at team or squadron websites.
-- --
-- SCORING automatically calculates the threat level of the objects hit and destroyed by players, -- SCORING automatically calculates the threat level of the objects hit and destroyed by players,
-- which can be @{Wrapper.Unit}, @{Static) and @{Scenery} objects. -- which can be @{Wrapper.Unit}, @{Wrapper.Static) and @{Scenery} objects.
-- --
-- Positive score points are granted when enemy or neutral targets are destroyed. -- Positive score points are granted when enemy or neutral targets are destroyed.
-- Negative score points or penalties are given when a friendly target is hit or destroyed. -- Negative score points or penalties are given when a friendly target is hit or destroyed.
@@ -81,7 +81,7 @@
-- --
-- * **Wingthor (TAW)**: Testing & Advice. -- * **Wingthor (TAW)**: Testing & Advice.
-- * **Dutch-Baron (TAW)**: Testing & Advice. -- * **Dutch-Baron (TAW)**: Testing & Advice.
-- * **[Whisper](http://forums.eagle.ru/member.php?u=3829): Testing and Advice. -- * **Whisper**: Testing and Advice.
-- --
-- === -- ===
-- --
@@ -226,6 +226,7 @@ SCORING = {
ClassID = 0, ClassID = 0,
Players = {}, Players = {},
AutoSave = true, AutoSave = true,
version = "1.17.1"
} }
local _SCORINGCoalition = { local _SCORINGCoalition = {
@@ -275,9 +276,15 @@ function SCORING:New( GameName )
self:SetMessagesZone( true ) self:SetMessagesZone( true )
-- Scales -- Scales
self:SetScaleDestroyScore( 10 ) self:SetScaleDestroyScore( 10 )
self:SetScaleDestroyPenalty( 30 ) self:SetScaleDestroyPenalty( 30 )
-- Hitting a target multiple times before destoying it should not result in a higger score
-- Multiple hits is typically a results of bombs/missles missing their target but still inflict some spash damage
-- Making this configurable to anyone can enable this anyway if they want
self:SetScoreIncrementOnHit(0)
-- Default fratricide penalty level (maximum penalty that can be assigned to a player before he gets kicked). -- Default fratricide penalty level (maximum penalty that can be assigned to a player before he gets kicked).
self:SetFratricide( self.ScaleDestroyPenalty * 3 ) self:SetFratricide( self.ScaleDestroyPenalty * 3 )
self.penaltyonfratricide = true self.penaltyonfratricide = true
@@ -466,6 +473,16 @@ function SCORING:SetMessagesHit( OnOff )
return self return self
end end
--- Configure to increment score after a target has been hit.
-- @param #SCORING self
-- @param #number score amount of point to inclement score on each hit
-- @return #SCORING
function SCORING:SetScoreIncrementOnHit( score )
self.ScoreIncrementOnHit = score
return self
end
--- If to send messages after a target has been hit. --- If to send messages after a target has been hit.
-- @param #SCORING self -- @param #SCORING self
-- @return #boolean -- @return #boolean
@@ -659,7 +676,7 @@ function SCORING:_AddPlayerFromUnit( UnitData )
self.Players[PlayerName].Penalty = self.Players[PlayerName].Penalty + self.CoalitionChangePenalty or 50 self.Players[PlayerName].Penalty = self.Players[PlayerName].Penalty + self.CoalitionChangePenalty or 50
self.Players[PlayerName].PenaltyCoalition = self.Players[PlayerName].PenaltyCoalition + 1 self.Players[PlayerName].PenaltyCoalition = self.Players[PlayerName].PenaltyCoalition + 1
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' changed coalition from " .. _SCORINGCoalition[self.Players[PlayerName].UnitCoalition] .. " to " .. _SCORINGCoalition[UnitCoalition] .. MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' changed coalition from " .. _SCORINGCoalition[self.Players[PlayerName].UnitCoalition] .. " to " .. _SCORINGCoalition[UnitCoalition] ..
"(changed " .. self.Players[PlayerName].PenaltyCoalition .. " times the coalition). ".. self.CoalitionChangePenalty .."Penalty points added.", "(changed " .. self.Players[PlayerName].PenaltyCoalition .. " times the coalition). ".. self.CoalitionChangePenalty .." penalty points added.",
MESSAGE.Type.Information MESSAGE.Type.Information
):ToAll() ):ToAll()
self:ScoreCSV( PlayerName, "", "COALITION_PENALTY", 1, -1*self.CoalitionChangePenalty, self.Players[PlayerName].UnitName, _SCORINGCoalition[self.Players[PlayerName].UnitCoalition], _SCORINGCategory[self.Players[PlayerName].UnitCategory], self.Players[PlayerName].UnitType, self:ScoreCSV( PlayerName, "", "COALITION_PENALTY", 1, -1*self.CoalitionChangePenalty, self.Players[PlayerName].UnitName, _SCORINGCoalition[self.Players[PlayerName].UnitCoalition], _SCORINGCategory[self.Players[PlayerName].UnitCategory], self.Players[PlayerName].UnitType,
@@ -715,11 +732,11 @@ function SCORING:AddGoalScorePlayer( PlayerName, GoalTag, Text, Score )
PlayerData.Goals[GoalTag] = PlayerData.Goals[GoalTag] or { Score = 0 } PlayerData.Goals[GoalTag] = PlayerData.Goals[GoalTag] or { Score = 0 }
PlayerData.Goals[GoalTag].Score = PlayerData.Goals[GoalTag].Score + Score PlayerData.Goals[GoalTag].Score = PlayerData.Goals[GoalTag].Score + Score
PlayerData.Score = PlayerData.Score + Score PlayerData.Score = PlayerData.Score + Score
if Text then
MESSAGE:NewType( self.DisplayMessagePrefix .. Text, MESSAGE:NewType( self.DisplayMessagePrefix .. Text,
MESSAGE.Type.Information ) MESSAGE.Type.Information )
:ToAll() :ToAll()
end
self:ScoreCSV( PlayerName, "", "GOAL_" .. string.upper( GoalTag ), 1, Score, nil ) self:ScoreCSV( PlayerName, "", "GOAL_" .. string.upper( GoalTag ), 1, Score, nil )
end end
end end
@@ -738,7 +755,7 @@ function SCORING:AddGoalScore( PlayerUnit, GoalTag, Text, Score )
local PlayerName = PlayerUnit:GetPlayerName() local PlayerName = PlayerUnit:GetPlayerName()
self:F( { PlayerUnit.UnitName, PlayerName, GoalTag, Text, Score } ) self:T2( { PlayerUnit.UnitName, PlayerName, GoalTag, Text, Score } )
-- PlayerName can be nil, if the Unit with the player crashed or due to another reason. -- PlayerName can be nil, if the Unit with the player crashed or due to another reason.
if PlayerName then if PlayerName then
@@ -747,11 +764,12 @@ function SCORING:AddGoalScore( PlayerUnit, GoalTag, Text, Score )
PlayerData.Goals[GoalTag] = PlayerData.Goals[GoalTag] or { Score = 0 } PlayerData.Goals[GoalTag] = PlayerData.Goals[GoalTag] or { Score = 0 }
PlayerData.Goals[GoalTag].Score = PlayerData.Goals[GoalTag].Score + Score PlayerData.Goals[GoalTag].Score = PlayerData.Goals[GoalTag].Score + Score
PlayerData.Score = PlayerData.Score + Score PlayerData.Score = PlayerData.Score + Score
MESSAGE:NewType( self.DisplayMessagePrefix .. Text, if Text then
MESSAGE:NewType( self.DisplayMessagePrefix .. Text,
MESSAGE.Type.Information ) MESSAGE.Type.Information )
:ToAll() :ToAll()
end
self:ScoreCSV( PlayerName, "", "GOAL_" .. string.upper( GoalTag ), 1, Score, PlayerUnit:GetName() ) self:ScoreCSV( PlayerName, "", "GOAL_" .. string.upper( GoalTag ), 1, Score, PlayerUnit:GetName() )
end end
end end
@@ -784,11 +802,12 @@ function SCORING:_AddMissionTaskScore( Mission, PlayerUnit, Text, Score )
PlayerData.Score = self.Players[PlayerName].Score + Score PlayerData.Score = self.Players[PlayerName].Score + Score
PlayerData.Mission[MissionName].ScoreTask = self.Players[PlayerName].Mission[MissionName].ScoreTask + Score PlayerData.Mission[MissionName].ScoreTask = self.Players[PlayerName].Mission[MissionName].ScoreTask + Score
MESSAGE:NewType( self.DisplayMessagePrefix .. Mission:GetText() .. " : " .. Text .. " Score: " .. Score, if Text then
MESSAGE.Type.Information ) MESSAGE:NewType( self.DisplayMessagePrefix .. Mission:GetText() .. " : " .. Text .. " Score: " .. Score,
:ToAll() MESSAGE.Type.Information )
:ToAll()
end
self:ScoreCSV( PlayerName, "", "TASK_" .. MissionName:gsub( ' ', '_' ), 1, Score, PlayerUnit:GetName() ) self:ScoreCSV( PlayerName, "", "TASK_" .. MissionName:gsub( ' ', '_' ), 1, Score, PlayerUnit:GetName() )
end end
end end
@@ -820,9 +839,11 @@ function SCORING:_AddMissionGoalScore( Mission, PlayerName, Text, Score )
PlayerData.Score = self.Players[PlayerName].Score + Score PlayerData.Score = self.Players[PlayerName].Score + Score
PlayerData.Mission[MissionName].ScoreTask = self.Players[PlayerName].Mission[MissionName].ScoreTask + Score PlayerData.Mission[MissionName].ScoreTask = self.Players[PlayerName].Mission[MissionName].ScoreTask + Score
MESSAGE:NewType( string.format( "%s%s: %s! Player %s receives %d score!", self.DisplayMessagePrefix, Mission:GetText(), Text, PlayerName, Score ), MESSAGE.Type.Information ):ToAll() if Text then
MESSAGE:NewType( string.format( "%s%s: %s! Player %s receives %d score!", self.DisplayMessagePrefix, Mission:GetText(), Text, PlayerName, Score ), MESSAGE.Type.Information ):ToAll()
end
self:ScoreCSV( PlayerName, "", "TASK_" .. MissionName:gsub( ' ', '_' ), 1, Score ) self:ScoreCSV( PlayerName, "", "TASK_" .. MissionName:gsub( ' ', '_' ), 1, Score )
end end
end end
@@ -847,11 +868,12 @@ function SCORING:_AddMissionScore( Mission, Text, Score )
PlayerData.Score = PlayerData.Score + Score PlayerData.Score = PlayerData.Score + Score
PlayerData.Mission[MissionName].ScoreMission = PlayerData.Mission[MissionName].ScoreMission + Score PlayerData.Mission[MissionName].ScoreMission = PlayerData.Mission[MissionName].ScoreMission + Score
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' has " .. Text .. " in " .. Mission:GetText() .. ". " .. Score .. " mission score!", if Text then
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' has " .. Text .. " in " .. Mission:GetText() .. ". " .. Score .. " mission score!",
MESSAGE.Type.Information ) MESSAGE.Type.Information )
:ToAll() :ToAll()
end
self:ScoreCSV( PlayerName, "", "MISSION_" .. MissionName:gsub( ' ', '_' ), 1, Score ) self:ScoreCSV( PlayerName, "", "MISSION_" .. MissionName:gsub( ' ', '_' ), 1, Score )
end end
end end
@@ -873,10 +895,13 @@ end
function SCORING:OnEventBirth( Event ) function SCORING:OnEventBirth( Event )
if Event.IniUnit then if Event.IniUnit then
Event.IniUnit.ThreatLevel, Event.IniUnit.ThreatType = Event.IniUnit:GetThreatLevel()
if Event.IniObjectCategory == 1 then if Event.IniObjectCategory == 1 then
local PlayerName = Event.IniUnit:GetPlayerName() local PlayerName = Event.IniUnit:GetPlayerName()
Event.IniUnit.BirthTime = timer.getTime()
if PlayerName then if PlayerName then
self:_AddPlayerFromUnit( Event.IniUnit ) self:_AddPlayerFromUnit( Event.IniUnit )
self.Players[PlayerName].PlayerKills = 0
self:SetScoringMenu( Event.IniGroup ) self:SetScoringMenu( Event.IniGroup )
end end
end end
@@ -1005,8 +1030,19 @@ function SCORING:_EventOnHit( Event )
PlayerHit.PenaltyHit = PlayerHit.PenaltyHit or 0 PlayerHit.PenaltyHit = PlayerHit.PenaltyHit or 0
PlayerHit.TimeStamp = PlayerHit.TimeStamp or 0 PlayerHit.TimeStamp = PlayerHit.TimeStamp or 0
PlayerHit.UNIT = PlayerHit.UNIT or TargetUNIT PlayerHit.UNIT = PlayerHit.UNIT or TargetUNIT
PlayerHit.ThreatLevel, PlayerHit.ThreatType = PlayerHit.UNIT:GetThreatLevel() -- After an instant kill we can't compute the thread level anymore. To fix this we compute at OnEventBirth
if PlayerHit.UNIT.ThreatType == nil then
PlayerHit.ThreatLevel, PlayerHit.ThreatType = PlayerHit.UNIT:GetThreatLevel()
-- if this fails for some reason, set a good default value
if PlayerHit.ThreatType == nil then
PlayerHit.ThreatLevel = 1
PlayerHit.ThreatType = "Unknown"
end
else
PlayerHit.ThreatLevel = PlayerHit.UNIT.ThreatLevel
PlayerHit.ThreatType = PlayerHit.UNIT.ThreatType
end
-- Only grant hit scores if there was more than one second between the last hit. -- Only grant hit scores if there was more than one second between the last hit.
if timer.getTime() - PlayerHit.TimeStamp > 1 then if timer.getTime() - PlayerHit.TimeStamp > 1 then
PlayerHit.TimeStamp = timer.getTime() PlayerHit.TimeStamp = timer.getTime()
@@ -1021,27 +1057,28 @@ function SCORING:_EventOnHit( Event )
if InitCoalition then -- A coalition object was hit. if InitCoalition then -- A coalition object was hit.
if InitCoalition == TargetCoalition then if InitCoalition == TargetCoalition then
Player.Penalty = Player.Penalty + 10 local Penalty = 10
PlayerHit.Penalty = PlayerHit.Penalty + 10 Player.Penalty = Player.Penalty + Penalty
PlayerHit.Penalty = PlayerHit.Penalty + Penalty
PlayerHit.PenaltyHit = PlayerHit.PenaltyHit + 1 PlayerHit.PenaltyHit = PlayerHit.PenaltyHit + 1
if TargetPlayerName ~= nil then -- It is a player hitting another player ... if TargetPlayerName ~= nil then -- It is a player hitting another player ...
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit friendly player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.PenaltyHit .. " times. " .. MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit friendly player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.PenaltyHit .. " times. " ..
"Penalty: -" .. PlayerHit.Penalty .. ". Score Total:" .. Player.Score - Player.Penalty, "Penalty: -" .. Penalty .. ". Score Total:" .. Player.Score - Player.Penalty,
MESSAGE.Type.Update ) MESSAGE.Type.Update )
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() ) :ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
:ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() ) :ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
else else
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit friendly target " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.PenaltyHit .. " times. " .. MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit friendly target " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.PenaltyHit .. " times. " ..
"Penalty: -" .. PlayerHit.Penalty .. ". Score Total:" .. Player.Score - Player.Penalty, "Penalty: -" .. Penalty .. ". Score Total:" .. Player.Score - Player.Penalty,
MESSAGE.Type.Update ) MESSAGE.Type.Update )
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() ) :ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
:ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() ) :ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
end end
self:ScoreCSV( InitPlayerName, TargetPlayerName, "HIT_PENALTY", 1, -10, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType ) self:ScoreCSV( InitPlayerName, TargetPlayerName, "HIT_PENALTY", 1, -10, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
else else
Player.Score = Player.Score + 1 Player.Score = Player.Score + self.ScoreIncrementOnHit
PlayerHit.Score = PlayerHit.Score + 1 PlayerHit.Score = PlayerHit.Score + self.ScoreIncrementOnHit
PlayerHit.ScoreHit = PlayerHit.ScoreHit + 1 PlayerHit.ScoreHit = PlayerHit.ScoreHit + 1
if TargetPlayerName ~= nil then -- It is a player hitting another player ... if TargetPlayerName ~= nil then -- It is a player hitting another player ...
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit enemy player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.ScoreHit .. " times. " .. MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit enemy player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.ScoreHit .. " times. " ..
@@ -1104,7 +1141,18 @@ function SCORING:_EventOnHit( Event )
PlayerHit.PenaltyHit = PlayerHit.PenaltyHit or 0 PlayerHit.PenaltyHit = PlayerHit.PenaltyHit or 0
PlayerHit.TimeStamp = PlayerHit.TimeStamp or 0 PlayerHit.TimeStamp = PlayerHit.TimeStamp or 0
PlayerHit.UNIT = PlayerHit.UNIT or TargetUNIT PlayerHit.UNIT = PlayerHit.UNIT or TargetUNIT
PlayerHit.ThreatLevel, PlayerHit.ThreatType = PlayerHit.UNIT:GetThreatLevel() -- After an instant kill we can't compute the thread level anymore. To fix this we compute at OnEventBirth
if PlayerHit.UNIT.ThreatType == nil then
PlayerHit.ThreatLevel, PlayerHit.ThreatType = PlayerHit.UNIT:GetThreatLevel()
-- if this fails for some reason, set a good default value
if PlayerHit.ThreatType == nil then
PlayerHit.ThreatLevel = 1
PlayerHit.ThreatType = "Unknown"
end
else
PlayerHit.ThreatLevel = PlayerHit.UNIT.ThreatLevel
PlayerHit.ThreatType = PlayerHit.UNIT.ThreatType
end
-- Only grant hit scores if there was more than one second between the last hit. -- Only grant hit scores if there was more than one second between the last hit.
if timer.getTime() - PlayerHit.TimeStamp > 1 then if timer.getTime() - PlayerHit.TimeStamp > 1 then
@@ -1115,25 +1163,26 @@ function SCORING:_EventOnHit( Event )
if InitCoalition then -- A coalition object was hit, probably a static. if InitCoalition then -- A coalition object was hit, probably a static.
if InitCoalition == TargetCoalition then if InitCoalition == TargetCoalition then
-- TODO: Penalty according scale -- TODO: Penalty according scale
Player.Penalty = Player.Penalty + 10 --* self.ScaleDestroyPenalty local Penalty = 10
PlayerHit.Penalty = PlayerHit.Penalty + 10 --* self.ScaleDestroyPenalty Player.Penalty = Player.Penalty + Penalty --* self.ScaleDestroyPenalty
PlayerHit.Penalty = PlayerHit.Penalty + Penalty --* self.ScaleDestroyPenalty
PlayerHit.PenaltyHit = PlayerHit.PenaltyHit + 1 * self.ScaleDestroyPenalty PlayerHit.PenaltyHit = PlayerHit.PenaltyHit + 1 * self.ScaleDestroyPenalty
MESSAGE MESSAGE
:NewType( self.DisplayMessagePrefix .. "Player '" .. Event.WeaponPlayerName .. "' hit friendly target " .. :NewType( self.DisplayMessagePrefix .. "Player '" .. Event.WeaponPlayerName .. "' hit friendly target " ..
TargetUnitCategory .. " ( " .. TargetType .. " ) " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " ..
"Penalty: -" .. PlayerHit.Penalty .. " = " .. Player.Score - Player.Penalty, "Penalty: -" .. Penalty .. " = " .. Player.Score - Player.Penalty,
MESSAGE.Type.Update MESSAGE.Type.Update
) )
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() ) :ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
:ToCoalitionIf( Event.WeaponCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() ) :ToCoalitionIf( Event.WeaponCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
self:ScoreCSV( Event.WeaponPlayerName, TargetPlayerName, "HIT_PENALTY", 1, -10, Event.WeaponName, Event.WeaponCoalition, Event.WeaponCategory, Event.WeaponTypeName, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType ) self:ScoreCSV( Event.WeaponPlayerName, TargetPlayerName, "HIT_PENALTY", 1, -10, Event.WeaponName, Event.WeaponCoalition, Event.WeaponCategory, Event.WeaponTypeName, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
else else
Player.Score = Player.Score + 1 Player.Score = Player.Score + self.ScoreIncrementOnHit
PlayerHit.Score = PlayerHit.Score + 1 PlayerHit.Score = PlayerHit.Score + self.ScoreIncrementOnHit
PlayerHit.ScoreHit = PlayerHit.ScoreHit + 1 PlayerHit.ScoreHit = PlayerHit.ScoreHit + 1
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. Event.WeaponPlayerName .. "' hit enemy target " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. Event.WeaponPlayerName .. "' hit enemy target " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " ..
"Score: +" .. PlayerHit.Score .. " = " .. Player.Score - Player.Penalty, "Score: " .. PlayerHit.Score .. ". Score Total:" .. Player.Score - Player.Penalty,
MESSAGE.Type.Update ) MESSAGE.Type.Update )
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() ) :ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
:ToCoalitionIf( Event.WeaponCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() ) :ToCoalitionIf( Event.WeaponCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
@@ -1211,7 +1260,7 @@ function SCORING:_EventOnDeadOrCrash( Event )
local Destroyed = false local Destroyed = false
-- What is the player destroying? -- What is the player destroying?
if Player and Player.Hit and Player.Hit[TargetCategory] and Player.Hit[TargetCategory][TargetUnitName] and Player.Hit[TargetCategory][TargetUnitName].TimeStamp ~= 0 then -- Was there a hit for this unit for this player before registered??? if Player and Player.Hit and Player.Hit[TargetCategory] and Player.Hit[TargetCategory][TargetUnitName] and Player.Hit[TargetCategory][TargetUnitName].TimeStamp ~= 0 and (TargetUnit.BirthTime == nil or Player.Hit[TargetCategory][TargetUnitName].TimeStamp > TargetUnit.BirthTime) then -- Was there a hit for this unit for this player before registered???
local TargetThreatLevel = Player.Hit[TargetCategory][TargetUnitName].ThreatLevel local TargetThreatLevel = Player.Hit[TargetCategory][TargetUnitName].ThreatLevel
local TargetThreatType = Player.Hit[TargetCategory][TargetUnitName].ThreatType local TargetThreatType = Player.Hit[TargetCategory][TargetUnitName].ThreatType
@@ -1238,15 +1287,20 @@ function SCORING:_EventOnDeadOrCrash( Event )
TargetDestroy.Penalty = TargetDestroy.Penalty + ThreatPenalty TargetDestroy.Penalty = TargetDestroy.Penalty + ThreatPenalty
TargetDestroy.PenaltyDestroy = TargetDestroy.PenaltyDestroy + 1 TargetDestroy.PenaltyDestroy = TargetDestroy.PenaltyDestroy + 1
self:OnKillPvP(Player, TargetPlayerName, true, TargetThreatLevel, Player.ThreatLevel, ThreatPenalty)
if Player.HitPlayers[TargetPlayerName] then -- A player destroyed another player if Player.HitPlayers[TargetPlayerName] then -- A player destroyed another player
self:OnKillPvP(Player, TargetPlayerName, true)
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed friendly player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " .. MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed friendly player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
"Penalty: -" .. TargetDestroy.Penalty .. " = " .. Player.Score - Player.Penalty, "Penalty: -" .. ThreatPenalty .. " = " .. Player.Score - Player.Penalty,
MESSAGE.Type.Information ) MESSAGE.Type.Information )
:ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() ) :ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() )
:ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() ) :ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() )
else else
self:OnKillPvE(Player, TargetUnitName, true, TargetThreatLevel, Player.ThreatLevel, ThreatPenalty)
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed friendly target " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " .. MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed friendly target " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
"Penalty: -" .. TargetDestroy.Penalty .. " = " .. Player.Score - Player.Penalty, "Penalty: -" .. ThreatPenalty .. " = " .. Player.Score - Player.Penalty,
MESSAGE.Type.Information ) MESSAGE.Type.Information )
:ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() ) :ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() )
:ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() ) :ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() )
@@ -1267,14 +1321,21 @@ function SCORING:_EventOnDeadOrCrash( Event )
TargetDestroy.Score = TargetDestroy.Score + ThreatScore TargetDestroy.Score = TargetDestroy.Score + ThreatScore
TargetDestroy.ScoreDestroy = TargetDestroy.ScoreDestroy + 1 TargetDestroy.ScoreDestroy = TargetDestroy.ScoreDestroy + 1
if Player.HitPlayers[TargetPlayerName] then -- A player destroyed another player if Player.HitPlayers[TargetPlayerName] then -- A player destroyed another player
if Player.PlayerKills ~= nil then
Player.PlayerKills = Player.PlayerKills + 1
else
Player.PlayerKills = 1
end
self:OnKillPvP(Player, TargetPlayerName, false, TargetThreatLevel, Player.ThreatLevel, ThreatScore)
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed enemy player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " .. MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed enemy player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
"Score: +" .. TargetDestroy.Score .. " = " .. Player.Score - Player.Penalty, "Score: +" .. ThreatScore .. " = " .. Player.Score - Player.Penalty,
MESSAGE.Type.Information ) MESSAGE.Type.Information )
:ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() ) :ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() )
:ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() ) :ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() )
else else
self:OnKillPvE(Player, TargetUnitName, false, TargetThreatLevel, Player.ThreatLevel, ThreatScore)
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed enemy " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " .. MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed enemy " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
"Score: +" .. TargetDestroy.Score .. " = " .. Player.Score - Player.Penalty, "Score: +" .. ThreatScore .. " = " .. Player.Score - Player.Penalty,
MESSAGE.Type.Information ) MESSAGE.Type.Information )
:ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() ) :ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() )
:ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() ) :ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() )
@@ -1385,7 +1446,7 @@ function SCORING:ReportDetailedPlayerHits( PlayerName )
Penalty = Penalty + UnitData.Penalty Penalty = Penalty + UnitData.Penalty
PenaltyHit = UnitData.PenaltyHit PenaltyHit = UnitData.PenaltyHit
end end
local ScoreMessageHit = string.format( "%s:%d ", CategoryName, Score - Penalty ) local ScoreMessageHit = string.format( "%s: %d ", CategoryName, Score - Penalty )
self:T( ScoreMessageHit ) self:T( ScoreMessageHit )
ScoreMessageHits = ScoreMessageHits .. ScoreMessageHit ScoreMessageHits = ScoreMessageHits .. ScoreMessageHit
PlayerScore = PlayerScore + Score PlayerScore = PlayerScore + Score
@@ -1441,7 +1502,7 @@ function SCORING:ReportDetailedPlayerDestroys( PlayerName )
end end
end end
local ScoreMessageDestroy = string.format( " %s:%d ", CategoryName, Score - Penalty ) local ScoreMessageDestroy = string.format( " %s: %d ", CategoryName, Score - Penalty )
self:T( ScoreMessageDestroy ) self:T( ScoreMessageDestroy )
ScoreMessageDestroys = ScoreMessageDestroys .. ScoreMessageDestroy ScoreMessageDestroys = ScoreMessageDestroys .. ScoreMessageDestroy
@@ -1732,9 +1793,9 @@ function SCORING:SecondsToClock( sSeconds )
-- return nil; -- return nil;
return "00:00:00"; return "00:00:00";
else else
nHours = string.format( "%02.f", math.floor( nSeconds / 3600 ) ); local nHours = string.format( "%02.f", math.floor( nSeconds / 3600 ) );
nMins = string.format( "%02.f", math.floor( nSeconds / 60 - (nHours * 60) ) ); local nMins = string.format( "%02.f", math.floor( nSeconds / 60 - (nHours * 60) ) );
nSecs = string.format( "%02.f", math.floor( nSeconds - nHours * 3600 - nMins * 60 ) ); local nSecs = string.format( "%02.f", math.floor( nSeconds - nHours * 3600 - nMins * 60 ) );
return nHours .. ":" .. nMins .. ":" .. nSecs return nHours .. ":" .. nMins .. ":" .. nSecs
end end
end end
@@ -1871,3 +1932,26 @@ function SCORING:SwitchAutoSave(OnOff)
self.AutoSave = OnOff self.AutoSave = OnOff
return self return self
end end
--- Handles the event when one player kill another player
-- @param #SCORING self
-- @param #PLAYER Player the ataching player
-- @param #string TargetPlayerName the name of the killed player
-- @param #bool IsTeamKill true if this kill was a team kill
-- @param #number TargetThreatLevel Thread level of the target
-- @param #number PlayerThreatLevelThread level of the player
-- @param #number Score The score based on both threat levels
function SCORING:OnKillPvP(Player, TargetPlayerName, IsTeamKill, TargetThreatLevel, PlayerThreatLevel, Score)
end
--- Handles the event when one player kill another player
-- @param #SCORING self
-- @param #PLAYER Player the ataching player
-- @param #string TargetUnitName the name of the killed unit
-- @param #bool IsTeamKill true if this kill was a team kill
-- @param #number TargetThreatLevel Thread level of the target
-- @param #number PlayerThreatLevelThread level of the player
-- @param #number Score The score based on both threat levels
function SCORING:OnKillPvE(Player, TargetUnitName, IsTeamKill, TargetThreatLevel, PlayerThreatLevel, Score)
end

View File

@@ -1,4 +1,4 @@
--- **Functional** - Make SAM sites execute evasive and defensive behaviour when being fired upon. --- **Functional** - Make SAM sites evasive and execute defensive behaviour when being fired upon.
-- --
-- === -- ===
-- --
@@ -13,13 +13,13 @@
-- --
-- ## Missions: -- ## Missions:
-- --
-- [SEV - SEAD Evasion](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SEV%20-%20SEAD%20Evasion) -- [SEV - SEAD Evasion](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/Sead)
-- --
-- === -- ===
-- --
-- ### Authors: **FlightControl**, **applevangelist** -- ### Authors: **applevangelist**, **FlightControl**
-- --
-- Last Update: Feb 2022 -- Last Update: Dec 2023
-- --
-- === -- ===
-- --
@@ -34,7 +34,7 @@
-- --
-- This class is very easy to use. Just setup a SEAD object by using @{#SEAD.New}() and SAMs will evade and take defensive action when being fired upon. -- This class is very easy to use. Just setup a SEAD object by using @{#SEAD.New}() and SAMs will evade and take defensive action when being fired upon.
-- Once a HARM attack is detected, SEAD will shut down the radars of the attacked SAM site and take evasive action by moving the SAM -- Once a HARM attack is detected, SEAD will shut down the radars of the attacked SAM site and take evasive action by moving the SAM
-- vehicles around (*if* they are drivable, that is). There's a component of randomness in detection and evasion, which is based on the -- vehicles around (*if* they are driveable, that is). There's a component of randomness in detection and evasion, which is based on the
-- skill set of the SAM set (the higher the skill, the more likely). When a missile is fired from far away, the SAM will stay active for a -- skill set of the SAM set (the higher the skill, the more likely). When a missile is fired from far away, the SAM will stay active for a
-- period of time to stay defensive, before it takes evasive actions. -- period of time to stay defensive, before it takes evasive actions.
-- --
@@ -66,7 +66,6 @@ SEAD = {
-- @field Harms -- @field Harms
SEAD.Harms = { SEAD.Harms = {
["AGM_88"] = "AGM_88", ["AGM_88"] = "AGM_88",
["AGM_45"] = "AGM_45",
["AGM_122"] = "AGM_122", ["AGM_122"] = "AGM_122",
["AGM_84"] = "AGM_84", ["AGM_84"] = "AGM_84",
["AGM_45"] = "AGM_45", ["AGM_45"] = "AGM_45",
@@ -80,6 +79,7 @@ SEAD = {
["BGM_109"] = "BGM_109", ["BGM_109"] = "BGM_109",
["AGM_154"] = "AGM_154", ["AGM_154"] = "AGM_154",
["HY-2"] = "HY-2", ["HY-2"] = "HY-2",
["ADM_141A"] = "ADM_141A",
} }
--- Missile enumerators - from DCS ME and Wikipedia --- Missile enumerators - from DCS ME and Wikipedia
@@ -100,6 +100,7 @@ SEAD = {
["BGM_109"] = {460, 0.705}, --in-game ~465kn ["BGM_109"] = {460, 0.705}, --in-game ~465kn
["AGM_154"] = {130, 0.61}, ["AGM_154"] = {130, 0.61},
["HY-2"] = {90,1}, ["HY-2"] = {90,1},
["ADM_141A"] = {126,0.6},
} }
--- Creates the main object which is handling defensive actions for SA sites or moving SA vehicles. --- Creates the main object which is handling defensive actions for SA sites or moving SA vehicles.
@@ -143,7 +144,7 @@ function SEAD:New( SEADGroupPrefixes, Padding )
self:AddTransition("*", "ManageEvasion", "*") self:AddTransition("*", "ManageEvasion", "*")
self:AddTransition("*", "CalculateHitZone", "*") self:AddTransition("*", "CalculateHitZone", "*")
self:I("*** SEAD - Started Version 0.4.3") self:I("*** SEAD - Started Version 0.4.6")
return self return self
end end
@@ -203,7 +204,7 @@ function SEAD:SwitchEmissions(Switch)
return self return self
end end
--- Add an object to call back when going evasive. --- Set an object to call back when going evasive.
-- @param #SEAD self -- @param #SEAD self
-- @param #table Object The object to call. Needs to have object functions as follows: -- @param #table Object The object to call. Needs to have object functions as follows:
-- `:SeadSuppressionPlanned(Group, Name, SuppressionStartTime, SuppressionEndTime)` -- `:SeadSuppressionPlanned(Group, Name, SuppressionStartTime, SuppressionEndTime)`
@@ -348,8 +349,9 @@ end
-- @param #string SEADWeaponName -- @param #string SEADWeaponName
-- @param Wrapper.Group#GROUP SEADGroup Attacker Group -- @param Wrapper.Group#GROUP SEADGroup Attacker Group
-- @param #number timeoffset Offset for tti calc -- @param #number timeoffset Offset for tti calc
-- @param Wrapper.Weapon#WEAPON Weapon
-- @return #SEAD self -- @return #SEAD self
function SEAD:onafterManageEvasion(From,Event,To,_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup,timeoffset) function SEAD:onafterManageEvasion(From,Event,To,_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup,timeoffset,Weapon)
local timeoffset = timeoffset or 0 local timeoffset = timeoffset or 0
if _targetskill == "Random" then -- when skill is random, choose a skill if _targetskill == "Random" then -- when skill is random, choose a skill
local Skills = { "Average", "Good", "High", "Excellent" } local Skills = { "Average", "Good", "High", "Excellent" }
@@ -369,9 +371,13 @@ function SEAD:onafterManageEvasion(From,Event,To,_targetskill,_targetgroup,SEADP
local reach = 10 local reach = 10
if hit then if hit then
local wpndata = SEAD.HarmData[data] local wpndata = SEAD.HarmData[data]
reach = wpndata[1] * 1,1 reach = wpndata[1] * 1.1
local mach = wpndata[2] local mach = wpndata[2]
wpnspeed = math.floor(mach * 340.29) wpnspeed = math.floor(mach * 340.29)
if Weapon then
wpnspeed = Weapon:GetSpeed()
self:T(string.format("*** SEAD - Weapon Speed from WEAPON: %f m/s",wpnspeed))
end
end end
-- time to impact -- time to impact
local _tti = math.floor(_distance / wpnspeed) - timeoffset -- estimated impact time local _tti = math.floor(_distance / wpnspeed) - timeoffset -- estimated impact time
@@ -395,7 +401,7 @@ function SEAD:onafterManageEvasion(From,Event,To,_targetskill,_targetgroup,SEADP
grp:EnableEmission(false) grp:EnableEmission(false)
end end
grp:OptionAlarmStateGreen() -- needed else we cannot move around grp:OptionAlarmStateGreen() -- needed else we cannot move around
grp:RelocateGroundRandomInRadius(20,300,false,false,"Diamond") grp:RelocateGroundRandomInRadius(20,300,false,false,"Diamond",true)
if self.UseCallBack then if self.UseCallBack then
local object = self.CallBack local object = self.CallBack
object:SeadSuppressionStart(grp,name,attacker) object:SeadSuppressionStart(grp,name,attacker)
@@ -405,7 +411,7 @@ function SEAD:onafterManageEvasion(From,Event,To,_targetskill,_targetgroup,SEADP
local function SuppressionStop(args) local function SuppressionStop(args)
self:T(string.format("*** SEAD - %s Radar On",args[2])) self:T(string.format("*** SEAD - %s Radar On",args[2]))
local grp = args[1] -- Wrapper.Group#GROUP local grp = args[1] -- Wrapper.Group#GROUP
local name = args[2] -- #string Group Nam local name = args[2] -- #string Group Name
if self.UseEmissionsOnOff then if self.UseEmissionsOnOff then
grp:EnableEmission(true) grp:EnableEmission(true)
end end
@@ -424,7 +430,7 @@ function SEAD:onafterManageEvasion(From,Event,To,_targetskill,_targetgroup,SEADP
if _tti > 600 then delay = _tti - 90 end -- shot from afar, 600 is default shorad ontime if _tti > 600 then delay = _tti - 90 end -- shot from afar, 600 is default shorad ontime
local SuppressionStartTime = timer.getTime() + delay local SuppressionStartTime = timer.getTime() + delay
local SuppressionEndTime = timer.getTime() + _tti + self.Padding local SuppressionEndTime = timer.getTime() + delay + _tti + self.Padding + delay
local _targetgroupname = _targetgroup:GetName() local _targetgroupname = _targetgroup:GetName()
if not self.SuppressedGroups[_targetgroupname] then if not self.SuppressedGroups[_targetgroupname] then
self:T(string.format("*** SEAD - %s | Parameters TTI %ds | Switch-Off in %ds",_targetgroupname,_tti,delay)) self:T(string.format("*** SEAD - %s | Parameters TTI %ds | Switch-Off in %ds",_targetgroupname,_tti,delay))
@@ -457,6 +463,9 @@ function SEAD:HandleEventShot( EventData )
local SEADWeapon = EventData.Weapon -- Identify the weapon fired local SEADWeapon = EventData.Weapon -- Identify the weapon fired
local SEADWeaponName = EventData.WeaponName -- return weapon type local SEADWeaponName = EventData.WeaponName -- return weapon type
local WeaponWrapper = WEAPON:New(EventData.Weapon)
--local SEADWeaponSpeed = WeaponWrapper:GetSpeed() -- mps
self:T( "*** SEAD - Missile Launched = " .. SEADWeaponName) self:T( "*** SEAD - Missile Launched = " .. SEADWeaponName)
--self:T({ SEADWeapon }) --self:T({ SEADWeapon })
@@ -475,7 +484,7 @@ function SEAD:HandleEventShot( EventData )
end end
return self return self
end end
local targetcat = _target:getCategory() -- Identify category local targetcat = Object.getCategory(_target) -- Identify category
local _targetUnit = nil -- Wrapper.Unit#UNIT local _targetUnit = nil -- Wrapper.Unit#UNIT
local _targetgroup = nil -- Wrapper.Group#GROUP local _targetgroup = nil -- Wrapper.Group#GROUP
self:T(string.format("*** Targetcat = %d",targetcat)) self:T(string.format("*** Targetcat = %d",targetcat))
@@ -513,7 +522,11 @@ function SEAD:HandleEventShot( EventData )
end end
end end
if SEADGroupFound == true then -- yes we are being attacked if SEADGroupFound == true then -- yes we are being attacked
self:ManageEvasion(_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup) if string.find(SEADWeaponName,"ADM_141",1,true) then
self:__ManageEvasion(2,_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup,0,WeaponWrapper)
else
self:ManageEvasion(_targetskill,_targetgroup,SEADPlanePos,SEADWeaponName,SEADGroup,0,WeaponWrapper)
end
end end
end end
return self return self

View File

@@ -11,7 +11,7 @@
-- --
-- ## Missions: -- ## Missions:
-- --
-- ### [SHORAD - Short Range Air Defense](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SRD%20-%20SHORAD%20Defense) -- ### [SHORAD - Short Range Air Defense](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/Shorad)
-- --
-- === -- ===
-- --
@@ -21,6 +21,7 @@
-- @image Functional.Shorad.jpg -- @image Functional.Shorad.jpg
-- --
-- Date: Nov 2021 -- Date: Nov 2021
-- Last Update: Nov 2023
------------------------------------------------------------------------- -------------------------------------------------------------------------
--- **SHORAD** class, extends Core.Base#BASE --- **SHORAD** class, extends Core.Base#BASE
@@ -39,8 +40,15 @@
-- @field #boolean DefendHarms Default true, intercept incoming HARMS -- @field #boolean DefendHarms Default true, intercept incoming HARMS
-- @field #boolean DefendMavs Default true, intercept incoming AG-Missiles -- @field #boolean DefendMavs Default true, intercept incoming AG-Missiles
-- @field #number DefenseLowProb Default 70, minimum detection limit -- @field #number DefenseLowProb Default 70, minimum detection limit
-- @field #number DefenseHighProb Default 90, maximim detection limit -- @field #number DefenseHighProb Default 90, maximum detection limit
-- @field #boolean UseEmOnOff Decide if we are using Emission on/off (default) or AlarmState red/green. -- @field #boolean UseEmOnOff Decide if we are using Emission on/off (default) or AlarmState red/green
-- @field #boolean shootandscoot If true, shoot and scoot between zones
-- @field #number SkateNumber Number of zones to consider
-- @field Core.Set#SET_ZONE SkateZones Zones in this set are considered
-- @field #number minscootdist Min distance of the next zone
-- @field #number maxscootdist Max distance of the next zone
-- @field #boolean scootrandomcoord If true, use a random coordinate in the zone and not the center
-- @field #string scootformation Formation to take for scooting, e.g. "Vee" or "Cone"
-- @extends Core.Base#BASE -- @extends Core.Base#BASE
@@ -73,14 +81,15 @@
-- --
-- `myshorad = SHORAD:New("RedShorad", "Red SHORAD", SamSet, 25000, 600, "red")` -- `myshorad = SHORAD:New("RedShorad", "Red SHORAD", SamSet, 25000, 600, "red")`
-- --
-- ## Customize options -- ## Customization options
-- --
-- * SHORAD:SwitchDebug(debug) -- * myshorad:SwitchDebug(debug)
-- * SHORAD:SwitchHARMDefense(onoff) -- * myshorad:SwitchHARMDefense(onoff)
-- * SHORAD:SwitchAGMDefense(onoff) -- * myshorad:SwitchAGMDefense(onoff)
-- * SHORAD:SetDefenseLimits(low,high) -- * myshorad:SetDefenseLimits(low,high)
-- * SHORAD:SetActiveTimer(seconds) -- * myshorad:SetActiveTimer(seconds)
-- * SHORAD:SetDefenseRadius(meters) -- * myshorad:SetDefenseRadius(meters)
-- * myshorad:AddScootZones(ZoneSet,Number,Random,Formation)
-- --
-- @field #SHORAD -- @field #SHORAD
SHORAD = { SHORAD = {
@@ -99,7 +108,13 @@ SHORAD = {
DefendMavs = true, DefendMavs = true,
DefenseLowProb = 70, DefenseLowProb = 70,
DefenseHighProb = 90, DefenseHighProb = 90,
UseEmOnOff = false, UseEmOnOff = true,
shootandscoot = false,
SkateNumber = 3,
SkateZones = nil,
minscootdist = 100,
minscootdist = 3000,
scootrandomcoord = false,
} }
----------------------------------------------------------------------- -----------------------------------------------------------------------
@@ -112,7 +127,6 @@ do
-- @field Harms -- @field Harms
SHORAD.Harms = { SHORAD.Harms = {
["AGM_88"] = "AGM_88", ["AGM_88"] = "AGM_88",
["AGM_45"] = "AGM_45",
["AGM_122"] = "AGM_122", ["AGM_122"] = "AGM_122",
["AGM_84"] = "AGM_84", ["AGM_84"] = "AGM_84",
["AGM_45"] = "AGM_45", ["AGM_45"] = "AGM_45",
@@ -123,6 +137,8 @@ do
["X_25"] = "X_25", ["X_25"] = "X_25",
["X_31"] = "X_31", ["X_31"] = "X_31",
["Kh25"] = "Kh25", ["Kh25"] = "Kh25",
["HY-2"] = "HY-2",
["ADM_141A"] = "ADM_141A",
} }
--- TODO complete list? --- TODO complete list?
@@ -134,7 +150,6 @@ do
["Kh29"] = "Kh29", ["Kh29"] = "Kh29",
["Kh31"] = "Kh31", ["Kh31"] = "Kh31",
["Kh66"] = "Kh66", ["Kh66"] = "Kh66",
--["BGM_109"] = "BGM_109",
} }
--- Instantiates a new SHORAD object --- Instantiates a new SHORAD object
@@ -146,7 +161,7 @@ do
-- @param #number ActiveTimer Determines how many seconds the systems stay on red alert after wake-up call -- @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" -- @param #string Coalition Coalition, i.e. "blue", "red", or "neutral"
-- @param #boolean UseEmOnOff Use Emissions On/Off rather than Alarm State Red/Green (default: use Emissions switch) -- @param #boolean UseEmOnOff Use Emissions On/Off rather than Alarm State Red/Green (default: use Emissions switch)
-- @retunr #SHORAD self -- @return #SHORAD self
function SHORAD:New(Name, ShoradPrefix, Samset, Radius, ActiveTimer, Coalition, UseEmOnOff) function SHORAD:New(Name, ShoradPrefix, Samset, Radius, ActiveTimer, Coalition, UseEmOnOff)
local self = BASE:Inherit( self, FSM:New() ) local self = BASE:Inherit( self, FSM:New() )
self:T({Name, ShoradPrefix, Samset, Radius, ActiveTimer, Coalition}) self:T({Name, ShoradPrefix, Samset, Radius, ActiveTimer, Coalition})
@@ -165,8 +180,9 @@ do
self.DefendMavs = true self.DefendMavs = true
self.DefenseLowProb = 70 -- probability to detect a missile shot, low margin self.DefenseLowProb = 70 -- probability to detect a missile shot, low margin
self.DefenseHighProb = 90 -- probability to detect a missile shot, high margin self.DefenseHighProb = 90 -- probability to detect a missile shot, high margin
self.UseEmOnOff = UseEmOnOff or false -- Decide if we are using Emission on/off (default) or AlarmState red/green self.UseEmOnOff = true -- Decide if we are using Emission on/off (default) or AlarmState red/green
self:I("*** SHORAD - Started Version 0.3.1") if UseEmOnOff == false then self.UseEmOnOff = UseEmOnOff end
self:I("*** SHORAD - Started Version 0.3.4")
-- Set the string id for output to DCS.log file. -- Set the string id for output to DCS.log file.
self.lid=string.format("SHORAD %s | ", self.name) self.lid=string.format("SHORAD %s | ", self.name)
self:_InitState() self:_InitState()
@@ -176,12 +192,14 @@ do
self:SetStartState("Running") self:SetStartState("Running")
self:AddTransition("*", "WakeUpShorad", "*") self:AddTransition("*", "WakeUpShorad", "*")
self:AddTransition("*", "CalculateHitZone", "*") self:AddTransition("*", "CalculateHitZone", "*")
self:AddTransition("*", "ShootAndScoot", "*")
return self return self
end end
--- Initially set all groups to alarm state GREEN --- Initially set all groups to alarm state GREEN
-- @param #SHORAD self -- @param #SHORAD self
-- @return #SHORAD self
function SHORAD:_InitState() function SHORAD:_InitState()
self:T(self.lid .. " _InitState") self:T(self.lid .. " _InitState")
local table = {} local table = {}
@@ -205,21 +223,40 @@ do
return self return self
end end
--- Add a SET_ZONE of zones for Shoot&Scoot
-- @param #SHORAD self
-- @param Core.Set#SET_ZONE ZoneSet Set of zones to be used. Units will move around to the next (random) zone between 100m and 3000m away.
-- @param #number Number Number of closest zones to be considered, defaults to 3.
-- @param #boolean Random If true, use a random coordinate inside the next zone to scoot to.
-- @param #string Formation Formation to use, defaults to "Cone". See mission editor dropdown for options.
-- @return #SHORAD self
function SHORAD:AddScootZones(ZoneSet, Number, Random, Formation)
self:T(self.lid .. " AddScootZones")
self.SkateZones = ZoneSet
self.SkateNumber = Number or 3
self.shootandscoot = true
self.scootrandomcoord = Random
self.scootformation = Formation or "Cone"
return self
end
--- Switch debug state on --- Switch debug state on
-- @param #SHORAD self -- @param #SHORAD self
-- @param #boolean debug Switch debug on (true) or off (false) -- @param #boolean debug Switch debug on (true) or off (false)
-- @return #SHORAD self
function SHORAD:SwitchDebug(onoff) function SHORAD:SwitchDebug(onoff)
self:T( { onoff } ) self:T( { onoff } )
if onoff then if onoff then
self:SwitchDebugOn() self:SwitchDebugOn()
else else
self.SwitchDebugOff() self:SwitchDebugOff()
end end
return self return self
end end
--- Switch debug state on --- Switch debug state on
-- @param #SHORAD self -- @param #SHORAD self
-- @return #SHORAD self
function SHORAD:SwitchDebugOn() function SHORAD:SwitchDebugOn()
self.debug = true self.debug = true
--tracing --tracing
@@ -230,6 +267,7 @@ do
--- Switch debug state off --- Switch debug state off
-- @param #SHORAD self -- @param #SHORAD self
-- @return #SHORAD self
function SHORAD:SwitchDebugOff() function SHORAD:SwitchDebugOff()
self.debug = false self.debug = false
BASE:TraceOff() BASE:TraceOff()
@@ -239,6 +277,7 @@ do
--- Switch defense for HARMs --- Switch defense for HARMs
-- @param #SHORAD self -- @param #SHORAD self
-- @param #boolean onoff -- @param #boolean onoff
-- @return #SHORAD self
function SHORAD:SwitchHARMDefense(onoff) function SHORAD:SwitchHARMDefense(onoff)
self:T( { onoff } ) self:T( { onoff } )
local onoff = onoff or true local onoff = onoff or true
@@ -249,6 +288,7 @@ do
--- Switch defense for AGMs --- Switch defense for AGMs
-- @param #SHORAD self -- @param #SHORAD self
-- @param #boolean onoff -- @param #boolean onoff
-- @return #SHORAD self
function SHORAD:SwitchAGMDefense(onoff) function SHORAD:SwitchAGMDefense(onoff)
self:T( { onoff } ) self:T( { onoff } )
local onoff = onoff or true local onoff = onoff or true
@@ -260,6 +300,7 @@ do
-- @param #SHORAD self -- @param #SHORAD self
-- @param #number low Minimum detection limit, integer 1-100 -- @param #number low Minimum detection limit, integer 1-100
-- @param #number high Maximum detection limit integer 1-100 -- @param #number high Maximum detection limit integer 1-100
-- @return #SHORAD self
function SHORAD:SetDefenseLimits(low,high) function SHORAD:SetDefenseLimits(low,high)
self:T( { low, high } ) self:T( { low, high } )
local low = low or 70 local low = low or 70
@@ -278,6 +319,7 @@ do
--- Set the number of seconds a SHORAD site will stay active --- Set the number of seconds a SHORAD site will stay active
-- @param #SHORAD self -- @param #SHORAD self
-- @param #number seconds Number of seconds systems stay active -- @param #number seconds Number of seconds systems stay active
-- @return #SHORAD self
function SHORAD:SetActiveTimer(seconds) function SHORAD:SetActiveTimer(seconds)
self:T(self.lid .. " SetActiveTimer") self:T(self.lid .. " SetActiveTimer")
local timer = seconds or 600 local timer = seconds or 600
@@ -291,6 +333,7 @@ do
--- Set the number of meters for the SHORAD defense zone --- Set the number of meters for the SHORAD defense zone
-- @param #SHORAD self -- @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 -- @param #number meters Radius of the defense search zone in meters. #SHORADs in this range around a targeted group will go active
-- @return #SHORAD self
function SHORAD:SetDefenseRadius(meters) function SHORAD:SetDefenseRadius(meters)
self:T(self.lid .. " SetDefenseRadius") self:T(self.lid .. " SetDefenseRadius")
local radius = meters or 20000 local radius = meters or 20000
@@ -304,6 +347,7 @@ do
--- Set using Emission on/off instead of changing alarm state --- Set using Emission on/off instead of changing alarm state
-- @param #SHORAD self -- @param #SHORAD self
-- @param #boolean switch Decide if we are changing alarm state or AI state -- @param #boolean switch Decide if we are changing alarm state or AI state
-- @return #SHORAD self
function SHORAD:SetUsingEmOnOff(switch) function SHORAD:SetUsingEmOnOff(switch)
self:T(self.lid .. " SetUsingEmOnOff") self:T(self.lid .. " SetUsingEmOnOff")
self.UseEmOnOff = switch or false self.UseEmOnOff = switch or false
@@ -375,11 +419,11 @@ do
local shorad = self.Groupset local shorad = self.Groupset
local shoradset = shorad:GetAliveSet() --#table local shoradset = shorad:GetAliveSet() --#table
local returnname = false local returnname = false
--local TDiff = 1
for _,_groups in pairs (shoradset) do for _,_groups in pairs (shoradset) do
local groupname = _groups:GetName() local groupname = _groups:GetName()
if string.find(groupname, tgtgrp, 1, true) then if string.find(groupname, tgtgrp, 1, true) then
returnname = true returnname = true
--_groups:RelocateGroundRandomInRadius(7,100,false,false) -- be a bit evasive
end end
end end
return returnname return returnname
@@ -426,6 +470,7 @@ do
-- @param #number Radius Radius of the #ZONE -- @param #number Radius Radius of the #ZONE
-- @param #number ActiveTimer Number of seconds to stay active -- @param #number ActiveTimer Number of seconds to stay active
-- @param #number TargetCat (optional) Category, i.e. Object.Category.UNIT or Object.Category.STATIC -- @param #number TargetCat (optional) Category, i.e. Object.Category.UNIT or Object.Category.STATIC
-- @return #SHORAD self
-- @usage Use this function to integrate with other systems, example -- @usage Use this function to integrate with other systems, example
-- --
-- local SamSet = SET_GROUP:New():FilterPrefixes("Blue SAM"):FilterCoalitions("blue"):FilterStart() -- local SamSet = SET_GROUP:New():FilterPrefixes("Blue SAM"):FilterCoalitions("blue"):FilterStart()
@@ -452,28 +497,35 @@ do
local targetzone = ZONE_RADIUS:New("Shorad",targetvec2,Radius) -- create a defense zone to check local targetzone = ZONE_RADIUS:New("Shorad",targetvec2,Radius) -- create a defense zone to check
local groupset = self.Groupset --Core.Set#SET_GROUP local groupset = self.Groupset --Core.Set#SET_GROUP
local shoradset = groupset:GetAliveSet() --#table local shoradset = groupset:GetAliveSet() --#table
-- local function to switch off shorad again -- local function to switch off shorad again
local function SleepShorad(group) local function SleepShorad(group)
local groupname = group:GetName() if group and group:IsAlive() then
self.ActiveGroups[groupname] = nil local groupname = group:GetName()
if self.UseEmOnOff then self.ActiveGroups[groupname] = nil
group:EnableEmission(false) if self.UseEmOnOff then
--group:SetAIOff() group:EnableEmission(false)
else else
group:OptionAlarmStateGreen() 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)
--Shoot and Scoot
if self.shootandscoot then
self:__ShootAndScoot(1,group)
end
end end
local text = string.format("Sleeping SHORAD %s", group:GetName())
self:T(text)
local m = MESSAGE:New(text,10,"SHORAD"):ToAllIf(self.debug)
end end
-- go through set and find the one(s) to activate -- go through set and find the one(s) to activate
local TDiff = 4
for _,_group in pairs (shoradset) do for _,_group in pairs (shoradset) do
if _group:IsAnyInZone(targetzone) then if _group:IsAnyInZone(targetzone) then
local text = string.format("Waking up SHORAD %s", _group:GetName()) local text = string.format("Waking up SHORAD %s", _group:GetName())
self:T(text) self:T(text)
local m = MESSAGE:New(text,10,"SHORAD"):ToAllIf(self.debug) local m = MESSAGE:New(text,10,"SHORAD"):ToAllIf(self.debug)
if self.UseEmOnOff then if self.UseEmOnOff then
--_group:SetAIOn()
_group:EnableEmission(true) _group:EnableEmission(true)
end end
_group:OptionAlarmStateRed() _group:OptionAlarmStateRed()
@@ -481,91 +533,132 @@ do
if self.ActiveGroups[groupname] == nil then -- no timer yet for this group if self.ActiveGroups[groupname] == nil then -- no timer yet for this group
self.ActiveGroups[groupname] = { Timing = ActiveTimer } self.ActiveGroups[groupname] = { Timing = ActiveTimer }
local endtime = timer.getTime() + (ActiveTimer * math.random(75,100) / 100 ) -- randomize wakeup a bit local endtime = timer.getTime() + (ActiveTimer * math.random(75,100) / 100 ) -- randomize wakeup a bit
timer.scheduleFunction(SleepShorad, _group, endtime) self.ActiveGroups[groupname].Timer = TIMER:New(SleepShorad,_group):Start(endtime)
--Shoot and Scoot
if self.shootandscoot then
self:__ShootAndScoot(TDiff,_group)
TDiff=TDiff+1
end
end end
end end
end end
return self return self
end end
--- (Internal) Calculate hit zone of an AGM-88 --- (Internal) Calculate hit zone of an AGM-88
-- @param #SHORAD self -- @param #SHORAD self
-- @param #table SEADWeapon DCS.Weapon object -- @param #table SEADWeapon DCS.Weapon object
-- @param Core.Point#COORDINATE pos0 Position of the plane when it fired -- @param Core.Point#COORDINATE pos0 Position of the plane when it fired
-- @param #number height Height when the missile was fired -- @param #number height Height when the missile was fired
-- @param Wrapper.Group#GROUP SEADGroup Attacker group -- @param Wrapper.Group#GROUP SEADGroup Attacker group
-- @return #SHORAD self -- @return #SHORAD self
function SHORAD:onafterCalculateHitZone(From,Event,To,SEADWeapon,pos0,height,SEADGroup) function SHORAD:onafterCalculateHitZone(From,Event,To,SEADWeapon,pos0,height,SEADGroup)
self:T("**** Calculating hit zone") self:T("**** Calculating hit zone")
if SEADWeapon and SEADWeapon:isExist() then if SEADWeapon and SEADWeapon:isExist() then
--local pos = SEADWeapon:getPoint() --local pos = SEADWeapon:getPoint()
-- postion and height
local position = SEADWeapon:getPosition()
local mheight = height
-- heading
local wph = math.atan2(position.x.z, position.x.x)
if wph < 0 then
wph=wph+2*math.pi
end
wph=math.deg(wph)
-- velocity
local wpndata = SEAD.HarmData["AGM_88"]
local mveloc = math.floor(wpndata[2] * 340.29)
local c1 = (2*mheight*9.81)/(mveloc^2)
local c2 = (mveloc^2) / 9.81
local Ropt = c2 * math.sqrt(c1+1)
if height <= 5000 then
Ropt = Ropt * 0.72
elseif height <= 7500 then
Ropt = Ropt * 0.82
elseif height <= 10000 then
Ropt = Ropt * 0.87
elseif height <= 12500 then
Ropt = Ropt * 0.98
end
-- look at a couple of zones across the trajectory
for n=1,3 do
local dist = Ropt - ((n-1)*20000)
local predpos= pos0:Translate(dist,wph)
if predpos then
-- postion and height local targetzone = ZONE_RADIUS:New("Target Zone",predpos:GetVec2(),20000)
local position = SEADWeapon:getPosition()
local mheight = height if self.debug then
-- heading predpos:MarkToAll(string.format("height=%dm | heading=%d | velocity=%ddeg | Ropt=%dm",mheight,wph,mveloc,Ropt),false)
local wph = math.atan2(position.x.z, position.x.x) targetzone:DrawZone(coalition.side.BLUE,{0,0,1},0.2,nil,nil,3,true)
if wph < 0 then end
wph=wph+2*math.pi
end local seadset = self.Groupset
wph=math.deg(wph) local tgtcoord = targetzone:GetRandomPointVec2()
local tgtgrp = seadset:FindNearestGroupFromPointVec2(tgtcoord)
-- velocity local _targetgroup = nil
local wpndata = SEAD.HarmData["AGM_88"] local _targetgroupname = "none"
local mveloc = math.floor(wpndata[2] * 340.29) local _targetskill = "Random"
local c1 = (2*mheight*9.81)/(mveloc^2) if tgtgrp and tgtgrp:IsAlive() then
local c2 = (mveloc^2) / 9.81 _targetgroup = tgtgrp
local Ropt = c2 * math.sqrt(c1+1) _targetgroupname = tgtgrp:GetName() -- group name
if height <= 5000 then _targetskill = tgtgrp:GetUnit(1):GetSkill()
Ropt = Ropt * 0.72 self:T("*** Found Target = ".. _targetgroupname)
elseif height <= 7500 then self:WakeUpShorad(_targetgroupname, self.Radius, self.ActiveTimer, Object.Category.UNIT)
Ropt = Ropt * 0.82 end
elseif height <= 10000 then end
Ropt = Ropt * 0.87 end
elseif height <= 12500 then
Ropt = Ropt * 0.98
end end
return self
-- look at a couple of zones across the trajectory end
for n=1,3 do
local dist = Ropt - ((n-1)*20000)
local predpos= pos0:Translate(dist,wph)
if predpos then
local targetzone = ZONE_RADIUS:New("Target Zone",predpos:GetVec2(),20000) --- (Internal) Shoot and Scoot
-- @param #SHORAD self
if self.debug then -- @param #string From
predpos:MarkToAll(string.format("height=%dm | heading=%d | velocity=%ddeg | Ropt=%dm",mheight,wph,mveloc,Ropt),false) -- @param #string Event
targetzone:DrawZone(coalition.side.BLUE,{0,0,1},0.2,nil,nil,3,true) -- @param #string To
end -- @param Wrapper.Group#GROUP Shorad Shorad group
-- @return #SHORAD self
local seadset = self.Groupset function SHORAD:onafterShootAndScoot(From,Event,To,Shorad)
local tgtcoord = targetzone:GetRandomPointVec2() self:T( { From,Event,To } )
local tgtgrp = seadset:FindNearestGroupFromPointVec2(tgtcoord) local possibleZones = {}
local _targetgroup = nil local mindist = self.minscootdist or 100
local _targetgroupname = "none" local maxdist = self.maxscootdist or 3000
local _targetskill = "Random" if Shorad and Shorad:IsAlive() then
if tgtgrp and tgtgrp:IsAlive() then local NowCoord = Shorad:GetCoordinate()
_targetgroup = tgtgrp for _,_zone in pairs(self.SkateZones.Set) do
_targetgroupname = tgtgrp:GetName() -- group name local zone = _zone -- Core.Zone#ZONE_RADIUS
_targetskill = tgtgrp:GetUnit(1):GetSkill() local dist = NowCoord:Get2DDistance(zone:GetCoordinate())
self:T("*** Found Target = ".. _targetgroupname) if dist >= mindist and dist <= maxdist then
self:WakeUpShorad(_targetgroupname, self.Radius, self.ActiveTimer, Object.Category.UNIT) possibleZones[#possibleZones+1] = zone
if #possibleZones == self.SkateNumber then break end
end end
end end
end if #possibleZones > 0 and Shorad:GetVelocityKMH() < 2 then
local rand = math.floor(math.random(1,#possibleZones*1000)/1000+0.5)
if rand == 0 then rand = 1 end
self:T(self.lid .. " ShootAndScoot to zone "..rand)
local ToCoordinate = possibleZones[rand]:GetCoordinate()
if self.scootrandomcoord then
ToCoordinate = possibleZones[rand]:GetRandomCoordinate(nil,nil,{land.SurfaceType.LAND,land.SurfaceType.ROAD})
end
local formation = self.scootformation or "Cone"
Shorad:RouteGroundTo(ToCoordinate,20,formation,1)
end
end
return self
end end
return self
end
--- Main function - work on the EventData --- Main function - work on the EventData
-- @param #SHORAD self -- @param #SHORAD self
-- @param Core.Event#EVENTDATA EventData The event details table data set -- @param Core.Event#EVENTDATA EventData The event details table data set
-- @return #SHORAD self
function SHORAD:HandleEventShot( EventData ) function SHORAD:HandleEventShot( EventData )
self:T( { EventData } ) self:T( { EventData } )
self:T(self.lid .. " HandleEventShot") self:T(self.lid .. " HandleEventShot")
--local ShootingUnit = EventData.IniDCSUnit
--local ShootingUnitName = EventData.IniDCSUnitName
local ShootingWeapon = EventData.Weapon -- Identify the weapon fired local ShootingWeapon = EventData.Weapon -- Identify the weapon fired
local ShootingWeaponName = EventData.WeaponName -- return weapon type local ShootingWeaponName = EventData.WeaponName -- return weapon type
-- get firing coalition -- get firing coalition
@@ -596,27 +689,18 @@ end
return self return self
end end
local targetcat = targetdata:getCategory() -- Identify category local targetcat = Object.getCategory(targetdata) -- Identify category
self:T(string.format("Target Category (3=STATIC, 1=UNIT)= %s",tostring(targetcat))) self:T(string.format("Target Category (3=STATIC, 1=UNIT)= %s",tostring(targetcat)))
self:T({targetdata}) self:T({targetdata})
local targetunit = nil local targetunit = nil
if targetcat == Object.Category.UNIT then -- UNIT if targetcat == Object.Category.UNIT then -- UNIT
targetunit = UNIT:Find(targetdata) targetunit = UNIT:Find(targetdata)
elseif targetcat == Object.Category.STATIC then -- STATIC elseif targetcat == Object.Category.STATIC then -- STATIC
--self:T("Static Target Data")
--self:T({targetdata:isExist()})
--self:T({targetdata:getPoint()})
local tgtcoord = COORDINATE:NewFromVec3(targetdata:getPoint()) local tgtcoord = COORDINATE:NewFromVec3(targetdata:getPoint())
--tgtcoord:MarkToAll("Missile Target",true) local tgtgrp1 = self.Samset:FindNearestGroupFromPointVec2(tgtcoord)
local tgtgrp1 = self.Samset:FindNearestGroupFromPointVec2(tgtcoord)
local tgtcoord1 = tgtgrp1:GetCoordinate() local tgtcoord1 = tgtgrp1:GetCoordinate()
--tgtcoord1:MarkToAll("Close target SAM",true)
local tgtgrp2 = self.Groupset:FindNearestGroupFromPointVec2(tgtcoord) local tgtgrp2 = self.Groupset:FindNearestGroupFromPointVec2(tgtcoord)
local tgtcoord2 = tgtgrp2:GetCoordinate() local tgtcoord2 = tgtgrp2:GetCoordinate()
--tgtcoord2:MarkToAll("Close target SHORAD",true)
local dist1 = tgtcoord:Get2DDistance(tgtcoord1) local dist1 = tgtcoord:Get2DDistance(tgtcoord1)
local dist2 = tgtcoord:Get2DDistance(tgtcoord2) local dist2 = tgtcoord:Get2DDistance(tgtcoord2)
@@ -628,10 +712,8 @@ end
targetcat = Object.Category.UNIT targetcat = Object.Category.UNIT
end end
end end
--local targetunitname = Unit.getName(targetdata) -- Unit name
if targetunit and targetunit:IsAlive() then if targetunit and targetunit:IsAlive() then
local targetunitname = targetunit:GetName() local targetunitname = targetunit:GetName()
--local targetgroup = Unit.getGroup(Weapon.getTarget(ShootingWeapon)) --targeted group
local targetgroup = nil local targetgroup = nil
local targetgroupname = "none" local targetgroupname = "none"
if targetcat == Object.Category.UNIT then if targetcat == Object.Category.UNIT then
@@ -649,7 +731,6 @@ end
self:T( text ) self:T( text )
local m = MESSAGE:New(text,10,"Info"):ToAllIf(self.debug) local m = MESSAGE:New(text,10,"Info"):ToAllIf(self.debug)
-- check if we or a SAM site are the target -- check if we or a SAM site are the target
--local TargetGroup = EventData.TgtGroup -- Wrapper.Group#GROUP
local shotatus = self:_CheckShotAtShorad(targetgroupname) --#boolean local shotatus = self:_CheckShotAtShorad(targetgroupname) --#boolean
local shotatsams = self:_CheckShotAtSams(targetgroupname) --#boolean local shotatsams = self:_CheckShotAtSams(targetgroupname) --#boolean
-- if being shot at, find closest SHORADs to activate -- if being shot at, find closest SHORADs to activate
@@ -666,4 +747,4 @@ end
end end
----------------------------------------------------------------------- -----------------------------------------------------------------------
-- SHORAD end -- SHORAD end
----------------------------------------------------------------------- -----------------------------------------------------------------------

View File

@@ -33,9 +33,9 @@
-- --
-- === -- ===
-- --
-- ### Author: **[funkyfranky](https://forums.eagle.ru/member.php?u=115026)** -- ### Author: **funkyfranky**
-- --
-- ### Contributions: [FlightControl](https://forums.eagle.ru/member.php?u=89536) -- ### Contributions: FlightControl
-- --
-- === -- ===
-- --

View File

@@ -87,7 +87,7 @@
-- @field #number respawndelay Delay before respawn in seconds. -- @field #number respawndelay Delay before respawn in seconds.
-- @field #number runwaydestroyed Time stamp timer.getAbsTime() when the runway was destroyed. -- @field #number runwaydestroyed Time stamp timer.getAbsTime() when the runway was destroyed.
-- @field #number runwayrepairtime Time in seconds until runway will be repaired after it was destroyed. Default is 3600 sec (one hour). -- @field #number runwayrepairtime Time in seconds until runway will be repaired after it was destroyed. Default is 3600 sec (one hour).
-- @field Ops.FlightControl#FLIGHTCONTROL flightcontrol Flight control of this warehouse. -- @field OPS.FlightControl#FLIGHTCONTROL flightcontrol Flight control of this warehouse.
-- @extends Core.Fsm#FSM -- @extends Core.Fsm#FSM
--- Have your assets at the right place at the right time - or not! --- Have your assets at the right place at the right time - or not!
@@ -742,7 +742,7 @@
-- --
-- ## Save Assets -- ## Save Assets
-- --
-- Saving asset data to file is achieved by the @{WAREHOUSE.Save}(*path*, *filename*) function. The parameter *path* specifies the path on the file system where the -- Saving asset data to file is achieved by the @{#WAREHOUSE.Save}(*path*, *filename*) function. The parameter *path* specifies the path on the file system where the
-- warehouse data is saved. If you do not specify a path, the file is saved your the DCS installation root directory. -- warehouse data is saved. If you do not specify a path, the file is saved your the DCS installation root directory.
-- The parameter *filename* is optional and defines the name of the saved file. By default this is automatically created from the warehouse id and name, for example -- The parameter *filename* is optional and defines the name of the saved file. By default this is automatically created from the warehouse id and name, for example
-- "Warehouse-1234_Batumi.txt". -- "Warehouse-1234_Batumi.txt".
@@ -753,13 +753,13 @@
-- --
-- ### Automatic Save at Mission End -- ### Automatic Save at Mission End
-- --
-- The assets can be saved automatically when the mission is ended via the @{WAREHOUSE.SetSaveOnMissionEnd}(*path*, *filename*) function, i.e. -- The assets can be saved automatically when the mission is ended via the @{#WAREHOUSE.SetSaveOnMissionEnd}(*path*, *filename*) function, i.e.
-- --
-- warehouseBatumi:SetSaveOnMissionEnd("D:\\My Warehouse Data\\") -- warehouseBatumi:SetSaveOnMissionEnd("D:\\My Warehouse Data\\")
-- --
-- ## Load Assets -- ## Load Assets
-- --
-- Loading assets data from file is achieved by the @{WAREHOUSE.Load}(*path*, *filename*) function. The parameter *path* specifies the path on the file system where the -- Loading assets data from file is achieved by the @{#WAREHOUSE.Load}(*path*, *filename*) function. The parameter *path* specifies the path on the file system where the
-- warehouse data is loaded from. If you do not specify a path, the file is loaded from your the DCS installation root directory. -- warehouse data is loaded from. If you do not specify a path, the file is loaded from your the DCS installation root directory.
-- The parameter *filename* is optional and defines the name of the file to load. By default this is automatically generated from the warehouse id and name, for example -- The parameter *filename* is optional and defines the name of the file to load. By default this is automatically generated from the warehouse id and name, for example
-- "Warehouse-1234_Batumi.txt". -- "Warehouse-1234_Batumi.txt".
@@ -1798,7 +1798,7 @@ _WAREHOUSEDB = {
--- Warehouse class version. --- Warehouse class version.
-- @field #string version -- @field #string version
WAREHOUSE.version="1.0.2" WAREHOUSE.version="1.0.2a"
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO: Warehouse todo list. -- TODO: Warehouse todo list.
@@ -3616,9 +3616,10 @@ function WAREHOUSE:onafterStatus(From, Event, To)
end end
-- Print queue after processing requests. -- Print queue after processing requests.
self:_PrintQueue(self.queue, "Queue waiting") if self.verbosity > 2 then
self:_PrintQueue(self.pending, "Queue pending") self:_PrintQueue(self.queue, "Queue waiting")
self:_PrintQueue(self.pending, "Queue pending")
end
-- Check fuel for all assets. -- Check fuel for all assets.
--self:_CheckFuel() --self:_CheckFuel()
@@ -4101,9 +4102,9 @@ function WAREHOUSE:_RegisterAsset(group, ngroups, forceattribute, forcecargobay,
-- Get the size of an object. -- Get the size of an object.
local function _GetObjectSize(DCSdesc) local function _GetObjectSize(DCSdesc)
if DCSdesc.box then if DCSdesc.box then
local x=DCSdesc.box.max.x+math.abs(DCSdesc.box.min.x) --length local x=DCSdesc.box.max.x-DCSdesc.box.min.x --length
local y=DCSdesc.box.max.y+math.abs(DCSdesc.box.min.y) --height local y=DCSdesc.box.max.y-DCSdesc.box.min.y --height
local z=DCSdesc.box.max.z+math.abs(DCSdesc.box.min.z) --width local z=DCSdesc.box.max.z-DCSdesc.box.min.z --width
return math.max(x,z), x , y, z return math.max(x,z), x , y, z
end end
return 0,0,0,0 return 0,0,0,0
@@ -4561,7 +4562,8 @@ function WAREHOUSE:onafterRequest(From, Event, To, Request)
self:_ErrorMessage("ERROR: Cargo transport by train not supported yet!") self:_ErrorMessage("ERROR: Cargo transport by train not supported yet!")
return return
elseif Request.transporttype==WAREHOUSE.TransportType.SHIP or Request.transporttype==WAREHOUSE.TransportType.NAVALCARRIER then elseif Request.transporttype==WAREHOUSE.TransportType.SHIP or Request.transporttype==WAREHOUSE.TransportType.NAVALCARRIER
or Request.transporttype==WAREHOUSE.TransportType.ARMEDSHIP or Request.transporttype==WAREHOUSE.TransportType.WARSHIP then
-- Spawn Ship in port zone -- Spawn Ship in port zone
spawngroup=self:_SpawnAssetGroundNaval(_alias, _assetitem, Request, self.portzone) spawngroup=self:_SpawnAssetGroundNaval(_alias, _assetitem, Request, self.portzone)
@@ -5497,8 +5499,13 @@ function WAREHOUSE:onafterAssetDead(From, Event, To, asset, request)
--- ---
-- Remove dead group from cargo group set. -- Remove dead group from cargo group set.
request.cargogroupset:Remove(groupname, NoTriggerEvent) if request.cargogroupset then
self:T(self.lid..string.format("Removed selfpropelled cargo %s: ncargo=%d.", groupname, request.cargogroupset:Count())) -- cargogroupset was nil for user case. Difficult to reproduce so we add a nil check.
request.cargogroupset:Remove(groupname, NoTriggerEvent)
self:T(self.lid..string.format("Removed selfpropelled cargo %s: ncargo=%d.", groupname, request.cargogroupset:Count()))
else
self:E(self.lid..string.format("ERROR: cargogroupset is nil for request ID=%s!", tostring(request.uid)))
end
else else
@@ -5829,62 +5836,65 @@ function WAREHOUSE:_SpawnAssetRequest(Request)
-- Get stock item. -- Get stock item.
local asset=cargoassets[i] --#WAREHOUSE.Assetitem local asset=cargoassets[i] --#WAREHOUSE.Assetitem
if not asset.spawned then
-- Set asset status to not spawned until we capture its birth event. -- Set asset status to not spawned until we capture its birth event.
asset.spawned=false asset.iscargo=true
asset.iscargo=true
-- Set request ID.
-- Set request ID. asset.rid=Request.uid
asset.rid=Request.uid
-- Spawn group name.
-- Spawn group name. local _alias=asset.spawngroupname
local _alias=asset.spawngroupname
--Request add asset by id.
--Request add asset by id. Request.assets[asset.uid]=asset
Request.assets[asset.uid]=asset
-- Spawn an asset group.
-- Spawn an asset group. local _group=nil --Wrapper.Group#GROUP
local _group=nil --Wrapper.Group#GROUP if asset.category==Group.Category.GROUND then
if asset.category==Group.Category.GROUND then
-- Spawn ground troops.
-- Spawn ground troops.
_group=self:_SpawnAssetGroundNaval(_alias, asset, Request, self.spawnzone, Request.lateActivation)
elseif asset.category==Group.Category.AIRPLANE or asset.category==Group.Category.HELICOPTER then
-- Spawn air units.
if Parking[asset.uid] then
_group=self:_SpawnAssetAircraft(_alias, asset, Request, Parking[asset.uid], UnControlled, Request.lateActivation)
else
_group=self:_SpawnAssetAircraft(_alias, asset, Request, nil, UnControlled, Request.lateActivation)
end
elseif asset.category==Group.Category.TRAIN then
-- Spawn train.
if self.rail then
--TODO: Rail should only get one asset because they would spawn on top!
-- Spawn naval assets.
_group=self:_SpawnAssetGroundNaval(_alias, asset, Request, self.spawnzone, Request.lateActivation) _group=self:_SpawnAssetGroundNaval(_alias, asset, Request, self.spawnzone, Request.lateActivation)
elseif asset.category==Group.Category.AIRPLANE or asset.category==Group.Category.HELICOPTER then
-- Spawn air units.
if Parking[asset.uid] then
_group=self:_SpawnAssetAircraft(_alias, asset, Request, Parking[asset.uid], UnControlled, Request.lateActivation)
else
_group=self:_SpawnAssetAircraft(_alias, asset, Request, nil, UnControlled, Request.lateActivation)
end
elseif asset.category==Group.Category.TRAIN then
-- Spawn train.
if self.rail then
--TODO: Rail should only get one asset because they would spawn on top!
-- Spawn naval assets.
_group=self:_SpawnAssetGroundNaval(_alias, asset, Request, self.spawnzone, Request.lateActivation)
end
--self:E(self.lid.."ERROR: Spawning of TRAIN assets not possible yet!")
elseif asset.category==Group.Category.SHIP then
-- Spawn naval assets.
_group=self:_SpawnAssetGroundNaval(_alias, asset, Request, self.portzone, Request.lateActivation)
else
self:E(self.lid.."ERROR: Unknown asset category!")
end end
--self:E(self.lid.."ERROR: Spawning of TRAIN assets not possible yet!") -- Trigger event.
if _group then
elseif asset.category==Group.Category.SHIP then self:__AssetSpawned(0.01, _group, asset, Request)
end
-- Spawn naval assets.
_group=self:_SpawnAssetGroundNaval(_alias, asset, Request, self.portzone, Request.lateActivation)
else
self:E(self.lid.."ERROR: Unknown asset category!")
end end
-- Trigger event.
if _group then
self:__AssetSpawned(0.01, _group, asset, Request)
end
end end
end end
@@ -6667,7 +6677,13 @@ function WAREHOUSE:_OnEventCrashOrDead(EventData)
self:Destroyed() self:Destroyed()
end end
if self.airbase and self.airbasename and self.airbasename==EventData.IniUnitName then if self.airbase and self.airbasename and self.airbasename==EventData.IniUnitName then
self:RunwayDestroyed() if self:IsRunwayOperational() then
-- Trigger RunwayDestroyed event (only if it is not destroyed already)
self:RunwayDestroyed()
else
-- Reset the time stamp.
self.runwaydestroyed=timer.getAbsTime()
end
end end
end end
@@ -6757,7 +6773,7 @@ function WAREHOUSE:_UnitDead(deadunit, deadgroup, request)
-- Dont trigger a Remove event for the group sets. -- Dont trigger a Remove event for the group sets.
local NoTriggerEvent=true local NoTriggerEvent=true
if not request.transporttype==WAREHOUSE.TransportType.SELFPROPELLED then if request.transporttype~=WAREHOUSE.TransportType.SELFPROPELLED then
--- ---
-- Complicated case: Dead unit could be: -- Complicated case: Dead unit could be:
@@ -7388,6 +7404,8 @@ function WAREHOUSE:_CheckRequestNow(request)
-- Check if at least one (cargo) asset is available. -- Check if at least one (cargo) asset is available.
if _nassets>0 then if _nassets>0 then
local asset=_assets[1] --#WAREHOUSE.Assetitem
-- Get the attibute of the requested asset. -- Get the attibute of the requested asset.
_assetattribute=_assets[1].attribute _assetattribute=_assets[1].attribute
@@ -7398,11 +7416,24 @@ function WAREHOUSE:_CheckRequestNow(request)
if _assetcategory==Group.Category.AIRPLANE or _assetcategory==Group.Category.HELICOPTER then if _assetcategory==Group.Category.AIRPLANE or _assetcategory==Group.Category.HELICOPTER then
if self.airbase and self.airbase:GetCoalition()==self:GetCoalition() then if self.airbase and self.airbase:GetCoalition()==self:GetCoalition() then
-- Check if DCS warehouse of airbase has enough assets
if self.airbase.storage then
local nS=self.airbase.storage:GetAmount(asset.unittype)
local nA=asset.nunits*request.nasset -- Number of units requested
if nS<nA then
local text=string.format("Warehouse %s: Request denied! DCS Warehouse has only %d assets of type %s ==> NOT enough to spawn the requested %d asset units (%d groups)",
self.alias, nS, asset.unittype, nA, request.nasset)
self:_InfoMessage(text, 5)
return false
end
end
if self:IsRunwayOperational() or _assetairstart then if self:IsRunwayOperational() or _assetairstart then
if _assetairstart then if _assetairstart then
-- Airstart no need to check parking -- Airstart no need to check parking
else else
-- Check parking. -- Check parking.
@@ -7514,6 +7545,9 @@ function WAREHOUSE:_CheckRequestNow(request)
self:_InfoMessage(text, 5) self:_InfoMessage(text, 5)
return false return false
end end
elseif _assetcategory==Group.Category.AIRPLANE or _assetcategory==Group.Category.HELICOPTER then
end end
@@ -7854,7 +7888,7 @@ function WAREHOUSE:_GetTerminal(_attribute, _category)
-- Default terminal is "large". -- Default terminal is "large".
local _terminal=AIRBASE.TerminalType.OpenBig local _terminal=AIRBASE.TerminalType.OpenBig
if _attribute==WAREHOUSE.Attribute.AIR_FIGHTER then if _attribute==WAREHOUSE.Attribute.AIR_FIGHTER or _attribute==WAREHOUSE.Attribute.AIR_UAV then
-- Fighter ==> small. -- Fighter ==> small.
_terminal=AIRBASE.TerminalType.FighterAircraft _terminal=AIRBASE.TerminalType.FighterAircraft
elseif _attribute==WAREHOUSE.Attribute.AIR_BOMBER or _attribute==WAREHOUSE.Attribute.AIR_TRANSPORTPLANE or _attribute==WAREHOUSE.Attribute.AIR_TANKER or _attribute==WAREHOUSE.Attribute.AIR_AWACS then elseif _attribute==WAREHOUSE.Attribute.AIR_BOMBER or _attribute==WAREHOUSE.Attribute.AIR_TRANSPORTPLANE or _attribute==WAREHOUSE.Attribute.AIR_TANKER or _attribute==WAREHOUSE.Attribute.AIR_AWACS then
@@ -8219,7 +8253,7 @@ end
-- @return #number Request ID. -- @return #number Request ID.
function WAREHOUSE:_GetIDsFromGroupName(groupname) function WAREHOUSE:_GetIDsFromGroupName(groupname)
---@param #string text The text to analyse. -- @param #string text The text to analyse.
local function analyse(text) local function analyse(text)
-- Get rid of #0001 tail from spawn. -- Get rid of #0001 tail from spawn.

View File

@@ -12,7 +12,7 @@
-- --
-- ## Missions: -- ## Missions:
-- --
-- [CAZ - Capture Zones](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/CAZ%20-%20Capture%20Zones) -- [CAZ - Capture Zones](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/ZoneCaptureCoalition)
-- --
-- === -- ===
-- --
@@ -363,8 +363,8 @@ do -- ZONE_CAPTURE_COALITION
--- ZONE_CAPTURE_COALITION Constructor. --- ZONE_CAPTURE_COALITION Constructor.
-- @param #ZONE_CAPTURE_COALITION self -- @param #ZONE_CAPTURE_COALITION self
-- @param Core.Zone#ZONE Zone A @{Core.Zone} object with the goal to be achieved. Alternatively, can be handed as the name of late activated group describing a @{ZONE_POLYGON} with its waypoints. -- @param Core.Zone#ZONE Zone A @{Core.Zone} object with the goal to be achieved. Alternatively, can be handed as the name of late activated group describing a @{Core.Zone#ZONE_POLYGON} with its waypoints.
-- @param DCSCoalition.DCSCoalition#coalition Coalition The initial coalition owning the zone. -- @param #number Coalition The initial coalition owning the zone.
-- @param #table UnitCategories Table of unit categories. See [DCS Class Unit](https://wiki.hoggitworld.com/view/DCS_Class_Unit). Default {Unit.Category.GROUND_UNIT}. -- @param #table UnitCategories Table of unit categories. See [DCS Class Unit](https://wiki.hoggitworld.com/view/DCS_Class_Unit). Default {Unit.Category.GROUND_UNIT}.
-- @param #table ObjectCategories Table of unit categories. See [DCS Class Object](https://wiki.hoggitworld.com/view/DCS_Class_Object). Default {Object.Category.UNIT, Object.Category.STATIC}, i.e. all UNITS and STATICS. -- @param #table ObjectCategories Table of unit categories. See [DCS Class Object](https://wiki.hoggitworld.com/view/DCS_Class_Object). Default {Object.Category.UNIT, Object.Category.STATIC}, i.e. all UNITS and STATICS.
-- @return #ZONE_CAPTURE_COALITION -- @return #ZONE_CAPTURE_COALITION
@@ -715,7 +715,7 @@ do -- ZONE_CAPTURE_COALITION
local UnitHit = EventData.TgtUnit local UnitHit = EventData.TgtUnit
if UnitHit.ClassName ~= "SCENERY" then if UnitHit and UnitHit.ClassName ~= "SCENERY" then
-- Check if unit is inside the capture zone and that it is of the defending coalition. -- Check if unit is inside the capture zone and that it is of the defending coalition.
if UnitHit and UnitHit:IsInZone(self) and UnitHit:GetCoalition()==self.Coalition then if UnitHit and UnitHit:IsInZone(self) and UnitHit:GetCoalition()==self.Coalition then

View File

@@ -4,7 +4,12 @@
-- --
-- ZONE_GOAL_CARGO models processes that have a Goal with a defined achievement involving a Zone and Cargo. -- ZONE_GOAL_CARGO models processes that have a Goal with a defined achievement involving a Zone and Cargo.
-- Derived classes implement the ways how the achievements can be realized. -- Derived classes implement the ways how the achievements can be realized.
--
-- # Developer Note
-- --
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- === -- ===
-- --
-- ### Author: **FlightControl** -- ### Author: **FlightControl**
@@ -56,7 +61,7 @@ do -- ZoneGoal
--- ZONE_GOAL_CARGO Constructor. --- ZONE_GOAL_CARGO Constructor.
-- @param #ZONE_GOAL_CARGO self -- @param #ZONE_GOAL_CARGO self
-- @param Core.Zone#ZONE Zone A @{Core.Zone} object with the goal to be achieved. -- @param Core.Zone#ZONE Zone A @{Core.Zone} object with the goal to be achieved.
-- @param DCSCoalition.DCSCoalition#coalition Coalition The initial coalition owning the zone. -- @param #number Coalition The initial coalition owning the zone.
-- @return #ZONE_GOAL_CARGO -- @return #ZONE_GOAL_CARGO
function ZONE_GOAL_CARGO:New( Zone, Coalition ) function ZONE_GOAL_CARGO:New( Zone, Coalition )
@@ -254,7 +259,7 @@ do -- ZoneGoal
--- Set the owning coalition of the zone. --- Set the owning coalition of the zone.
-- @param #ZONE_GOAL_CARGO self -- @param #ZONE_GOAL_CARGO self
-- @param DCSCoalition.DCSCoalition#coalition Coalition -- @param #number Coalition
function ZONE_GOAL_CARGO:SetCoalition( Coalition ) function ZONE_GOAL_CARGO:SetCoalition( Coalition )
self.Coalition = Coalition self.Coalition = Coalition
end end
@@ -262,7 +267,7 @@ do -- ZoneGoal
--- Get the owning coalition of the zone. --- Get the owning coalition of the zone.
-- @param #ZONE_GOAL_CARGO self -- @param #ZONE_GOAL_CARGO self
-- @return DCSCoalition.DCSCoalition#coalition Coalition. -- @return #number Coalition.
function ZONE_GOAL_CARGO:GetCoalition() function ZONE_GOAL_CARGO:GetCoalition()
return self.Coalition return self.Coalition
end end

View File

@@ -54,7 +54,7 @@ do -- ZoneGoal
--- ZONE_GOAL_COALITION Constructor. --- ZONE_GOAL_COALITION Constructor.
-- @param #ZONE_GOAL_COALITION self -- @param #ZONE_GOAL_COALITION self
-- @param Core.Zone#ZONE Zone A @{Core.Zone} object with the goal to be achieved. -- @param Core.Zone#ZONE Zone A @{Core.Zone} object with the goal to be achieved.
-- @param DCSCoalition.DCSCoalition#coalition Coalition The initial coalition owning the zone. Default coalition.side.NEUTRAL. -- @param #number Coalition The initial coalition owning the zone. Default coalition.side.NEUTRAL.
-- @param #table UnitCategories Table of unit categories. See [DCS Class Unit](https://wiki.hoggitworld.com/view/DCS_Class_Unit). Default {Unit.Category.GROUND_UNIT}. -- @param #table UnitCategories Table of unit categories. See [DCS Class Unit](https://wiki.hoggitworld.com/view/DCS_Class_Unit). Default {Unit.Category.GROUND_UNIT}.
-- @return #ZONE_GOAL_COALITION -- @return #ZONE_GOAL_COALITION
function ZONE_GOAL_COALITION:New( Zone, Coalition, UnitCategories ) function ZONE_GOAL_COALITION:New( Zone, Coalition, UnitCategories )
@@ -80,7 +80,7 @@ do -- ZoneGoal
--- Set the owning coalition of the zone. --- Set the owning coalition of the zone.
-- @param #ZONE_GOAL_COALITION self -- @param #ZONE_GOAL_COALITION self
-- @param DCSCoalition.DCSCoalition#coalition Coalition The coalition ID, e.g. *coalition.side.RED*. -- @param #number Coalition The coalition ID, e.g. *coalition.side.RED*.
-- @return #ZONE_GOAL_COALITION -- @return #ZONE_GOAL_COALITION
function ZONE_GOAL_COALITION:SetCoalition( Coalition ) function ZONE_GOAL_COALITION:SetCoalition( Coalition )
self.PreviousCoalition = self.Coalition or Coalition self.PreviousCoalition = self.Coalition or Coalition
@@ -120,14 +120,14 @@ do -- ZoneGoal
--- Get the owning coalition of the zone. --- Get the owning coalition of the zone.
-- @param #ZONE_GOAL_COALITION self -- @param #ZONE_GOAL_COALITION self
-- @return DCSCoalition.DCSCoalition#coalition Coalition. -- @return #number Coalition.
function ZONE_GOAL_COALITION:GetCoalition() function ZONE_GOAL_COALITION:GetCoalition()
return self.Coalition return self.Coalition
end end
--- Get the previous coalition, i.e. the one owning the zone before the current one. --- Get the previous coalition, i.e. the one owning the zone before the current one.
-- @param #ZONE_GOAL_COALITION self -- @param #ZONE_GOAL_COALITION self
-- @return DCSCoalition.DCSCoalition#coalition Coalition. -- @return #number Coalition.
function ZONE_GOAL_COALITION:GetPreviousCoalition() function ZONE_GOAL_COALITION:GetPreviousCoalition()
return self.PreviousCoalition return self.PreviousCoalition
end end

View File

@@ -1,146 +1,149 @@
__Moose.Include( 'Scripts/Moose/Utilities/Enums.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/Enums.lua' )
__Moose.Include( 'Scripts/Moose/Utilities/Routines.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/Utils.lua' )
__Moose.Include( 'Scripts/Moose/Utilities/Utils.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/Profiler.lua' )
__Moose.Include( 'Scripts/Moose/Utilities/Profiler.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/Templates.lua' )
__Moose.Include( 'Scripts/Moose/Utilities/Templates.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/STTS.lua' )
__Moose.Include( 'Scripts/Moose/Utilities/STTS.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/FiFo.lua' )
__Moose.Include( 'Scripts/Moose/Utilities/FiFo.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/Socket.lua' )
__Moose.Include( 'Scripts/Moose/Utilities/Socket.lua' )
__Moose.Include( 'Scripts/Moose/Core/Base.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Base.lua' )
__Moose.Include( 'Scripts/Moose/Core/Astar.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Astar.lua' )
__Moose.Include( 'Scripts/Moose/Core/Beacon.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Beacon.lua' )
__Moose.Include( 'Scripts/Moose/Core/Condition.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Condition.lua' )
__Moose.Include( 'Scripts/Moose/Core/UserFlag.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/UserFlag.lua' )
__Moose.Include( 'Scripts/Moose/Core/Report.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Report.lua' )
__Moose.Include( 'Scripts/Moose/Core/Scheduler.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Scheduler.lua' )
__Moose.Include( 'Scripts/Moose/Core/ScheduleDispatcher.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/ScheduleDispatcher.lua' )
__Moose.Include( 'Scripts/Moose/Core/Event.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Event.lua' )
__Moose.Include( 'Scripts/Moose/Core/Settings.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Settings.lua' )
__Moose.Include( 'Scripts/Moose/Core/Menu.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Menu.lua' )
__Moose.Include( 'Scripts/Moose/Core/Zone.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Zone.lua' )
__Moose.Include( 'Scripts/Moose/Core/Zone_Detection.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Zone_Detection.lua' )
__Moose.Include( 'Scripts/Moose/Core/Database.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Database.lua' )
__Moose.Include( 'Scripts/Moose/Core/Set.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Set.lua' )
__Moose.Include( 'Scripts/Moose/Core/Point.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Point.lua' )
__Moose.Include( 'Scripts/Moose/Core/Velocity.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Velocity.lua' )
__Moose.Include( 'Scripts/Moose/Core/Message.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Message.lua' )
__Moose.Include( 'Scripts/Moose/Core/Fsm.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Fsm.lua' )
__Moose.Include( 'Scripts/Moose/Core/Spawn.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Spawn.lua' )
__Moose.Include( 'Scripts/Moose/Core/SpawnStatic.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/SpawnStatic.lua' )
__Moose.Include( 'Scripts/Moose/Core/Timer.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Timer.lua' )
__Moose.Include( 'Scripts/Moose/Core/Goal.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Goal.lua' )
__Moose.Include( 'Scripts/Moose/Core/Spot.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Spot.lua' )
__Moose.Include( 'Scripts/Moose/Core/MarkerOps_Base.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/MarkerOps_Base.lua' )
__Moose.Include( 'Scripts/Moose/Core/TextAndSound.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/TextAndSound.lua' )
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Pathline.lua' )
__Moose.Include( 'Scripts/Moose/Wrapper/Object.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Object.lua' )
__Moose.Include( 'Scripts/Moose/Wrapper/Identifiable.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Identifiable.lua' )
__Moose.Include( 'Scripts/Moose/Wrapper/Positionable.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Positionable.lua' )
__Moose.Include( 'Scripts/Moose/Wrapper/Controllable.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Controllable.lua' )
__Moose.Include( 'Scripts/Moose/Wrapper/Group.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Group.lua' )
__Moose.Include( 'Scripts/Moose/Wrapper/Unit.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Unit.lua' )
__Moose.Include( 'Scripts/Moose/Wrapper/Client.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Client.lua' )
__Moose.Include( 'Scripts/Moose/Wrapper/Static.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Static.lua' )
__Moose.Include( 'Scripts/Moose/Wrapper/Airbase.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Airbase.lua' )
__Moose.Include( 'Scripts/Moose/Wrapper/Scenery.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Scenery.lua' )
__Moose.Include( 'Scripts/Moose/Wrapper/Marker.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Marker.lua' )
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Weapon.lua' )
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Net.lua' )
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Storage.lua' )
__Moose.Include( 'Scripts/Moose/Cargo/Cargo.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Cargo/Cargo.lua' )
__Moose.Include( 'Scripts/Moose/Cargo/CargoUnit.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Cargo/CargoUnit.lua' )
__Moose.Include( 'Scripts/Moose/Cargo/CargoSlingload.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Cargo/CargoSlingload.lua' )
__Moose.Include( 'Scripts/Moose/Cargo/CargoCrate.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Cargo/CargoCrate.lua' )
__Moose.Include( 'Scripts/Moose/Cargo/CargoGroup.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Cargo/CargoGroup.lua' )
__Moose.Include( 'Scripts/Moose/Functional/Scoring.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Scoring.lua' )
__Moose.Include( 'Scripts/Moose/Functional/CleanUp.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/CleanUp.lua' )
__Moose.Include( 'Scripts/Moose/Functional/Movement.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Movement.lua' )
__Moose.Include( 'Scripts/Moose/Functional/Sead.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Sead.lua' )
__Moose.Include( 'Scripts/Moose/Functional/Escort.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Escort.lua' )
__Moose.Include( 'Scripts/Moose/Functional/MissileTrainer.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/MissileTrainer.lua' )
__Moose.Include( 'Scripts/Moose/Functional/ATC_Ground.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/ATC_Ground.lua' )
__Moose.Include( 'Scripts/Moose/Functional/Detection.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Detection.lua' )
__Moose.Include( 'Scripts/Moose/Functional/DetectionZones.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/DetectionZones.lua' )
__Moose.Include( 'Scripts/Moose/Functional/Designate.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Designate.lua' )
__Moose.Include( 'Scripts/Moose/Functional/RAT.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/RAT.lua' )
__Moose.Include( 'Scripts/Moose/Functional/Range.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Range.lua' )
__Moose.Include( 'Scripts/Moose/Functional/ZoneGoal.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/ZoneGoal.lua' )
__Moose.Include( 'Scripts/Moose/Functional/ZoneGoalCoalition.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/ZoneGoalCoalition.lua' )
__Moose.Include( 'Scripts/Moose/Functional/ZoneCaptureCoalition.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/ZoneCaptureCoalition.lua' )
__Moose.Include( 'Scripts/Moose/Functional/Artillery.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Artillery.lua' )
__Moose.Include( 'Scripts/Moose/Functional/Suppression.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Suppression.lua' )
__Moose.Include( 'Scripts/Moose/Functional/PseudoATC.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/PseudoATC.lua' )
__Moose.Include( 'Scripts/Moose/Functional/Warehouse.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Warehouse.lua' )
__Moose.Include( 'Scripts/Moose/Functional/Fox.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Fox.lua' )
__Moose.Include( 'Scripts/Moose/Functional/Mantis.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Mantis.lua' )
__Moose.Include( 'Scripts/Moose/Functional/Shorad.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Shorad.lua' )
__Moose.Include( 'Scripts/Moose/Ops/Airboss.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Airboss.lua' )
__Moose.Include( 'Scripts/Moose/Ops/RecoveryTanker.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/RecoveryTanker.lua' )
__Moose.Include( 'Scripts/Moose/Ops/RescueHelo.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/RescueHelo.lua' )
__Moose.Include( 'Scripts/Moose/Ops/ATIS.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/ATIS.lua' )
__Moose.Include( 'Scripts/Moose/Ops/CTLD.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/CTLD.lua' )
__Moose.Include( 'Scripts/Moose/Ops/CSAR.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/CSAR.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_Balancer.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Balancer.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_Air.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Air.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_Air_Patrol.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Air_Patrol.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_Air_Engage.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Air_Engage.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_A2A_Patrol.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2A_Patrol.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_A2A_Cap.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2A_Cap.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_A2A_Gci.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2A_Gci.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_A2A_Dispatcher.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2A_Dispatcher.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_A2G_BAI.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2G_BAI.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_A2G_CAS.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2G_CAS.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_A2G_SEAD.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2G_SEAD.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_A2G_Dispatcher.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2G_Dispatcher.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_Patrol.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Patrol.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_Cap.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_CAP.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_Cas.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_CAS.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_Bai.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_BAI.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_Formation.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Formation.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_Escort.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Escort.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_Escort_Request.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Escort_Request.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_Escort_Dispatcher.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Escort_Dispatcher.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_Escort_Dispatcher_Request.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Escort_Dispatcher_Request.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_Cargo.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_Cargo_APC.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_APC.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_Cargo_Helicopter.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Helicopter.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_Cargo_Airplane.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Airplane.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_Cargo_Ship.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Ship.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_Cargo_Dispatcher.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Dispatcher.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_Cargo_Dispatcher_APC.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Dispatcher_APC.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_Cargo_Dispatcher_Helicopter.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Dispatcher_Helicopter.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_Cargo_Dispatcher_Airplane.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Dispatcher_Airplane.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_Cargo_Dispatcher_Ship.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Dispatcher_Ship.lua' )
__Moose.Include( 'Scripts/Moose/Actions/Act_Assign.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Actions/Act_Assign.lua' )
__Moose.Include( 'Scripts/Moose/Actions/Act_Route.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Actions/Act_Route.lua' )
__Moose.Include( 'Scripts/Moose/Actions/Act_Account.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Actions/Act_Account.lua' )
__Moose.Include( 'Scripts/Moose/Actions/Act_Assist.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Actions/Act_Assist.lua' )
__Moose.Include( 'Scripts/Moose/Sound/UserSound.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Sound/UserSound.lua' )
__Moose.Include( 'Scripts/Moose/Sound/SoundOutput.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Sound/SoundOutput.lua' )
__Moose.Include( 'Scripts/Moose/Sound/Radio.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Sound/Radio.lua' )
__Moose.Include( 'Scripts/Moose/Sound/RadioQueue.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Sound/RadioQueue.lua' )
__Moose.Include( 'Scripts/Moose/Sound/RadioSpeech.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Sound/RadioSpeech.lua' )
__Moose.Include( 'Scripts/Moose/Sound/SRS.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Sound/SRS.lua' )
__Moose.Include( 'Scripts/Moose/Tasking/CommandCenter.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/CommandCenter.lua' )
__Moose.Include( 'Scripts/Moose/Tasking/Mission.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Mission.lua' )
__Moose.Include( 'Scripts/Moose/Tasking/Task.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task.lua' )
__Moose.Include( 'Scripts/Moose/Tasking/TaskInfo.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/TaskInfo.lua' )
__Moose.Include( 'Scripts/Moose/Tasking/Task_Manager.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_Manager.lua' )
__Moose.Include( 'Scripts/Moose/Tasking/DetectionManager.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/DetectionManager.lua' )
__Moose.Include( 'Scripts/Moose/Tasking/Task_A2G_Dispatcher.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_A2G_Dispatcher.lua' )
__Moose.Include( 'Scripts/Moose/Tasking/Task_A2G.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_A2G.lua' )
__Moose.Include( 'Scripts/Moose/Tasking/Task_A2A_Dispatcher.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_A2A_Dispatcher.lua' )
__Moose.Include( 'Scripts/Moose/Tasking/Task_A2A.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_A2A.lua' )
__Moose.Include( 'Scripts/Moose/Tasking/Task_Cargo.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_CARGO.lua' )
__Moose.Include( 'Scripts/Moose/Tasking/Task_Cargo_Transport.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_Cargo_Transport.lua' )
__Moose.Include( 'Scripts/Moose/Tasking/Task_Cargo_CSAR.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_Cargo_CSAR.lua' )
__Moose.Include( 'Scripts/Moose/Tasking/Task_Cargo_Dispatcher.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_Cargo_Dispatcher.lua' )
__Moose.Include( 'Scripts/Moose/Tasking/Task_Capture_Zone.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_Capture_Zone.lua' )
__Moose.Include( 'Scripts/Moose/Tasking/Task_Capture_Dispatcher.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_Capture_Dispatcher.lua' )
__Moose.Include( 'Scripts/Moose/Globals.lua' ) __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Globals.lua' )

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -16,7 +16,7 @@
-- --
-- ## Missions: -- ## Missions:
-- --
-- ### [CSAR - Combat Search & Rescue](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/OPS%20-%20CSAR) -- ### [CSAR - Combat Search & Rescue](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/Ops/CSAR)
-- --
-- === -- ===
-- --
@@ -30,7 +30,8 @@
-- @module Ops.CSAR -- @module Ops.CSAR
-- @image OPS_CSAR.jpg -- @image OPS_CSAR.jpg
-- Date: January 2023 -- Date: May 2023
-- Last: Update Dec 2024
------------------------------------------------------------------------- -------------------------------------------------------------------------
--- **CSAR** class, extends Core.Base#BASE, Core.Fsm#FSM --- **CSAR** class, extends Core.Base#BASE, Core.Fsm#FSM
@@ -46,8 +47,6 @@
-- --
-- === -- ===
-- --
-- ![Banner Image](OPS_CSAR.jpg)
--
-- # CSAR Concept -- # CSAR Concept
-- --
-- * MOOSE-based Helicopter CSAR Operations for Players. -- * MOOSE-based Helicopter CSAR Operations for Players.
@@ -61,6 +60,8 @@
-- You need to load an .ogg soundfile for the pilot\'s beacons into the mission, e.g. "beacon.ogg", use a once trigger, "sound to country" for that. -- You need to load an .ogg soundfile for the pilot\'s beacons into the mission, e.g. "beacon.ogg", use a once trigger, "sound to country" for that.
-- Create a late-activated single infantry unit as template in the mission editor and name it e.g. "Downed Pilot". -- Create a late-activated single infantry unit as template in the mission editor and name it e.g. "Downed Pilot".
-- --
-- Example sound files are here: [Moose Sound](https://github.com/FlightControl-Master/MOOSE_SOUND/tree/master/CTLD%20CSAR)
--
-- ## 1. Basic Setup -- ## 1. Basic Setup
-- --
-- A basic setup example is the following: -- A basic setup example is the following:
@@ -116,21 +117,21 @@
-- mycsar.ADFRadioPwr = 1000 -- ADF Beacons sending with 1KW as default -- mycsar.ADFRadioPwr = 1000 -- ADF Beacons sending with 1KW as default
-- mycsar.PilotWeight = 80 -- Loaded pilots weigh 80kgs each -- mycsar.PilotWeight = 80 -- Loaded pilots weigh 80kgs each
-- --
-- ## 2.1 Experimental Features -- ## 2.1 SRS Features and Other Features
-- --
-- WARNING - Here\'ll be dragons!
-- DANGER - For this to work you need to de-sanitize your mission environment (all three entries) in <DCS root>\Scripts\MissionScripting.lua
-- Needs SRS => 1.9.6 to work (works on the **server** side of SRS)
-- mycsar.useSRS = false -- Set true to use FF\'s SRS integration -- mycsar.useSRS = false -- Set true to use FF\'s SRS integration
-- mycsar.SRSPath = "C:\\Progra~1\\DCS-SimpleRadio-Standalone\\" -- adjust your own path in your SRS installation -- server(!) -- mycsar.SRSPath = "C:\\Progra~1\\DCS-SimpleRadio-Standalone\\" -- adjust your own path in your SRS installation -- server(!)
-- mycsar.SRSchannel = 300 -- radio channel -- mycsar.SRSchannel = 300 -- radio channel
-- mycsar.SRSModulation = radio.modulation.AM -- modulation -- mycsar.SRSModulation = radio.modulation.AM -- modulation
-- mycsar.SRSport = 5002 -- and SRS Server port -- mycsar.SRSport = 5002 -- and SRS Server port
-- mycsar.SRSCulture = "en-GB" -- SRS voice culture -- mycsar.SRSCulture = "en-GB" -- SRS voice culture
-- mycsar.SRSVoice = nil -- SRS voice, relevant for Google TTS -- mycsar.SRSVoice = nil -- SRS voice for downed pilot, relevant for Google TTS
-- mycsar.SRSGPathToCredentials = nil -- Path to your Google credentials json file, set this if you want to use Google TTS -- mycsar.SRSGPathToCredentials = nil -- Path to your Google credentials json file, set this if you want to use Google TTS
-- mycsar.SRSVolume = 1 -- Volume, between 0 and 1 -- mycsar.SRSVolume = 1 -- Volume, between 0 and 1
-- mycsar.SRSGender = "male" -- male or female voice -- mycsar.SRSGender = "male" -- male or female voice
-- mycsar.CSARVoice = MSRS.Voices.Google.Standard.en_US_Standard_A -- SRS voice for CSAR Controller, relevant for Google TTS
-- mycsar.CSARVoiceMS = MSRS.Voices.Microsoft.Hedda -- SRS voice for CSAR Controller, relevant for MS Desktop TTS
-- mycsar.coordinate -- Coordinate from which CSAR TTS is sending. Defaults to a random MASH object position
-- -- -- --
-- mycsar.csarUsePara = false -- If set to true, will use the LandingAfterEjection Event instead of Ejection. Requires mycsar.enableForAI to be set to true. --shagrat -- mycsar.csarUsePara = false -- If set to true, will use the LandingAfterEjection Event instead of Ejection. Requires mycsar.enableForAI to be set to true. --shagrat
-- mycsar.wetfeettemplate = "man in floating thingy" -- if you use a mod to have a pilot in a rescue float, put the template name in here for wet feet spawns. Note: in conjunction with csarUsePara this might create dual ejected pilots in edge cases. -- mycsar.wetfeettemplate = "man in floating thingy" -- if you use a mod to have a pilot in a rescue float, put the template name in here for wet feet spawns. Note: in conjunction with csarUsePara this might create dual ejected pilots in edge cases.
@@ -230,7 +231,7 @@ CSAR = {
takenOff = {}, takenOff = {},
csarUnits = {}, -- table of unit names csarUnits = {}, -- table of unit names
downedPilots = {}, downedPilots = {},
woundedGroups = {}, -- = {},
landedStatus = {}, landedStatus = {},
addedTo = {}, addedTo = {},
woundedGroups = {}, -- contains the new group of units woundedGroups = {}, -- contains the new group of units
@@ -292,7 +293,7 @@ CSAR.AircraftType["Bronco-OV-10A"] = 2
--- CSAR class version. --- CSAR class version.
-- @field #string version -- @field #string version
CSAR.version="1.0.17" CSAR.version="1.0.19"
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- ToDo list -- ToDo list
@@ -316,7 +317,7 @@ function CSAR:New(Coalition, Template, Alias)
-- Inherit everything from FSM class. -- Inherit everything from FSM class.
local self=BASE:Inherit(self, FSM:New()) -- #CSAR local self=BASE:Inherit(self, FSM:New()) -- #CSAR
BASE:T({Coalition, Prefixes, Alias}) BASE:T({Coalition, Template, Alias})
--set Coalition --set Coalition
if Coalition and type(Coalition)=="string" then if Coalition and type(Coalition)=="string" then
@@ -465,7 +466,10 @@ function CSAR:New(Coalition, Template, Alias)
self.SRSGPathToCredentials = nil self.SRSGPathToCredentials = nil
self.SRSVolume = 1.0 -- volume 0.0 to 1.0 self.SRSVolume = 1.0 -- volume 0.0 to 1.0
self.SRSGender = "male" -- male or female self.SRSGender = "male" -- male or female
self.CSARVoice = MSRS.Voices.Google.Standard.en_US_Standard_A
self.CSARVoiceMS = MSRS.Voices.Microsoft.Hedda
self.coordinate = nil -- Core.Point#COORDINATE
local AliaS = string.gsub(self.alias," ","_") local AliaS = string.gsub(self.alias," ","_")
self.filename = string.format("CSAR_%s_Persist.csv",AliaS) self.filename = string.format("CSAR_%s_Persist.csv",AliaS)
@@ -532,6 +536,7 @@ function CSAR:New(Coalition, Template, Alias)
-- @param #number Frequency Beacon frequency in kHz. -- @param #number Frequency Beacon frequency in kHz.
-- @param #string Leadername Name of the #UNIT of the downed pilot. -- @param #string Leadername Name of the #UNIT of the downed pilot.
-- @param #string CoordinatesText String of the position of the pilot. Format determined by self.coordtype. -- @param #string CoordinatesText String of the position of the pilot. Format determined by self.coordtype.
-- @param #string Playername Player name if any given. Might be nil!
--- On After "Aproach" event. Heli close to downed Pilot. --- On After "Aproach" event. Heli close to downed Pilot.
-- @function [parent=#CSAR] OnAfterApproach -- @function [parent=#CSAR] OnAfterApproach
@@ -838,7 +843,7 @@ function CSAR:_AddCsar(_coalition , _country, _point, _typeName, _unitName, _pla
self:_CreateDownedPilotTrack(_spawnedGroup,_GroupName,_coalition,_unitName,_text,_typeName,_freq,_playerName,wetfeet) self:_CreateDownedPilotTrack(_spawnedGroup,_GroupName,_coalition,_unitName,_text,_typeName,_freq,_playerName,wetfeet)
self:_InitSARForPilot(_spawnedGroup, _unitName, _freq, noMessage) --shagrat use unitName to have the aircraft callsign / descriptive "name" etc. self:_InitSARForPilot(_spawnedGroup, _unitName, _freq, noMessage, _playerName) --shagrat use unitName to have the aircraft callsign / descriptive "name" etc.
return self return self
end end
@@ -1220,7 +1225,8 @@ end
-- @param #string _GroupName Name of the Group -- @param #string _GroupName Name of the Group
-- @param #number _freq Beacon frequency. -- @param #number _freq Beacon frequency.
-- @param #boolean _nomessage Send message true or false. -- @param #boolean _nomessage Send message true or false.
function CSAR:_InitSARForPilot(_downedGroup, _GroupName, _freq, _nomessage) -- @param #string _playername Name of the downed pilot if any
function CSAR:_InitSARForPilot(_downedGroup, _GroupName, _freq, _nomessage, _playername)
self:T(self.lid .. " _InitSARForPilot") self:T(self.lid .. " _InitSARForPilot")
local _leader = _downedGroup:GetUnit(1) local _leader = _downedGroup:GetUnit(1)
local _groupName = _GroupName local _groupName = _GroupName
@@ -1243,7 +1249,7 @@ function CSAR:_InitSARForPilot(_downedGroup, _GroupName, _freq, _nomessage)
end end
-- trigger FSM event -- trigger FSM event
self:__PilotDown(2,_downedGroup, _freqk, _groupName, _coordinatesText) self:__PilotDown(2,_downedGroup, _freqk, _groupName, _coordinatesText, _playername)
return self return self
end end
@@ -1306,7 +1312,7 @@ end
-- @param #string UnitName -- @param #string UnitName
-- @return #string CallSign -- @return #string CallSign
function CSAR:_GetCustomCallSign(UnitName) function CSAR:_GetCustomCallSign(UnitName)
local callsign = Unitname local callsign = UnitName
local unit = UNIT:FindByName(UnitName) local unit = UNIT:FindByName(UnitName)
if unit and unit:IsAlive() then if unit and unit:IsAlive() then
local group = unit:GetGroup() local group = unit:GetGroup()
@@ -1737,7 +1743,16 @@ function CSAR:_DisplayMessageToSAR(_unit, _text, _time, _clear, _speak, _overrid
end end
-- integrate SRS -- integrate SRS
if _speak and self.useSRS then if _speak and self.useSRS then
self.SRSQueue:NewTransmission(_text,nil,self.msrs,nil,2) local coord = _unit:GetCoordinate()
if coord then
self.msrs:SetCoordinate(coord)
end
_text = string.gsub(_text,"km"," kilometer")
_text = string.gsub(_text,"nm"," nautical miles")
--self.msrs:SetVoice(self.SRSVoice)
--self.SRSQueue:NewTransmission(_text,nil,self.msrs,nil,1)
self:I("Voice = "..self.SRSVoice)
self.SRSQueue:NewTransmission(_text,duration,self.msrs,tstart,2,subgroups,subtitle,subduration,self.SRSchannel,self.SRSModulation,gender,culture,self.SRSVoice,volume,label,coord)
end end
return self return self
end end
@@ -1876,11 +1891,11 @@ function CSAR:_SignalFlare(_unitName)
if _closest ~= nil and _closest.pilot ~= nil and _closest.distance > 0 and _closest.distance < smokedist then if _closest ~= nil and _closest.pilot ~= nil and _closest.distance > 0 and _closest.distance < smokedist then
local _clockDir = self:_GetClockDirection(_heli, _closest.pilot) local _clockDir = self:_GetClockDirection(_heli, _closest.pilot)
local _distance = 0 local _distance = ""
if _SETTINGS:IsImperial() then if _SETTINGS:IsImperial() then
_distance = string.format("%.1fnm",UTILS.MetersToNM(_closest.distance)) _distance = string.format("%.1fnm",UTILS.MetersToNM(_closest.distance))
else else
_distance = string.format("%.1fkm",_closest.distance) _distance = string.format("%.1fkm",_closest.distance/1000)
end end
local _msg = string.format("%s - Popping signal flare at your %s o\'clock. Distance %s", self:_GetCustomCallSign(_unitName), _clockDir, _distance) local _msg = string.format("%s - Popping signal flare at your %s o\'clock. Distance %s", self:_GetCustomCallSign(_unitName), _clockDir, _distance)
self:_DisplayMessageToSAR(_heli, _msg, self.messageTime, false, true, true) self:_DisplayMessageToSAR(_heli, _msg, self.messageTime, false, true, true)
@@ -1889,12 +1904,13 @@ function CSAR:_SignalFlare(_unitName)
_coord:FlareRed(_clockDir) _coord:FlareRed(_clockDir)
else else
local _distance = smokedist local _distance = smokedist
local dtext = ""
if _SETTINGS:IsImperial() then if _SETTINGS:IsImperial() then
_distance = string.format("%.1fnm",UTILS.MetersToNM(smokedist)) dtext = string.format("%.1fnm",UTILS.MetersToNM(smokedist))
else else
_distance = string.format("%.1fkm",smokedist/1000) dtext = string.format("%.1fkm",smokedist/1000)
end end
self:_DisplayMessageToSAR(_heli, string.format("No Pilots within %s",_distance), self.messageTime, false, false, true) self:_DisplayMessageToSAR(_heli, string.format("No Pilots within %s",dtext), self.messageTime, false, false, true)
end end
return self return self
end end
@@ -1907,6 +1923,14 @@ end
function CSAR:_DisplayToAllSAR(_message, _side, _messagetime) function CSAR:_DisplayToAllSAR(_message, _side, _messagetime)
self:T(self.lid .. " _DisplayToAllSAR") self:T(self.lid .. " _DisplayToAllSAR")
local messagetime = _messagetime or self.messageTime local messagetime = _messagetime or self.messageTime
if self.msrs then
local voice = self.CSARVoice or MSRS.Voices.Google.Standard.en_GB_Standard_F
if self.msrs:GetProvider() == MSRS.Provider.WINDOWS then
voice = self.CSARVoiceMS or MSRS.Voices.Microsoft.Hedda
end
self:I("Voice = "..voice)
self.SRSQueue:NewTransmission(_message,duration,self.msrs,tstart,2,subgroups,subtitle,subduration,self.SRSchannel,self.SRSModulation,gender,culture,voice,volume,label,self.coordinate)
end
for _, _unitName in pairs(self.csarUnits) do for _, _unitName in pairs(self.csarUnits) do
local _unit = self:_GetSARHeli(_unitName) local _unit = self:_GetSARHeli(_unitName)
if _unit and not self.suppressmessages then if _unit and not self.suppressmessages then
@@ -1930,7 +1954,7 @@ function CSAR:_Reqsmoke( _unitName )
local _closest = self:_GetClosestDownedPilot(_heli) local _closest = self:_GetClosestDownedPilot(_heli)
if _closest ~= nil and _closest.pilot ~= nil and _closest.distance > 0 and _closest.distance < smokedist then if _closest ~= nil and _closest.pilot ~= nil and _closest.distance > 0 and _closest.distance < smokedist then
local _clockDir = self:_GetClockDirection(_heli, _closest.pilot) local _clockDir = self:_GetClockDirection(_heli, _closest.pilot)
local _distance = 0 local _distance = string.format("%.1fkm",_closest.distance/1000)
if _SETTINGS:IsImperial() then if _SETTINGS:IsImperial() then
_distance = string.format("%.1fnm",UTILS.MetersToNM(_closest.distance)) _distance = string.format("%.1fnm",UTILS.MetersToNM(_closest.distance))
else else
@@ -1942,7 +1966,7 @@ function CSAR:_Reqsmoke( _unitName )
local color = self.smokecolor local color = self.smokecolor
_coord:Smoke(color) _coord:Smoke(color)
else else
local _distance = 0 local _distance = string.format("%.1fkm",smokedist/1000)
if _SETTINGS:IsImperial() then if _SETTINGS:IsImperial() then
_distance = string.format("%.1fnm",UTILS.MetersToNM(smokedist)) _distance = string.format("%.1fnm",UTILS.MetersToNM(smokedist))
else else
@@ -2175,6 +2199,7 @@ function CSAR:_AddBeaconToGroup(_group, _freq)
if _group:IsAlive() then if _group:IsAlive() then
local _radioUnit = _group:GetUnit(1) local _radioUnit = _group:GetUnit(1)
if _radioUnit then if _radioUnit then
local name = _radioUnit:GetName()
local Frequency = _freq -- Freq in Hertz local Frequency = _freq -- Freq in Hertz
local name = _radioUnit:GetName() local name = _radioUnit:GetName()
local Sound = "l10n/DEFAULT/"..self.radioSound local Sound = "l10n/DEFAULT/"..self.radioSound
@@ -2266,6 +2291,12 @@ function CSAR:onafterStart(From, Event, To)
self.allheligroupset = SET_GROUP:New():FilterCoalitions(self.coalitiontxt):FilterCategoryHelicopter():FilterStart() self.allheligroupset = SET_GROUP:New():FilterCoalitions(self.coalitiontxt):FilterCategoryHelicopter():FilterStart()
end end
self.mash = SET_GROUP:New():FilterCoalitions(self.coalitiontxt):FilterPrefixes(self.mashprefix):FilterStart() -- currently only GROUP objects, maybe support STATICs also? self.mash = SET_GROUP:New():FilterCoalitions(self.coalitiontxt):FilterPrefixes(self.mashprefix):FilterStart() -- currently only GROUP objects, maybe support STATICs also?
if not self.coordinate then
local csarhq = self.mash:GetRandom()
if csarhq then
self.coordinate = csarhq:GetCoordinate()
end
end
if self.wetfeettemplate then if self.wetfeettemplate then
self.usewetfeet = true self.usewetfeet = true
end end
@@ -2273,7 +2304,7 @@ function CSAR:onafterStart(From, Event, To)
local path = self.SRSPath local path = self.SRSPath
local modulation = self.SRSModulation local modulation = self.SRSModulation
local channel = self.SRSchannel local channel = self.SRSchannel
self.msrs = MSRS:New(path,channel,modulation) self.msrs = MSRS:New(path,channel,modulation) -- Sound.SRS#MSRS
self.msrs:SetPort(self.SRSport) self.msrs:SetPort(self.SRSport)
self.msrs:SetLabel("CSAR") self.msrs:SetLabel("CSAR")
self.msrs:SetCulture(self.SRSCulture) self.msrs:SetCulture(self.SRSCulture)
@@ -2281,11 +2312,12 @@ function CSAR:onafterStart(From, Event, To)
self.msrs:SetVoice(self.SRSVoice) self.msrs:SetVoice(self.SRSVoice)
self.msrs:SetGender(self.SRSGender) self.msrs:SetGender(self.SRSGender)
if self.SRSGPathToCredentials then if self.SRSGPathToCredentials then
self.msrs:SetGoogle(self.SRSGPathToCredentials) self.msrs:SetProviderOptionsGoogle(self.SRSGPathToCredentials,self.SRSGPathToCredentials)
self.msrs:SetProvider(MSRS.Provider.GOOGLE)
end end
self.msrs:SetVolume(self.SRSVolume) self.msrs:SetVolume(self.SRSVolume)
self.msrs:SetLabel("CSAR") self.msrs:SetLabel("CSAR")
self.SRSQueue = MSRSQUEUE:New("CSAR") self.SRSQueue = MSRSQUEUE:New("CSAR") -- Sound.SRS#MSRSQUEUE
end end
self:__Status(-10) self:__Status(-10)
@@ -2513,8 +2545,9 @@ end
-- @param #number Frequency Beacon frequency in kHz. -- @param #number Frequency Beacon frequency in kHz.
-- @param #string Leadername Name of the #UNIT of the downed pilot. -- @param #string Leadername Name of the #UNIT of the downed pilot.
-- @param #string CoordinatesText String of the position of the pilot. Format determined by self.coordtype. -- @param #string CoordinatesText String of the position of the pilot. Format determined by self.coordtype.
function CSAR:onbeforePilotDown(From, Event, To, Group, Frequency, Leadername, CoordinatesText) -- @param #string Playername Player name if any given. Might be nil!
self:T({From, Event, To, Group, Frequency, Leadername, CoordinatesText}) function CSAR:onbeforePilotDown(From, Event, To, Group, Frequency, Leadername, CoordinatesText, Playername)
self:T({From, Event, To, Group, Frequency, Leadername, CoordinatesText, tostring(Playername)})
return self return self
end end
@@ -2750,12 +2783,12 @@ function CSAR:onafterLoad(From, Event, To, path, filename)
vec3.z = tonumber(dataset[4]) vec3.z = tonumber(dataset[4])
local point = COORDINATE:NewFromVec3(vec3) local point = COORDINATE:NewFromVec3(vec3)
local coalition = dataset[5] local coalition = tonumber(dataset[5])
local country = dataset[6] local country = tonumber(dataset[6])
local description = dataset[7] local description = dataset[7]
local typeName = dataset[8] local typeName = dataset[8]
local unitName = dataset[9] local unitName = dataset[9]
local freq = dataset[10] local freq = tonumber(dataset[10])
self:_AddCsar(coalition, country, point, typeName, unitName, playerName, freq, nil, description, nil) self:_AddCsar(coalition, country, point, typeName, unitName, playerName, freq, nil, description, nil)
end end

File diff suppressed because it is too large Load Diff

View File

@@ -63,6 +63,7 @@
-- @field #boolean eplrs If true, enable data link, e.g. if used as AWACS. -- @field #boolean eplrs If true, enable data link, e.g. if used as AWACS.
-- @field #boolean recovery If true, tanker will recover using the AIRBOSS marshal pattern. -- @field #boolean recovery If true, tanker will recover using the AIRBOSS marshal pattern.
-- @field #number terminaltype Terminal type of used parking spots on airbases. -- @field #number terminaltype Terminal type of used parking spots on airbases.
-- @field #boolean unlimitedfuel If true, the tanker will have unlimited fuel.
-- @extends Core.Fsm#FSM -- @extends Core.Fsm#FSM
--- Recovery Tanker. --- Recovery Tanker.
@@ -198,7 +199,7 @@
-- The first parameter *callsignname* defines the name (1=Texaco, 2=Arco, 3=Shell). The second (optional) parameter specifies the first number and has to be between 1-9. -- The first parameter *callsignname* defines the name (1=Texaco, 2=Arco, 3=Shell). The second (optional) parameter specifies the first number and has to be between 1-9.
-- Also see [DCS_enum_callsigns](https://wiki.hoggitworld.com/view/DCS_enum_callsigns) and [DCS_command_setCallsign](https://wiki.hoggitworld.com/view/DCS_command_setCallsign). -- Also see [DCS_enum_callsigns](https://wiki.hoggitworld.com/view/DCS_enum_callsigns) and [DCS_command_setCallsign](https://wiki.hoggitworld.com/view/DCS_command_setCallsign).
-- --
-- TexacoStennis:SetCAllsign(CALLSIGN.Tanker.Arco) -- TexacoStennis:SetCallsign(CALLSIGN.Tanker.Arco)
-- --
-- For convenience, MOOSE has a CALLSIGN enumerator introduced. -- For convenience, MOOSE has a CALLSIGN enumerator introduced.
-- --
@@ -300,6 +301,7 @@ RECOVERYTANKER = {
eplrs = nil, eplrs = nil,
recovery = nil, recovery = nil,
terminaltype = nil, terminaltype = nil,
unlimitedfuel = false,
} }
--- Unique ID (global). --- Unique ID (global).
@@ -308,7 +310,7 @@ _RECOVERYTANKERID=0
--- Class version. --- Class version.
-- @field #string version -- @field #string version
RECOVERYTANKER.version="1.0.9" RECOVERYTANKER.version="1.0.10"
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO list -- TODO list
@@ -326,6 +328,7 @@ RECOVERYTANKER.version="1.0.9"
-- DONE: Set AA TACAN. -- DONE: Set AA TACAN.
-- DONE: Add refueling event/state. -- DONE: Add refueling event/state.
-- DONE: Possibility to add already present/spawned aircraft, e.g. for warehouse. -- DONE: Possibility to add already present/spawned aircraft, e.g. for warehouse.
-- DONE: Add unlimited fuel
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Constructor -- Constructor
@@ -550,6 +553,15 @@ end
-- User functions -- User functions
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Set the tanker to have unlimited fuel.
-- @param #RECOVERYTANKER self
-- @param #boolean OnOff If true, the tanker will have unlimited fuel.
-- @return #RECOVERYTANKER self
function RECOVERYTANKER:SetUnlimitedFuel(OnOff)
self.unlimitedfuel = OnOff
return self
end
--- Set the speed the tanker flys in its orbit pattern. --- Set the speed the tanker flys in its orbit pattern.
-- @param #RECOVERYTANKER self -- @param #RECOVERYTANKER self
-- @param #number speed True air speed (TAS) in knots. Default 274 knots, which results in ~250 KIAS. -- @param #number speed True air speed (TAS) in knots. Default 274 knots, which results in ~250 KIAS.
@@ -899,6 +911,14 @@ function RECOVERYTANKER:onafterStart(From, Event, To)
-- Spawn tanker. We need to introduce an alias in case this class is used twice. This would confuse the spawn routine. -- Spawn tanker. We need to introduce an alias in case this class is used twice. This would confuse the spawn routine.
local Spawn=SPAWN:NewWithAlias(self.tankergroupname, self.alias) local Spawn=SPAWN:NewWithAlias(self.tankergroupname, self.alias)
if self.unlimitedfuel then
Spawn:OnSpawnGroup(
function (grp)
grp:CommandSetUnlimitedFuel(self.unlimitedfuel)
end
)
end
-- Set radio frequency and modulation. -- Set radio frequency and modulation.
Spawn:InitRadioCommsOnOff(true) Spawn:InitRadioCommsOnOff(true)
Spawn:InitRadioFrequency(self.RadioFreq) Spawn:InitRadioFrequency(self.RadioFreq)

View File

@@ -64,8 +64,6 @@
-- --
-- === -- ===
-- --
-- ![Banner Image](..\Presentations\RESCUEHELO\RescueHelo_Main.png)
--
-- # Recue Helo -- # Recue Helo
-- --
-- The rescue helo will fly in close formation with another unit, which is typically an aircraft carrier. -- The rescue helo will fly in close formation with another unit, which is typically an aircraft carrier.
@@ -805,7 +803,9 @@ function RESCUEHELO:_OnEventCrashOrEject(EventData)
self:T(self.lid..text) self:T(self.lid..text)
-- Get coordinate of unit. -- Get coordinate of unit.
local coord=unit:GetCoordinate() --local coord=unit:GetCoordinate()
local Vec3 = EventData.IniDCSUnit:getPoint() -- Vec3
local coord = COORDINATE:NewFromVec3(Vec3)
if coord and self.rescuezone:IsCoordinateInZone(coord) then if coord and self.rescuezone:IsCoordinateInZone(coord) then

View File

@@ -44,7 +44,7 @@
-- --
-- * First, you need to **"add a @{#RADIO} object** to your @{Wrapper.Positionable#POSITIONABLE}. This is done using the @{Wrapper.Positionable#POSITIONABLE.GetRadio}() function, -- * First, you need to **"add a @{#RADIO} object** to your @{Wrapper.Positionable#POSITIONABLE}. This is done using the @{Wrapper.Positionable#POSITIONABLE.GetRadio}() function,
-- * Then, you will **set the relevant parameters** to the transmission (see below), -- * Then, you will **set the relevant parameters** to the transmission (see below),
-- * When done, you can actually **broadcast the transmission** (i.e. play the sound) with the @{RADIO.Broadcast}() function. -- * When done, you can actually **broadcast the transmission** (i.e. play the sound) with the @{#RADIO.Broadcast}() function.
-- --
-- Methods to set relevant parameters for both a @{Wrapper.Unit#UNIT} or a @{Wrapper.Group#GROUP} or any other @{Wrapper.Positionable#POSITIONABLE} -- Methods to set relevant parameters for both a @{Wrapper.Unit#UNIT} or a @{Wrapper.Group#GROUP} or any other @{Wrapper.Positionable#POSITIONABLE}
-- --

View File

@@ -183,8 +183,10 @@ end
-- @param #number Port SRS port. Default 5002. -- @param #number Port SRS port. Default 5002.
-- @return #RADIOQUEUE self The RADIOQUEUE object. -- @return #RADIOQUEUE self The RADIOQUEUE object.
function RADIOQUEUE:SetSRS(PathToSRS, Port) function RADIOQUEUE:SetSRS(PathToSRS, Port)
self.msrs=MSRS:New(PathToSRS, self.frequency/1000000, self.modulation) local path = PathToSRS or MSRS.path
self.msrs:SetPort(Port) local port = Port or MSRS.port
self.msrs=MSRS:New(path, self.frequency/1000000, self.modulation)
self.msrs:SetPort(port)
return self return self
end end

View File

@@ -18,9 +18,14 @@
-- --
-- # RADIOSPEECH usage -- # RADIOSPEECH usage
-- --
-- # Developer Note
--
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
-- Therefore, this class is considered to be deprecated
--
-- --
-- @type RADIOSPEECH -- @type RADIOSPEECH
-- @extends Core.RadioQueue#RADIOQUEUE -- @extends Sound.RadioQueue#RADIOQUEUE
RADIOSPEECH = { RADIOSPEECH = {
ClassName = "RADIOSPEECH", ClassName = "RADIOSPEECH",
Vocabulary = { Vocabulary = {

Some files were not shown because too many files have changed in this diff Show More