Compare commits

..

1479 Commits

Author SHA1 Message Date
Frank d52e427238 Merge branch 'FF/Ops' into FF/Fox2 2022-05-09 08:54:01 +02:00
Frank f8e5efc874 Merge branch 'develop' into FF/Ops 2022-05-09 08:41:55 +02:00
Frank 2c61c695d5 Update Chief.lua
- Added target in zone check to abort missions
2022-05-09 08:41:33 +02:00
Frank b6e806adbc Update FlightGroup.lua
-No despawn after player landed.
2022-05-08 00:29:36 +02:00
Applevangelist e74aa160af Group - small change 2022-05-07 19:42:10 +02:00
Clément Fassot 6793228fbe Add an option to display arrows if clusters are moving (#1728) 2022-05-07 15:32:48 +02:00
Applevangelist e83ea8124e GROUP - change to GetUnits(n) to make it more robust, now returns first alive unit,actually. Similar changes to GetHeading() 2022-05-07 11:54:48 +02:00
Frank 313f99d09d OPS
**AUFTRAG**
- Added option to specify mission type for escorts, *e.g.* `AUFTRAG.Type.SEAD`

**LEGION** and **COMMANDER**
- Improved handling of SEAD escorts.
2022-05-06 21:50:23 +02:00
Applevangelist 28de292107 ##AWACS Alpha 0.0.17
* Added RejectZone (foreign border)
* Option to suppress screen output
* Option to add google key in SetSRS
* Some corrections to callouts
* Menu option to show base info
* WIP - Basic player task assignment
2022-05-06 16:36:57 +02:00
Applevangelist 10efb98eb3 Fallout fixes 2022-05-06 11:44:59 +02:00
Applevangelist 8ac2241372 AI Patrol - life check on route 2022-05-06 10:36:51 +02:00
Applevangelist 092434a103 UNIT Register - small fix for trains 2022-05-06 08:01:18 +02:00
Applevangelist a777997f79 AI_CAP - more fallout from the dead units in the API 2022-05-05 17:40:17 +02:00
Applevangelist 36cf7f718b AI_AIR - restrict AB on RTB 2022-05-05 16:41:15 +02:00
Applevangelist 7989267d51 AI/ZONE - Some fixes for units unreachable 2022-05-05 12:08:43 +02:00
Applevangelist ef4398a5f1 SRS - adding volume setting and a test on OS and IO available
OpsGroup - added volume options for `SetSRS`
2022-05-05 11:35:27 +02:00
Applevangelist 0da8afc108 SRS - adding volume setting and a test on OS and IO available 2022-05-05 08:57:15 +02:00
Frank 0e74d36227 Update Range.lua
**RANGE** v2.4.0
- Copy from updated
2022-05-04 22:40:22 +02:00
Applevangelist 290cc151bc SET - further event related stuff not working any more
AWACS - update
2022-05-04 18:10:20 +02:00
Applevangelist 21f93aa7e8 AWACS - 0.0.12 2022-05-04 13:29:14 +02:00
Applevangelist 04c77e9760 Some fixes to make the SpawnScheduled work again 2022-05-04 09:58:30 +02:00
Frank c6da6544da Merge pull request #1725 from FlightControl-Master/FF/Ops
Dead Event
2022-05-04 09:49:37 +02:00
Frank 94d3e38bc7 Merge branch 'develop' into FF/Ops 2022-05-04 09:47:30 +02:00
Frank 5fcf992920 Dead Event
**EVENT**
- Improved handling of delayed dead event

**SPAWN**
- Improved handling of delayed dead event
2022-05-04 09:46:00 +02:00
Frank 22cc9eabc0 Merge pull request #1724 from Ked57/develop
Replace log MESSAGE when updating cluster markers in INTEL with a log
2022-05-03 23:31:15 +02:00
Clément Fassot b191c0d341 Replace log MESSAGE when updating cluster markers in INTEL with a log (#1) 2022-05-03 23:08:26 +02:00
Frank d2d431ce2e OPS (#1723)
**INTEL**
- Added nil check for cluster position update

**OPSGROUP**
- Improved fire at point task to take only max avail shots and relative shot amount
- Fixed tasks not executed after teleport
2022-05-03 09:41:22 +02:00
Frank 3a6b58ea8c Merge branch 'develop' into FF/Ops 2022-05-03 09:25:15 +02:00
Frank 2d8fc40307 OPS
**INTEL**
- Added nil check for cluster position update

**OPSGROUP**
- Improved fire at point task to take only max avail shots and relative shot amount
- Fixed tasks not executed after teleport
2022-05-03 09:23:53 +02:00
Applevangelist 68dce2f247 extra nil checks for dead units 2022-05-03 08:46:23 +02:00
Applevangelist bc03eb2e65 FIFO - FIFO:HasUniqueID(UniqueID)
GROUP - added GROUP:IsPlayer()
INTEL - added clustering by flight deck (10'k ft) for AIR
SET - added option to NOT set the cargo bay weight limit automatically on SET_GROUP:AddGroup( group, DontSetCargoBayLimit )
2022-05-02 17:18:48 +02:00
Frank f725709e5b Merge pull request #1721 from FlightControl-Master/FF/Ops
OPS
2022-04-29 22:02:24 +02:00
Frank ba591c9dc5 OPS
**AUFTRAG**
- Added new type `NOTHING` (similar to `ALERT5` but for ground/naval)
2022-04-29 22:00:23 +02:00
Applevangelist def5d33055 GROUP - making GetCoordinate() a bit more resilient
POINT - slight changes to ToStringBRAANATO
2022-04-29 18:48:27 +02:00
Applevangelist 1aaa51c4be COORDINATE - added bogey option to COORDINATE:ToStringBRAANATO(FromCoordinate,Bogey,Spades) 2022-04-29 12:19:06 +02:00
Applevangelist 37206bcc83 Range - added nil check for playerData 2022-04-29 12:10:16 +02:00
Frank c2b86bac4b Update Airboss.lua
- Fixed DATABASE:GetFlightGroup to DATABASE:GetOpsGroup
2022-04-28 20:52:47 +02:00
Frank 02dad179cd Recovery tanker 2022-04-28 20:50:30 +02:00
Applevangelist adb94f8773 Nicefy docs 2022-04-28 17:10:49 +02:00
Applevangelist 035110df75 AWACS - removed banner from docs 2022-04-28 16:48:24 +02:00
Applevangelist 5adb65899c USERSOUND - added USERSOUND:ToUnit() 2022-04-28 16:48:07 +02:00
Applevangelist 764a373e7d POSITIONABLE - added POSITIONABLE:MessageToUnit(), and :MessageToSetUnit() 2022-04-28 16:47:42 +02:00
Applevangelist 8114327c7e MESSAGE - added MESSAGE:ToUnit(), altered MESSAGE:ToClient() to message the unit only 2022-04-28 16:46:28 +02:00
Applevangelist 6404417dad luacheck barking 2022-04-28 13:48:48 +02:00
Applevangelist d89cb8f1e9 Added Awacs WIP to working tree, Enums - corrected Hawkeye, added Super_Hercules 2022-04-28 13:11:04 +02:00
Applevangelist dee95c2f08 Update Moose.files 2022-04-28 13:04:22 +02:00
Frank 3a907ec7c2 Merge pull request #1720 from FlightControl-Master/FF/Ops
Ff/ops
2022-04-28 09:19:01 +02:00
Frank 851dff6e8c Update Intelligence.lua
- Added function to add detection group
- Added functions to retrieve contact details
2022-04-28 09:17:33 +02:00
Frank 47e7364976 Merge branch 'develop' into FF/Ops 2022-04-27 22:46:36 +02:00
Frank 41f8207b3a Merge pull request #1719 from FlightControl-Master/FF/Ops
**CHIEF**
- Added resources as parameters to `:AddStrategicZone` function

**COMMANDER**
- Added function to relocate cohorts `:RelocateCohort`

**AUFTRAG**
- Added new type `AIRDEFENSE`
- Added new type `EWR`
- Added option to teleport assets to the mission ingress waypoint via `:SetTeleport`
- Added `:SetRequiredAttribute` and `:SetRequiredProperty` functions
- Added `:SetEmission` function

**LEGION**
- Fixed bug that assets on GCI dont get additional score for INTERCEPT missions
- Assets on ONGUARD or PATROLZONE are not considered for ARTY and GROUNDATTACK missions
- Added option for transport to `RelocateCohort` function
- Ground/naval assets now automatically return when out of ammo

**OPSGROUP**
- Immobile groups are teleported to mission ingress point

**RECOVERYTANKER**
- Added parameter to set TACAN mode/band (e.g. "X")

**GROUP**
- Fixed bug in `:GetSpeedMax` function

**BEACON**
- Allowed TACAN "X" mode for AA
2022-04-27 22:38:34 +02:00
Frank ed0a3a22ab OPS
**CHIEF**
- Added resources as parameters to `:AddStrategicZone` function

**COMMANDER**
- Added function to relocate cohorts `:RelocateCohort`

**AUFTRAG**
- Added new type `AIRDEFENSE`
- Added new type `EWR`
- Added option to teleport assets to the mission ingress waypoint via `:SetTeleport`
- Added `:SetRequiredAttribute` and `:SetRequiredProperty` functions
- Added `:SetEmission` function

**LEGION**
- Fixed bug that assets on GCI dont get additional score for INTERCEPT missions
- Assets on ONGUARD or PATROLZONE are not considered for ARTY and GROUNDATTACK missions
- Added option for transport to `RelocateCohort` function
- Ground/naval assets now automatically return when out of ammo

**OPSGROUP**
- Immobile groups are teleported to mission ingress point

**RECOVERYTANKER**
- Added parameter to set TACAN mode/band (e.g. "X")

**GROUP**
- Fixed bug in `:GetSpeedMax` function

**BEACON**
- Allowed TACAN "X" mode for AA
2022-04-27 22:36:13 +02:00
Applevangelist 3a513da942 Awacs next Alpha 2022-04-27 14:37:38 +02:00
Applevangelist a4f1c60da2 Enums - added a couple of names 2022-04-26 10:09:05 +02:00
Applevangelist de0bf7d814 typo 2022-04-25 10:36:10 +02:00
Applevangelist 71fd72e462 adding ZONE_POLYGON_BASE:IsVec3InZone( Vec3 ) (might be called from POSITIONABLE), closes gap for GROUP/UNIT:IsInZone(Zone_Polygon)
GROUP - better docu
2022-04-25 09:59:44 +02:00
Applevangelist 619cc3c047 various 2022-04-24 19:11:08 +02:00
Applevangelist 68c75a4e34 Menu Refresh cleanup 2022-04-24 14:06:24 +02:00
Applevangelist 37671cefa3 GROUP - overwrite GetHeight() inherited from POSITIONABLE with something that is actually working for groups 2022-04-24 13:50:23 +02:00
Applevangelist d9f409069a INTEL - add platform type for AIR contacts (Foxbat ... ), defaults to Bogey for AIR and Unknown for everything else
SRS- added option to set a label for the SRS radio overlay
OpsGroup - added options to use said label, and option to override a frequency for an SRS (TTS) sender
2022-04-24 12:46:11 +02:00
Applevangelist fd5a190490 AWACS Alpha 2022-04-23 18:58:27 +02:00
Applevangelist 2f4d5b32b6 GROUP/UNIT - added :GetNatoReportingName() 2022-04-23 16:41:47 +02:00
Applevangelist 4c7ac68858 UTILS - UTILS.GetReportingName(Typename)
ENUMS - added ENUMS.ReportingName
2022-04-23 15:09:02 +02:00
Applevangelist ad3a3c5266 AWACS a0.0.7 - cleaned up AWACS calls, implemented DECLARE 2022-04-22 20:34:24 +02:00
Applevangelist 51d924c1b8 BRAANato - make bearing a 3digit number 2022-04-22 13:32:34 +02:00
Applevangelist 83491f535a Point - BRAANATO - will return BRA only if no aspect can be generated 2022-04-21 18:56:51 +02:00
Applevangelist 380731a244 AWACS 0.0.6 2022-04-21 18:56:09 +02:00
Applevangelist 60c78da0f6 Utils/Point - Corrections 2022-04-21 12:56:40 +02:00
Frank 2d02f4f962 Merge branch 'develop' into FF/Ops 2022-04-21 08:40:45 +02:00
Frank 982bd89924 Merge branch 'develop' into FF/Ops 2022-04-20 22:03:24 +02:00
Frank 04f60747d9 Merge pull request #1716 from FlightControl-Master/FF/Ops
OPS
2022-04-20 21:51:09 +02:00
Frank 28c107b089 OPS
**AIRWING**
- Added option to start in air `:SetTakeoffAir()`
- Added option to despawn near airbase `:SetDespawnAfterHolding()`
- Added option to despawn after landing `:SetDepawnAfterLanding()`

**SQUADRON**
- Added option to start in air `:SetTakeoffAir()`
- Added option to despawn near airbase `:SetDespawnAfterHolding()`
- Added option to despawn after landing `:SetDepawnAfterLanding()`
- Squadron settings overrule Airwing settings

**OPSGROUP**
- Improved `:Teleport()` function
2022-04-20 21:48:03 +02:00
Applevangelist e6cc8757ac Utils typo 2022-04-20 19:14:19 +02:00
Applevangelist 9169bfc608 COORDINATE - Added Precision to GetDistanceText as an option 2022-04-20 19:04:37 +02:00
Applevangelist 610e33e4a4 COORDINATE - added ToStringBRAANATO (works hopfully ;)) 2022-04-20 18:54:51 +02:00
Applevangelist 77dd40fb4a SET - clarified return value of SET_GROUP:GetAliveSET() (table, not SET)
UTILS - BRAANATO
ZONE - added examples to ZONE_RADIUS:Scan()
2022-04-20 14:01:26 +02:00
Applevangelist 5a63c51316 Utils - docu spelling 2022-04-20 12:45:33 +02:00
Applevangelist eabc8b5854 UTILS - added BearingToCardinal, added ToStringBRAANATO 2022-04-20 12:43:24 +02:00
Applevangelist 1a798886a2 AIRWING - added function to callback AWACS "onafterflightonmission" 2022-04-20 08:33:49 +02:00
Applevangelist 8735dadbca Awacs updates 2022-04-20 08:33:11 +02:00
Applevangelist 2c53ebc0e4 FIFO Added Routines 2022-04-20 08:32:57 +02:00
Applevangelist f93033695d Alpha Updates 2022-04-19 15:38:29 +02:00
Applevangelist 2d0f5817d0 Minor Changes 2022-04-19 15:36:44 +02:00
Applevangelist 2033e22216 AWACS Alpha 0.0.2 (WIP) (#1714)
TBD
2022-04-18 16:57:33 +02:00
Applevangelist bada6f64ae Update Moose.files (#1713) 2022-04-18 12:27:58 +02:00
Applevangelist bc141698c8 FIFO - make own file in Utils
AUFTRAG - Add base missions params for NewNOTHING
Marker - typo
Modules - FiFo added
UTILS - removed FiFo code
2022-04-18 12:27:14 +02:00
Applevangelist 75fddd9349 FIFO/LIFO - Read functions. Count as alternative to GetSize() 2022-04-17 11:25:48 +02:00
Applevangelist b1a417295f TextAndSound - Docu 2022-04-17 11:24:36 +02:00
Applevangelist 0522036b80 Docu 2022-04-16 18:58:43 +02:00
Applevangelist 061469840b FIFO 2022-04-14 15:55:51 +02:00
Applevangelist 6e218ed908 LIFO/FIFO - enforce unique ID 2022-04-14 15:05:49 +02:00
Applevangelist 626b48c3d1 Added LIFO/FIFO:HasUniqueID(UniqueID) 2022-04-14 11:11:18 +02:00
Applevangelist dd957237e2 Nicefy docs 2022-04-14 08:54:42 +02:00
Applevangelist fc9e237dbb UTILS - LiFo/FiFo Stacks 2022-04-14 08:12:02 +02:00
Frank faac265373 Merge pull request #1712 from FlightControl-Master/FF/Ops
Ff/ops
2022-04-13 22:44:52 +02:00
Frank 998935e2a3 Merge branch 'develop' into FF/Ops 2022-04-13 22:40:19 +02:00
Frank 24f8116fce OPS
**ZONE**
- Fixed incorrect fillcolor alpha.

**COORDINATE**
- Fixed incorrect fillcolor alpha.

**AUFTRAG**
- Fixed `CASENHANCED` order of arguments wrong in docs.

**FLEET**
- Improved docs.
- Added ``:SetPathfinding` function

**OPSGROUP**
- Fixed RECON mission behaviour if not random.
- Improved stuck check if engaging.

**LEGION**
- Added weapon type as parameter for selecting cohort assets.

**COHORT**
- Added `:GetMissionRange` function that accounts for long range weapons.
- Added counting of asset ammo.
2022-04-13 22:39:48 +02:00
Applevangelist 3415330871 UTILS - added FiFo 2022-04-13 16:13:02 +02:00
Applevangelist eadeaae6db CTLD Corrected imperial hover message to say ft not m 2022-04-13 15:30:43 +02:00
Penecruz 32bdaf4f24 Update Ops Airboss for develop (#1711)
* Update Airboss.lua

* Revert "Update Airboss.lua"

This reverts commit 61b0f843eb.

* Update Airboss.lua
2022-04-13 09:35:18 +02:00
Applevangelist 7525fe9357 UTILS - corrected door check for AH64 2022-04-12 08:23:37 +02:00
Applevangelist b24f31922f Soundfile - missing backslash 2022-04-10 18:26:27 +02:00
Applevangelist 4c79349b8d MSRS - repair command string for .bat processing 2022-04-10 18:23:20 +02:00
Applevangelist 44f7a27387 AICSAR - missing \ in path 2022-04-10 18:22:31 +02:00
Applevangelist 369425bec1 Some SRS changes 2022-04-10 15:12:51 +02:00
Applevangelist 3dc284335e SoundOutput - Honor self.useSRS to find a path to sound files located inside the miz folder 2022-04-10 14:59:54 +02:00
Applevangelist bfc284994a SRS - port set not honored 2022-04-10 14:59:05 +02:00
Applevangelist 277409a807 Text and Sound: Spelling error 2022-04-10 14:58:47 +02:00
Applevangelist d1f1f14bc3 SRS - add port to docu 2022-04-10 10:18:26 +02:00
Applevangelist 5ee1f5d3af CSAR/AICSAR - added port options for SRS 2022-04-10 09:28:47 +02:00
Frank f4569fb5cc Merge pull request #1710 from FlightControl-Master/FF/Ops
OPS
2022-04-08 22:19:42 +02:00
Frank 4ba0a2dafb OPS
**FLEET v0.0.1**
- New class for naval units corresponding to AIRWING and BRIGADE

**FLOTILLA v0.0.1**
- New class for naval units corresponding to SQUADRON and PLATOON
2022-04-08 22:18:35 +02:00
Applevangelist c2b1c2b1d8 SET - logic correction in :Remove() 2022-04-08 11:26:59 +02:00
Frank 2e119e2efd Merge pull request #1709 from FlightControl-Master/FF/Ops
OPS
2022-04-07 12:39:49 +02:00
Frank 4641918486 OPS
**LEGION**
- Added function `:RelocateCohort()` to relocate cohorts from one legion to another.
2022-04-07 12:11:17 +02:00
Frank 407f6f2b0f Merge pull request #1707 from FlightControl-Master/FF/Ops
OPS
2022-04-04 22:31:33 +02:00
Frank f01d7ecd96 OPS
**AUFTRAG v0.9.1**
- Added new mission type `CARGOTRANSPORT`
2022-04-04 22:30:30 +02:00
Frank e3d987bbdf Update Database.lua
- Static templates saved under first unit name so they can be found.
2022-04-04 16:53:52 +02:00
Applevangelist 89845883d0 Some nil checks to the A2A dispatcher, keeping it from detecting nil units, added locale to Settings and use of it to TextAndSound 2022-04-04 12:57:31 +02:00
Frank 4e7ff94b33 Merge pull request #1706 from FlightControl-Master/FF/Ops
static spawn
2022-04-04 12:16:48 +02:00
Frank 2fb9a1b1d7 static spawn 2022-04-04 12:15:29 +02:00
Applevangelist 5c0ab36662 CTLD - Build object at the first crate location found, not randomly around the helo 2022-04-04 11:29:21 +02:00
Frank fc6dac326d Merge pull request #1705 from FlightControl-Master/FF/Ops
OPS
2022-04-04 00:00:51 +02:00
Frank 426dcff085 OPS
FLIGHTGROUP
- Improved homebase for spawned units
- Enabled helo inAir check due to DCS bug that inAir returns true when spawned at airbase or farp

SET_ZONE
- Added DrawZone() function

ARMYGROUP
- Improved EngageTarget() function

AUFTRAG
- ARMORATTACK is not falling back to GROUNDATTACK
2022-04-03 23:59:43 +02:00
Applevangelist e623f45c04 Update AICSAR.lua (#1704)
Added localization and fitting german (locale "de") texts
2022-04-02 12:49:09 +02:00
Applevangelist 3b9a9cb0fa some code cleanup 2022-04-01 19:37:55 +02:00
Applevangelist c018a86bdb adding missing goshawk variable 2022-04-01 19:37:37 +02:00
Applevangelist 559be38baf Update TextAndSound.lua (#1703)
Slight doc changes
2022-04-01 19:36:00 +02:00
Applevangelist e3e05e5003 Adding TextAndSound (#1702)
Adding TextAndSound localization class
2022-04-01 19:20:35 +02:00
Applevangelist 95649d7d46 Adding localisation class TEXTANDSOUND 2022-04-01 19:17:31 +02:00
Frank 61097de76d Merge pull request #1701 from FlightControl-Master/FF/Ops
OPS
2022-04-01 12:33:31 +02:00
Frank e49fff5028 Update Auftrag.lua 2022-04-01 12:11:28 +02:00
Frank 20ae7945e0 Merge branch 'develop' into FF/Ops 2022-04-01 12:09:33 +02:00
Frank c5a50d23b6 OPS
CHIEF
- Added option to customize reaction on strategic zones

AUFTRAG
- Added new type GROUNDATTACK
2022-04-01 11:17:43 +02:00
Applevangelist ad37e5ca27 AIRBASE, added ["Deir_ez-Zor"] = "Deir ez-Zor", 2022-03-30 12:05:04 +02:00
Frank e8303064b9 Update OpsGroup.lua 2022-03-29 16:32:50 +02:00
Applevangelist f8a577749a OPS - Some changes to ARMORATTACK to update route if target is moving 2022-03-29 12:03:45 +02:00
Applevangelist e113817293 CTLD - docu nicefy 2022-03-29 12:02:35 +02:00
Applevangelist 0d15cdd370 CTLD - corrected error in setting Hercules min and max drop height, added documentation 2022-03-29 08:52:21 +02:00
Applevangelist b5db08eec3 AIRBASE - Add'l AB for the Channels map 2022-03-28 10:13:02 +02:00
Frank c3591c1fae Merge pull request #1699 from FlightControl-Master/FF/Ops
OPS
2022-03-26 22:39:44 +01:00
Frank e1a4d5497a Merge branch 'develop' into FF/Ops 2022-03-26 22:38:20 +01:00
Frank 4e83162adc OPS
CHIEF
- Added `:RemoveStrategicZone()` function
- Added `:SetLimitMission()` function to limit number of total or specific mission types.
- Improved Tactical Overview

OPSZONE
- Improved `Stop()` function
2022-03-26 22:38:03 +01:00
Applevangelist 42c6b8a016 And don't forget Fahrenheit 2022-03-26 14:47:10 +01:00
Applevangelist 48f9d808cf Correcting Celcius to Celsius 2022-03-26 14:42:36 +01:00
Applevangelist 6546c27cf5 OPS - added HOVER mission type 2022-03-25 17:54:02 +01:00
Frank fc0c0f87dc Merge pull request #1697 from FlightControl-Master/FF/Ops
OPS
2022-03-25 12:52:31 +01:00
Frank 9d703c0af6 OPS
- CHIEF: added tactical overview
2022-03-25 12:50:45 +01:00
Frank 24559c475b Merge branch 'develop' into FF/Ops 2022-03-25 11:00:17 +01:00
Frank f92e8a285a OPS
- Added nil check on vec3 for _UndateEngageTarget in ARMYGROUP and NAVYGROUP
2022-03-25 10:27:32 +01:00
Frank 0411120551 OPS
OPSGROUP
- Added damage check for groups that are not alive.
- Added `:ReturnToLegion` function.
- Added `:Teleport` function

LEGION
- Aircraft dont start hot if on Alert5 mission

AUFTRAG
- Added Formation parameter to PATROLZONE (for ground only)

ARMYGROUP
- Set Vee formation for engage group
2022-03-25 09:49:26 +01:00
Applevangelist 5f57d4ddcd docu changes 2022-03-23 07:57:06 +01:00
Applevangelist 4164bbeba8 CSAR/CTLD - added type to script 2022-03-22 10:38:07 +01:00
Frank 14dea99ccd Update Utils.lua
- Removed useless UTILS.GetDate() function
2022-03-22 09:31:16 +01:00
Frank 3ea1881ff5 OPS INTEL v0.3.0
- Added option to detect statics via `INTEL:SetDetectStatics` function.
- Added `INTEL:KnowObject` function to make intel aware of GROUPs or STATICs.
- Improved cluster analysis.
- Changed `NewCluster` event: removed contact as first parameter.
2022-03-20 22:20:09 +01:00
Applevangelist 5192c188f4 AIRBASE - added 10 new AB names in Syria 2022-03-18 09:49:06 +01:00
Applevangelist c1ffa47e9d changed descriptions 2022-03-18 07:59:49 +01:00
Applevangelist 2808a9dcc5 CONTROLLABLE - added SetSpeed() and SetAltitude() from latest release 2022-03-18 07:41:10 +01:00
Applevangelist e1ab6b6c93 CSAR - remove timer check for "open the door" message to make behaviour more realistic 2022-03-14 09:12:06 +01:00
Frank 229868bb20 OPS
AUFTRAG: Trooptransport set pickup radius to 100 meters.
OPSGROUP: enabled pickup radius for trooptransport auftrag
ARMYGOUP: removed GetPathOnRoad as it seems unncessary
2022-03-14 08:32:09 +01:00
Frank 520eb4cd1d OPS
- Improved recovery of retreated groups
2022-03-11 22:36:00 +01:00
Applevangelist 2d0b4d6ae5 SCORING: Corrected calc error in summary scoring functions 2022-03-11 10:19:30 +01:00
Frank 5dae9a197a OPS
- CHIEF: fixed bug in LEGION.RecruitCohortAssets() function call
- COMMANDER: added total weight to LEGION.RecruitCohortAssets() function call
- POSITIONABLE: fixed bug in relFuel calculation for cargo bay size
2022-03-10 10:05:21 +01:00
Frank ff1ebf9775 OPS
- Legion: Improved max number of transport assets.
- OPSGROUP: fixed bugs in speed parameter
2022-03-09 19:07:24 +01:00
Applevangelist e6f388518a Update CTLD.lua (#1693)
minor nil check
2022-03-09 10:28:26 +01:00
Frank 3557706e3a OPS
- Added new AUFTRAG type  CASENHANCED
- Improved capturing of OPSZONES by CHIEF
2022-03-05 14:43:39 +01:00
Applevangelist f3d0d55a2f CTLD - small extra nil check in _GetUnitCargoMass(Unit 2022-03-03 12:34:55 +01:00
Applevangelist b0c2bad1d8 CTLD - small fix for finding crates when using engineers 2022-03-03 11:02:14 +01:00
Applevangelist 53c9ca3b3a SEAD/MANTIS - added Silkworm ASM 2022-03-03 11:02:14 +01:00
Frank e41ba1be45 Troop Transport
- Auftrag TROOPTRANSPORT: troops will wait in a zone and not at the exact position where the carrier lands.
2022-03-02 09:34:18 +01:00
Applevangelist 594febaece CSAR - remove double class 2022-02-21 19:36:13 +01:00
Applevangelist 890dae8ba7 SEAD - adding workaround for AGM_154 which lost target data 2022-02-21 08:35:56 +01:00
Applevangelist 8a3120be39 AUTOLASE - added nil check for CanLase() 2022-02-19 13:26:02 +01:00
Applevangelist 6b4975559d CSAR - added wet feet check if also using csarUsePara (no landing event triggered) 2022-02-18 08:22:57 +01:00
Applevangelist 3326550705 CSAR - added "wet feet" option for a 2nd template to be used over water 2022-02-17 17:41:20 +01:00
Frank 6be0d82fc6 Merge branch 'develop' into FF/Ops 2022-02-16 12:23:03 +01:00
Applevangelist 44ad841d05 CTLD - fix side effects in weight check - fixes #1688 (#1689)
Fixed _FindCratesNearby() to optionally ignore the helo's max load capacity, which prevented CTLD from finding, listing, building crates is weights are used. Fixes #1688
2022-02-16 10:02:44 +01:00
Applevangelist 53f45ace4c CTLD - corrected default weight limits when using CTLD:UnitCapabilities() - was setting loadable weight to zero 2022-02-15 18:07:14 +01:00
Applevangelist 42e9cae876 added back GROUP:GetHighestThreat() 2022-02-15 14:41:45 +01:00
Applevangelist e46922d341 small correction 2022-02-15 07:30:41 +01:00
Applevangelist 21c242ee05 Added CTLD:SetTroopDropZoneRadius(Radius) 2022-02-13 12:07:57 +01:00
Frank 33b7a0cef2 Merge branch 'develop' into FF/Ops 2022-02-08 08:53:03 +01:00
Frank 9cddca1af5 AUFTRAG and WAREHOUSE
- Added check for AUFTRAG that if it is executing and all groups are dead, it's done
- Added check in WAREHOUSE find parking that units need to be alive
2022-02-08 08:52:47 +01:00
Applevangelist 8cdf0d9fce CSAR - CSAR:SpawnCSARAtZone(Zone ...) - Zone can now be a ZONE object as well as a string 2022-02-08 07:49:16 +01:00
Applevangelist a079ac4207 CTLD - allow AFB zones smoke/flare 2022-02-07 12:17:41 +01:00
Applevangelist 099238a2e5 CTLD - Allow option to create sub-category names for crates (normal, repair), added function to create zones from AFB/FARP names directly 2022-02-07 11:54:35 +01:00
Applevangelist 595bc16d92 DETECTION - added 3 missing functions 2022-02-04 08:56:34 +01:00
Applevangelist e9875c8288 small correction 2022-02-04 08:54:22 +01:00
Applevangelist ec600ab672 CTLD - Added Hercules support for crates, troops & vehicles loaded with the help of the ground crew and dropped from the plane. 2022-02-03 09:59:35 +01:00
Applevangelist c3689aee93 AICSAR - added limiter for available helos 2022-02-01 11:47:36 +01:00
Applevangelist 60a728d521 SET - correct error in intersection 2022-02-01 08:03:02 +01:00
Applevangelist 7bd7071ec5 CTLD Docu updates 2022-01-31 11:36:20 +01:00
Applevangelist bb787aa9ca Update Range.lua (#1686)
Target sheet saving abilities as added by @TonyG
2022-01-31 11:27:44 +01:00
Applevangelist d2f629d100 CTLD - added maxweight, load weight checks for crates cargo, template checks 2022-01-31 11:15:24 +01:00
Applevangelist 5d949de0ee Point - fix typos 2022-01-30 09:49:42 +01:00
Applevangelist e21bc8a930 POINT - added option to name and stop smoke/fire 2022-01-30 09:39:03 +01:00
Applevangelist af79f63870 CTLD - small correction for Hercules 2022-01-27 15:56:10 +01:00
Applevangelist 4ff32342e3 AI Dispatchers - add ability to add/remove resources to/from a squad 2022-01-24 09:54:30 +01:00
Applevangelist 98d55faf4e CTLD - added selectable smoke drop color, droppable beacons 2022-01-23 11:37:53 +01:00
Applevangelist bd532ea808 Added Callsigns as per 2.7.9 2022-01-23 11:37:28 +01:00
Applevangelist d4bd57ee70 Autolase - small update on nil check 2022-01-21 10:09:12 +01:00
Applevangelist 90dbfb31a6 DETECTION - corrected call for Vec2 in zone 2022-01-19 07:51:43 +01:00
Applevangelist 55ca34cad3 Added doors check for UH-60L 2022-01-16 17:07:32 +01:00
Applevangelist 36a5e919cd CTLD, CSAR - added support for UH-60L 2022-01-16 11:39:37 +01:00
Applevangelist 3263ba1440 CTLD - make container shape configureable 2022-01-15 11:32:51 +01:00
Tony 9721c19e48 Update Range.lua (#1683)
Addition of self.rangename to results for Rangeboss
2022-01-10 15:10:49 +01:00
Applevangelist de71213eed AICSAR - added SRS and DCS radio capabilities, changed order of messages for initial spawning, documentation 2022-01-06 13:47:47 +01:00
Applevangelist 65abbf9563 AICSAR - added SRS option, made it easy to customize messages 2022-01-04 15:09:47 +01:00
Applevangelist a94098494a Docu updates 2022-01-01 14:57:40 +01:00
Applevangelist ec935356aa Mark visible as deprecated 2021-12-31 17:51:48 +01:00
Applevangelist 6ab419dfad Fix ATC new NTTR AFB names 2021-12-31 17:51:48 +01:00
Applevangelist b1ffcff064 Update Moose.files (#1679) 2021-12-31 15:37:08 +01:00
Applevangelist 4ce09a3845 New Module AI CSAR 2021-12-31 15:36:35 +01:00
Applevangelist 9686e74feb Update Airbase.lua (#1678)
Changed (again) Airport names on the Nevada map
2021-12-30 07:46:14 +01:00
Frank e97e24762d Merge pull request #1676 from FlightControl-Master/Applevangelist-patch-1
Update Range.lua
2021-12-29 15:41:48 +01:00
Applevangelist b3fd0805e8 Update Range.lua 2021-12-29 08:59:45 +01:00
Applevangelist 300092d07d SEAD - fix a rare case when a coordinate of a weapon cannot be found 2021-12-28 08:28:19 +01:00
Applevangelist 56ed3a11d6 Scoring - docu changes 2021-12-28 08:28:19 +01:00
Applevangelist 6938b20ab6 Group - added docu 2021-12-28 08:28:19 +01:00
Frank 77f2cf5089 Merge pull request #1672 from FlightControl-Master/FF/Ops
AIRWING
2021-12-23 19:55:27 +01:00
Frank 19e3b015c5 Merge branch 'develop' into FF/Ops 2021-12-23 19:54:15 +01:00
Frank 2702d0fc2a AIRWING
- Fix for missions not being assigned
2021-12-23 19:54:01 +01:00
Applevangelist 472a4883f0 ZONE: Set down trials for getting a random coordinate on a given land type to 100
Cohort -ensure fallback of mission range
2021-12-22 11:48:42 +01:00
Frank 485e2e18bf Merge pull request #1671 from FlightControl-Master/FF/Ops
OPS
2021-12-21 11:57:09 +01:00
Frank 40c0f69eff OPS
- Airwing added :SetPayloadAmount() and SetAirboss() functions
- AUFTRAG fixed Failure to Failed event name
- CHIEF added statics as targets
- LEGION added check that runway is operational and carrier is not recovering for mission selection
2021-12-21 11:54:55 +01:00
Frank 854a1e5723 Update ArmyGroup.lua
- Fixed speed nil in ofafterUpdateRoute
2021-12-17 15:57:28 +01:00
Applevangelist f4cd28cdb9 fixes 2021-12-17 14:31:06 +01:00
Applevangelist 5bae790dd8 Fix a rare occasion 2021-12-17 14:15:08 +01:00
Frank d1d43c38cd Merge pull request #1668 from FlightControl-Master/FF/Ops
OPS
2021-12-17 13:29:08 +01:00
Frank 7e1552eeb4 Merge branch 'develop' into FF/Ops 2021-12-17 13:27:13 +01:00
Frank 7306bf28e0 OPS
- CHIEF: fixed ground groups deployment
- AUFTRAG: minor fixes
- OPSGROUP: emission option
2021-12-17 13:26:27 +01:00
Applevangelist 07e00a8faf Noise reducing measures 2021-12-15 13:46:33 +01:00
Applevangelist ab93866366 Removing noise 2021-12-14 17:28:16 +01:00
Applevangelist d7801b59e7 OPS - making a couple of modules much less noisy as the logs on a large mission get rather big 2021-12-14 13:40:16 +01:00
Applevangelist ea926f173a CSAR - make beacon length configureable 2021-12-14 09:50:13 +01:00
Applevangelist f6b55da0c6 CSAR - override suppressmessages for menu driven information 2021-12-12 19:48:49 +01:00
Applevangelist ee4e562874 CTLD - corrected landheight of dropped smoke 2021-12-12 19:30:00 +01:00
Applevangelist abfe5ffc45 Typos 2021-12-11 19:41:21 +01:00
Applevangelist 9629b0e1a3 SET - Added Zone Filter for STATIC 2021-12-11 14:24:07 +01:00
Applevangelist 80b03dd194 CTLD Added menu for smoke/flare 2021-12-11 14:13:43 +01:00
Applevangelist 3f92f8d2aa SET - added a couple of zone filters for GROUP, UNIT, CLIENT and PLAYER 2021-12-10 16:02:50 +01:00
Applevangelist 823c94cace BRIGADE - Added function to load platoons back into the field 2021-12-10 12:09:04 +01:00
Frank 421ac6c427 Fixes in AUFTRAG and LEGION
- Object in AUFTRAG:_TargetFromObject(Object) can be nil
- Assets are optimized wrt later mission type for assets on alert5
2021-12-10 10:38:34 +01:00
Applevangelist 72550d6d84 small changes Legion & Auftrag 2021-12-09 17:44:44 +01:00
Applevangelist 72999cc7b0 Update Zone.lua (#1660) 2021-12-09 07:16:29 +01:00
Applevangelist 706cf641b3 Multiple fixes 2021-12-08 19:27:22 +01:00
Applevangelist d42bdb2505 Revert "Ops - Various"
This reverts commit 23ea5d9d06.
2021-12-07 18:13:13 +01:00
Applevangelist 9082054ba9 Revert "legion"
This reverts commit abc69bc838.
2021-12-07 18:10:21 +01:00
Applevangelist abc69bc838 legion 2021-12-07 17:35:56 +01:00
Applevangelist 23ea5d9d06 Ops - Various 2021-12-07 16:09:02 +01:00
Applevangelist 8d009d6366 Some false values seem to be in need of being set explicitly 2021-12-06 15:15:46 +01:00
Applevangelist 8213b51bd6 Update Utils.lua (#1654)
Small bugfix in UTILS.LoadSetOfGroups
2021-12-06 14:56:42 +01:00
Applevangelist a18fc2080d SET - slight change in remove function 2021-12-06 10:26:01 +01:00
Applevangelist 9c0ac0ff57 CHIEF - ArmoredGuard ensure on road 2021-12-04 18:40:14 +01:00
Applevangelist c34dc9f946 CHIEF/AUFTRAG/OPSGROUP Fixed RECON type mission adhereing to paramters adinfinitum and randomly, fixed CAS mission in CHIEF 2021-12-04 16:24:45 +01:00
Applevangelist 1c5c205614 OpsGroup - corrected speed calculation from DCSTask 2021-12-03 16:51:06 +01:00
Applevangelist 897df1b8fa CHIEF - Option to allow ground transport. Set CAS speed to 70% max as Russian Helos are overly slow 2021-12-03 14:27:03 +01:00
Applevangelist 3fb22b7c55 AUFTRAG - correct wrongly corrected speed conversion 2021-12-02 16:07:34 +01:00
Applevangelist 7819a30c57 BRIGADE - Fuel zones landing in the wrong table. Corrected 2021-12-02 12:17:48 +01:00
Applevangelist 37d2c72945 MANTIS - added variable ranges for short, med and long range systems. Altered engage range to 95% and shoradactivation to 25km as defaults
AUFTRAG/CHIEF/OPSGROUP - added Auftrag type ARMOREDGUARD to have an ONGUARD mission for tanks w/o triggering transport by CHIEF
Made classes around CHIEF & AIRBOSS a bit less noisy as it kills my logfile
2021-12-02 10:13:38 +01:00
Applevangelist 5631e2c09f Minor changes 2021-11-29 08:03:58 +01:00
Applevangelist c7ddd6ec35 CSAR - added check smoke/flare distance is valid 2021-11-27 17:27:58 +01:00
Applevangelist 7280ceac32 ARMYGROUP - in tracing, formation flag can be empty 2021-11-26 15:36:46 +01:00
Applevangelist f8b9128d8e CHIEF - Added catch if coalition us given as string 2021-11-26 15:36:09 +01:00
Applevangelist c482f1dccd Corrected typo in Unit.Category.HELICOPTER 2021-11-26 15:35:45 +01:00
Applevangelist 7e306be8aa UTILS - Added functionality to save & load groups and statics information 2021-11-26 15:34:47 +01:00
Frank 035e6913b5 Merge pull request #1643 from FlightControl-Master/Applevangelist-armor-1
CHIEF - Added use of ARMORATTACK
2021-11-24 13:38:25 +01:00
Applevangelist e12f233afc Update Chief.lua 2021-11-24 13:32:39 +01:00
Applevangelist 26c7ff8c18 Update Chief.lua 2021-11-24 13:32:14 +01:00
Frank 5647364293 Merge pull request #1644 from FlightControl-Master/Applevangelist-armor-1-1
OpsGroup - Added support for ARMORATTACK
2021-11-24 13:17:45 +01:00
Frank 06fa585f69 Merge pull request #1642 from FlightControl-Master/Applevangelist-Armor-1
Auftrag - Added type ARMORATTACK
2021-11-24 13:17:13 +01:00
Applevangelist 035eac2f1e OpsGroup - Added support for ARMORATTACK
OpsGroup - Added support for ARMORATTACK
2021-11-24 12:09:07 +01:00
Applevangelist f01889cbf7 CHIEF - Added use of ARMORATTACK 2021-11-24 12:07:03 +01:00
Applevangelist 73025bfd4b Auftrag - Added type ARMORATTACK
Auftrag - Added type ARMORATTACK
2021-11-24 12:06:02 +01:00
Applevangelist aec6dd1246 SEAD/SHORAD - Add AGM-88 player modes handling 2021-11-22 11:37:10 +01:00
Applevangelist ab4411e5bb SEAD - calculate HARM impact point from firing position if no target data is given
SHORAD - ignore HARM AGM-88 is not fired at a specific target
2021-11-21 18:40:04 +01:00
Frank 0ac00efda6 Merge pull request #1641 from FlightControl-Master/FF/Ops
Ff/ops
2021-11-20 22:38:38 +01:00
Frank f32eb8d710 OPS
AUFTRAG
- Added mission task param for RECON, PATROLZONE and TROOPTRANSPORT

FLIGHTGROUP
- Fixed CheckGroupDone if group is engaging and has a paused mission

TARGET
- Added GetThreatLevelMax functions

CHIEF
- Added :AddGciCapZone() function
2021-11-20 22:36:15 +01:00
Frank ec33dfb76c Merge branch 'develop' into FF/Ops 2021-11-20 20:38:40 +01:00
Frank 43dfbac2fa Update Auftrag.lua
- Changed ROE in ESCORT auftrag from OpenFireWeaponFree to OpenFire
2021-11-20 20:38:23 +01:00
Frank 7a483abec2 Merge pull request #1639 from FlightControl-Master/Applevangelist-ArmyGroup-1
Update ArmyGroup.lua
2021-11-20 17:50:36 +01:00
Frank 35e6b6faf4 Merge pull request #1637 from FlightControl-Master/Applevangelist-Chief-1
CHIEF - Updates
2021-11-20 17:49:30 +01:00
Frank 1066b58fb6 Merge pull request #1640 from FlightControl-Master/Applevangelist-OpsZone-2
Update OpsZone.lua
2021-11-20 17:47:43 +01:00
Applevangelist b41b8f251f Update Chief.lua 2021-11-20 17:26:42 +01:00
Applevangelist a1426c3e81 Update OpsZone.lua 2021-11-20 17:12:33 +01:00
Applevangelist aa3967d88f Update ArmyGroup.lua
Added code to obey routing on roads
2021-11-20 17:09:55 +01:00
Applevangelist c610c4cba9 Update Chief.lua
Added some improvements to threat calculation
2021-11-20 17:08:20 +01:00
Applevangelist abb3a2dbd2 CHIEF - Updates
Added alignment to OpsZone Mission table. Added ARTY. Added Tanks for patrol
2021-11-19 16:03:25 +01:00
Frank 1f035301d9 Merge pull request #1636 from IsmaelB83/InboundCallMarshall
Inbound call marshall
2021-11-19 15:48:28 +01:00
Frank ebf7f76d48 Merge pull request #1635 from FlightControl-Master/Applevangelist-OpsZone-1
OpsZone -Mission Table
2021-11-19 15:47:18 +01:00
Ismael 397ab77105 This pull request enhances Airboss class functionality to provide with the
1) Inbound calls both from Players requesting marshal and AI sent to marshal:
"Marshal, [MODEX], marking mom's [BEARING] for [DISTANCE], angels [HEIGHT], state [FUEL_STATE]
2) Commencing call and voiceover (both AI and Players)

For that, two boolean fields have been added to Airboss class to trigger or not extra voice overs:
xtVoiceOvers
xtVoiceOversAI

These fields can be modified trough methods:
AIRBOSS:SetExtraVoiceOvers(true/false)
AIRBOSS:SetExtraVoiceOversAI(true/false)

Note. At the moment both methods initialize to "false" at Airboss:NEW, so in case you want to have this functionality activated, you need to call the methods with (true) when initializing your Airboss class.
The new methods in charge of creating the radio calls are
AIRBOSS:_MarshalAI: for AI flights send to marshal
AIRBOSS:_RequestMarshal: for player flighs requesting marshal from F10 menu

2) AIRBOSS:_CommencingCall(unit, modex), which is called from
AIRBOSS:_ClearForLanding: for AI flights cleared for landing
AIRBOSS:_RequestCommence: for player flights requesting commencing from F10 menu (disregarding if the player call is right or not)

This enhacement of the Airboss class requires 5 new sound files (.ogg) to be included to folder "\Airboss Soundfiles" in your .miz file:
PILOT-Angels.ogg
PILOT-For.ogg
PILOT-MarkingMoms.ogg
PILOT-Marshal.ogg
PILOT-State.ogg
PILOT-Commencing.ogg
2021-11-19 15:31:49 +01:00
Applevangelist f37abc69ea Update OpsZone.lua 2021-11-19 14:29:18 +01:00
Applevangelist ee85b0e057 OpsZone -Mission Table
Added functionality to admin missions attached to an OpsZone (for CHIEF)
2021-11-19 14:20:53 +01:00
Ismael eab28abc86 Subject: Add Player and AI Inbound radio calls to better inmersion in Airboss #16311
This commit enhances Airboss class functionality to provide with the inbound calls both from Players requesting marshal and AI sent to marshal:
- "Marshal, [MODEX], marking mom's [BEARING] for [DISTANCE], angels [HEIGHT], state [FUEL_STATE]

Two new boolean fields have been added to Airboss class to trigger or not the inbound calls:
- inRadioCall
- inRadioCallAI

These fields can be modified trough methods:
- AIRBOSS:SetInboundMessagesPlayer(false)
- AIRBOSS:SetInboundMessagesAI(false)
Note. At the moment both methods initialize to "false" at Airboss:NEW, so in case you want to have this functionality activated, you need to call the methods with (true) when initializing your Airboss class.

This enhacement of the Airboss class requires 5 new sound files (.ogg) to be included to folder "\Airboss Soundfiles" in your .miz file:
- PILOT-Angels.ogg
- PILOT-For.ogg
- PILOT-MarkingMoms.ogg
- PILOT-Marshal.ogg
- PILOT-State.ogg

To get them, please refer to the SOUNDS MOOSE repository or the discord channel. Where they will be available.
2021-11-19 01:11:49 +01:00
Applevangelist 16c5307fc2 COMMANDER - Zone parameter doc not correctly mentioned in Luadocs 2021-11-18 10:58:42 +01:00
Applevangelist 8c8cae1e27 AUFTRAG - wrong speed conversion lines 925/295 corrected to KnotsToKmph 2021-11-18 10:58:13 +01:00
Frank 925c645821 Merge pull request #1633 from FlightControl-Master/FF/Ops
OPS
2021-11-17 17:17:11 +01:00
Frank c1c97a86b7 OPS
- COMMANDER: Added GCICAP zones
- AIRWING: Improved patrol zone counting, fixed bug in NewPatrolPoint
- OPSGROUP: mission speed acknowledged
2021-11-17 17:15:44 +01:00
Applevangelist 1fc1016148 Update Auftrag.lua
Added missionSpeed to Orbit
2021-11-17 16:42:58 +01:00
Frank e73545d296 Merge pull request #1630 from dogjutsu/dogutsu/develop
Fixed some typos of forms of the word 'strategy'.
2021-11-16 22:08:00 +01:00
dogjutsu f2fb7d43d0 Fixed some typos of forms of the word 'strategy'. 2021-11-16 12:45:14 -08:00
Applevangelist 781d421e1c slightly changes message 2021-11-16 15:48:00 +01:00
Applevangelist a3a7464a29 Small fix fox autoshorad parameters 2021-11-16 10:34:42 +01:00
Frank ac936f5650 Merge pull request #1629 from FlightControl-Master/FF/Ops
Scheduler
2021-11-16 10:34:12 +01:00
Frank c0f5dc2dc8 Scheduler
- Fixed bug
2021-11-16 10:33:35 +01:00
Applevangelist 31c113180e MANTIS - Zones - added conflict zones 2021-11-16 09:26:05 +01:00
Applevangelist 239df2deb2 SEAD - Updated TTI calculation for Tomahawk long shots 2021-11-16 09:25:38 +01:00
Applevangelist 31a8c4b0b9 SHORAD - Updates for missile without set target intel 2021-11-15 16:18:21 +01:00
Applevangelist f394bd45c7 SEAD - Updated to handle missiles w/o clear targets 2021-11-15 16:18:21 +01:00
Applevangelist 63999c9ec3 MANTIS - Added Attacker group info on planned/started suppression events 2021-11-15 16:18:21 +01:00
Frank 82c24cee7e Merge pull request #1628 from FlightControl-Master/FF/Ops
scheduler
2021-11-15 10:22:35 +01:00
Frank 5e94b0c009 Update Base.lua 2021-11-15 10:20:34 +01:00
Frank 452ff62134 SCHEDULER 2021-11-15 10:19:21 +01:00
Frank 3df494cacd Merge pull request #1627 from FlightControl-Master/FF/Ops
Ff/ops
2021-11-14 23:31:03 +01:00
Frank d62bb59df7 OPS
- Clean up tracing
2021-11-14 22:12:41 +01:00
Applevangelist b367f9320b CSAR - don't make usePara default. Added coalition check if using the parachute landing event 2021-11-14 13:33:31 +01:00
Applevangelist 4bc3dbbf6c MANTIS - added auto-setup of SHORAD 2021-11-14 13:13:41 +01:00
Applevangelist e7b7e3ac96 Merge pull request #1626 from FlightControl-Master/Applevangelist-unit-2
Wrapper Unit fix missile count
2021-11-14 13:00:35 +01:00
Applevangelist f3c4aea12f Wrapper Unit fix missile count
missile count for SAM and CRUISE types #1624
2021-11-14 12:59:24 +01:00
Frank b9b5938a91 OPS
- Fixed refuel system always true.
2021-11-13 20:08:22 +01:00
Applevangelist e7fdcf0db4 SEAD - Slightly wider escape radius 2021-11-13 19:11:25 +01:00
Applevangelist c1f22aa556 MANTIS - Added support for HighDigitSAM mod, added blindspot management, corrected distinguising between SA-2 and SA-3 2021-11-12 15:27:05 +01:00
Applevangelist 991b4089d6 SHORAD radius clarification 2021-11-12 15:25:25 +01:00
Frank a8132552de OPS
- Fixed bug in egress coord
- Improved barrage mission
- improved pickup at legion
- fixed bug in SetPathfindingOff function
2021-11-11 21:16:48 +01:00
Applevangelist a0323aef19 MANTIS - Some docu updates 2021-11-11 18:34:06 +01:00
Applevangelist a38abc2f7f MANTIS - latest updates 2021-11-11 17:45:25 +01:00
Applevangelist a6beecf510 MANTIS - Added Auto Mode 2021-11-11 17:22:21 +01:00
Applevangelist c5dece0e59 SEAD - make emissions on/off standard 2021-11-11 16:03:52 +01:00
Applevangelist ce935bafc1 Small fix to switch off pattern matching 2021-11-09 09:53:23 +01:00
Applevangelist fd426a96aa File functions 2021-11-09 09:51:31 +01:00
Applevangelist fad8800842 Added Docu 2021-11-09 09:51:05 +01:00
Applevangelist 273a473db1 MANTIS/SEAD make docu Pikes-friendly 2021-11-08 15:21:20 +01:00
Applevangelist a7588e517d SEAD - (re-)added emissions on/off option and ability to link object functions for state changes. 2021-11-08 13:11:58 +01:00
Applevangelist 84eff098eb MANTIS - Added FSM Events for SeadSuppressionPlanned/Start/ENd 2021-11-08 13:11:58 +01:00
Frank f157f3b5d6 OPS
- Fixed mission alt for patrol zone auftrag
2021-11-07 22:32:17 +01:00
Frank 6cd00c60a7 Update OpsGroup.lua
- Fixed waypoint alt for missions
2021-11-07 21:39:38 +01:00
Frank 2ea951db61 Removed WIP classes
- F10MENUE and FLIGHTCONTROL
2021-11-07 19:43:02 +01:00
Frank 9d0bd0aabb Update OpsGroup.lua 2021-11-07 19:39:53 +01:00
Frank 3d88d16b4b Merge branch 'FF/Ops' into FF/OpsDev 2021-11-07 18:24:48 +01:00
Frank 02724dc26d Merge branch 'develop' into FF/Ops 2021-11-07 18:20:27 +01:00
Frank 21a93652cd Update OpsGroup.lua
- Fix for AUFTRAG carried out only after the group has passed all waypoints
2021-11-07 16:08:11 +01:00
Frank fb4caf1a42 OPS
- Improved transport path
2021-11-07 16:03:44 +01:00
Frank 7a2508bf17 OPSTRANSPORT
- Improved pre-defined paths for pickup and transport
2021-11-06 18:10:49 +01:00
Applevangelist eeeab86952 added altered message 2021-11-06 18:07:42 +01:00
Applevangelist a149ff1705 Switch for fratricide and treason (coalition changes) 2021-11-06 15:15:30 +01:00
Applevangelist 2c73c9c815 Merge pull request #1620 from FlightControl-Master/Applevangelist-casevac-1
CSAR additions by Shagrat
2021-11-05 16:31:22 +01:00
Applevangelist f6f29db9f1 CSAR additions by Shagrat
Added functionality for Casevac
2021-11-04 17:23:29 +01:00
Frank c823a68616 OPS
- Fixed several bugs
2021-11-02 21:14:15 +01:00
Applevangelist e7e2184760 Autolase - fixed error when not using a pilotset 2021-11-01 19:46:56 +01:00
Applevangelist 6fe2422bc9 SRS Google addition by rollnthndr 2021-10-31 11:53:53 +01:00
Applevangelist cd62776be6 AIRBOSS additions by Pene 2021-10-31 11:53:24 +01:00
Applevangelist 037357efe9 Merge pull request #1619 from bbirchnz/ctld-crate-leak
fix cleanup of crates on load or build.
2021-10-31 11:31:19 +01:00
Ben Birch 8d3910ea4c fix cleanup of crates on load or build. 2021-10-31 19:37:26 +11:00
Applevangelist 3e5926f706 Speedmax returning 0 not nil 2021-10-30 16:32:59 +02:00
Applevangelist a1d67bf539 Speedmax returning 0 not nil 2021-10-30 16:32:42 +02:00
Applevangelist 3e65457041 doc impro 2021-10-29 18:30:22 +02:00
Applevangelist f70180eb66 SET_BASE - cmpleted GetSetComplement 2021-10-29 10:20:34 +02:00
Applevangelist c0a558e229 Merge pull request #1616 from Zonr0/Zonr0-ExternalToolsFix
Fixes broken external tools
2021-10-28 15:45:02 +02:00
Applevangelist 801069f5ac Update Moose_Create.lua 2021-10-28 15:39:57 +02:00
Frank f9dcac8264 Merge branch 'master' into develop 2021-10-28 10:21:16 +02:00
Frank 902c001aa4 OPS
Improved OPSTRANSPORT
2021-10-28 10:04:01 +02:00
Applevangelist 0cf2a4353d doc build - next try 2021-10-28 09:13:36 +02:00
Applevangelist 13c8cc90f2 doc build fix 2021-10-28 08:41:10 +02:00
Applevangelist db231fafeb Docs build test 2021-10-28 08:12:27 +02:00
Andrew Waugh c3f7deb602 Fixes broken external tools
Several small changes that should hopefully be a nice QoL upgrade for generating the imports and lead to less newbie confusion.

* Adds a lua binary directly to the repository instead of just expecting the user to have installed it via choco. Added binary is 5.4 as that's the lowest 5.x exe that's easily downloaded, and it works fine for what we need.
* Modifies the launch targets to use workspace_loc macros instead of resource_loc macros. Workspace_loc requires the user to have correctly set the name of their project, but that is already stressed in the documentation.  resource_loc was just wrong. (project_loc would cause problems if the user had selected something outside of the moose project before running).
* Modifies launch targets to use the folder structure that the project is actually structured with.
* Adds the include folder and files so Eclipse doesn't explode when they are missing.
* Small modifications to Moose_Create, also includes a path conversion function that in my testing doesn't make a difference eitherway on Windows, but is there for a troubleshooting option.
* Adds courtesy instructions when generating the dynamic include file.
2021-10-27 20:18:10 -07:00
Applevangelist 300e3f2f58 Merge pull request #1615 from FlightControl-Master/Applevangelist-docpatch
Update Task_Cargo_Transport.lua
2021-10-27 13:10:40 +02:00
Applevangelist 513406f0e5 Update Task_Cargo_Transport.lua 2021-10-27 13:09:30 +02:00
Applevangelist 27e21e77f9 Update Task_Cargo_Transport.lua 2021-10-27 11:19:32 +02:00
Applevangelist dadfd803f7 Update Autolase.lua
added docu
2021-10-26 13:58:11 +02:00
Frank 02b0ba2278 OPS
- Improved behaviour of OPSTRANSPORT when cargo or carrier is on mission.
2021-10-25 22:17:56 +02:00
Applevangelist 3e1005aef1 Small correction to silence wall of text when adding tasks to a mission 2021-10-25 16:29:14 +02:00
Applevangelist e2eb13739c Commented out wall of text when joining a unit as a player 2021-10-25 16:28:40 +02:00
Applevangelist c52e30ceae Added smoke color per RECCE 2021-10-25 16:28:11 +02:00
Applevangelist 07754cdf5f Merge pull request #1614 from madmoney99/develop
Forrestal Wire Corrections
2021-10-24 09:14:10 +02:00
madmoney99 c74c475a29 Forrestal Wire Corrections
Tested on MP and SP.  Both were recording incorrect wires on 1/2 and 4 wires regularly with an occasional 3 wire miss.  This tested correct in the Hornet.

TonyG
2021-10-23 16:34:21 -07:00
Applevangelist ad36ab520b Added Bell-47 2021-10-22 17:04:03 +02:00
Applevangelist bc32ff5db9 Added Bell-47 2021-10-22 17:03:57 +02:00
Frank 6009432933 OPS
- NAVYGROUP added engage target
- Barrage improvments
2021-10-22 11:23:29 +02:00
Frank 99eaa37c76 Merge branch 'master' into develop 2021-10-20 19:56:31 +02:00
Frank ed6d5f727a OPS 2021-10-20 19:49:26 +02:00
Frank c6995d6e58 OPS
- Fixed AUFTRAG :Repeat()
- Fixed bug in BRIGADE
- Improved cargo bay calculation in POSITIONABLE (includes rel. fuel)
- Changed carrier event names in OPSGROUP

- New class F10MENU (not sure about it)
2021-10-19 10:19:26 +02:00
Frank cb0f453a8d Merge branch 'FF/Ops' into FF/OpsDev 2021-10-16 13:41:40 +02:00
Frank d9866846ad Merge branch 'FF/MasterDevel' into FF/Ops 2021-10-16 13:40:37 +02:00
Frank de5d9195f3 OPSGROUP
- Cargo bay of element remains after respawn
- Added some docs for CHIEF
2021-10-16 09:32:47 +02:00
Frank fd1fe8562c Merge branch 'develop' into FF/Ops 2021-10-12 22:20:20 +02:00
Frank b1298223aa Merge branch 'master' into develop 2021-10-12 22:18:43 +02:00
Applevangelist c48128d92e CSAR - Added country options for spawned pilots 2021-10-12 08:30:44 +02:00
Frank 0f4d466953 OPS
- Changed mission, legion in MissionAssign functions (LEGION, COMMANDER, CHIEF)
- OPSTRANSPORT: improved TZC selection
- ARMYGROUP needs to
2021-10-11 21:28:35 +02:00
Applevangelist 1b752fcaf6 CTLD - bug fix for open doors 2021-10-11 18:47:39 +02:00
Applevangelist d06db9909c AUTOLASE Small update 2021-10-11 14:11:58 +02:00
Applevangelist 921024035c AUTOLASE - cleanup, added SRS option 2021-10-08 12:33:33 +02:00
Applevangelist 3b1c8c3deb AUTOLASE - added LOS check, maxlasingunits valid per lasing Recce 2021-10-07 18:16:40 +02:00
Applevangelist 69862ab67d CSAR - try to avoid spawning under water 2021-10-07 18:15:50 +02:00
Applevangelist b05c321306 CTLD - added door check for troops 2021-10-07 18:15:13 +02:00
Applevangelist 9b74a58dde UTILS - added door check for Hercules 2021-10-07 18:14:50 +02:00
Applevangelist d112ffaf6a Autolase - better calculation of LoS for lasing, somewhat faster detection 2021-10-07 09:49:06 +02:00
Applevangelist 554f063def INTEL - allow variable update times 2021-10-07 09:46:06 +02:00
Frank f6dce02203 INTEL
- Introduced pcall to getName() of detected objects. Found a problem with an object of ID 5,000,031
2021-10-06 22:03:02 +02:00
Frank 653dfe82fa OPS CHIEF
- Improved target queue for assigning new missions
2021-10-06 13:25:57 +02:00
Frank 5dbf743052 OPS
- Fixed a couple of minor bugs.
- FC added _PlayerAbortInbound function
2021-10-05 23:59:24 +02:00
Applevangelist f7e7e2e41c ZONE_CAPTURE_COALITION - fix an error when monitoring hits but the Event Function delivers SCENERY as a hit UNIT 2021-10-05 19:07:59 +02:00
Applevangelist b28b4db7fd docu fixes 2021-10-05 19:06:49 +02:00
Applevangelist c34f30e4a3 Docu fixes 2021-10-05 19:06:40 +02:00
Applevangelist aa7f11185d Small update 2021-10-05 19:06:30 +02:00
Frank 1790d19809 FC 2021-10-03 23:09:45 +02:00
Frank fa6fbca67b OPS
- Added tanker and CAP zones
2021-10-03 21:33:33 +02:00
Applevangelist cd79c57a27 AUTOLASE - added Cancel FSM to stop, docu changes, option to notify pilots in the set only 2021-10-02 14:45:37 +02:00
Applevangelist 4c3a97e2b2 Autolase! 2021-10-01 17:29:22 +02:00
Applevangelist f126dceeae Merge pull request #1610 from FlightControl-Master/Applevangelist-Autolase-2
Update Moose.files
2021-10-01 17:26:50 +02:00
Applevangelist 414521acc5 Merge pull request #1611 from FlightControl-Master/Applevangelist-autolase-3
Update Modules.lua
2021-10-01 17:26:40 +02:00
Applevangelist 9147422340 Merge pull request #1609 from FlightControl-Master/Applevangelist-Autolase-1
Create Autolase.lua
2021-10-01 17:26:29 +02:00
Applevangelist 920646ea74 Update Modules.lua
added autolase
2021-10-01 17:24:25 +02:00
Applevangelist c57d839927 Update Moose.files
Add Autolase.lua
2021-10-01 17:22:58 +02:00
Applevangelist e7fd5db2c2 Create Autolase.lua
Added Class AUTOLASE
2021-10-01 17:20:17 +02:00
Applevangelist b76486ef5f CSAR - added parameters for hovering rescue 2021-10-01 14:52:25 +02:00
Applevangelist 5c06584676 UTILS - correction door check MI-8 2021-10-01 14:52:00 +02:00
Frank 2ae2ee64be OPS
- Lots of updates and improvements
2021-10-01 12:04:15 +02:00
Applevangelist 17ba35e237 INTEL - also set isship and isground attributes on contacts 2021-10-01 10:44:25 +02:00
Applevangelist 53e98e70aa CTLD: added user-friendly function to inject static cargos: CTLD:InjectStaticFromTemplate(Zone, Template, Mass) 2021-10-01 10:43:49 +02:00
Applevangelist 359e18eb58 RADIO - delete frequency check 2021-09-30 08:07:42 +02:00
Applevangelist 3377459df5 Added option for silent mission addition 2021-09-29 16:57:45 +02:00
Frank 3e30d15405 Merge branch 'FF/Ops' into FF/OpsDev 2021-09-29 09:57:52 +02:00
Frank 2b50cf2243 Merge branch 'develop' into FF/Ops 2021-09-29 09:55:20 +02:00
Frank b72e2b6bf9 Merge branch 'master' into develop 2021-09-29 09:34:37 +02:00
Frank c7a2b34f59 Update Warehouse.lua
- Disabled fuel check.
2021-09-29 08:15:22 +02:00
Frank b48958995a OPS
- Fixed oscillation between UpdateRoute and CheckGroupDone in FLIGHTGROUP
- Improvements regarding capturing zones.
- Reduced log output
2021-09-28 23:26:33 +02:00
Applevangelist 58c496eacd GROUP - GROUP:GetAmmunition() - fix to also return bomb count correctly 2021-09-28 16:52:18 +02:00
Applevangelist 7bd867c9dd SEAD - Docu changes for Intellisense 2021-09-28 16:51:35 +02:00
Frank be0558849c OPS
- Added rearming zones
- Improved rearming
2021-09-27 16:11:03 +02:00
Applevangelist a1c7ec2ac9 Fix "local" error 2021-09-27 15:49:03 +02:00
Applevangelist 8bf073c0c6 Small fix for Airbase Parking Spot Finder 2021-09-26 09:51:02 +02:00
Frank 994689f05a OPS
- Improved transport assignments
2021-09-25 20:18:16 +02:00
Applevangelist 3e10f9f451 bugfix 2021-09-24 18:38:58 +02:00
Frank 972fa9f674 OPS
- Fixed bug in WAREHOUSE isShip
- FLIGHTGROUP added damage and ammo checks that trigger FSM events
- Improved engage detected targets
- Improved OPSZONE
2021-09-24 14:47:36 +02:00
Applevangelist 8e64d8e334 CTLD: Added mass and canCargo Flag on spawned statics. Use .enableslingload = true to use 2021-09-24 11:06:54 +02:00
Applevangelist eccd81d40a SPAWNSTATIC - bigfix on canCargo (not:isCargo) and mass (not transported into template) when spawning 2021-09-24 11:05:42 +02:00
Applevangelist 649136f98f small updates, fixes 2021-09-23 12:43:28 +02:00
Frank d7dae1366d OPS
- Improved OPSTRANSPORT for LEGION assets.
2021-09-22 19:27:33 +02:00
Applevangelist 19e2ebcd03 CTLD - Added statics as cargo (#1601)
.... and the ability to load and save them alongside your buildable crates.
2021-09-22 15:55:10 +02:00
Applevangelist 021c907d16 SET - Added SET_CLIENT:CountAlive() 2021-09-21 07:46:21 +02:00
Applevangelist 8ac3e28fdf CTLD - fix SAVE/LOAD when using no path on calls 2021-09-21 07:46:05 +02:00
Frank c5af279730 OPS
- Fixed some stuff for Egress coordinate
- Fixed some bugs in OPSTRANPORT if disembark carriers are specified
2021-09-20 22:47:51 +02:00
Applevangelist e9377e93f1 Postionable - Added Cargo Seats to VAB Mephisto 2021-09-20 14:20:09 +02:00
Applevangelist 6747c69511 CTLD Ability to fire an event on injection 2021-09-20 14:19:26 +02:00
Frank 9b6cae6c49 Update Commander.lua 2021-09-19 22:45:58 +02:00
Frank 7148bd1d42 OPS Escort
- Refined functions to recruit escort assets.
2021-09-19 22:10:52 +02:00
Frank 73940fffc6 Update Legion.lua
- Fix that assets did not get removed
2021-09-18 18:47:06 +02:00
Frank 09015449cd OPS Recruting
- Removed obsolete recruiting functions from code
2021-09-18 18:23:22 +02:00
Frank 4dfdb99731 OPS
- Recruit assets with new function (LEGION, COMMANDER, CHIEF)
2021-09-18 18:09:41 +02:00
Frank bbbca04066 OPS Legion
- Added new global function to recruit assets.
2021-09-18 00:11:04 +02:00
Frank e755bba608 OPS
- Clean up on "CheckMissionType" and "CheckMissionCapability" functions ==> moved to AUFTRAG as global functions.
2021-09-17 16:59:43 +02:00
Frank 9161cec238 OPS
- Simplified asset selection by using just one routine for LEGION, COMMANDER and CHIEF
2021-09-16 21:30:36 +02:00
Applevangelist dc14b60fcc bug fixing 2021-09-16 15:09:51 +02:00
Applevangelist da625d51f6 Merge pull request #1599 from FlightControl-Master/Applevangelist-CTLD-1
CTLD - Added persistance
2021-09-16 13:44:54 +02:00
Applevangelist ce69055758 CTLD - Added persistance
-- ## 6. Save and load back units - persistance
-- 
-- You can save and later load back units dropped or build to make your mission persistent.
-- For this to work, you need to de-sanitize **io** and **lfs** in your MissionScripting.lua, which is located in your DCS installtion folder under Scripts.
-- There is a risk involved in doing that; if you do not know what that means, this is possibly not for you.
-- 
-- Use the following options to manage your saves:
-- 
--              my_ctld.enableLoadSave = true -- allow auto-saving and loading of files
--              my_ctld.saveinterval = 600 -- save every 10 minutes
--              my_ctld.filename = "missionsave.csv" -- example filename
--              my_ctld.filepath = "C:\\Users\\myname\\Saved Games\\DCS\Missions\\MyMission" -- example path
--  
--  Then use an initial load at the beginning of your mission:
--  
--            my_ctld:__Load(10)
--            
-- **Caveat:**
-- If you use units build by multiple templates, they will effectively double on loading. Dropped crates are not saved. Current stock is not saved.
2021-09-16 13:43:39 +02:00
Frank 589ebd5bca CHIEF
- Improved asset selection
2021-09-16 11:02:49 +02:00
Frank 35b50e1a9d OPSZONE and CHIEF 2021-09-14 23:51:03 +02:00
Frank f038564b1b OPSTRANSPORT
- Added Cancel feature. First steps...
- Fixed a couple of other little bugs.
2021-09-13 16:04:16 +02:00
Frank 1d0eb9806d COMMANDER
- Added OPS transport (untested)
2021-09-13 08:31:00 +02:00
Applevangelist c50a9bd318 CTLD - small bug fix on stock removal 2021-09-12 17:37:21 +02:00
Applevangelist cd9006d29b CTLD - added alternative crate spawn by @mousepilot. Add menu item to list stock.Injected troops will not lead to cargo type duplication. 2021-09-11 15:20:36 +02:00
Applevangelist d3b88f9065 bug fixing 2021-09-11 10:03:32 +02:00
Frank 6a6cb1961d OPS LEGION
- Improved asset selection for transports
2021-09-10 11:37:53 +02:00
Frank 884c51a69a OPSTRANSPORT
- Improved assignment to multiple legions.
2021-09-10 00:32:15 +02:00
Frank 6f126e6cd4 OPSCARGO
- fixes for Legion assignment
2021-09-09 13:35:10 +02:00
Frank b0c2e5409a OPS AUFTRAG
- Added Alert 5 mission
- Added Fuel supply mission
- Added Ammo supply mission
2021-09-08 11:49:27 +02:00
Applevangelist 9516ec3cd2 CSAR: Gardening cleanup 2021-09-07 19:53:05 +02:00
Frank aecb92ccd3 OPSGROUP
- Added EPLRS option
- EPLRS is on if group has datalink capability
2021-09-07 11:17:20 +02:00
Frank bdf13f29f7 OPS
- COMMANDER and LEGION clean up of obsolete stuff for recruiting assets.
2021-09-06 23:40:58 +02:00
Frank 81120abfcb OPS
- LEGION and COMMANDER: Recruit assets for mission
2021-09-06 23:24:26 +02:00
Applevangelist 08a8170990 CTLD - improved crate spawning, added beacons / smoke / flare for ships, added documentation 2021-09-05 18:05:08 +02:00
Frank 316ea910c2 Update Cohort.lua
- Fixed some stuff for combat readiness check
2021-09-05 00:23:12 +02:00
Frank 0b5edfc21f OPSGROUP
- Ad infinitum fixes
- Turn into wind fixes
2021-09-04 23:51:17 +02:00
Applevangelist 76c08095ab CTLD - added country variable for crates 2021-09-03 18:38:51 +02:00
Frank 538864519e OPSGROUP
- Fixes that ARMY and NAVYGROUPS only go to first waypoint
- Fixes for PATROL and RECON missions that waypoints are added at the end
- Some other stuff
- Still need to fix adinfinitum
2021-09-03 18:20:28 +02:00
Applevangelist cd6631049b CSAR - Removed message for dead pilots 2021-09-03 14:16:30 +02:00
Applevangelist 079f8030b7 CTLD - added unit parameter to place crates in correct distance. Refactored location calculation for crates. 2021-09-03 14:16:11 +02:00
Frank ad0b32c0ee OPS
- Found and fixed bugs for ARMY and NAVY groups, which caused only one waypoint to be processed
- Added Duration for AUFTRAG
- Fixed bug in auftrag if no legion was assigned and mission was canceled at opsgroup level
- Trying (again) to include the whole route for ARMY and NAVY when UpdateRoute
- Simpler task function for passing waypoint

STILL a lot to do/check!
2021-09-03 00:05:58 +02:00
Applevangelist 8235b51a14 Bug fixing 2021-09-02 18:04:39 +02:00
Frank 1bd5e7472f OPSTRANSPORT v0.4.2
- Some fixed.
- All tested demo missions look nice
2021-09-02 08:30:54 +02:00
Applevangelist 7433a7144c CTLD Added method to inject troops into the field. 2021-09-01 13:33:43 +02:00
Frank 27632ecdd9 OPSTRANSPORT v0.4.1
- Fixed a couple of bugs
- Lots of other fixes and improvements
2021-09-01 00:07:54 +02:00
Frank 0b1e25b073 OPSTRANSPORT v0.4
- Multiple transport zone combos (TZC)
- Other issues solved.
- Demo miz D-day landing is still not working correctly.
2021-08-30 23:45:40 +02:00
Applevangelist 19a93f0026 MANTIS - allow SEAD padding in Mantis 2021-08-28 13:58:06 +02:00
Applevangelist 3256a6d596 SEAD - added time-back-on padding as variable 2021-08-28 13:57:15 +02:00
Frank 28ddfa5243 OPSTRANSPORT
- Fist working steps towards multiple pickup/deploy zone combos.
2021-08-28 00:17:16 +02:00
Applevangelist 05c560be3b CTLD - added delay after unsuccessful build or repair, relocate after done 2021-08-27 18:51:54 +02:00
Applevangelist 8ddd810fe2 SEAD - Refactor and enable delayed switch-off 2021-08-27 18:50:40 +02:00
Applevangelist f20760bae5 CSAR - Remove some noise 2021-08-27 18:48:18 +02:00
Applevangelist cea7320a9b UNIT/GROUP - added function to get the skill of a unit. SEAD - added functionality to calculate time-2-impact of HARMS and adjust behaviour accordingly 2021-08-27 14:56:50 +02:00
Frank fe6826016c Update Chief.lua 2021-08-27 11:59:34 +02:00
Frank f0167b3e88 OPS
- FSM pseudo function cleanup
- Fixed bug when mission is cancelled
2021-08-27 11:31:12 +02:00
Applevangelist 0edbf7f517 Added Engineering (Infantry) Troops 2021-08-27 09:14:54 +02:00
Frank a8a8dcff3f OPS Chief
- Removed mission queue. Now done via COMMANDER
- MissionCancel is buggy
2021-08-26 23:24:11 +02:00
Frank 1b0ad13529 OPS Commander 2021-08-26 21:24:47 +02:00
Frank 418d6c882c Update OpsGroup.lua 2021-08-25 17:46:00 +02:00
Frank 1e6899c40b OPS 2021-08-25 17:20:17 +02:00
Frank 259b201e65 OPS
Good version solving a few bugs and adding some new stuff.
2021-08-24 23:10:38 +02:00
Applevangelist 8fb113a04e CTLD - 1) added ability to limit stock. 2) Stopping Herc Pilots to try and build on the fly (look at you, Gunterlund! ;) ) 2021-08-24 14:16:11 +02:00
Frank c6ebbc6122 OPS
Strange version buggy
2021-08-23 23:34:15 +02:00
Applevangelist 755903a08e Changed priority to show bom target height in ft, in absence of player settings 2021-08-22 11:57:49 +02:00
Applevangelist 34e4825cd0 Merge pull request #1591 from bbirchnz/develop
CTLD: fix FOB units overwriting last instance, Unit Cargo Mass not working on first load
2021-08-22 08:32:18 +02:00
Ben Birch a68eeae9bd Merge remote-tracking branch 'origin/develop' into develop 2021-08-22 12:54:25 +10:00
Ben Birch e4e31b554e CTLD: fix FOB units overwriting last instance, Unit Cargo Mass not working on first load 2021-08-22 12:53:55 +10:00
Frank eba6e3f5f1 OPS Transport+Legion, Navy 2021-08-22 00:31:51 +02:00
Frank d73ebaca76 OPS
- Lots of stuff
2021-08-21 00:58:28 +02:00
Applevangelist 94167152e5 CTLD - added ability to spawn crates on ships 2021-08-20 12:33:10 +02:00
Applevangelist 830f76e909 Cleanup UTF-8 Mess 2021-08-18 18:00:38 +02:00
Applevangelist 8ae04944fe Fix for SAM pattern matching not working 2021-08-18 14:59:58 +02:00
Applevangelist c55b8d29f7 Fix for degree sign extra char 2021-08-18 11:51:41 +02:00
Applevangelist 30623f7d38 AIRBOSS / ATIS deleted extra char before degree char. Small correction for CSAR landings at Airports 2021-08-18 09:28:34 +02:00
Frank 16964520df OPS
- Lots of stuff to assign missions to multiple legions.
2021-08-18 00:25:18 +02:00
Frank 3050fdb3c3 OPS Zone 2021-08-15 00:28:03 +02:00
Frank 77fc2c5cf1 Update OpsGroup.lua 2021-08-12 11:41:30 +02:00
Frank b21c3ed4e9 OPS Cleanup 2021-08-12 11:07:28 +02:00
Frank 93f4b345c5 OPS Generalization 2021-08-12 00:17:55 +02:00
Frank 88e59a2739 OPS
- Ground ops
2021-08-11 10:40:16 +02:00
Frank 86bb256bf1 OPS
- Added Cohort and Legion classes
- Added Platoon and Brigade classes
2021-08-10 00:40:17 +02:00
Applevangelist 9a05f5bc93 Merge pull request #1589 from FlightControl-Master/Applevangelist-patch-5
CSAR fix for #1588
2021-08-09 09:18:51 +02:00
Applevangelist bce28cf389 CSAR fix for #1588
Fixes #1588
2021-08-09 09:06:15 +02:00
Frank 629c5e7739 AUFTRAG
- Recon Mission
2021-08-06 23:16:48 +02:00
Frank ed402e2f5f OPS Chief 2021-08-06 10:01:23 +02:00
Frank 4a56c7523d Wingcommander 2021-08-05 12:44:43 +02:00
Frank 218d9f48b0 Merge branch 'FF/Ops' into FF/OpsDev 2021-08-05 00:24:23 +02:00
Frank f67cf99477 OPS and SCHEDULER 2021-08-05 00:23:25 +02:00
Applevangelist 2201b2adda Update Utils.lua
Corrected self to BASE
2021-08-04 11:07:47 +02:00
Applevangelist 6b36421bce Merge pull request #1585 from FlightControl-Master/Applevangelist-patch-4
Update CSAR.lua
2021-08-04 08:04:21 +02:00
Frank 8c573c65d4 Update FlightControl.lua 2021-08-03 22:37:27 +02:00
Applevangelist 730dabd9cf Update CSAR.lua 2021-08-03 07:16:42 +02:00
Frank 69175e1b19 FC 2021-08-02 23:34:42 +02:00
Frank a5ad58e516 FC 2021-08-02 21:57:53 +02:00
Frank 82b4631341 Flightcontrol 2021-08-02 18:41:33 +02:00
Frank a1c9c1538d Merge branch 'FF/Ops' into FF/OpsDev 2021-08-02 11:59:32 +02:00
Frank 1a53f58540 OPS 2021-08-02 11:57:45 +02:00
Applevangelist 1b414b840e added AP check on landing/rescue 2021-07-31 15:50:50 +02:00
Applevangelist 642cc0e98f Added self.FARPRescueDistance reduced landing check to one call 2021-07-31 13:05:51 +02:00
Applevangelist 63431bb54b Couple of changes to make finding the distance to nearest pilot more stable 2021-07-30 17:30:32 +02:00
Frank d64de26ded OPS
- many fixes and improvements
2021-07-29 13:43:29 +02:00
Applevangelist 8b45067226 Various patches for AI_CARGO 2021-07-29 12:41:27 +02:00
Applevangelist 061032e3d7 Transition cleanup for AI Helicopter, deleted speed test bc in 20% of cases AI lands shit, which stops the FSM 2021-07-28 18:31:39 +02:00
Applevangelist 82432686aa Fixed display messages to all SAR, added option to suppress messaging 2021-07-27 14:10:10 +02:00
Applevangelist b66d2039be Added function to set speed and height parameters for landing 2021-07-27 14:09:10 +02:00
Applevangelist d245a73d7f Make Destroy() silent for scoring 2021-07-26 09:24:52 +02:00
Applevangelist f0037151e6 CTLD - added factor for troops extraction, making Destroy()s silent for scoring, refined autohoverload messaging 2021-07-26 09:24:35 +02:00
Applevangelist 52d494f573 Merge pull request #1582 from bbirchnz/develop
CTLD: fix troops being lost when crates dropped
2021-07-25 09:06:16 +02:00
Ben Birch 36a2d71731 CTLD: fix troops being lost when crates dropped 2021-07-25 13:46:15 +10:00
Frank 615a220acb Update OpsGroup.lua 2021-07-24 23:56:27 +02:00
Frank c718584755 Update OpsGroup.lua 2021-07-24 23:25:26 +02:00
Applevangelist 4db0ea616d Correct opendoor check to include anyone loaded 2021-07-24 15:53:20 +02:00
Applevangelist 5439e60078 Merge pull request #1580 from bbirchnz/ctld-add-mass
CTLD: Enable mass on cargo
2021-07-24 15:04:49 +02:00
Ben Birch a6880d4569 Add SetUnitInternalCargo to UNIT
Add PerCrateMass to CTLD_CARGO (default = 0kg)
Update unit internal cargo after each load/unload operation.
Add mass to cargo reports
2021-07-24 22:39:26 +10:00
Frank 65e852f341 OPS Transport 2021-07-24 01:06:44 +02:00
Frank 4ffdf9e536 Merge branch 'develop' into FF/Ops 2021-07-23 18:49:35 +02:00
Applevangelist 8f698e3e62 Changed Messaging Structure on Approach 2021-07-23 16:29:56 +02:00
Applevangelist 61481e6e9a CSAR updates to messaging. Detect if far approach note exceeds 8km for smoke/flare request 2021-07-23 11:19:53 +02:00
Applevangelist 49397df90b CTLD - added repair capabilties for VEHICLE and FOB types of CTLD_CARGO 2021-07-22 20:17:40 +02:00
Applevangelist 7b254a08fb Merge pull request #1579 from FlightControl-Master/Applevangelist-inteldlink
Update Intelligence.lua
2021-07-22 11:37:51 +02:00
Applevangelist 5bebbcf5eb Update Intelligence.lua
Added FSM functions and documentation for INTEL_DLINK
2021-07-22 11:36:21 +02:00
Applevangelist 83fd48e2f4 Merge pull request #1578 from madmoney99/develop
Airboss update for wind over deck
2021-07-22 08:03:32 +02:00
madmoney99 f5b25370b0 Change to wind measure for Skipper
Previous value 50m produced an incorrect heading and strength based on the actual wind over deck.
2021-07-21 22:51:29 -07:00
Tony Goodale f68d3209ac Merge branch 'FlightControl-Master:develop' into develop 2021-07-21 22:44:11 -07:00
Applevangelist 2ab7f784c9 Merge pull request #1576 from FlightControl-Master/Applevangelist-CTLD
Update CTLD.lua
2021-07-21 18:47:52 +02:00
Applevangelist 1e8d99a591 Merge pull request #1577 from FlightControl-Master/Applevangelist-INTEL
Update Intelligence.lua
2021-07-21 18:47:40 +02:00
Applevangelist d517cba765 Update Intelligence.lua
no dupe docs
2021-07-21 18:45:57 +02:00
Applevangelist 552eb5b9d8 Update CTLD.lua
Add housekeeping for dropped troops
2021-07-21 18:40:43 +02:00
Applevangelist 684c4ea113 Allow MANTIS to use INTEL_DLINK 2021-07-21 18:22:46 +02:00
Applevangelist 4dfaca610f INTEL - bug fixes, added new datalink class 2021-07-21 18:22:31 +02:00
Applevangelist 8a53998251 MANTIS - make start random async, so detection for multiple MANTIS objects works better
INTEL - added function to alter detection types, typos corrected etc
2021-07-20 18:30:11 +02:00
bbirchnz 6690f70b05 fix CTLD:ActivateZone not processing default correctly and using wrong zone table (#1575) 2021-07-19 07:16:21 +02:00
Applevangelist 96d1d3cb66 Light code cleanup, added docu for troop extract 2021-07-18 14:53:00 +02:00
bbirchnz 09785ef451 - ctld: add troop extract (#1574) 2021-07-18 13:01:45 +02:00
Applevangelist 25e118f3dc Added correct Player Mi-8MT unitname
CSAR - logic change to detect dead pilots, if they are not set to immortal. Added FSM event "KIA"
2021-07-17 15:48:18 +02:00
Frank 78b3e3c60b OPS Respawn 2021-07-15 22:25:02 +02:00
Applevangelist efe41a5e21 CSAR and CTLD - use Frequency generation moved to UTILS
CTLD - added option to drop crates anywhere
MANTIS - added state tracker to call Green/Red state change events only once
UTILS - added Marianas NDBs to Frequency generation
2021-07-15 17:16:30 +02:00
Frank 835041e5f6 OPS 2021-07-14 21:00:34 +02:00
Applevangelist 93a8086ff6 Update Mantis.lua (#1569)
Added state tracker so that Red/Green Events only get triggered when a state actually changes.
2021-07-14 15:37:57 +02:00
Applevangelist 1ac40684de Added option to force description on injected pilots for scripting 2021-07-14 08:39:54 +02:00
Applevangelist 433d1bbf57 MANTIS - Change logic to FSM, added functions
CSAR - advanced options to name injected AI downed pilots
CTLD - added Herc speed check
2021-07-13 17:50:44 +02:00
Applevangelist e33de03522 CSAR - honor settings NM vs KM
CTLD - documentation corrections
UTILS - added functions to generate beacon frequency tables FM,VHF,UHF and valid laser codes for JTACs
2021-07-12 19:17:39 +02:00
Applevangelist 86fedbfaae Updated noise level 2021-07-12 18:16:22 +02:00
Applevangelist c0f4eef896 Slightly changed versions of Mantis, Sead and Shorad as the Emissions On/Off stuff ED introduced doesn't really work well. 2021-07-12 18:10:12 +02:00
Frank a2f3bf3a8c Merge branch 'develop' into FF/Ops 2021-07-12 15:27:24 +02:00
Frank 1b717e4683 AUFTRAG
- Added push time
2021-07-12 15:27:08 +02:00
Applevangelist 52e2ac7174 Added documentation 2021-07-11 18:31:17 +02:00
Applevangelist 3d6b053eb4 Added function to check if a loading door on a heli is open 2021-07-11 18:31:09 +02:00
Frank 268eb1d60d OPS 2021-07-11 18:15:25 +02:00
Applevangelist a69865b8c9 -- -- (added 0.1.8) - allow to set far/near distance for approach and optionally pilot must open doors
--         self.approachdist_far = 5000 -- switch do 10 sec interval approach mode, meters
--         self.approachdist_near = 3000 -- switch to 5 sec interval approach mode, meters
--         self.pilotmustopendoors = false -- switch to true to enable check of open doors
2021-07-10 16:56:35 +02:00
Applevangelist 4a1df3d5cc -- -- (added 0.1.8) - allow to set far/near distance for approach and optionally pilot must open doors
--         self.approachdist_far = 5000 -- switch do 10 sec interval approach mode, meters
--         self.approachdist_near = 3000 -- switch to 5 sec interval approach mode, meters
--         self.pilotmustopendoors = false -- switch to true to enable check of open doors
2021-07-10 16:56:35 +02:00
Frank 6dfd757ea1 OPS 2021-07-08 22:59:29 +02:00
Frank fc1adf3b94 OPS Transport 2021-07-08 12:21:10 +02:00
Frank be2d1d7895 Update OpsTransport.lua 2021-07-07 11:33:51 +02:00
Frank 9e7c360912 Merge branch 'develop' into FF/Ops 2021-07-06 21:57:31 +02:00
Frank 51acd33d19 Merge branch 'master' into develop 2021-07-06 21:57:08 +02:00
Frank af3dbe2f86 Merge branch 'develop' into FF/Ops 2021-07-06 21:56:53 +02:00
Frank 97668e5413 Update FlightGroup.lua
- Fixed flight of airwing is going to tanker even if fuellowrefuel switch is false
2021-07-06 21:56:15 +02:00
Frank 464fde0ed2 OPS
- MSRS
- Callsign
2021-07-06 21:13:50 +02:00
cammel tech 65bd7909e1 Example for CTLD > SCORING added (#1566)
* Example added

Example for the connection to the SCORING Class.

* kleiner Fehler eingeschlichen
2021-07-06 20:26:20 +02:00
Applevangelist 5d3ea57d4d CSAR give scripted spawned pilots a name.
CTLD corrected that generic troops could be spawned only once.
2021-07-06 20:24:35 +02:00
Applevangelist b7bc3cfbcf Spawn crates in a wider radius. Also build, when only one crate is required. 2021-07-05 18:54:45 +02:00
Applevangelist 04ef32420b Merge pull request #1567 from thejuju/develop
Add ATC Ground Mariana Islands support
2021-07-05 14:44:02 +02:00
Julien B a3d8a48b92 Add ATC Ground Mariana Islands support
Added ATC_GROUND_MARIANAISLANDS
Supported optional airbase ZONE_POLYGON boundaries (like initially intented) when there is provided, fallback remain a ZONE from the center of the airfield.
Some airports are bigger than the default radius area and need custom boundaries to work properly on the edge of it.
2021-07-05 13:09:34 +02:00
Applevangelist ef86d1d7cb Merge pull request #1562 from cammeltech/SCORING-reactivate_destroy
Reactivate the :destroy() event on clients with scoring below thresmark
2021-07-04 18:10:45 +02:00
Applevangelist 00b3e9b371 Merge pull request #1564 from justin-lovell/justin-lovell-mark-changed-event
Synchronize Text with Wrapper State
2021-07-04 18:10:35 +02:00
Applevangelist 0d02f56855 Merge pull request #1565 from justin-lovell/updated-debug-msg
Correcting typo for debug message
2021-07-04 18:10:21 +02:00
Applevangelist 48aa841add ATIS - addede rainy presets 1-3
CTLD - avoid "preloading" when pilot leaves/crashes and rejoins
CSAR - added option for autosmokedistance
2021-07-04 18:04:27 +02:00
Applevangelist 4ba52212a9 ATIS - addede rainy presets 1-3
CTLD - avoid "preloading" when pilot leaves/crashes and rejoins
CSAR - added option for autosmokedistance
2021-07-04 18:04:08 +02:00
Justin Lovell a14bca1059 Synchronize Text with Wrapper State
Bug - text is not synchronized with the wrapper state, hence the `GetText()` will be incorrect.

Method `TextChanged` does not exist, resulting `nil` reference errors when the players update markers. Current implementation of `MARKER:OnEventMarkChange(EventData)` is not implemented the same as its siblings of `OnEventMarkRemoved` and `OnEventMarkAdded`. The siblings would move the FSM accordingly -- aligned implementation
2021-07-03 23:30:45 +10:00
Justin Lovell a7e07af24f Correcting typo for debug message
Small PR
2021-07-03 23:24:04 +10:00
Applevangelist e14d655447 Changed default fallback freq to 333.00Khz 2021-07-03 09:30:04 +02:00
Frank 74bdeaf4f7 AIRWING 2021-07-02 23:11:51 +02:00
Applevangelist 9591c62175 corrected autovalue for frequency - thanks to shadowze 2021-07-02 20:22:43 +02:00
Applevangelist 39c46dcab0 Changed frequency logic, some documentation changes 2021-07-02 20:15:12 +02:00
Applevangelist 299e08f53d additional checks to ensure only human players, extra checks in the logic, some logic errors corrected. 2021-07-02 17:52:58 +02:00
wob3155@posteo.de 12555a6ff1 Reactivate the :destroy() event on clients with scoring below thresmark 2021-07-02 08:56:28 +02:00
Frank 1cc012c7d1 Merge branch 'develop' into FF/Ops 2021-07-02 08:53:44 +02:00
Frank 28c6810878 Merge branch 'master' into develop 2021-07-02 08:52:07 +02:00
Frank 1ed36fdff4 Merge branch 'develop' into FF/Ops 2021-07-01 23:56:38 +02:00
Frank 26801cf206 Merge branch 'master' into develop 2021-07-01 23:54:57 +02:00
Frank c80cebb824 WAREHOUSE, AIRWING & SQUADRON
- Added function for hot start to SQUADRON
- Addressed bug #1560
2021-07-01 23:54:24 +02:00
Frank 3c6e8d6d01 OPS
- Transport
- Respawn
2021-07-01 12:29:29 +02:00
Applevangelist 76a53ab154 Added extra checks for Beacon refresh 2021-07-01 09:07:01 +02:00
Frank fa3e387dd1 OPS 2021-06-30 23:23:41 +02:00
Applevangelist dca626bbcb CTLD - added option to suppress messaging, added event for OnAfterTroopsRTB
CSAR - minor bugfix
2021-06-30 17:59:43 +02:00
Applevangelist 3289ad2817 Added basic support for Hercules mod 2021-06-29 17:49:42 +02:00
Applevangelist 5a022a2246 Messages going to SAR flights only 2021-06-29 08:50:46 +02:00
Frank b012c5b2aa OPS Transport
- Improved cargo bay weight calculation.
2021-06-28 13:17:55 +02:00
Frank a861f8d9d4 OPS 2021-06-25 21:13:24 +02:00
Frank 36669c80da OPSTRANSPORT 2021-06-25 13:23:56 +02:00
Applevangelist 2ff128f184 Added Docu for functions 2021-06-25 12:39:02 +02:00
Applevangelist 3b44aba341 Updated frequency test 2021-06-24 08:34:14 +02:00
Frank 978be4e383 OPS Transport 2021-06-23 17:20:51 +02:00
Applevangelist d4cdfcc48c Corrected Mi-8MTV2 Unit Type Name 2021-06-23 14:09:09 +02:00
Applevangelist 5123ab0720 Update CTLD.lua (#1558)
corrected fsm function name headlines in documentation
2021-06-23 09:47:05 +02:00
Applevangelist 5021a1e1f3 Update CTLD.lua 2021-06-22 18:26:44 +02:00
Applevangelist 576281a612 Update CSAR.lua (#1554)
Added options to limit number of downed pilots via Events (mission designers can still "inject" downed pilots):
`self.limitmaxdownedpilots = true
 self.maxdownedpilots = 10`
2021-06-22 18:24:46 +02:00
Applevangelist b84c0aba59 Update Moose.files (#1556) 2021-06-22 18:24:36 +02:00
Applevangelist ee503a378e Update Modules.lua (#1557)
added CTLD
2021-06-22 18:24:24 +02:00
Applevangelist f235037cb9 Create CTLD.lua (#1555)
Player Heli Cargo and Troops Ops :)
2021-06-22 18:24:11 +02:00
Applevangelist 0cd1cd97a6 Update CSAR.lua (#1553) 2021-06-22 13:11:12 +02:00
Frank 74513f1b5c Merge branch 'develop' into FF/Ops 2021-06-22 12:18:45 +02:00
Frank 231c5bfea7 Ops 2021-06-22 12:18:25 +02:00
Frank cfd0e4ba85 Merge branch 'master' into develop 2021-06-19 22:28:30 +02:00
Applevangelist bf33e4ed4f Update CSAR.lua (#1552) 2021-06-18 12:12:54 +02:00
Frank 6290db035d Merge branch 'develop' into FF/Ops 2021-06-15 22:00:14 +02:00
Applevangelist cd1935be1d Update CSAR.lua (#1551) 2021-06-15 15:49:58 +02:00
Applevangelist 64262d6ecc Update CSAR.lua (#1550) 2021-06-15 10:32:52 +02:00
Applevangelist 270c69344f Update CSAR.lua
Updated documentation / clarification. Added feature docu on using SRS
2021-06-15 07:42:45 +02:00
Applevangelist 10a0793af7 Update CSAR.lua
Small updates to reflect correct measurements. Options to SRS TTS.
2021-06-14 19:15:58 +02:00
Applevangelist 1b37af321f Update CSAR.lua
Small updates
2021-06-14 16:21:47 +02:00
Applevangelist 7cde279be1 Update Modules.lua
added CSAR module
2021-06-14 13:20:00 +02:00
Applevangelist 0396741f3d Create CSAR.lua
Initial Release
2021-06-14 13:18:27 +02:00
Applevangelist 117cf8888a Update Globals.lua 2021-06-13 10:39:07 +02:00
Frank 83db7b32e8 Merge branch 'master' into FF/Ops 2021-06-12 22:59:20 +02:00
Frank d496d3d16e Merge branch 'master' into develop 2021-06-12 22:23:10 +02:00
Frank 6b801247ab Merge branch 'FF/MasterDevel' into FF/Ops 2021-06-11 23:41:52 +02:00
Frank 4c6cd31bfc Merge branch 'FF/MasterDevel' into FF/Ops 2021-06-10 23:33:27 +02:00
Frank a8ef096f24 Merge branch 'FF/MasterDevel' into FF/Ops 2021-06-10 23:23:30 +02:00
Applevangelist c8d2a7e833 Added commands for immortal and invisible to Wrapper.Group#GROUP (#1547)
* Added function for message duration (#1542)

... and correct flash status setting

* Update Spawn.lua (#1544)

* Update Spawn.lua

* Update Group.lua (#1546)

Added invisible and immortal commands on GROUP level.
2021-06-10 11:59:50 +02:00
Frank 783391838b Merge branch 'FF/MasterDevel' into FF/Ops 2021-06-10 00:19:02 +02:00
Frank 7c37d8b204 Merge branch 'FF/MasterDevel' into FF/Ops 2021-06-09 13:19:14 +02:00
Applevangelist 65ed8825b0 Update Intelligence.lua
Added functionality to calculate the position of a cluster after x seconds, based on trajectory (average speed and heading) of a cluster
*  INTEL:CalcClusterFuturePosition(cluster,seconds)
Will also draw arrows on the map if `self.clustermarkers` is true and `self.verbose > 1`
Change cluster coordinate updates to better suite cluster movement
2021-06-08 15:59:36 +02:00
Applevangelist af9324dd5f master updates to develop for InitCleanup() and CC Messages (#1545)
* Added function for message duration (#1542)

... and correct flash status setting

* Update Spawn.lua (#1544)

* Update Spawn.lua
2021-06-07 18:26:43 +02:00
Frank 064f727676 Merge branch 'FF/MasterDevel' into FF/Ops 2021-06-05 23:45:15 +02:00
Frank 8025862fb9 Merge branch 'FF/MasterDevel' into FF/Ops 2021-06-01 23:20:59 +02:00
Frank 2544ec5587 Update SRS.lua 2021-05-30 01:44:36 +02:00
Frank 6c823b0137 Merge branch 'FF/MasterDevel' into FF/Ops 2021-05-30 01:36:43 +02:00
Frank 88d44fa654 Merge branch 'develop' into FF/Ops 2021-05-28 23:01:47 +02:00
Frank 8b6f9f9de7 Merge branch 'master' into develop 2021-05-28 23:01:15 +02:00
Applevangelist cb14961dcd Update Zone.lua (#1541)
added function `ZONE_POLYGON_BASE:Boundary()`
2021-05-26 15:54:20 +02:00
Applevangelist dab486ec99 Update Controllable.lua
Typo in `OptionDisperseOnAttack()`
2021-05-26 09:16:26 +02:00
Shadowze 75849fbfb5 Update Positionable.lua
function added to work out if a unit is a submarine
2021-05-25 22:30:16 +01:00
Frank f984ff044b Merge branch 'master' into develop 2021-05-25 21:13:36 +02:00
Frank aaf5f295da Merge branch 'develop' into FF/Ops 2021-05-20 23:27:05 +02:00
Frank 8f612f2017 Merge branch 'master' into develop 2021-05-20 23:25:29 +02:00
Frank a2808163a7 Boom and Probe 2021-05-20 23:23:12 +02:00
Frank e4aa23ce3d Update Point.lua 2021-05-15 00:29:20 +02:00
Frank 1b3cac9424 Merge branch 'FF/MasterDevel' into FF/Ops 2021-05-13 23:38:17 +02:00
Applevangelist e49020b905 Update README.md 2021-05-12 09:19:07 +02:00
Frank d68dcaf69a Merge branch 'develop' into FF/Ops 2021-05-11 14:52:31 +02:00
Frank 856c3578f6 Merge branch 'master' into develop 2021-05-11 11:59:48 +02:00
Tony Goodale 18c6ea39ce Merge pull request #7 from FlightControl-Master/develop
Develop
2021-05-10 15:47:14 -07:00
Frank 1ce46c016c Cargo 2021-05-10 00:14:07 +02:00
Frank 296944c23c Merge branch 'develop' into FF/Ops 2021-05-07 22:57:34 +02:00
Frank 4f772fecdc Merge branch 'master' into develop 2021-05-07 21:56:17 +02:00
Frank cdd22444b9 Merge branch 'master' into develop 2021-05-07 21:49:24 +02:00
Frank 15848bc8c4 Merge branch 'master' into FF/Ops 2021-05-07 17:47:41 +02:00
Applevangelist 9eba6d607c Updated doc images 2021-05-06 09:30:06 +02:00
Applevangelist e9d3c7c2e7 Update MarkerOps_Base.lua 2021-05-05 19:02:46 +02:00
Applevangelist ad16c6d44f Include MarkerOps_Base (#1533)
Include MarkerOps_Base
2021-05-05 11:56:00 +02:00
Applevangelist 2046958bd6 Added MarkerOps_Base.lua 2021-05-05 11:44:35 +02:00
Applevangelist 0046533d53 Added base class for action based on marker additions, changes, deletions and text keywords 2021-05-05 11:44:17 +02:00
Applevangelist ce7e152e13 Updated Shorad and Set 2021-05-04 12:59:21 +02:00
Tony Goodale edcdc057e6 Merge pull request #6 from FlightControl-Master/develop
Develop
2021-05-01 15:40:23 -07:00
Frank cfa851beea Merge branch 'master' into FF/Ops 2021-05-02 00:25:07 +02:00
Frank f5d8efe86e Merge branch 'master' into develop 2021-05-01 22:45:48 +02:00
Applevangelist 7c8e5033ec Merge pull request #1527 from FlightControl-Master/AA-1
Update Sead.lua
2021-05-01 17:29:43 +02:00
Applevangelist 22ec94b374 Merge pull request #1528 from FlightControl-Master/AA-2
Update Shorad.lua
2021-05-01 17:27:22 +02:00
Applevangelist 5cd3a172f1 Merge pull request #1529 from FlightControl-Master/AA-3
Update Mantis.lua
2021-05-01 17:24:33 +02:00
Applevangelist a89a3b38ce Update Mantis.lua
Adjustments for 2.7
2021-05-01 17:21:53 +02:00
Applevangelist 3202702612 Update Shorad.lua
Adjustments for 2.7
2021-05-01 17:20:35 +02:00
Applevangelist 725e32f439 Update Sead.lua
Adjust to Event changes
2021-05-01 17:19:10 +02:00
Applevangelist 7da1905ad3 Update Event.lua (#1525)
Updates for Events 33 and 6 - makes scoring also work again for STATIC targets
2021-05-01 14:22:01 +02:00
Frank 421005a3b6 event backfixed 2021-04-30 11:53:57 +02:00
Applevangelist d5bf28f799 Update AirWing.lua (#1521)
Markpoint honored for direct calls from #OPSGROUP
2021-04-29 18:20:03 +02:00
Frank 990f748e42 Update Database.lua 2021-04-27 09:19:33 +02:00
Applevangelist a466365949 Update Controllable.lua (#1519)
Error line 1463
2021-04-25 20:31:02 +02:00
Frank b12f71c430 Merge branch 'develop' into FF/Ops 2021-04-23 13:38:28 +02:00
Frank 236a69e5dc Merge branch 'master' into develop 2021-04-23 13:29:37 +02:00
Applevangelist 9458243926 Merge pull request #1516 from FlightControl-Master/AA
Update Controllable.lua
2021-04-23 11:00:50 +02:00
Applevangelist 41274e7801 Update Controllable.lua 2021-04-23 10:59:22 +02:00
Applevangelist 0259e41ce8 Create .luacheckrc 2021-04-22 10:10:59 +02:00
Applevangelist e78f9cbd46 Merge pull request #1512 from FlightControl-Master/aa
Update Airboss.lua
2021-04-22 08:53:52 +02:00
Applevangelist 9d6851adec Update Airboss.lua
Escape error 17933
2021-04-22 08:30:19 +02:00
Applevangelist 4668f072af Merge pull request #1511 from FlightControl-Master/AA-1
Update Airboss.lua
2021-04-22 08:21:00 +02:00
Applevangelist a1a414925f Update Airboss.lua 2021-04-22 08:19:56 +02:00
Applevangelist 19eb9dca30 Update Utils.lua 2021-04-20 18:49:54 +02:00
Applevangelist 8464a2ba43 Merge pull request #1507 from FlightControl-Master/Applevangelist-patch-1
Update Airbase.lua
2021-04-20 16:52:28 +02:00
Applevangelist a8549e2b7d Update Airbase.lua 2021-04-20 16:50:00 +02:00
Applevangelist 2531a25c9e Update Group.lua
Add EnableEmissions
2021-04-20 11:36:59 +02:00
Frank 2f7b7eeddd Merge branch 'master' into develop 2021-04-18 14:49:37 +02:00
Frank ab1ec54c03 Merge branch 'master' into develop 2021-04-18 14:34:46 +02:00
Frank a1ca605206 Merge branch 'master' into develop 2021-04-17 23:19:42 +02:00
Frank a7b444dfea Update OpsGroup.lua 2021-04-17 09:29:55 +02:00
Frank 64b35b9cb3 Merge branch 'develop' into FF/Ops 2021-04-16 23:15:30 +02:00
Frank 4a8d52b328 Merge branch 'master' into develop 2021-04-16 23:06:04 +02:00
Pikes 3cbf6fff90 Merge pull request #1490 from Applevangelist/patch-82
Update Event.lua workaround for 2.7
2021-04-16 18:01:25 +01:00
Frank 2693e76483 Update Airboss.lua 2021-04-15 21:13:35 +02:00
Applevangelist b232a5da37 Update Event.lua workaround for 2.7
Same as for Event 31
2021-04-15 13:02:59 +02:00
Frank e50fc00583 Merge branch 'develop' into FF/Ops 2021-04-14 23:44:43 +02:00
Frank 4b8802af37 Merge branch 'master' into develop 2021-04-14 23:42:48 +02:00
Frank ebd69fd10d Merge pull request #1482 from Applevangelist/patch-74
Update FlightGroup.lua
2021-04-12 15:55:50 +02:00
Applevangelist c1a8c08880 Update FlightGroup.lua 2021-04-12 13:02:16 +02:00
Frank 647fb6acbf Merge branch 'develop' into FF/Ops 2021-04-07 20:54:19 +02:00
Frank ede692ea2a Merge branch 'master' into develop 2021-04-07 20:53:27 +02:00
Frank ca44e2762b Update OpsGroup.lua 2021-04-07 20:53:15 +02:00
Frank eda70742eb Merge pull request #1486 from Applevangelist/patch-78
Update AirWing.lua
2021-04-04 22:03:49 +02:00
Frank b81e3e9e6d Merge pull request #1485 from Applevangelist/patch-77
Update Intelligence.lua
2021-04-04 22:03:40 +02:00
Applevangelist e766eaeccc Update AirWing.lua
Avoid loop if mission is governed by an Airwing. Mission cancel will ask airwing to cancel will ask flightgroup to cancel, which doesn't work if the latter is dead. Rare but happens.
2021-04-04 13:11:25 +02:00
Applevangelist bab61271f2 Update Intelligence.lua
Make Markers Coalition specific
2021-04-04 13:07:54 +02:00
Applevangelist b1465d89a6 Update FlightGroup.lua
Added check for velocity for the RTB loop (if group is taxiing). Added OutOfAAMissiles.
2021-04-04 12:49:40 +02:00
Frank 05b1ddf013 Merge pull request #1483 from Applevangelist/patch-75
Update AirWing.lua
2021-04-03 22:25:51 +02:00
Applevangelist 903e8711f7 Update AirWing.lua
Make Patrolpoint Markes Switchable
2021-04-01 13:28:59 +02:00
Applevangelist 31b93fb42c Update FlightGroup.lua
Avoid endless when plane/heli is not airborne by needs to RTB
2021-04-01 13:21:40 +02:00
Frank e16bbfc2b9 Merge branch 'develop' into FF/Ops 2021-03-29 19:55:35 +02:00
Frank 220e004d73 Merge branch 'master' into develop 2021-03-29 19:55:21 +02:00
Frank 3136861b24 Merge branch 'develop' into FF/Ops 2021-03-29 18:02:23 +02:00
Frank dc2693bead Merge branch 'master' into develop 2021-03-29 18:02:00 +02:00
Frank d7da8c4253 Merge branch 'develop' into FF/Ops 2021-03-29 09:55:13 +02:00
Frank c1ff5831ad Merge branch 'master' into develop 2021-03-29 09:53:51 +02:00
Frank ac5646075b Merge pull request #1481 from madmoney99/develop
Airboss CASE III fix for OS/AA
2021-03-29 00:31:46 +02:00
madmoney99 5a1faba796 CASE III fix for OS/AA 2021-03-28 15:25:59 -07:00
Tony Goodale 4ab16cb276 Merge pull request #5 from FlightControl-Master/develop
Merge pull request #1478 from madmoney99/develop
2021-03-28 15:12:27 -07:00
Frank eb1e885c0a Merge branch 'develop' into FF/Ops 2021-03-28 20:33:08 +02:00
Frank 00ff9a11b8 Merge branch 'master' into develop 2021-03-28 20:30:19 +02:00
Frank 8eabc024bf Merge pull request #1479 from madmoney99/develop
Update Airboss.lua
2021-03-23 08:44:14 +01:00
madmoney99 a848af0753 Update Airboss.lua 2021-03-22 19:01:04 -07:00
Frank f4e7a3a314 Merge pull request #1478 from madmoney99/develop
Airboss formating fixes
2021-03-22 22:19:29 +01:00
madmoney99 d83283c709 Update Airboss.lua
formatting fixes
2021-03-22 10:10:33 -07:00
Tony Goodale a35112a6f3 Merge pull request #4 from FlightControl-Master/develop
Merge pull request #1476 from madmoney99/develop
2021-03-22 10:01:53 -07:00
Frank 66c012a30d Merge pull request #1476 from madmoney99/develop
Develop Airboss grading additions
2021-03-22 12:03:58 +01:00
madmoney99 7b92b7853d Grading Additions
Addition of:
- AA - Angled Approach call (advisory)
- Drift Right/Left - DR/DL (advisory)
- Overshoot - OS - graded for start

Updated default SetMPWireCorrection(Dcorr) to 12 from 8.7 based on feedback.

Minor clean up and updates for intro section to include new additions and other changes previously made.

TonyG
2021-03-21 17:40:44 -07:00
madmoney99 6c9f10e6a8 Revert "Grading additions"
This reverts commit 6db2c4465d.
2021-03-21 17:38:06 -07:00
madmoney99 6db2c4465d Grading additions
Addition of:
 - AA - Angled Approach call (advisory)
 - Drift Right/Left - DR/DL (advisory)
 - Overshoot - OS - graded for start

Updated default SetMPWireCorrection(Dcorr) to 12 from 8.7 based on feedback.

Minor clean up and updates for intro section to include new additions and other changes previously made.

TonyG
2021-03-21 17:35:16 -07:00
Tony Goodale c0cc960df5 Merge pull request #3 from FlightControl-Master/develop
Develop
2021-03-21 14:53:53 -07:00
Frank 968240ad44 Merge pull request #1473 from Applevangelist/patch-72
Update Sead.lua
2021-03-14 22:46:16 +01:00
Applevangelist 50f3016711 Update Sead.lua
latest
2021-03-10 11:36:10 +01:00
Frank 56e2b06e9d OPS Cargo 2021-03-07 23:47:29 +01:00
Frank c02f69720a Merge pull request #1471 from Applevangelist/patch-71
Update Controllable.lua
2021-03-04 16:33:56 +01:00
Frank 96df7d1e42 Merge pull request #1470 from Applevangelist/patch-70
Update Intelligence.lua
2021-03-04 16:33:46 +01:00
Applevangelist 1d4caf7588 Update Controllable.lua
2 functions missing though they are in the doc header
2021-03-04 16:15:57 +01:00
Applevangelist b0e3201d3c Update Intelligence.lua
Added Docu
2021-03-04 11:13:30 +01:00
Frank bab097958f Merge branch 'develop' into FF/Ops 2021-03-03 00:03:52 +01:00
Frank f4a3f6d433 OPS 2021-03-03 00:03:39 +01:00
Frank e73ab89a18 Merge pull request #1469 from madmoney99/develop
Develop
2021-03-02 22:46:31 +01:00
madmoney99 187643f6ae Groove time additions
Changes on screen description of groove times to match NATOPs grading
NESA
LIG
Changes unicorn groove time from 16-18secs to 15-18.99 seconds.

No change to grading.  Reference GitHub issues 1445 &1446.
2021-03-02 13:36:54 -08:00
Tony Goodale 3c9bdb2915 Merge pull request #1 from FlightControl-Master/develop
Develop
2021-03-02 13:28:58 -08:00
Frank 5241642447 Merge branch 'master' into develop 2021-03-02 21:19:41 +01:00
Frank 3b2cbea1c4 Update OpsGroup.lua 2021-03-02 21:12:51 +01:00
Frank 80e3da49cb Merge pull request #1468 from Applevangelist/patch-69
Update Intelligence.lua
2021-03-02 15:34:27 +01:00
Applevangelist 1df7a12587 Update Intelligence.lua
Finalized Cluster functions, added bits and bobs
2021-03-02 14:28:37 +01:00
Frank 663a59bd71 Merge branch 'master' into develop 2021-02-28 23:26:48 +01:00
Frank ced859424b Merge branch 'master' into develop 2021-02-27 21:18:11 +01:00
Frank 4a6377c204 Ops Cargo 2021-02-27 21:17:58 +01:00
Frank fd22558207 Merge pull request #1467 from madmoney99/develop
T-45C Goshawk Parameters
2021-02-26 08:00:35 +01:00
madmoney99 a6faadea48 T-45C Goshawk Parameters
Addition of parameters for the VNAO T-45C Goshawk.
2021-02-25 12:52:50 -08:00
Frank 42a26100b7 Merge pull request #1465 from Applevangelist/patch-67
Update Intelligence.lua
2021-02-24 18:02:19 +01:00
Frank e8f4770abe Merge pull request #1464 from Applevangelist/patch-66
Update AirWing.lua
2021-02-24 18:01:44 +01:00
Applevangelist 7751d4ee88 Update Intelligence.lua
Added function to set verbosity
2021-02-24 16:22:13 +01:00
Applevangelist cdd829e7be Update AirWing.lua
Ensure correct type of tanker is going on mission
2021-02-24 16:16:28 +01:00
Frank 16bf3a89b5 Merge pull request #1461 from Applevangelist/patch-63
Update Intelligence.lua
2021-02-21 23:59:37 +01:00
Applevangelist 11cdae098b Update Intelligence.lua
Honor settings for clustermarkers
2021-02-21 19:55:48 +01:00
Frank a63ee3fa8b Merge branch 'develop' into FF/Ops 2021-02-21 11:54:06 +01:00
Frank 5cc023d1fe OPS Cargo 2021-02-21 11:53:52 +01:00
Frank c4084156ac OPS Cargo 2021-02-21 00:19:32 +01:00
Frank 302018feff OPS Cargo 2021-02-20 00:03:45 +01:00
Frank c50f6b72e7 OPS Cargo 2021-02-19 00:11:55 +01:00
Frank c0401447dd OPS Cargo 2021-02-18 00:10:17 +01:00
Frank 43680c2fc3 Merge branch 'master' into develop 2021-02-17 13:16:46 +01:00
Frank 2c92bb9d61 OPS Cargo 2021-02-17 00:29:59 +01:00
Frank dcf1a56756 Update OpsGroup.lua 2021-02-16 00:15:22 +01:00
Frank 5990ab1cc9 OPSTRANSPORT
- New class.
2021-02-15 23:19:35 +01:00
Frank 084499fa0e OPS Wait 2021-02-14 00:19:03 +01:00
Frank 74e84a73dd OPS Cargo 2021-02-13 00:09:25 +01:00
Frank 96b0393f91 OPS Cargo 2021-02-11 23:58:56 +01:00
Frank 0656c33e05 Update OpsGroup.lua 2021-02-10 23:50:37 +01:00
Frank ec1ab49b54 Merge pull request #1447 from Applevangelist/patch-51
Update Auftrag.lua
2021-02-10 21:34:12 +01:00
Applevangelist 1daa2857b2 Update Auftrag.lua
Corrected docu in NewTanker, 1 is actually boom, and 0 probe
2021-02-10 13:19:53 +01:00
Frank 8c55541d0e Update OpsGroup.lua 2021-02-08 16:27:58 +01:00
Frank c5a4776b3a OPS Cargo 2021-02-07 01:24:13 +01:00
Frank 8bb9f0d7c0 OPS Cargo 2021-02-06 09:41:24 +01:00
Frank 7d83c251a8 OPS Cargo 2021-02-03 22:51:18 +01:00
Frank ee3ead9aac OPS Cargo 2021-02-02 23:20:55 +01:00
Frank 54896e0e31 Merge pull request #1444 from rollnthndr/develop
Added a note pointing out that callsigns need to be chosen depending …
2021-02-01 08:06:11 +01:00
Frank 016198e7f2 OPS Cargo 2021-01-31 23:28:04 +01:00
Frank 0933eef4c3 Merge branch 'develop' into FF/Ops 2021-01-31 00:50:14 +01:00
Frank fe55555c67 OPS
- Fixed inAir check for spawned groups
- Reduced SCHEDULER min delay to 0.001 sec (was 0.1 sec)
2021-01-30 23:28:07 +01:00
Frank bcf8973eed OPS 2021-01-30 21:29:29 +01:00
rollnthndr 50d2e42cc3 Added VSCode settings folder and workspace file to the ignore list. 2021-01-29 18:31:19 -07:00
rollnthndr 261d1cbeba Added a note pointing out that callsigns need to be chosen depending on the type of unit that this task is being assigned to. 2021-01-29 18:15:20 -07:00
Frank 242462b9ba OPS Cargo 2021-01-29 00:32:38 +01:00
Frank fd4e478dbf Merge branch 'master' into develop 2021-01-26 12:40:15 +01:00
Frank 6b91e68668 OPS Cargo 2021-01-26 12:39:49 +01:00
Frank 7516d2af56 Merge branch 'master' into develop 2021-01-23 16:47:14 +01:00
Frank c247a98402 OPS cargo 2021-01-23 16:46:44 +01:00
Frank 83bcd55a7a Merge pull request #1439 from FlightControl-Master/wingthor_fixes
Added a table shuffler using Fisher Yeates algorithm in Utilities/Uti…
2021-01-22 23:28:42 +01:00
Wingthor 5a43936e35 Added a table shuffler using Fisher Yeates algorithm in Utilities/Utils.lua 2021-01-22 23:10:22 +01:00
Frank 35b776179e Merge branch 'master' into develop 2021-01-19 16:56:40 +01:00
Frank f4cb6df8d4 Ops
respawn
2021-01-19 16:53:22 +01:00
Frank a259b88f1d Merge branch 'develop' into FF/Ops 2021-01-16 22:57:10 +01:00
Frank 5b4f3d1c98 Merge branch 'master' into develop 2021-01-16 22:56:43 +01:00
Frank c62c21c386 FLIGHTGROUP v0.6.1
- Improved engage targets
2021-01-16 22:56:28 +01:00
Frank 17c56a11bd Merge pull request #1432 from OttoWerkr/develop
Update Scenery.lua
2021-01-15 23:53:37 +01:00
Frank 796561b8b6 Merge pull request #1433 from FlightControl-Master/FF/Ops
OPS
2021-01-15 23:44:46 +01:00
Frank 209b7a64ed Update OpsGroup.lua 2021-01-15 23:42:30 +01:00
Frank 8f56299380 OPS
**AUFTRAG**
- Added PATROLZONE type. Works for all OPSGROUPs (air, ground and sea).

**FLIGHTGROUP**
- Improved EngageTarget
- Added option to automatically engage detected targets.

**TARGET**
- Improved Zone type
2021-01-15 23:29:16 +01:00
OttoWerkr 73b1394ca7 Update Scenery.lua
Added FindByName() to SCENERY Class.
2021-01-15 14:27:43 -05:00
Frank f3a2cf7284 Patrol
- Added `FLIGHTGROUP:SetEngageDetectedOn()`
- AUFTRAG patrol zone.
2021-01-15 00:59:52 +01:00
Frank df79c765f8 Merge branch 'master' into develop 2021-01-12 17:40:40 +01:00
Frank d09737c218 Merge branch 'master' into develop 2021-01-12 13:51:26 +01:00
Frank 6b0c42ae50 Merge branch 'master' into develop 2021-01-12 10:45:11 +01:00
Frank 7363da1b54 Merge branch 'master' into develop 2021-01-09 23:48:42 +01:00
Frank 684f19c060 Merge branch 'master' into develop 2021-01-05 22:59:57 +01:00
Frank d08e4db0eb Merge branch 'master' into develop 2021-01-03 00:24:42 +01:00
Frank f1e7d8bd06 Merge branch 'master' into develop 2021-01-01 10:16:58 +01:00
Frank 1328ac061e Merge branch 'master' into develop 2020-12-31 21:22:59 +01:00
Frank 391f0fc9af Merge branch 'master' into develop 2020-12-29 23:38:44 +01:00
Frank 38cf5be738 Update Airbase.lua 2020-12-29 22:51:10 +01:00
Frank 1bb70b8697 Update Warehouse.lua
- added airbase coalition check when spawning aircraft #1413
2020-12-29 22:28:36 +01:00
Frank 6e35b80daf Update Warehouse.lua
- requests should no longer be processed if warehouse has no airbase
2020-12-29 21:41:15 +01:00
Frank a171c22ce4 Merge branch 'develop' into FF/Ops 2020-12-29 11:23:04 +01:00
Frank f56457bc28 Update Intelligence.lua
- added reject zones
2020-12-29 11:22:47 +01:00
Frank 9708de70c7 Merge branch 'master' into develop 2020-12-27 17:59:57 +01:00
Frank d68589bb70 Merge branch 'master' into develop 2020-12-23 16:10:07 +01:00
Frank 16eb38782a Merge branch 'master' into develop 2020-12-23 10:54:57 +01:00
Frank 2175e9c0d6 Merge branch 'master' into develop 2020-12-22 09:49:08 +01:00
Frank 9abd71f681 Merge branch 'develop' into FF/Ops 2020-12-21 00:13:09 +01:00
Frank d1dc829136 Merge branch 'master' into develop 2020-12-20 23:48:28 +01:00
Frank eda672bdc6 Merge branch 'develop' into FF/Ops 2020-12-19 12:48:12 +01:00
Frank 0e5dbbea79 Merge branch 'master' into develop 2020-12-19 01:18:17 +01:00
Frank f5809ef302 Merge branch 'develop' into FF/Ops 2020-12-18 23:50:59 +01:00
Frank 457ce1ece1 Merge branch 'master' into develop 2020-12-18 13:52:23 +01:00
Frank 9c9841332f Merge branch 'master' into develop 2020-12-17 13:55:38 +01:00
Frank 9470d3a2ef Merge branch 'master' into develop 2020-12-17 12:34:59 +01:00
Frank 8356271f8d Merge branch 'master' into develop 2020-12-17 12:34:04 +01:00
Frank 42a6f3272d Merge branch 'master' into develop 2020-12-16 00:12:38 +01:00
Frank 362b242c41 Merge pull request #1398 from Applevangelist/patch-20
Error in FlightGroup.lua in line 2390 as detected by HRP Zero
2020-12-15 00:36:57 +01:00
Frank 7ace7b49ca Merge branch 'develop' into FF/Ops 2020-12-15 00:14:15 +01:00
Frank 7cd902e924 Merge branch 'master' into develop 2020-12-15 00:11:34 +01:00
Applevangelist e3c14678e2 Error in FlightGroup.lua in line 2390 as detected by HRP Zero
Not searching in Paris, but in pairs :)
2020-12-14 13:37:17 +01:00
Frank bfaca75a7d Merge branch 'master' into develop 2020-12-14 12:37:45 +01:00
Frank 5aecd8c255 Ops
- Performance
2020-12-10 18:53:49 +01:00
Frank cfc0f1a1f7 Merge branch 'master' into develop 2020-12-03 23:18:32 +01:00
Frank edf657c65c Merge branch 'master' into develop 2020-11-30 11:40:34 +01:00
Frank 801d00fa26 Stuff 2020-11-30 11:38:36 +01:00
Frank eeffa31282 Update ChiefOfStaff.lua 2020-11-26 11:47:05 +01:00
Frank 206528a530 Merge branch 'FF/Ops' into FF/OpsDev 2020-11-26 10:56:17 +01:00
Frank 41690fdf7b Merge pull request #1385 from FlightControl-Master/FF/Ops
OPS
2020-11-25 11:34:41 +01:00
Frank 5b83f8e45b OPS 2020-11-25 11:27:07 +01:00
Frank 94863ed8ae Update OpsGroup.lua 2020-11-24 22:00:36 +01:00
Frank e63b99c890 Merge pull request #1379 from Applevangelist/patch-7
Update Controllable.lua
2020-11-22 15:54:03 +01:00
Frank e8542743b4 Merge pull request #1380 from Applevangelist/patch-8
Update Sead.lua
2020-11-22 15:53:14 +01:00
Applevangelist 309e1208c2 Update Sead.lua
Feature Request #1355
2020-11-22 14:17:42 +01:00
Applevangelist 3e0db05664 Update Controllable.lua
Added control to keep within limits of the options
2020-11-22 13:01:26 +01:00
Applevangelist 9573d92cc0 Update Controllable.lua
Add option to control a2a attack ranges for AIR fighter units. See https://wiki.hoggitworld.com/view/DCS_option_missileAttack
2020-11-22 12:07:49 +01:00
Frank 1abc0dcb6a Merge pull request #1378 from FlightControl-Master/FF/Ops
OPS
2020-11-21 21:55:20 +01:00
Frank 770fb3228f OPS
AUFTRAG
- Changed ESCORT engage distance input to NM (not meters)

TARGET
- Fixed bug in count targets
- Improved dead/destroyed management

FLIGHTGROUP
- Only register UNIT/STATIC kills (not SCENERY)

INTEL
- Improved agent set
2020-11-21 21:49:47 +01:00
Frank d6aa251c5e Merge pull request #1377 from Applevangelist/patch-6
Update AI_A2G_Dispatcher.lua
2020-11-20 18:17:25 +01:00
Frank 9305b870d2 Merge pull request #1376 from Applevangelist/patch-5
Update AI_A2A_Dispatcher.lua
2020-11-20 18:17:00 +01:00
Applevangelist 824a98d7a8 Update AI_A2G_Dispatcher.lua
Wrapper for player messages and function to set this on/off
2020-11-20 10:43:39 +01:00
Applevangelist 7a55ba105c Update AI_A2A_Dispatcher.lua
Wrap player messages, added function to switch on/off
2020-11-20 10:34:53 +01:00
Frank 122425338e Merge branch 'master' into develop 2020-11-20 10:18:05 +01:00
Frank 1d7f874a78 Merge pull request #1375 from FlightControl-Master/FF/Ops
OPS
2020-11-19 21:49:02 +01:00
Frank afb63a7331 Update Target.lua
- Fixed escort problem
2020-11-19 19:51:58 +01:00
Frank 0c07a660ee WAREHOUSE
- Added runway destroyed check.
2020-11-17 00:25:37 +01:00
Frank 8ffda53e3d Chief and Wing Commander
- Added back in
2020-11-16 18:11:15 +01:00
Frank 5a30c08ff6 Merge pull request #1369 from FlightControl-Master/FF/Ops
TARGET
2020-11-16 13:33:14 +01:00
Frank 9cac2674c4 Update Target.lua
- Alive checks improved
2020-11-16 13:22:53 +01:00
Frank ec3f43c69f Merge pull request #1367 from FlightControl-Master/FF/Ops
OPS
2020-11-16 00:02:20 +01:00
Frank 270dfab6a2 OPS
less output again
2020-11-15 23:49:25 +01:00
Frank 624b1f5647 Merge branch 'develop' into FF/Ops 2020-11-15 23:34:34 +01:00
Frank 84332a3ebf Update FlightGroup.lua
Fixes bug when flight searches a tanker when fuel is low.
2020-11-15 23:33:43 +01:00
Frank 63ff79ef0b Merge branch 'master' into FF/Ops 2020-11-15 23:00:50 +01:00
Frank 09452444d7 Merge branch 'master' into develop 2020-11-15 23:00:23 +01:00
Frank 75be2fc0ba Update Target.lua 2020-11-15 21:44:08 +01:00
Frank 1e0a0f8dc5 Ops 2020-11-13 23:26:56 +01:00
Frank f3d9b9c5be Ops 2020-11-06 00:29:42 +01:00
Frank cef0e444c9 Ops 2020-11-04 22:48:14 +01:00
Frank bad8dc2220 Merge pull request #1362 from FlightControl-Master/FF/Ops
Ops Enhancements
2020-10-31 22:05:58 +01:00
Frank e05d57d908 Merge branch 'develop' into FF/Ops 2020-10-31 21:22:17 +01:00
Frank 45c153f7a0 Merge branch 'master' into develop 2020-10-31 21:21:47 +01:00
Frank 0948f418cd Ops
- Fixed payload not reduced
2020-10-31 11:57:23 +01:00
Frank d027113b0b Merge branch 'develop' into FF/Ops 2020-10-28 09:48:36 +01:00
Frank ff00c2fb15 Merge branch 'master' into develop 2020-10-28 09:46:34 +01:00
Frank cd5b4ee1be Update AI_Formation.lua
- fixed bug
- set default mode to following
2020-10-28 09:44:33 +01:00
Frank ac337b8459 Ops
- Laser
2020-10-28 09:06:22 +01:00
Frank 567f7cbc29 Update OpsGroup.lua
- Laser
2020-10-27 00:12:59 +01:00
Frank d81ffcf119 Merge branch 'develop' into FF/Ops 2020-10-26 16:16:56 +01:00
Frank 6ed66a70a2 Merge branch 'master' into develop 2020-10-26 16:16:28 +01:00
Frank 9ed3b045f7 Merge branch 'master' into develop 2020-10-26 09:17:41 +01:00
Frank 2d6653c14a Ops
- Laser
2020-10-26 08:01:56 +01:00
Frank ab0e7e735a Merge branch 'develop' into FF/Ops 2020-10-20 23:40:52 +02:00
Frank 3243555d3f Merge branch 'master' into develop 2020-10-20 23:31:30 +02:00
Frank 8696ce0cc1 Ops 2020-10-20 23:04:15 +02:00
Frank 459ff26868 Ops 2020-10-19 23:33:39 +02:00
Frank 277eb2d09f Ops
- Laser
2020-10-18 00:02:48 +02:00
Frank 187093fa5a NavyGroup Update 2020-10-14 00:24:12 +02:00
Frank 6c9ce55759 Navygroup
- Fixed Astar bug
- Turn into wind stop
2020-10-13 00:29:31 +02:00
Frank f9721e501a Merge branch 'FF/Ops' into develop 2020-10-12 00:22:47 +02:00
Frank 23c22651be Update Airboss.lua
- Added USS Harry S. Truman (CVN-75) as SC type.
2020-10-12 00:21:47 +02:00
Frank 2ad81ca499 Ops 2020-10-12 00:09:02 +02:00
Frank 7792381c36 OPS 2020-10-09 17:10:24 +02:00
Frank 591dd128ce Navygroup 2020-10-09 00:15:19 +02:00
Frank ce10390406 ARMYGROUP 2020-10-07 23:26:46 +02:00
Frank bf299e5f8d Merge pull request #1353 from FlightControl-Master/FF/Ops
OPS fixes
2020-10-03 23:29:35 +02:00
Frank 7f98e703f1 Update Airbase.lua
- Fixed bug in the `AIRBASE:GetRunwaydata()` function.
2020-10-03 23:12:17 +02:00
Frank 421d27f640 Update Airboss.lua
- Fix if unit skill is not set in env.mission (DCS bug that should be fixed by ED meanwhile).
2020-10-03 21:43:09 +02:00
Frank fb1e95ab87 Pathfinding 2020-10-03 18:22:23 +02:00
Frank 3737592734 Ops
Fixes
2020-10-01 23:55:39 +02:00
Frank 6445cf01a2 Merge pull request #1350 from FlightControl-Master/FF/Ops
OPS Update
2020-09-20 00:26:10 +02:00
Frank 8e07b93eac Merge branch 'develop' into FF/Ops 2020-09-19 23:57:25 +02:00
Frank 23f6752362 Ops
- rm staff
2020-09-19 23:55:45 +02:00
Frank 19b870c038 Ops
- Less traceing.
2020-09-19 23:52:17 +02:00
Frank ca7f15e622 Ops 2020-09-19 01:15:34 +02:00
Frank d497bb25f3 Ops 2020-09-18 18:07:10 +02:00
Frank 29d694722b Ops
- Quite a few fixes while going through the example missions.
2020-09-16 23:35:13 +02:00
Frank 40ffef035b Ops 2020-09-15 18:11:19 +02:00
Frank a00c198bcc Update Warehouse.lua
- Added born check. Helps with delayed spawning on carriers.
2020-09-15 01:13:11 +02:00
Frank 717842b276 Ops 2020-09-10 00:34:17 +02:00
Frank d5c4c34759 Ops 2020-09-09 00:02:46 +02:00
Frank edb0032118 ops 2020-09-08 18:04:03 +02:00
Frank 123144d06e Ops temp 2020-09-08 00:15:29 +02:00
Frank 38f5d45d5b Merge branch 'master' into FF/Ops 2020-09-07 22:25:28 +02:00
Frank bcaf808b88 Ops little fixes 2020-09-07 22:17:33 +02:00
Frank 7b8db597ef Ops 2020-09-07 00:42:29 +02:00
Frank 18e192b235 Ops 2020-09-06 00:18:20 +02:00
Frank 5ad30277ba Ops 2020-09-05 00:56:44 +02:00
Frank 2e998dc315 Ops 2020-09-04 17:20:40 +02:00
Frank cda1658541 Ops 2020-09-04 00:58:37 +02:00
Frank 8b640912c3 Ops 2020-09-02 22:54:54 +02:00
Frank 81a773b861 Merge branch 'master' into develop 2020-09-02 00:09:15 +02:00
Frank 444cc43971 Ops 2020-09-02 00:05:05 +02:00
Frank eb86d59203 Ops 2020-09-01 11:42:45 +02:00
Frank 5ee35f3fbb Less output 2020-08-31 12:50:50 +02:00
Frank 9a91145f89 Small 2020-08-30 23:44:15 +02:00
Frank 637081ebdd Ops 2020-08-30 22:52:18 +02:00
Frank 7d2746e7be Merge branch 'develop' into FF/Ops 2020-08-30 17:24:57 +02:00
Frank c84a92c787 Merge branch 'master' into develop 2020-08-30 17:15:31 +02:00
Frank b775aaa274 Merge branch 'master' into FF/Ops 2020-08-30 17:05:09 +02:00
Frank a97d7abc24 Range Ops 2020-08-30 17:03:16 +02:00
Frank 7e73db505b Decreased Tracing 2020-08-30 01:38:18 +02:00
Frank a126906776 up 2020-08-29 21:24:15 +02:00
Frank 2d6092c114 TIMER
- Added new TIMER class.
2020-08-29 20:26:20 +02:00
Frank caef309547 Ops
- Airboss optimizations WIP
2020-08-28 13:24:29 +02:00
Frank f9ec21a2b5 Ops 2020-08-26 00:01:52 +02:00
Frank 06600b2a94 Ops 2020-08-25 17:55:53 +02:00
Frank 3f39ec0ae0 Stuff 2020-08-25 01:03:18 +02:00
Frank cfc45cf068 Warehouse marker and spawning update 2020-08-23 01:08:02 +02:00
Frank 45d809a641 Update Profiler.lua 2020-08-22 22:39:54 +02:00
Frank fcfbc5e17c Profiler
- Added lua Profiler.
2020-08-22 21:24:35 +02:00
Frank f30c66424c Radioqueue Profiler 2020-08-22 21:18:12 +02:00
Frank f823fc6ee0 Update AI_Formation.lua
Performance update
2020-08-22 16:31:56 +02:00
Frank aac291c0c6 Performance Optimizations 2020-08-22 00:09:36 +02:00
Frank 61adeeeda3 Delete Astar - Copy.lua 2020-08-20 01:24:28 +02:00
Frank f94a5eed61 Merge branch 'develop' into FF/OpsDev 2020-08-19 23:21:06 +02:00
Frank 0695c48e7a Merge branch 'master' into develop 2020-08-19 23:12:05 +02:00
Frank f4bfcf58fd Ops 2020-08-19 22:32:16 +02:00
Frank dee7307adc Ops 2020-08-19 01:06:28 +02:00
Frank 114032a743 Ops 2020-08-18 18:15:22 +02:00
Frank e9e6a63e6a Ops 2020-08-18 01:35:24 +02:00
Frank 2a4f6020c2 Ops 2020-08-17 01:24:51 +02:00
Frank 3ea8b3737f Update Profiler.lua 2020-08-16 01:18:18 +02:00
Frank ed47b4b3db Ops 2020-08-16 00:35:42 +02:00
Frank adc89feda9 Ops 2020-08-15 00:54:36 +02:00
Frank 32c9a59ff0 Ops 2020-08-14 18:09:13 +02:00
Frank 200c1dac85 Ops 2020-08-14 01:01:45 +02:00
Frank cf65c2af15 Ops 2020-08-13 01:21:02 +02:00
Frank fb6ebc42a5 Ops 2020-08-10 23:45:52 +02:00
Frank c7696c375e Ops 2020-08-10 01:46:03 +02:00
Frank 337e1a837f Ops 2020-08-08 01:10:03 +02:00
Frank 495a9fd3a0 Ops Target
New Class.
2020-08-06 01:43:42 +02:00
Frank e6f7493ddd Ops Fixes 2020-08-05 00:39:48 +02:00
Frank 76e75505e5 Ops 2020-08-04 16:56:45 +02:00
Frank dafbd3f368 Ops & Auftrag 2020-08-04 01:10:53 +02:00
Frank 11ec70441a Ops group 2020-08-03 00:31:10 +02:00
Frank d1a18913f3 Ops 2020-08-02 01:31:47 +02:00
Frank 775b9e9fde Fixed bugs with new option table. 2020-08-01 00:25:12 +02:00
Frank 286e34e057 Profiler 2020-07-31 17:32:24 +02:00
Frank da2aa00442 A*
Further improvements by switching to keys.
2020-07-31 00:09:21 +02:00
Frank ba90176bb1 A*
Further optimized by using DCS API land.isVisible instead of Moose IsLoS function.
2020-07-30 21:40:27 +02:00
Frank cf9248ecc8 A*
- Improved performance by caching cost and valid/invalid neighbours.
2020-07-30 17:41:26 +02:00
Frank 0d42b12658 Enhanced Groups 2020-07-30 01:08:25 +02:00
Frank 2f6d9b640f NAVY 2020-07-29 01:10:13 +02:00
Frank 04923b65b2 Stuff 2020-07-24 01:34:38 +02:00
Frank 2328f9a36b CHIEF 2020-07-23 19:15:26 +02:00
Frank 98971736f8 Astar 2020-07-23 00:24:59 +02:00
Frank ec809085b4 Waypoints 2020-07-22 01:05:24 +02:00
Frank af023c1994 Waypoints 2020-07-21 17:53:59 +02:00
Frank d9b7cc18f3 A* 2020-07-21 01:19:03 +02:00
Frank ce1121a4c2 INTEL
Clusters
2020-07-20 01:20:28 +02:00
Frank 5fa75bf6b9 INTEL
Improved clusters
2020-07-19 18:31:09 +02:00
Frank 5cb1036618 CHIEF
- Added Chief of Staff class.
2020-07-19 01:22:49 +02:00
Frank 9473dc2069 Update Intelligence.lua 2020-07-16 01:04:43 +02:00
Frank 81f5184b43 Added WINCOM;MANDER 2020-07-15 21:48:11 +02:00
Frank b6bc22f991 Squadron Grouping 2020-07-15 00:51:27 +02:00
Frank 56fad29df9 ops 2020-07-14 17:56:18 +02:00
Frank dfeea53cf6 Merge branch 'develop' into FF/Ops 2020-07-14 00:33:29 +02:00
Frank 71e6369960 INTEL class 2020-07-13 22:31:33 +02:00
Frank 0611db78b3 Intel 2020-07-13 18:31:01 +02:00
Frank 8c768cc517 Update Intelligence.lua 2020-07-12 22:20:20 +02:00
Frank b67750d808 Intel 2020-07-12 20:57:37 +02:00
Frank 96f2ad06e2 Update FlightGroup.lua
Fixed TACAN
2020-07-12 19:43:27 +02:00
Frank 5cf4833455 OpsGroup 2020-07-10 14:16:41 +02:00
Frank f578fcfdc7 NAVYGROUP
Improved dead/stop
2020-07-10 11:14:18 +02:00
Frank 9838e1af19 Ops 2020-07-09 00:06:02 +02:00
Frank cee443e28d Ops 2020-07-08 00:18:42 +02:00
Frank 1fe57cab67 bla 2020-07-08 00:12:57 +02:00
Frank 80b22a8444 Ops 2020-07-08 00:07:30 +02:00
Frank 71733babf8 NavyGroup 2020-07-07 22:28:54 +02:00
Frank 9f793d6cf7 OpsGroup 2020-07-07 00:47:42 +02:00
Frank 46e73a108f Ops 2020-07-04 23:16:57 +02:00
Frank b37a8f3217 Merge branch 'FF/Ops' into FF/Fox2 2020-07-02 10:58:55 +02:00
Frank 1202187e2d Update Warehouse.lua 2020-07-02 10:48:49 +02:00
Frank b13ddc958b Update Warehouse.lua 2020-07-02 10:48:08 +02:00
Frank ba3954ad3f Update Airboss.lua 2020-07-01 23:56:05 +02:00
Frank f2e417b21f Ops 2020-07-01 23:52:27 +02:00
Frank d93d0afdf3 Ops 2020-06-30 00:33:26 +02:00
Frank 66d913e4bf Merge branch 'FF/Ops' into FF/Fox2 2020-06-29 21:10:46 +02:00
Frank 207c9ed62e blanks 2020-06-29 21:08:57 +02:00
Frank e3f4aa3d64 Update FlightGroup.lua 2020-06-29 21:05:26 +02:00
Frank 02d30fa2b4 Ops 2020-06-29 21:04:42 +02:00
Frank c287a96c7f Merge branch 'FF/Ops' into FF/Fox2 2020-06-29 20:58:15 +02:00
Frank 2392c9dc8e Ops 2020-06-29 20:55:32 +02:00
Frank 682c1f5ef2 Ops 2020-06-27 22:44:50 +02:00
Frank 50305f3d6f Update Utils.lua 2020-06-15 20:33:27 +02:00
Frank 1129e34e01 Merge branch 'master' into FF/Fox2 2020-06-11 23:48:34 +02:00
Frank 76dfcf751c Update SpawnStatic.lua 2020-06-10 22:35:43 +02:00
Frank 4227186383 FG 2020-06-10 21:17:03 +02:00
Frank 9d3341ab9f Merge branch 'master' into FF/Fox2 2020-06-05 00:04:01 +02:00
Frank fd432dc0d1 Update ATIS.lua 2020-06-04 23:28:39 +02:00
Frank ee12dc0a7d The Channel Update
**AIRBASE**
- Added "The Channel" map airport enumerators.

**ATIS v0.8.0**
- Added sunset and sunrise time.

**UTILS**
- Corrected NTTR map local time diff to GMT-8 (was -7) hours.
- Corrected Normandy map local time diff to GMT+0 (was +1) hours.
- Added "The Channel" map local time diff as GMT+2 (should be 0).
- Fixed bug in UTILS.GetSunRiseAndSet() function.
2020-06-04 23:26:56 +02:00
Frank 6f940fbf46 Docs 2020-06-03 17:33:14 +02:00
Frank 5fbdeb7a78 Update FlightControl.lua 2020-05-31 15:34:58 +02:00
Frank 64f278e2e7 Merge branch 'master' into FF/Fox2 2020-05-27 22:54:17 +02:00
Frank 6fcc3ef1e2 Updates 2020-05-27 22:00:03 +02:00
Frank 0e073f3f8b Update SpawnStatic.lua 2020-05-27 16:00:55 +02:00
Frank b3b021550c Spawn Static 2020-05-27 11:03:28 +02:00
Frank 42e05aa28a SpawnStatic 2020-05-26 18:08:26 +02:00
Frank fd726f1da8 SPAWNSTATIC 2020-05-26 00:59:41 +02:00
Frank 44786c3ea4 Update SpawnStatic.lua 2020-05-25 22:06:57 +02:00
Frank 12d69c057a Update SpawnStatic.lua 2020-05-25 20:55:59 +02:00
Frank 4841a06c9f Merge branch 'master' into FF/Fox2 2020-05-25 00:25:52 +02:00
Frank 1ee03dfe8c Update Utils.lua 2020-05-24 23:16:05 +02:00
Frank c1ae6be799 Update Point.lua 2020-05-24 23:09:59 +02:00
Frank e689fe0366 Sunrise and Sunset 2020-05-24 01:58:10 +02:00
Frank 94fced4af0 Sunrise and set 2020-05-22 23:58:42 +02:00
Frank 5223a4beba Ops 2020-05-22 11:21:09 +02:00
Frank 3c7a90e2a2 Update NavyGroup.lua 2020-05-22 00:38:52 +02:00
Frank da2d56752d Refactoring 2020-05-21 18:01:58 +02:00
Frank b26fb5ac19 Refactoring 2020-05-21 00:16:19 +02:00
Frank 3bb8f35f63 Merge branch 'master' into FF/Fox2 2020-05-20 23:09:42 +02:00
Frank 3ca27c4852 Refactoring 2020-05-20 21:34:57 +02:00
Frank 32421bdb6a Update Auftrag.lua 2020-05-18 22:26:44 +02:00
Frank 06076f4154 Refactoring 2020-05-18 12:43:53 +02:00
Frank 322e079486 Refactoring 2020-05-18 10:26:48 +02:00
Frank f2af1b1921 Merge branch 'develop' into FF/Fox2 2020-05-17 18:49:00 +02:00
Frank c5d3db0bed Refactoring 2020-05-16 18:48:33 +02:00
Frank 66c6b8c2e4 Merge branch 'develop' into FF/Fox2 2020-05-16 13:17:14 +02:00
Frank 9b72254ccc Refactoring 2020-05-16 12:58:59 +02:00
Frank 5afd5cae27 Update NavyGroup.lua 2020-05-15 23:12:33 +02:00
Frank 4537784ad9 Refactoring 2020-05-15 22:44:15 +02:00
Frank c2f6940c5e Refactoring Ops 2020-05-14 22:50:27 +02:00
Frank a7011e33fa Refactoring 2020-05-13 16:35:32 +02:00
Frank 5686403f7f OPS 2020-05-13 11:31:50 +02:00
Frank 33859c2b31 Update NavyGroup.lua 2020-05-12 17:30:36 +02:00
Frank 8472a37cd8 NAVYGROUP 2020-05-11 18:52:12 +02:00
Frank ed49348155 Ops 2020-05-08 00:36:53 +02:00
Frank ae36353aab Ops FC 2020-05-07 18:05:41 +02:00
Frank c30d9f3472 Ops 2020-05-07 00:00:35 +02:00
Frank 853989bfc9 Ops 2020-05-06 16:05:12 +02:00
Frank df2dbed441 Ops 2020-05-06 01:13:39 +02:00
Frank 7f0f7cee0c Ops 2020-05-05 17:49:32 +02:00
Frank 14cf4edc39 Ops 2020-05-05 00:40:05 +02:00
Frank c1144b063b Merge branch 'FF/Develop' into FF/Fox2 2020-05-04 11:25:34 +02:00
Frank cd81911bfb Update WingCommander.lua 2020-05-01 23:50:59 +02:00
Frank d2962005ee Merge branch 'develop' into FF/Fox2 2020-05-01 23:06:28 +02:00
Frank c2d4f179ae Update Utils.lua
Big smoke and fire
2020-05-01 22:58:47 +02:00
Frank a51aeab811 Ops 2020-05-01 22:52:18 +02:00
Frank dbc8e8be67 Ops 2020-04-30 17:28:06 +02:00
Frank 1c93f06b9b Update Auftrag.lua 2020-04-30 12:39:25 +02:00
Frank 422e111857 Ops 2020-04-30 01:42:38 +02:00
Frank c8d2104c39 Ops 2020-04-29 16:09:11 +02:00
Frank b2a903e077 Update AirWing.lua 2020-04-29 00:14:44 +02:00
Frank 74bd2c1cfc Ops 2020-04-28 22:50:03 +02:00
Frank 4ea9c8508d Ops 2020-04-28 17:31:59 +02:00
Frank f9e5785f52 Ops 2020-04-28 00:42:13 +02:00
Frank 25e58393ea Ops 2020-04-27 01:48:16 +02:00
Frank 3653199bfc Update Auftrag.lua 2020-04-25 22:22:58 +02:00
Frank 443a37a9c5 Ops 2020-04-25 21:46:05 +02:00
Frank 78ef53fbea Merge branch 'FF/Develop' into FF/Fox2 2020-04-25 12:17:43 +02:00
Frank 5e63deb717 Merge branch 'FF/Develop' into FF/Fox2 2020-04-25 01:04:28 +02:00
Frank 5d8b0d150a Update Controllable.lua 2020-04-25 00:43:57 +02:00
Frank 0440982c83 Ops 2020-04-25 00:43:02 +02:00
Frank b683dd5352 Merge branch 'FF/Develop' into FF/Fox2 2020-04-24 22:57:08 +02:00
Frank ac975e7e86 Restored old CleanUp and Scoring 2020-04-24 16:55:15 +02:00
Frank 2745c6c1ca Merge branch 'FF/Develop' into FF/Fox2 2020-04-24 16:54:37 +02:00
Frank 918337f202 Merge branch 'FF/Develop' into FF/Fox2 2020-04-24 16:47:30 +02:00
Frank 5a2779c698 Update ATIS.lua 2020-04-24 16:42:07 +02:00
Frank 7429982bef Merge branch 'FF/Develop' into FF/Fox2 2020-04-24 16:06:59 +02:00
Frank 4222c4d945 Fixes 2020-04-23 23:19:11 +02:00
Frank 62bfdcff8f Merge branch 'FF/Develop' into FF/Fox2 2020-04-23 16:48:19 +02:00
Frank 06213ab583 Airboss v1.1.3 2020-04-23 16:38:33 +02:00
Frank 1a8f9b4aa2 Ops 2020-04-23 01:02:51 +02:00
Frank 7c07df19bf Ops 2020-04-22 18:06:18 +02:00
Frank d2629263c3 Ops 2020-04-22 00:33:52 +02:00
Frank 11fb5500f3 Ops 2020-04-21 01:04:24 +02:00
Frank 31697030ed Ops 2020-04-19 23:49:08 +02:00
Frank 54e799d3f6 Ops 2020-04-18 12:58:29 +02:00
Frank ca2ae9657c Update Warehouse.lua 2020-04-17 15:58:28 +02:00
Frank efaf7e856c Ops 2020-04-17 01:40:33 +02:00
Frank eeb5555400 Ops 2020-04-16 18:07:50 +02:00
Frank d72b33551e Ops Auftrag 2020-04-16 01:14:19 +02:00
Frank 5a6a9d1aed Ops 2020-04-15 00:45:28 +02:00
Frank 2810acc1f4 Ops 2020-04-13 22:41:05 +02:00
Frank 08e4b7baeb Ops 2020-04-13 01:44:39 +02:00
Frank 8d722c2ccc Ops & MARKER 2020-04-12 01:41:02 +02:00
Frank afe5df922a Ops 2020-04-11 17:14:36 +02:00
Frank 93a0b0e19e Ops 2020-04-10 01:26:37 +02:00
Frank d52867c541 Ops 2020-04-09 18:07:41 +02:00
Frank f554642505 Ops 2020-04-09 01:30:32 +02:00
Frank a0ecf58c7f Merge branch 'develop' into FF/Fox2 2020-04-08 16:09:04 +02:00
Frank 0ab54268e9 Update FlightGroup.lua 2020-04-08 01:38:42 +02:00
Frank fdf2605367 Merge branch 'FF/Develop' into FF/Fox2 2020-04-08 01:11:04 +02:00
Frank 3548cea999 Update Auftrag.lua 2020-04-07 21:36:48 +02:00
Frank 7f3ebe4f48 Ops 2020-04-07 01:22:06 +02:00
Frank f22837103b Ops 2020-04-06 00:19:50 +02:00
Frank 7465fd065f Ops 2020-04-05 01:37:36 +02:00
Frank 61d3035c76 Merge branch 'develop' into FF/Fox2 2020-04-04 23:52:36 +02:00
Frank 92402fc0ca Ops 2020-04-04 22:53:20 +02:00
Frank 6f1861f057 Update ATIS.lua 2020-04-04 16:21:39 +02:00
Frank 94259ab75a ATIS 2020-04-04 01:29:46 +02:00
Frank 2dbfe1d4ee Update Warehouse.lua 2020-04-03 17:48:39 +02:00
Frank d06d23cba2 Warehouse 2020-04-03 01:39:17 +02:00
Frank 8b9e49cfc6 Ops 2020-04-02 18:00:14 +02:00
Frank 618b4d7ded Ops 2020-04-02 01:03:32 +02:00
Frank b409b8dfc1 Update FlightGroup.lua 2020-04-01 17:46:53 +02:00
Frank efb514e97f Update FlightGroup.lua 2020-04-01 16:53:51 +02:00
Frank 81977aa04d Ops 2020-04-01 01:46:01 +02:00
Frank 3e5b87411e Ops 2020-03-31 01:15:05 +02:00
Frank 717ef02c44 Ops 2020-03-29 00:25:24 +01:00
Frank c4b8e4a36c Merge branch 'develop' into FF/Fox2 2020-03-28 20:48:19 +01:00
Frank 4ae4f76ce0 Ops 2020-03-28 20:47:49 +01:00
Frank c0a9d51f98 Merge branch 'develop' into FF/Fox2 2020-03-28 16:51:21 +01:00
Frank d9f7be4f25 Ops 2020-03-28 16:51:06 +01:00
Frank 891235032a Ops Auftrag 2020-03-27 22:19:20 +01:00
Frank dda74c471f Update Auftrag.lua 2020-03-27 19:03:52 +01:00
Frank f5c419919c Ops 2020-03-27 17:20:53 +01:00
Frank a95f3f2fa1 Ops 2020-03-26 23:59:30 +01:00
Frank 0e78a11fd6 Ops FC 2020-03-25 22:44:23 +01:00
Frank 130e089d1c Ops 2020-03-25 16:43:34 +01:00
Frank e675c991c4 Ops 2020-03-24 23:17:07 +01:00
Frank fc79188fe2 Ops 2020-03-24 21:34:05 +01:00
Frank 56ec7f122f Ops 2020-03-23 23:56:10 +01:00
Frank e1d09bdd8b Ops 2020-03-23 00:27:16 +01:00
Frank 1ae2171885 Ops 2020-03-22 00:33:15 +01:00
Frank c2257729d5 Ops 2020-03-20 23:11:29 +01:00
Frank 4dd8e53c1c Merge branch 'develop' into FF/Fox2 2020-03-20 16:47:41 +01:00
Frank 4991fc9cb4 Ops 2020-03-20 01:00:45 +01:00
Frank 1371445e94 Ops 2020-03-17 23:44:06 +01:00
Frank 8823b96b5f ops 2020-03-17 16:53:47 +01:00
Frank 9cb551e6fa Ops 2020-03-16 22:56:45 +01:00
Frank b9fc1df2e4 Ops 2020-03-16 16:44:23 +01:00
Frank 3bc387c1c7 Ops 2020-03-16 00:32:26 +01:00
Frank fb85b94d2d Ops 2020-03-14 23:26:58 +01:00
Frank 3409030e1a Merge branch 'develop' into FF/Fox2 2020-03-14 20:41:35 +01:00
Frank c0b816fd40 Merge branch 'FF/Develop' into FF/Fox2 2020-03-14 20:18:26 +01:00
Frank 9f14ed7a5c Ops 2020-03-14 18:38:52 +01:00
Frank e147a4c604 Ops 2020-03-14 02:03:20 +01:00
Frank fd7827c264 Ops Squadron 2020-03-12 14:29:41 +01:00
Frank 6c0b6b3b95 Ops
- First CAP version
2020-03-12 12:37:09 +01:00
Frank 04fb7f7684 Ops
Improved mission handling on cancel, done and repeat.
2020-03-11 19:35:42 +01:00
Frank fa9adaf046 Ops 2020-03-10 23:18:38 +01:00
Frank 6305459056 Ops 2020-03-10 17:03:24 +01:00
Frank a477fc78bc Ops 2020-03-10 00:44:50 +01:00
Frank 781ebc7a42 Ops 2020-03-09 00:23:56 +01:00
Frank 59603e3027 Ops 2020-03-08 00:35:06 +01:00
Frank dc7c50b97b Ops 2020-03-07 00:23:54 +01:00
Frank 2eb4e87d32 Ops 2020-03-06 17:29:43 +01:00
Frank fd730206a6 Merge branch 'FF/Develop' into FF/Fox2 2020-03-05 23:41:53 +01:00
Frank 7d9e721506 Ops 2020-03-05 23:40:18 +01:00
Frank 5f416b3271 Ops 2020-03-05 17:59:26 +01:00
Frank 589335e420 Ops 2020-03-05 00:13:49 +01:00
Frank 2214584e59 Ops 2020-03-04 17:22:30 +01:00
Frank 090d0e79f9 Ops 2020-03-03 22:57:11 +01:00
Frank ae3d1f6b2a Ops 2020-03-03 16:48:05 +01:00
Frank 9ea52fce28 Ops 2020-03-03 00:20:08 +01:00
Frank dc3350a1c8 FG
- SetTask --> PushTask to keep enroute tasks alive.
2020-03-01 23:55:15 +01:00
Frank 905095add9 Ops 2020-03-01 22:48:09 +01:00
Frank ce4353d701 Ops 2020-02-29 00:53:32 +01:00
Frank 929f99d527 Ops 2020-02-28 16:47:24 +01:00
Frank 541db97a74 Ops 2020-02-28 01:05:30 +01:00
Frank cc567cf342 Ops 2020-02-27 16:56:27 +01:00
Frank 8ed6f8b193 Update FlightGroup.lua 2020-02-26 23:06:36 +01:00
Frank 1dec76d96d Merge branch 'develop' into FF/Fox2 2020-02-26 21:12:33 +01:00
Frank 75216793f9 Ops 2020-02-26 17:03:23 +01:00
Frank 173e68676c Ops 2020-02-25 23:57:12 +01:00
Frank e67d5a6c9f Merge branch 'develop' into FF/Fox2 2020-02-25 22:47:37 +01:00
Frank 47e4777df0 Ops 2020-02-25 16:49:54 +01:00
Frank e1c602583c FG 2020-02-24 20:22:52 +01:00
Frank 8925bc11ca FG CONTROLLABLE
FG v0.3.2
CONTROLLABLE removed self dependencies for some tasks.
2020-02-22 11:03:15 +01:00
Frank 6e97433ec4 Ops 2020-02-21 16:59:51 +01:00
Frank bddc40ddb8 Update FlightGroup.lua 2020-02-20 23:16:32 +01:00
Frank 7d697dc584 Ops 2020-02-20 12:31:42 +01:00
Frank 02c63850a1 Ops 2020-02-19 23:30:11 +01:00
Frank 2d3ef543b3 Ops 2020-02-18 16:45:07 +01:00
Frank 78ccbd733b Merge branch 'FF/Develop' into FF/Fox2 2020-02-18 00:00:38 +01:00
Frank 99ab12ed99 Updates Base, Event, Point, Contollable, FG 2020-02-17 21:40:20 +01:00
Frank fd7469b5f0 FG 2020-02-16 17:38:37 +01:00
Frank 014b07ffc3 Merge branch 'FF/Develop' into FF/Fox2 2020-02-15 23:53:05 +01:00
Frank 165c569a99 Ops 2020-02-15 00:49:29 +01:00
Frank 6cb59a8f39 Merge branch 'FF/Develop' into FF/Fox2 2020-02-14 19:00:26 +01:00
Frank 2e49b72ab4 Ops 2020-02-14 16:51:49 +01:00
Frank 0da53c794e Update FlightGroup.lua 2020-02-14 00:44:33 +01:00
Frank c54a0968b9 Ops 2020-02-13 16:49:05 +01:00
Frank 5ba5dd5fd8 Ops 2020-02-12 23:44:31 +01:00
Frank 004591f8ad Ops 2020-02-12 16:44:01 +01:00
Frank b7543f24e8 Ops 2020-02-11 16:43:59 +01:00
Frank eb8853ddf4 FG 2020-02-10 23:22:36 +01:00
Frank 3a0e154daa FG/TG 2020-02-09 23:13:34 +01:00
Frank e004da9f00 Update FlightGroup.lua 2020-02-09 19:17:25 +01:00
Frank ecd76dec7d FG/TG 2020-02-08 23:42:52 +01:00
Frank 29995e1584 FG/TG 2020-02-06 12:40:23 +01:00
Frank b97b197219 FG 2020-02-04 23:15:48 +01:00
Frank 87b75b4269 FG 2020-02-03 22:25:02 +01:00
Frank 2b96071884 FG/TG 2020-02-02 23:46:59 +01:00
Frank 4ee3d8fb5c FG/TG 2020-02-02 01:01:04 +01:00
Frank 30c21086ba Intermediate 2020-01-31 23:34:07 +01:00
Frank 5fda8c1c1b FG TG 2020-01-31 12:02:13 +01:00
Frank 4bb96a7730 FG/TANKER 2020-01-30 16:50:03 +01:00
Frank 4ec757d87a FGFC 2020-01-29 22:52:06 +01:00
Frank 745da36e78 FG 2020-01-29 16:50:08 +01:00
Frank 3a2effb2dc Update FlightGroup.lua 2020-01-29 00:14:53 +01:00
Frank f45eef2dd2 FGFC 2020-01-28 16:48:42 +01:00
Frank d3825ccda1 Update FlightGroup.lua 2020-01-27 22:42:10 +01:00
Frank aaabf5220e FG/FC v0.2.4 2020-01-27 00:09:35 +01:00
Frank 43034ed0ad Merge branch 'develop' into FF/Fox2 2020-01-26 00:00:17 +01:00
Frank 50ee8865ed FG & FC 2020-01-25 23:32:41 +01:00
Frank 74a4b84b78 Update FlightControl.lua 2020-01-24 18:36:25 +01:00
Frank 56feca1451 FC 2020-01-24 16:54:46 +01:00
Frank d5cdb9ec34 FCFG 2020-01-23 16:57:15 +01:00
Frank 37d2602f2d FCFG 2020-01-22 22:53:22 +01:00
Frank fe7df16ac0 FCFG 2020-01-22 16:40:34 +01:00
Frank 1c1f74e1ad FG/FC 2020-01-22 00:23:18 +01:00
Frank 33d86bd081 FC 2020-01-21 16:40:07 +01:00
Frank e509eb3d35 FG/FC/ATIS v0.6.3 2020-01-20 23:25:43 +01:00
Frank ebc080b452 Merge branch 'FF/Develop' into FF/Fox2 2020-01-20 15:41:53 +01:00
Frank 25ddf06ad7 FCFG 2020-01-17 16:51:35 +01:00
Frank 5c23b102df FG 2020-01-16 23:36:54 +01:00
Frank 3e9ab6834e FCFG 2020-01-16 16:47:51 +01:00
Frank d9bfc65862 FC&FG 2020-01-15 22:58:25 +01:00
Frank c661491772 FC 2020-01-15 16:56:50 +01:00
Frank 0b2f6b4f3d Update FlightGroup.lua 2020-01-15 00:14:29 +01:00
Frank 75114effc1 Update FlightGroup.lua 2020-01-14 23:52:35 +01:00
Frank b513b2a049 Rat2 2020-01-14 16:52:32 +01:00
Frank 82c606edc1 Merge branch 'develop' into FF/Fox2 2020-01-08 22:26:05 +01:00
Frank 0550ed1566 Update FlightGroup.lua 2020-01-08 00:33:07 +01:00
Frank 9dad6fb9b9 Merge branch 'FF/Develop' into FF/Fox2 2020-01-07 23:36:10 +01:00
Frank 5d4fb7c1ba Merge branch 'develop' into FF/Fox2 2020-01-06 23:20:55 +01:00
Frank 2e15341f6b Merge branch 'FF/Develop' into FF/Fox2 2020-01-04 00:21:45 +01:00
Frank 8be023a5ee Merge branch 'develop' into FF/Fox2 2020-01-02 23:04:48 +01:00
Frank 6b66b0d567 Merge branch 'FF/Develop' into FF/Fox2 2019-12-31 00:01:11 +01:00
Frank 53bde229c3 Update FlightGroup.lua 2019-12-30 19:44:26 +01:00
Frank 4eaff505df Merge branch 'develop' into FF/Fox2 2019-12-29 23:49:14 +01:00
Frank bff55e29ea Merge branch 'FF/Develop' into FF/Fox2 2019-12-29 00:03:51 +01:00
Frank 3950008d05 AI_AIR 2019-12-28 19:51:32 +01:00
Frank bbc1da3c48 Merge branch 'FF/Develop' into FF/Fox2 2019-12-20 15:14:44 +01:00
Frank a4c6a67d33 Merge branch 'FF/Develop' into FF/Fox2 2019-12-18 23:01:10 +01:00
Frank dbb1fa05d7 Merge branch 'develop' into FF/Fox2 2019-12-17 23:39:04 +01:00
Frank 859b33fa08 FG & FC 2019-12-14 22:37:59 +01:00
Frank abf8601f67 Merge branch 'develop' into FF/Fox2 2019-12-12 18:22:22 +01:00
Frank cd33677de4 ATIS v0.6.0
- Added altimeter QNH
2019-12-11 20:50:25 +01:00
Frank 68fff65088 Merge branch 'develop' into FF/Fox2 2019-12-10 21:07:00 +01:00
Frank 99827bce47 RAT 2019-12-10 19:35:10 +01:00
Frank 2583c5c175 Merge branch 'develop' into FF/Fox2 2019-12-08 13:13:23 +01:00
Frank 61dafa7aa7 Merge branch 'FF/Develop' into FF/Fox2 2019-12-08 00:50:48 +01:00
Frank abbe53c7fa RAT 2019-12-06 23:31:44 +01:00
Frank 5b57873dee RAT 2019-12-06 16:55:21 +01:00
Frank 1d9b114c95 RAT2 2019-12-05 22:42:24 +01:00
Frank 88e7302838 RAT2 2019-12-05 17:06:58 +01:00
Frank b9cb19e8e0 Merge branch 'develop' into FF/Fox2 2019-12-04 22:18:09 +01:00
Frank 3e69143cfd Update Range.lua 2019-12-04 12:12:21 +01:00
Frank 7a53439408 Airbase and TaskBombingRunway 2019-12-02 21:58:32 +01:00
Frank 6a6c7a3236 Merge branch 'develop' into FF/Fox2 2019-12-02 17:06:39 +01:00
Frank f9a49ab7e7 f 2019-12-02 16:26:53 +01:00
Frank 5ad927d20c RAT 2019-11-27 16:46:03 +01:00
Frank 75a7f05761 Update FlightGroup.lua 2019-11-25 23:42:01 +01:00
Frank 70d8fa23fb Merge branch 'develop' into FF/Fox2 2019-11-25 12:34:13 +01:00
Frank a1e6ee7a90 Merge branch 'FF/Develop' into FF/Fox2 2019-11-25 12:24:15 +01:00
Frank b3fe6fe363 FC FG 2019-11-25 09:44:55 +01:00
Frank e978ff69bb Merge branch 'develop' into FF/Fox2 2019-11-23 21:03:13 +01:00
Frank 5fe9cb24ac Merge branch 'develop' into FF/Fox2 2019-11-23 20:45:57 +01:00
Frank cc5db0ef6b Update FlightControl.lua 2019-11-23 19:17:01 +01:00
Frank 3d1f0cc376 FC FG 2019-11-22 23:45:04 +01:00
Frank 751cd8c75c FC 2019-11-21 21:39:31 +01:00
Frank 26bb6471dc FC 2019-11-21 16:38:36 +01:00
Frank 1822df778d Parking 2019-11-20 23:17:31 +01:00
Frank 57af94ef7b Parking 2019-11-20 16:45:31 +01:00
Frank f79ec32c2b FG & FC
parking
2019-11-19 23:08:02 +01:00
Frank 8c91c753ee RAT 2019-11-19 16:48:56 +01:00
Frank f975fa8eae Update FlightControl.lua 2019-11-18 22:48:24 +01:00
Frank d0d58b3f24 Update FlightControl.lua 2019-11-17 22:17:49 +01:00
Frank 986459151f FC 2019-11-15 16:33:58 +01:00
Frank 5cf97ac802 FC FG 2019-11-14 21:50:55 +01:00
Frank a33c8219e1 Merge branch 'FF/Fox2' of https://github.com/FlightControl-Master/MOOSE into FF/Fox2 2019-11-14 16:08:27 +01:00
Frank f5ec6c1cb4 FC FG 2019-11-14 16:08:16 +01:00
Frank 6f1afa2de9 Update Warehouse.lua 2019-11-13 21:10:26 +01:00
Frank 7e9042074d FG 2019-11-13 15:59:34 +01:00
Frank 164bcc5557 Update FlightGroup.lua 2019-11-12 21:43:56 +01:00
Frank 50b61ea094 Ops 2019-11-12 20:10:29 +01:00
Frank b737da9c51 Arty v1.1.6 2019-11-12 16:13:07 +01:00
Frank b41e539b6e Ops FG & FC 2019-11-11 15:14:47 +01:00
Frank a2f35d816c FC 2019-11-10 00:37:31 +01:00
Frank b12d9e9a5d Merge branch 'develop' into FF/Fox2 2019-11-09 22:28:42 +01:00
Frank 5ba8979d94 Ops FG & FC 2019-11-09 20:40:40 +01:00
Frank 880fae604d Ops FlightGroup & FlightControl 2019-11-09 15:19:11 +01:00
Frank 0db24006e1 Merge branch 'develop' into FF/Fox2 2019-11-04 22:44:49 +01:00
Frank 05b87659f4 FG 2019-11-03 15:38:22 +01:00
Frank 3b58e1f127 Merge branch 'develop' into FF/Fox2 2019-10-31 19:31:44 +01:00
Frank c5705e8b1a ARTY v1.1.5 2019-10-31 18:52:35 +01:00
Frank 91dc8a9453 Update FlightGroup.lua 2019-10-30 11:23:37 +01:00
Frank 16ed06a10b Update FlightGroup.lua 2019-10-29 15:36:27 +01:00
Frank 4fb28b1bf5 Update FlightGroup.lua 2019-10-24 23:35:59 +02:00
Frank 7c2ad7e8d0 Merge branch 'FF/Develop' into FF/Fox2 2019-10-22 23:38:02 +02:00
Frank a79b4ba3a9 Merge branch 'FF/Develop' into FF/Fox2 2019-10-22 23:19:47 +02:00
Frank 7b92053277 ATIS v0.5.0 2019-10-21 22:14:10 +02:00
Frank 9e742b1620 ATIS UTILS 2019-10-21 21:58:27 +02:00
Frank b3be71c75b Merge branch 'FF/Develop' into FF/Fox2 2019-10-21 00:30:39 +02:00
Frank 010ca59281 Update Airboss.lua 2019-10-19 19:22:23 +02:00
Frank 1293679401 Merge branch 'develop' into FF/Fox2 2019-10-18 23:29:25 +02:00
Frank f1f3d69584 ATIS v0.4.1 2019-10-18 21:12:24 +02:00
Frank 8a00a31d5b Update Settings.lua 2019-10-14 19:29:13 +02:00
Frank f96a554a84 Update Settings.lua 2019-10-14 18:10:54 +02:00
Frank 70f49a9600 Merge branch 'FF/Develop' into FF/Fox2 2019-10-14 14:44:05 +02:00
Frank f968472c00 Ops
Airboss v1.0.9
Range v2.2.0
2019-10-14 14:32:47 +02:00
Frank c9f9ac7b0e Merge branch 'FF/Develop' into FF/Fox2 2019-10-11 01:55:42 +02:00
Frank 6a3c0b00a1 Update Settings.lua 2019-10-10 20:51:38 +02:00
Frank f194db0309 Merge branch 'FF/Develop' into FF/Fox2 2019-10-09 21:14:58 +02:00
Frank b0342c048d Merge branch 'FF/Develop' into FF/Fox2 2019-10-03 22:46:20 +02:00
Frank 6ae074cd10 Merge branch 'develop' into FF/Fox2 2019-10-02 23:41:34 +02:00
Frank d37a16f3ef ATIS v0.3.0 2019-10-02 18:10:42 +02:00
Frank 7efd2a3053 Merge branch 'FF/Develop' into FF/Fox2 2019-09-30 13:50:56 +02:00
Frank 5c8a3f695e ATIS v0.2.0 2019-09-30 00:33:19 +02:00
Frank fff30c21cd Ops 2019-09-28 00:51:01 +02:00
Frank 6eafba3032 Ops 2019-09-25 23:07:15 +02:00
Frank b96cd1909a ATIS v0.1.0 2019-09-23 12:15:44 +02:00
Frank aa294cd9c6 ATIS 2019-09-22 00:27:03 +02:00
Frank 8880bf8587 ATIS 2019-09-21 00:02:10 +02:00
Frank b0b8d81e5c OPS ATIS 2019-09-19 00:07:28 +02:00
Frank de2f7148ee FG/FC 2019-09-17 22:09:56 +02:00
Frank 69c8d52f52 Ops 2019-09-16 23:23:00 +02:00
Frank aae67268df Ops 2019-09-15 22:18:56 +02:00
Frank 417e88cc6b FlightControl/Group 2019-09-14 22:06:34 +02:00
Frank 6411b77284 Merge branch 'FF/Develop' into FF/Fox2 2019-09-13 19:43:17 +02:00
Frank 367c67f269 ops 2019-09-13 10:24:55 +02:00
Frank a3067740a3 Ops 2019-09-11 20:09:55 +02:00
Frank af3bf7dece OPS 2019-09-06 22:23:52 +02:00
Frank 553f14d2ea Ops 2019-09-05 09:49:27 +02:00
Frank 36e923cac7 Ops 2019-09-04 23:05:03 +02:00
Frank eb14fdc84b Ops 2019-09-04 16:57:01 +02:00
Frank 361854390f Ops 2019-09-03 23:15:20 +02:00
Frank c6fc6ab017 Update Range.lua 2019-09-03 18:06:15 +02:00
Frank 254dd92cd8 Ops 2019-09-03 16:59:20 +02:00
Frank 93af911891 up 2019-09-02 22:38:09 +02:00
Frank 1ecbf22f0a misc 2019-08-30 23:48:41 +02:00
Frank 3531b6a3e6 WH Ops 2019-08-30 10:53:20 -04:00
Frank 91035064fb FG v0.0.7 2019-08-28 10:55:50 -04:00
Frank 11944dab2f FG v0.0.6 2019-08-26 22:26:11 +02:00
Frank 15cbdabbeb FG v0.0.5 2019-08-26 17:54:50 +02:00
Frank 677a733767 Update FlightGroup.lua 2019-08-25 23:49:26 +02:00
Frank 657e3578e0 FG 2019-08-25 22:00:42 +02:00
Frank f9389f4aed FG merge 2019-08-23 10:51:47 -04:00
Frank c263221236 FG v0.0.4 2019-08-23 10:48:38 -04:00
Frank c0a1df4682 Update FlightGroup.lua 2019-08-23 00:41:43 +02:00
Frank aae8ef8053 Update Airboss.lua 2019-08-22 00:02:15 +02:00
Frank d9d246e194 Update FlightGroup.lua 2019-08-21 21:16:06 +02:00
Frank 2d4520995a FG 2019-08-21 10:52:24 -04:00
Frank 786e1ea784 FG v0.0.3 2019-08-21 00:14:05 +02:00
Frank 9e2f312126 FC 2019-08-20 10:42:51 -04:00
Frank 9797d47fbf FG 2019-08-19 23:45:48 +02:00
Frank 594afc5b8e FLIGHTGROUP v0.0.2
- Proper flight status.
2019-08-19 14:25:15 +02:00
Frank d530ba5c3e Merge branch 'FF/Develop' into FF/Fox2 2019-08-18 22:38:14 +02:00
Frank 94bbb8a9a4 RH, GROUP 2019-08-18 21:02:23 +02:00
Frank aade1eebf1 AB, RH 1.0.9 2019-08-18 12:46:22 +02:00
Frank f16db1d4e5 Update Airboss.lua 2019-08-18 11:55:06 +02:00
Frank 17372a16c6 AB, FG 2019-08-16 10:49:19 -04:00
Frank 059bc05527 Merge 2019-08-16 03:46:22 -04:00
Frank 296a7a808a FG 2019-08-16 03:17:03 -04:00
Frank db3ab439d0 FG 2019-08-14 10:36:09 -04:00
Frank a26c9f423c Update FlightGroup.lua 2019-08-12 15:18:42 +02:00
Frank d1e4295178 Merge branch 'FF/Develop' into FF/Fox2 2019-08-11 20:41:45 +02:00
Frank 043e1dc74b Merge branch 'FF/Develop' into FF/Fox2 2019-08-11 20:39:15 +02:00
Frank 10154a6e4e Added SWAPR 2019-08-11 20:34:04 +02:00
Frank 1e1e0758f8 Update FlightGroup.lua 2019-08-11 18:28:57 +02:00
Frank f069523ba6 Flight Group 2019-08-10 22:55:01 +02:00
Frank 6c846380c0 WH
- WAREHOUSE
- FlIGHTGROUP
2019-08-09 21:45:50 +02:00
Frank c172c6d6d6 Update Warehouse.lua 2019-08-09 00:16:43 +02:00
Frank acd0ec187f Update Warehouse.lua 2019-08-08 18:59:14 +02:00
Frank 965ae51223 Update Airboss.lua 2019-08-08 17:00:49 +02:00
funkyfranky 65557db444 WH 2019-08-08 16:28:53 +02:00
funkyfranky 414196afc6 CVW 2019-08-07 16:49:26 +02:00
Frank eb37f9b18c CVW 0.0.5 2019-08-04 11:05:05 +02:00
Frank 6f7f20f7a8 Merge branch 'FF/Develop' into FF/Fox2 2019-08-02 20:46:59 +02:00
funkyfranky 2533651215 CVW 0.0.4 2019-08-02 16:51:00 +02:00
Frank aa4e5d0e7b Detection fix issue #1173
fix for #1173
2019-06-26 09:05:31 +02:00
funkyfranky aef5f0c11a SET 2019-06-25 16:56:15 +02:00
Frank a43769981d Merge branch 'FF/Develop' into FF/Fox2 2019-06-24 13:59:43 +02:00
funkyfranky b0a67686e3 CVW 2019-06-21 16:24:08 +02:00
funkyfranky 4622affe70 CVW 2019-06-21 08:39:44 +02:00
Frank 6b55f0e5dc CVW 0.0.5 2019-06-20 00:42:04 +02:00
Frank 92a75d488c Update CarrierAirWing.lua 2019-06-19 21:00:30 +02:00
funkyfranky c76703207a CVW 2019-06-19 16:22:04 +02:00
funkyfranky 0418dfaa32 CVW 2019-06-18 16:27:18 +02:00
Frank 15d7c36d8f CVW 2019-06-17 23:50:03 +02:00
Frank 305a738926 Skipper v0.0.5 2019-06-16 22:20:26 +02:00
funkyfranky ba1b42f209 SK 2019-06-14 16:23:55 +02:00
Frank b45b3c9804 Update Skipper.lua 2019-06-13 22:32:55 +02:00
funkyfranky fa048311ca Skipper 2019-06-13 15:55:11 +02:00
Frank 23bffd8c1d SKIPPER v0.0.3 2019-06-12 22:43:13 +02:00
funkyfranky 731517dcf2 AB 1.0.3 2019-06-12 16:30:37 +02:00
Frank 6ac1194746 Skipper v0.0.1
- Added skipper class.
- Other minor improvements.
2019-06-11 22:57:38 +02:00
Frank 9b2ed229b2 Merge branch 'FF/Develop' into FF/Fox2 2019-06-08 23:10:05 +02:00
funkyfranky 8ad430347c Score 2019-06-07 15:46:40 +02:00
funkyfranky 9c344eff6e Score 2019-06-06 15:57:05 +02:00
Frank 557a652f73 Merge branch 'FF/Develop' into FF/Fox2 2019-05-26 12:18:05 +02:00
Frank 1ce7ecf64e Fox file 2019-05-26 12:16:42 +02:00
Frank 9c84e995ac FOX 2019-05-26 11:54:45 +02:00
Frank 93936a07d0 Merge branch 'develop' into FF/Fox2 2019-05-26 11:43:35 +02:00
Frank 7a000b02ce WH 0.9.0
WH: Added AssedLowFuel event.
2019-05-26 00:01:15 +02:00
Frank fbff95ed29 FOX update 2019-05-24 23:08:48 +02:00
Frank 7a79d49659 Update Fox2.lua 2019-05-24 09:24:59 +02:00
Frank 614a1cc906 Fixed zone find 2019-05-23 21:07:47 +02:00
Frank 1e1335e2ed Update Scoring.lua 2019-05-16 21:09:18 +02:00
funkyfranky 70bca0d142 SC 2019-05-15 16:47:38 +02:00
funkyfranky eb3037c913 Sc 2019-05-14 16:42:49 +02:00
Frank 8e92b8045b MISC
FMD: misc
FOX v0.3.0 improvements
RANGE v2.1.1 fixed bugs
SCORING added option to reload csv file
WAREHOUSE v0.7.1 added AssedSpawned FMS event.
2019-05-13 21:57:09 +02:00
funkyfranky b795d2fd09 FMD 2019-05-09 16:27:54 +02:00
Frank a73faca149 Update FlightModelData.lua 2019-05-08 23:13:32 +02:00
Frank 96a7a963e6 Update Radio.lua 2019-05-07 21:25:24 +02:00
funkyfranky e206fcd5d5 RQ 2019-05-07 15:37:20 +02:00
Frank bbc353a861 RANGE 2.1.0
RADIOQUEUE class added.
WAREHOUS fixed bug with speed unit conversion.
2019-05-07 01:10:48 +02:00
funkyfranky ba1857950e RAT2 2019-05-03 16:28:40 +02:00
Frank 43193cf7f6 RANGE 2.0 2019-05-01 17:27:30 +02:00
Frank 43c95b6ab5 RANGE 2.0.0
RANGE
- Converted to FSM.
2019-04-29 20:17:09 +02:00
Frank da44f6ef22 Merge branch 'FF/Develop' into FF/Fox2 2019-04-23 19:21:56 +02:00
Frank 6113455520 Rescuehelo 1.0.6 2019-04-23 19:05:54 +02:00
Frank 1150c81ab9 AIRBOSS v0.9.9
FOX2 fixes
2019-04-19 19:44:06 +02:00
funkyfranky 5aabdb7593 Fox, AB 2019-04-18 16:29:00 +02:00
Frank 0a8f83b0fc Update Fox2.lua 2019-04-17 23:02:02 +02:00
funkyfranky b0adfc6bb5 Fox2 v0.1.1 2019-04-17 16:32:29 +02:00
funkyfranky e959b40805 Fox2 2019-04-16 16:36:33 +02:00
Frank 274771b212 Fox 2019-04-15 23:59:20 +02:00
171 changed files with 265561 additions and 18923 deletions
+7
View File
@@ -28,6 +28,13 @@ local.properties
.buildpath
#####################
## Visual Studio Code
#####################
*.code-workspace
.vscode/
#################
## Visual Studio
#################
-10
View File
@@ -1,10 +0,0 @@
{
"ExpandedNodes": [
"",
"\\Moose Development",
"\\Moose Development\\Moose",
"\\Moose Development\\Moose\\Ops"
],
"SelectedNode": "\\Moose Development\\Moose\\Ops\\Airboss.lua",
"PreviewInSolutionExplorer": false
}
BIN
View File
Binary file not shown.
@@ -0,0 +1,24 @@
env.info( '*** MOOSE DYNAMIC INCLUDE START *** ' )
local base = _G
__Moose = {}
__Moose.Include = function( IncludeFile )
if not __Moose.Includes[ IncludeFile ] then
__Moose.Includes[IncludeFile] = IncludeFile
local f = assert( base.loadfile( IncludeFile ) )
if f == nil then
error ("Moose: Could not load Moose file " .. IncludeFile )
else
env.info( "Moose: " .. IncludeFile .. " dynamically loaded." )
return f()
end
end
end
__Moose.Includes = {}
__Moose.Include( 'Scripts/Moose/Modules.lua' )
BASE:TraceOnOff( true )
env.info( '*** MOOSE INCLUDE END *** ' )
File diff suppressed because it is too large Load Diff
-166
View File
@@ -1,166 +0,0 @@
# Repository: https://github.com/CppCXY/EmmyLuaCodeStyle
# English documentation: https://github.com/CppCXY/EmmyLuaCodeStyle/blob/master/README_EN.md
[*.lua]
# [basic]
# optional space/tab
indent_style = space
# if indent_style is space, this is valid
indent_size = 4
# if indent_style is tab, this is valid
tab_width = 4
# none/single/double
quote_style = none
# only support number
continuation_indent_size = 0
# optional crlf/lf/cr/auto, if it is 'auto', in windows it is crlf other platforms are lf
end_of_line = auto
detect_end_of_line = false
# this mean utf8 length , if this is 'unset' then the line width is no longer checked
# this option decides when to chopdown the code
max_line_length = 9999
# this will check text end with new line
insert_final_newline = true
# [function]
# function call expression's args will align to first arg
# optional true/false/only_after_more_indention_statement/only_not_exist_cross_row_expression
align_call_args = false
# if true, all function define params will align to first param
align_function_define_params = true
remove_expression_list_finish_comma = true
# keep/remove/remove_table_only/remove_string_only/unambiguous_remove_string_only
call_arg_parentheses = keep
# [table]
#optional none/comma/semicolon
table_separator_style = none
#optional keep/never/always/smart
trailing_table_separator = keep
# see document for detail
continuous_assign_table_field_align_to_equal_sign = true
# if true, format like this "local t = { 1, 2, 3 }"
keep_one_space_between_table_and_bracket = true
# if indent_style is tab, this option is invalid
align_table_field_to_first_field = true
# [statement]
align_chained_expression_statement = false
# continous line distance
max_continuous_line_distance = 1
# see document for detail
continuous_assign_statement_align_to_equal_sign = true
# if statement will align like switch case
if_condition_align_with_each_other = false
# if true, continuation_indent_size for local or assign statement is invalid
# however, if the expression list has cross row expression, it will not be aligned to the first expression
local_assign_continuation_align_to_first_expression = false
statement_inline_comment_space = 1
# [indentation]
# if true, the label loses its current indentation
label_no_indent = false
# if true, there will be no indentation in the do statement
do_statement_no_indent = false
# if true, the conditional expression of the if statement will not be a continuation line indent
if_condition_no_continuation_indent = false
if_branch_comments_after_block_no_indent = false
# [space]
# if true, t[#t+1] will not space wrapper '+'
table_append_expression_no_space = false
long_chain_expression_allow_one_space_after_colon = false
remove_empty_header_and_footer_lines_in_function = true
space_before_function_open_parenthesis = false
space_inside_function_call_parentheses = false
space_inside_function_param_list_parentheses = false
space_before_open_square_bracket = false
space_inside_square_brackets = false
# if true, ormat like this "local t <const> = 1"
keep_one_space_between_namedef_and_attribute = true
# [row_layout]
# The following configuration supports four expressions
# minLine:${n}
# keepLine
# keepLine:${n}
# maxLine:${n}
keep_line_after_if_statement = minLine:0
keep_line_after_do_statement = minLine:0
keep_line_after_while_statement = minLine:0
keep_line_after_repeat_statement = minLine:0
keep_line_after_for_statement = minLine:0
keep_line_after_local_or_assign_statement = keepLine
keep_line_after_function_define_statement = keepLine:1
keep_line_after_expression_statement = keepLine
# [diagnostic]
# the following is code diagnostic options
enable_check_codestyle = true
# [diagnostic.name_style]
enable_name_style_check = false
# the following is name style check rule
# base option off/camel_case/snake_case/upper_snake_case/pascal_case/same(filename/first_param/'<const string>', snake_case/pascal_case/camel_case)
# all option can use '|' represent or
# for example:
# snake_case | upper_snake_case
# same(first_param, snake_case)
# same('m')
local_name_define_style = snake_case
function_param_name_style = snake_case
function_name_define_style = snake_case
local_function_name_define_style = snake_case
table_field_name_define_style = snake_case
global_variable_name_define_style = snake_case|upper_snake_case
module_name_define_style = same('m')|same(filename, snake_case)
require_module_name_style = same(first_param, snake_case)
class_name_define_style = same(filename, snake_case)
-17
View File
@@ -1,17 +0,0 @@
{
"Lua.workspace.preloadFileSize": 1000,
"Lua.diagnostics.disable": [
"undefined-doc-name"
],
"Lua.diagnostics.globals": [
"BASE",
"lfs",
"__Moose",
"trigger",
"coord",
"missionCommands"
],
"Lua.completion.displayContext": 5,
"Lua.runtime.version": "Lua 5.1",
"Lua.completion.callSnippet": "Both"
}
+12 -13
View File
@@ -1,6 +1,4 @@
--- **AI** - Models the process of Combat Air Patrol (CAP) for airplanes.
--
-- This is a class used in the @{AI.AI_A2A_Dispatcher}.
--- **AI** -- (R2.2) - Models the process of Combat Air Patrol (CAP) for airplanes.
--
-- ===
--
@@ -15,7 +13,8 @@
-- @extends AI.AI_Air_Patrol#AI_AIR_PATROL
-- @extends AI.AI_Air_Engage#AI_AIR_ENGAGE
--- The AI_A2A_CAP class implements the core functions to patrol a @{Core.Zone} by an AI @{Wrapper.Group} or @{Wrapper.Group}
--- The AI_A2A_CAP class implements the core functions to patrol a @{Zone} by an AI @{Wrapper.Group} or @{Wrapper.Group}
-- and automatically engage any airborne enemies that are within a certain range or within a certain zone.
--
-- ![Process](..\Presentations\AI_CAP\Dia3.JPG)
@@ -41,8 +40,8 @@
--
-- ![Process](..\Presentations\AI_CAP\Dia10.JPG)
--
-- 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.
-- Until a fuel or damage treshold has been reached by the AI, or when the AI is commanded to RTB.
-- When the fuel treshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
--
-- ![Process](..\Presentations\AI_CAP\Dia13.JPG)
--
@@ -72,7 +71,7 @@
-- * **@{AI.AI_Patrol#AI_PATROL_ZONE.Detected}**: The AI has detected new targets.
-- * **@{#AI_A2A_CAP.Destroy}**: The AI has destroyed a bogey @{Wrapper.Unit}.
-- * **@{#AI_A2A_CAP.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 tresholds have been reached, the AI will RTB.
--
-- ## 3. Set the Range of Engagement
--
@@ -82,15 +81,15 @@
-- 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_A2A_CAP.SetEngageRange}() to define that range.
-- Use the method @{AI.AI_CAP#AI_A2A_CAP.SetEngageRange}() to define that range.
--
-- ## 4. Set the Zone of Engagement
--
-- ![Zone](..\Presentations\AI_CAP\Dia12.JPG)
--
-- An optional @{Core.Zone} can be set,
-- An optional @{Zone} can be set,
-- 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.AI_Cap#AI_A2A_CAP.SetEngageZone}() to define that Zone.
--
-- ===
--
@@ -107,7 +106,7 @@ AI_A2A_CAP = {
-- @param DCS#Altitude EngageFloorAltitude The lowest altitude in meters where to execute the engagement.
-- @param DCS#Altitude EngageCeilingAltitude The highest altitude in meters where to execute the engagement.
-- @param DCS#AltitudeType EngageAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to "RADIO".
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Core.Zone} where the patrol needs to be executed.
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Group} in km/h.
-- @param DCS#Speed PatrolMaxSpeed The maximum speed of the @{Wrapper.Group} in km/h.
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
@@ -133,7 +132,7 @@ end
--- Creates a new AI_A2A_CAP object
-- @param #AI_A2A_CAP self
-- @param Wrapper.Group#GROUP AICap
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Core.Zone} where the patrol needs to be executed.
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Group} in km/h.
@@ -192,7 +191,7 @@ end
--- Evaluate the attack and create an AttackUnitTask list.
-- @param #AI_A2A_CAP self
-- @param Core.Set#SET_UNIT AttackSetUnit The set of units to attack.
-- @param Wrapper.Group#GROUP DefenderGroup The group of defenders.
-- @param Wrappper.Group#GROUP DefenderGroup The group of defenders.
-- @param #number EngageAltitude The altitude to engage the targets.
-- @return #AI_A2A_CAP self
function AI_A2A_CAP:CreateAttackUnitTasks( AttackSetUnit, DefenderGroup, EngageAltitude )
File diff suppressed because it is too large Load Diff
+9 -9
View File
@@ -1,6 +1,6 @@
--- **AI** - Models the process of Ground Controlled Interception (GCI) for airplanes.
--- **AI** -- (R2.2) - Models the process of Ground Controlled Interception (GCI) for airplanes.
--
-- This is a class used in the @{AI.AI_A2A_Dispatcher}.
-- This is a class used in the @{AI_A2A_Dispatcher}.
--
-- ===
--
@@ -8,7 +8,7 @@
--
-- ===
--
-- @module AI.AI_A2A_Gci
-- @module AI.AI_A2A_GCI
-- @image AI_Ground_Control_Intercept.JPG
@@ -42,8 +42,8 @@
--
-- ![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.
-- When the fuel threshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
-- Until a fuel or damage treshold has been reached by the AI, or when the AI is commanded to RTB.
-- When the fuel treshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
--
-- ![Process](..\Presentations\AI_GCI\Dia13.JPG)
--
@@ -73,7 +73,7 @@
-- * **@{AI.AI_Patrol#AI_PATROL_ZONE.Detected}**: The AI has detected new targets.
-- * **@{#AI_A2A_GCI.Destroy}**: The AI has destroyed a bogey @{Wrapper.Unit}.
-- * **@{#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 tresholds have been reached, the AI will RTB.
--
-- ## 3. Set the Range of Engagement
--
@@ -89,9 +89,9 @@
--
-- ![Zone](..\Presentations\AI_GCI\Dia12.JPG)
--
-- An optional @{Core.Zone} can be set,
-- An optional @{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.
-- Use the method @{AI.AI_Cap#AI_A2A_GCI.SetEngageZone}() to define that Zone.
--
-- ===
--
@@ -153,7 +153,7 @@ end
--- Evaluate the attack and create an AttackUnitTask list.
-- @param #AI_A2A_GCI self
-- @param Core.Set#SET_UNIT AttackSetUnit The set of units to attack.
-- @param Wrapper.Group#GROUP DefenderGroup The group of defenders.
-- @param Wrappper.Group#GROUP DefenderGroup The group of defenders.
-- @param #number EngageAltitude The altitude to engage the targets.
-- @return #AI_A2A_GCI self
function AI_A2A_GCI:CreateAttackUnitTasks( AttackSetUnit, DefenderGroup, EngageAltitude )
+13 -13
View File
@@ -1,4 +1,4 @@
--- **AI** - Models the process of air patrol of airplanes.
--- **AI** -- (R2.2) - Models the process of air patrol of airplanes.
--
-- ===
--
@@ -13,7 +13,7 @@
--- @type AI_A2A_PATROL
-- @extends AI.AI_A2A#AI_A2A
--- Implements the core functions to patrol a @{Core.Zone} by an AI @{Wrapper.Group} or @{Wrapper.Group}.
--- Implements the core functions to patrol a @{Zone} by an AI @{Wrapper.Group} or @{Wrapper.Group}.
--
-- ![Process](..\Presentations\AI_PATROL\Dia3.JPG)
--
@@ -39,8 +39,8 @@
--
-- ![Process](..\Presentations\AI_PATROL\Dia10.JPG)
--
-- 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.
-- Until a fuel or damage treshold has been reached by the AI, or when the AI is commanded to RTB.
-- When the fuel treshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
--
-- ![Process](..\Presentations\AI_PATROL\Dia11.JPG)
--
@@ -68,7 +68,7 @@
-- * **RTB** ( Group ): Route the AI to the home base.
-- * **Detect** ( Group ): The AI is detecting targets.
-- * **Detected** ( Group ): The AI has detected new targets.
-- * **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 tresholds have been reached, the AI will RTB.
--
-- ## 3. Set or Get the AI controllable
--
@@ -100,16 +100,16 @@
-- ## 6. Manage the "out of fuel" in the AI_A2A_PATROL
--
-- When the AI is out of fuel, it is required that a new AI is started, before the old AI can return to the home base.
-- Therefore, with a parameter and a calculation of the distance to the home base, the fuel threshold is calculated.
-- When the fuel threshold is reached, the AI will continue for a given time its patrol task in orbit,
-- while a new AI is targeted to the AI_A2A_PATROL.
-- Therefore, with a parameter and a calculation of the distance to the home base, the fuel treshold is calculated.
-- When the fuel treshold is reached, the AI will continue for a given time its patrol task in orbit,
-- while a new AI is targetted to the AI_A2A_PATROL.
-- Once the time is finished, the old AI will return to the base.
-- Use the method @{#AI_A2A_PATROL.ManageFuel}() to have this proces in place.
--
-- ## 7. Manage "damage" behaviour of the AI in the AI_A2A_PATROL
--
-- 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 treshold 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.
--
-- ===
@@ -122,7 +122,7 @@ AI_A2A_PATROL = {
--- Creates a new AI_A2A_PATROL object
-- @param #AI_A2A_PATROL self
-- @param Wrapper.Group#GROUP AIPatrol The patrol group object.
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Core.Zone} where the patrol needs to be executed.
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Group} in km/h.
@@ -264,7 +264,7 @@ function AI_A2A_PATROL:SetAltitude( PatrolFloorAltitude, PatrolCeilingAltitude )
end
--- Defines a new patrol route using the @{AI.AI_Patrol#AI_PATROL_ZONE} parameters and settings.
--- Defines a new patrol route using the @{Process_PatrolZone} parameters and settings.
-- @param #AI_A2A_PATROL self
-- @return #AI_A2A_PATROL self
-- @param Wrapper.Group#GROUP AIPatrol The Group Object managed by the FSM.
@@ -287,7 +287,7 @@ function AI_A2A_PATROL:onafterPatrol( AIPatrol, From, Event, To )
end
--- This static method is called from the route path within the last task at the last waypoint of the AIPatrol.
--- This statis method is called from the route path within the last task at the last waaypoint of the AIPatrol.
-- Note that this method is required, as triggers the next route when patrolling for the AIPatrol.
-- @param Wrapper.Group#GROUP AIPatrol The AI group.
-- @param #AI_A2A_PATROL Fsm The FSM.
@@ -302,7 +302,7 @@ function AI_A2A_PATROL.PatrolRoute( AIPatrol, Fsm )
end
--- Defines a new patrol route using the @{AI.AI_Patrol#AI_PATROL_ZONE} parameters and settings.
--- Defines a new patrol route using the @{Process_PatrolZone} parameters and settings.
-- @param #AI_A2A_PATROL self
-- @param Wrapper.Group#GROUP AIPatrol The Group managed by the FSM.
-- @param #string From The From State string.
+15 -7
View File
@@ -1,6 +1,6 @@
--- **AI** - Models the process of air to ground BAI engagement for airplanes and helicopters.
--- **AI** -- Models the process of air to ground BAI engagement for airplanes and helicopters.
--
-- This is a class used in the @{AI.AI_A2G_Dispatcher}.
-- This is a class used in the @{AI_A2G_Dispatcher}.
--
-- ===
--
@@ -11,8 +11,11 @@
-- @module AI.AI_A2G_BAI
-- @image AI_Air_To_Ground_Engage.JPG
--- @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_A2A_Engage#AI_A2A_Engage
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
--
@@ -23,6 +26,8 @@ AI_A2G_BAI = {
ClassName = "AI_A2G_BAI",
}
--- Creates a new AI_A2G_BAI object
-- @param #AI_A2G_BAI self
-- @param Wrapper.Group#GROUP AIGroup
@@ -31,7 +36,7 @@ AI_A2G_BAI = {
-- @param DCS#Altitude EngageFloorAltitude The lowest altitude in meters where to execute the engagement.
-- @param DCS#Altitude EngageCeilingAltitude The highest altitude in meters where to execute the engagement.
-- @param DCS#AltitudeType EngageAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to "RADIO".
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Core.Zone} where the patrol needs to be executed.
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Group} in km/h.
@@ -48,6 +53,7 @@ function AI_A2G_BAI:New2( AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAl
return self
end
--- Creates a new AI_A2G_BAI object
-- @param #AI_A2G_BAI self
-- @param Wrapper.Group#GROUP AIGroup
@@ -55,7 +61,7 @@ end
-- @param DCS#Speed EngageMaxSpeed The maximum speed of the @{Wrapper.Group} in km/h when engaging a target.
-- @param DCS#Altitude EngageFloorAltitude The lowest altitude in meters where to execute the engagement.
-- @param DCS#Altitude EngageCeilingAltitude The highest altitude in meters where to execute the engagement.
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Core.Zone} where the patrol needs to be executed.
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Group} in km/h.
@@ -70,7 +76,7 @@ end
--- Evaluate the attack and create an AttackUnitTask list.
-- @param #AI_A2G_BAI self
-- @param Core.Set#SET_UNIT AttackSetUnit The set of units to attack.
-- @param Wrapper.Group#GROUP DefenderGroup The group of defenders.
-- @param Wrappper.Group#GROUP DefenderGroup The group of defenders.
-- @param #number EngageAltitude The altitude to engage the targets.
-- @return #AI_A2G_BAI self
function AI_A2G_BAI:CreateAttackUnitTasks( AttackSetUnit, DefenderGroup, EngageAltitude )
@@ -86,6 +92,8 @@ function AI_A2G_BAI:CreateAttackUnitTasks( AttackSetUnit, DefenderGroup, EngageA
end
end
end
return AttackUnitTasks
end
+16 -7
View File
@@ -1,6 +1,6 @@
--- **AI** - Models the process of air to ground engagement for airplanes and helicopters.
--- **AI** -- Models the process of air to ground engagement for airplanes and helicopters.
--
-- This is a class used in the @{AI.AI_A2G_Dispatcher}.
-- This is a class used in the @{AI_A2G_Dispatcher}.
--
-- ===
--
@@ -11,8 +11,11 @@
-- @module AI.AI_A2G_CAS
-- @image AI_Air_To_Ground_Engage.JPG
--- @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_A2G_Patrol#AI_AIR_PATROL
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
--
@@ -23,6 +26,8 @@ AI_A2G_CAS = {
ClassName = "AI_A2G_CAS",
}
--- Creates a new AI_A2G_CAS object
-- @param #AI_A2G_CAS self
-- @param Wrapper.Group#GROUP AIGroup
@@ -31,7 +36,7 @@ AI_A2G_CAS = {
-- @param DCS#Altitude EngageFloorAltitude The lowest altitude in meters where to execute the engagement.
-- @param DCS#Altitude EngageCeilingAltitude The highest altitude in meters where to execute the engagement.
-- @param DCS#AltitudeType EngageAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to "RADIO".
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Core.Zone} where the patrol needs to be executed.
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Group} in km/h.
@@ -48,6 +53,7 @@ function AI_A2G_CAS:New2( AIGroup, EngageMinSpeed, EngageMaxSpeed, EngageFloorAl
return self
end
--- Creates a new AI_A2G_CAS object
-- @param #AI_A2G_CAS self
-- @param Wrapper.Group#GROUP AIGroup
@@ -55,7 +61,7 @@ end
-- @param DCS#Speed EngageMaxSpeed The maximum speed of the @{Wrapper.Group} in km/h when engaging a target.
-- @param DCS#Altitude EngageFloorAltitude The lowest altitude in meters where to execute the engagement.
-- @param DCS#Altitude EngageCeilingAltitude The highest altitude in meters where to execute the engagement.
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Core.Zone} where the patrol needs to be executed.
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Group} in km/h.
@@ -70,7 +76,7 @@ end
--- Evaluate the attack and create an AttackUnitTask list.
-- @param #AI_A2G_CAS self
-- @param Core.Set#SET_UNIT AttackSetUnit The set of units to attack.
-- @param Wrapper.Group#GROUP DefenderGroup The group of defenders.
-- @param Wrappper.Group#GROUP DefenderGroup The group of defenders.
-- @param #number EngageAltitude The altitude to engage the targets.
-- @return #AI_A2G_CAS self
function AI_A2G_CAS:CreateAttackUnitTasks( AttackSetUnit, DefenderGroup, EngageAltitude )
@@ -86,6 +92,9 @@ function AI_A2G_CAS:CreateAttackUnitTasks( AttackSetUnit, DefenderGroup, EngageA
end
end
end
return AttackUnitTasks
end
File diff suppressed because it is too large Load Diff
+11 -9
View File
@@ -1,6 +1,6 @@
--- **AI** - Models the process of air to ground SEAD engagement for airplanes and helicopters.
--- **AI** -- Models the process of air to ground SEAD engagement for airplanes and helicopters.
--
-- This is a class used in the @{AI.AI_A2G_Dispatcher}.
-- This is a class used in the @{AI_A2G_Dispatcher}.
--
-- ===
--
@@ -42,8 +42,8 @@
--
-- ![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.
-- When the fuel threshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
-- Until a fuel or damage treshold has been reached by the AI, or when the AI is commanded to RTB.
-- When the fuel treshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
--
-- ![Process](..\Presentations\AI_GCI\Dia13.JPG)
--
@@ -65,9 +65,9 @@
--
-- ![Zone](..\Presentations\AI_GCI\Dia12.JPG)
--
-- An optional @{Core.Zone} can be set,
-- An optional @{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.
-- Use the method @{AI.AI_Cap#AI_A2G_SEAD.SetEngageZone}() to define that Zone.
--
-- ===
--
@@ -76,6 +76,8 @@ AI_A2G_SEAD = {
ClassName = "AI_A2G_SEAD",
}
--- Creates a new AI_A2G_SEAD object
-- @param #AI_A2G_SEAD self
-- @param Wrapper.Group#GROUP AIGroup
@@ -84,7 +86,7 @@ AI_A2G_SEAD = {
-- @param DCS#Altitude EngageFloorAltitude The lowest altitude in meters where to execute the engagement.
-- @param DCS#Altitude EngageCeilingAltitude The highest altitude in meters where to execute the engagement.
-- @param DCS#AltitudeType EngageAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to "RADIO".
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Core.Zone} where the patrol needs to be executed.
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Group} in km/h.
@@ -109,7 +111,7 @@ end
-- @param DCS#Speed EngageMaxSpeed The maximum speed of the @{Wrapper.Group} in km/h when engaging a target.
-- @param DCS#Altitude EngageFloorAltitude The lowest altitude in meters where to execute the engagement.
-- @param DCS#Altitude EngageCeilingAltitude The highest altitude in meters where to execute the engagement.
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Core.Zone} where the patrol needs to be executed.
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Group} in km/h.
@@ -125,7 +127,7 @@ end
--- Evaluate the attack and create an AttackUnitTask list.
-- @param #AI_A2G_SEAD self
-- @param Core.Set#SET_UNIT AttackSetUnit The set of units to attack.
-- @param Wrapper.Group#GROUP DefenderGroup The group of defenders.
-- @param Wrappper.Group#GROUP DefenderGroup The group of defenders.
-- @param #number EngageAltitude The altitude to engage the targets.
-- @return #AI_A2G_SEAD self
function AI_A2G_SEAD:CreateAttackUnitTasks( AttackSetUnit, DefenderGroup, EngageAltitude )
+42 -59
View File
@@ -253,9 +253,6 @@ function AI_AIR:New( AIGroup )
self.IdleCount = 0
self.RTBSpeedMaxFactor = 0.6
self.RTBSpeedMinFactor = 0.5
return self
end
@@ -373,11 +370,11 @@ end
--- When the AI is out of fuel, it is required that a new AI is started, before the old AI can return to the home base.
-- Therefore, with a parameter and a calculation of the distance to the home base, the fuel threshold is calculated.
-- When the fuel threshold is reached, the AI will continue for a given time its patrol task in orbit, while a new AIControllable is targeted to the AI_AIR.
-- Therefore, with a parameter and a calculation of the distance to the home base, the fuel treshold is calculated.
-- When the fuel treshold is reached, the AI will continue for a given time its patrol task in orbit, while a new AIControllable is targetted to the AI_AIR.
-- Once the time is finished, the old AI will return to the base.
-- @param #AI_AIR self
-- @param #number FuelThresholdPercentage The threshold in percentage (between 0 and 1) when the AIControllable is considered to get out of fuel.
-- @param #number FuelThresholdPercentage The treshold in percentage (between 0 and 1) when the AIControllable is considered to get out of fuel.
-- @param #number OutOfFuelOrbitTime The amount of seconds the out of fuel AIControllable will orbit before returning to the base.
-- @return #AI_AIR self
function AI_AIR:SetFuelThreshold( FuelThresholdPercentage, OutOfFuelOrbitTime )
@@ -390,14 +387,14 @@ function AI_AIR:SetFuelThreshold( FuelThresholdPercentage, OutOfFuelOrbitTime )
return self
end
--- When the AI is damaged beyond a certain threshold, it is required that the AI returns to the home base.
--- When the AI is damaged beyond a certain treshold, it is required that the AI returns to the home base.
-- However, damage cannot be foreseen early on.
-- Therefore, when the damage threshold is reached,
-- Therefore, when the damage treshold is reached,
-- the AI will return immediately to the home base (RTB).
-- Note that for groups, the average damage of the complete group will be calculated.
-- So, in a group of 4 airplanes, 2 lost and 2 with damage 0.2, the damage threshold will be 0.25.
-- So, in a group of 4 airplanes, 2 lost and 2 with damage 0.2, the damage treshold will be 0.25.
-- @param #AI_AIR self
-- @param #number PatrolDamageThreshold The threshold in percentage (between 0 and 1) when the AI is considered to be damaged.
-- @param #number PatrolDamageThreshold The treshold in percentage (between 0 and 1) when the AI is considered to be damaged.
-- @return #AI_AIR self
function AI_AIR:SetDamageThreshold( PatrolDamageThreshold )
@@ -409,7 +406,7 @@ end
--- Defines a new patrol route using the @{AI.AI_Patrol#AI_PATROL_ZONE} parameters and settings.
--- Defines a new patrol route using the @{Process_PatrolZone} parameters and settings.
-- @param #AI_AIR self
-- @return #AI_AIR self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
@@ -473,27 +470,27 @@ function AI_AIR:onafterStatus()
-- self:Home( "Destroy" )
-- end
-- end
if not self:Is( "Fuel" ) and not self:Is( "Home" ) and not self:is( "Refuelling" )then
local Fuel = self.Controllable:GetFuelMin()
-- If the fuel in the controllable is below the threshold percentage,
-- If the fuel in the controllable is below the treshold percentage,
-- then send for refuel in case of a tanker, otherwise RTB.
if Fuel < self.FuelThresholdPercentage then
if self.TankerName then
self:I( self.Controllable:GetName() .. " is out of fuel: " .. Fuel .. " ... Refuelling at Tanker!" )
self:Refuel()
else
self:I( self.Controllable:GetName() .. " is out of fuel: " .. Fuel .. " ... RTB!" )
local OldAIControllable = self.Controllable
local OrbitTask = OldAIControllable:TaskOrbitCircle( math.random( self.PatrolFloorAltitude, self.PatrolCeilingAltitude ), self.PatrolMinSpeed )
local TimedOrbitTask = OldAIControllable:TaskControlled( OrbitTask, OldAIControllable:TaskCondition(nil,nil,nil,nil,self.OutOfFuelOrbitTime,nil ) )
OldAIControllable:SetTask( TimedOrbitTask, 10 )
self:Fuel()
RTB = true
end
@@ -504,11 +501,11 @@ function AI_AIR:onafterStatus()
if self:Is( "Fuel" ) and not self:Is( "Home" ) and not self:is( "Refuelling" ) then
RTB = true
end
-- TODO: Check GROUP damage function.
local Damage = self.Controllable:GetLife()
local InitialLife = self.Controllable:GetLife0()
-- If the group is damaged, then RTB.
-- Note that a group can consist of more units, so if one unit is damaged of a group, the mission may continue.
-- The damaged unit will RTB due to DCS logic, and the others will continue to engage.
@@ -518,7 +515,7 @@ function AI_AIR:onafterStatus()
RTB = true
self:SetStatusOff()
end
-- Check if planes went RTB and are out of control.
-- We only check if planes are out of control, when they are in duty.
if self.Controllable:HasTask() == false then
@@ -532,7 +529,7 @@ function AI_AIR:onafterStatus()
self:Damaged()
else
self:I( self.Controllable:GetName() .. " control lost! " )
self:LostControl()
end
else
@@ -550,7 +547,7 @@ function AI_AIR:onafterStatus()
if not self:Is("Home") then
self:__Status( 10 )
end
end
end
@@ -559,11 +556,11 @@ end
function AI_AIR.RTBRoute( AIGroup, Fsm )
AIGroup:F( { "AI_AIR.RTBRoute:", AIGroup:GetName() } )
if AIGroup:IsAlive() then
Fsm:RTB()
end
end
--- @param Wrapper.Group#GROUP AIGroup
@@ -576,20 +573,7 @@ function AI_AIR.RTBHold( AIGroup, Fsm )
local Task = AIGroup:TaskOrbitCircle( 4000, 400 )
AIGroup:SetTask( Task )
end
end
--- Set the min and max factors on RTB speed. Use this, if your planes are heading back to base too fast. Default values are 0.5 and 0.6.
-- The RTB speed is calculated as the max speed of the unit multiplied by MinFactor (lower bracket) and multiplied by MaxFactor (upper bracket).
-- A random value in this bracket is then applied in the waypoint routing generation.
-- @param #AI_AIR self
-- @param #number MinFactor Lower bracket factor. Defaults to 0.5.
-- @param #number MaxFactor Upper bracket factor. Defaults to 0.6.
-- @return #AI_AIR self
function AI_AIR:SetRTBSpeedFactors(MinFactor,MaxFactor)
self.RTBSpeedMaxFactor = MaxFactor or 0.6
self.RTBSpeedMinFactor = MinFactor or 0.5
return self
end
@@ -598,53 +582,52 @@ end
function AI_AIR:onafterRTB( AIGroup, From, Event, To )
self:F( { AIGroup, From, Event, To } )
if AIGroup and AIGroup:IsAlive() then
if AIGroup and AIGroup:IsAlive() then
self:T( "Group " .. AIGroup:GetName() .. " ... RTB! ( " .. self:GetState() .. " )" )
self:ClearTargetDistance()
--AIGroup:ClearTasks()
AIGroup:OptionProhibitAfterburner(true)
local EngageRoute = {}
--- Calculate the target route point.
local FromCoord = AIGroup:GetCoordinate()
local ToTargetCoord = self.HomeAirbase:GetCoordinate() -- coordinate is on land height(!)
local ToTargetVec3 = ToTargetCoord:GetVec3()
ToTargetVec3.y = ToTargetCoord:GetLandHeight()+3000 -- let's set this 1000m/3000 feet above ground
ToTargetVec3.y = ToTargetCoord:GetLandHeight()+1000 -- let's set this 1000m/3000 feet above ground
local ToTargetCoord2 = COORDINATE:NewFromVec3( ToTargetVec3 )
if not self.RTBMinSpeed or not self.RTBMaxSpeed then
local RTBSpeedMax = AIGroup:GetSpeedMax()
local RTBSpeedMaxFactor = self.RTBSpeedMaxFactor or 0.6
local RTBSpeedMinFactor = self.RTBSpeedMinFactor or 0.5
self:SetRTBSpeed( RTBSpeedMax * RTBSpeedMinFactor, RTBSpeedMax * RTBSpeedMaxFactor)
self:SetRTBSpeed( RTBSpeedMax * 0.5, RTBSpeedMax * 0.6 )
end
local RTBSpeed = math.random( self.RTBMinSpeed, self.RTBMaxSpeed )
--local ToAirbaseAngle = FromCoord:GetAngleDegrees( FromCoord:GetDirectionVec3( ToTargetCoord2 ) )
local Distance = FromCoord:Get2DDistance( ToTargetCoord2 )
--local ToAirbaseCoord = FromCoord:Translate( 5000, ToAirbaseAngle )
local ToAirbaseCoord = ToTargetCoord2
if Distance < 5000 then
self:I( "RTB and near the airbase!" )
self:Home()
return
end
if not AIGroup:InAir() == true then
self:I( "Not anymore in the air, considered Home." )
self:Home()
return
end
--- Create a route point of type air.
local FromRTBRoutePoint = FromCoord:WaypointAir(
self.PatrolAltType,
@@ -665,10 +648,10 @@ function AI_AIR:onafterRTB( AIGroup, From, Event, To )
EngageRoute[#EngageRoute+1] = FromRTBRoutePoint
EngageRoute[#EngageRoute+1] = ToRTBRoutePoint
local Tasks = {}
Tasks[#Tasks+1] = AIGroup:TaskFunction( "AI_AIR.RTBRoute", self )
EngageRoute[#EngageRoute].task = AIGroup:TaskCombo( Tasks )
AIGroup:OptionROEHoldFire()
@@ -676,9 +659,9 @@ function AI_AIR:onafterRTB( AIGroup, From, Event, To )
--- NOW ROUTE THE GROUP!
AIGroup:Route( EngageRoute, self.TaskDelay )
end
end
--- @param #AI_AIR self
@@ -1,4 +1,4 @@
--- **AI** - Create an automated AIR defense system with reconnaissance units, coordinating SEAD, BAI and CAP operations.
--- **AI** - Create an automated AIR defense system based on a detection network of reconnaissance vehicles and air units, coordinating SEAD, BAI and CAP operations.
--
-- ===
--
@@ -7,14 +7,14 @@
-- * Setup quickly an AIR defense system for a coalition.
-- * Setup multiple defense zones to defend specific coordinates in your battlefield.
-- * Setup (SEAD) Suppression of Air Defense squadrons, to gain control in the air of enemy grounds.
-- * Setup (CAS) Controlled Air Support squadrons, to attack close by enemy ground units near friendly installations.
-- * Setup (CAS) Controlled Air Support squadrons, to attack closeby enemy ground units near friendly installations.
-- * Setup (BAI) Battleground Air Interdiction squadrons to attack remote enemy ground units and targets.
-- * Define and use a detection network controlled by recce.
-- * Define AIR defense squadrons at airbases, FARPs and carriers.
-- * Define AIR defense squadrons at airbases, farps and carriers.
-- * Enable airbases for AIR defenses.
-- * Add different planes and helicopter templates to squadrons.
-- * Assign squadrons to execute a specific engagement type depending on threat level of the detected ground enemy unit composition.
-- * Add multiple squadrons to different airbases, FARPs or carriers.
-- * Add multiple squadrons to different airbases, farps or carriers.
-- * Define different ranges to engage upon.
-- * Establish an automatic in air refuel process for planes using refuel tankers.
-- * Setup default settings for all squadrons and AIR defenses.
@@ -24,7 +24,7 @@
--
-- ## Missions:
--
-- [AID-AIR - AI AIR Dispatching](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching)
-- [AID-AIR - AI AIR Dispatching](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching/AID-AIR%20-%20AI%20AIR%20Dispatching)
--
-- ===
--
@@ -40,7 +40,7 @@
--
-- AI_AIR_DISPATCHER is the main AIR defense class that models the AIR defense system.
--
-- Before you start using the AI_AIR_DISPATCHER, ask yourself the following questions.
-- Before you start using the AI_AIR_DISPATCHER, ask youself the following questions.
--
--
-- ## 1. Which coalition am I modeling an AIR defense system for? blue or red?
@@ -88,7 +88,7 @@
--
-- ## 4. How do the defenses decide **when and where to engage** on approaching enemy units?
--
-- The AIR dispatcher needs you to setup (various) defense coordinates, which are strategic positions in the battle field to be defended.
-- The AIR dispacher needs you to setup (various) defense coordinates, which are strategic positions in the battle field to be defended.
-- Any ground based enemy approaching within the proximity of such a defense point, may trigger for a defensive action by friendly air units.
--
-- There are 2 important parameters that play a role in the defensive decision making: defensiveness and reactivity.
@@ -108,7 +108,7 @@
-- ## 5. Are defense coordinates and defense reactivity the only parameters?
--
-- No, depending on the target type, and the threat level of the target, the probability of defense will be higher.
-- In other words, when a SAM-10 radar emitter is detected, its probability for defense will be much higher than when a BMP-1 vehicle is
-- In other words, when a SAM-10 radar emitter is detected, its probabilty for defense will be much higher than when a BMP-1 vehicle is
-- detected, even when both enemies are at the same distance from a defense coordinate.
-- This will ensure optimal defenses, SEAD tasks will be launched much more quicker against engaging radar emitters, to ensure air superiority.
-- Approaching main battle tanks will be engaged much faster, than a group of approaching trucks.
@@ -117,18 +117,18 @@
-- ## 6. Which Squadrons will I create and which name will I give each Squadron?
--
-- The AIR defense system works with **Squadrons**. Each Squadron must be given a unique name, that forms the **key** to the squadron.
-- Several options and activities can be set per Squadron. A free format name can be given, but always ensure that the name is meaningful
-- Several options and activities can be set per Squadron. A free format name can be given, but always ensure that the name is meaningfull
-- for your mission, and remember that squadron names are used for communication to the players of your mission.
--
-- There are mainly 3 types of defenses: **SEAD**, **CAS** and **BAI**.
--
-- Suppression of Air Defenses (SEAD) are effective against radar emitters. Close Air Support (CAS) is launched when the enemy is close near friendly units.
-- Suppression of Air Defenses (SEAD) are effective agains radar emitters. Close Air Support (CAS) is launched when the enemy is close near friendly units.
-- Battleground Air Interdiction (BAI) tasks are launched when there are no friendlies around.
--
-- Depending on the defense type, different payloads will be needed. See further points on squadron definition.
--
--
-- ## 7. Where will the Squadrons be located? On Airbases? On Carrier Ships? On FARPs?
-- ## 7. Where will the Squadrons be located? On Airbases? On Carrier Ships? On Farps?
--
-- Squadrons are placed at the **home base** on an **airfield**, **carrier** or **farp**.
-- Carefully plan where each Squadron will be located as part of the defense system required for mission effective defenses.
@@ -174,13 +174,13 @@
-- * polygon zones
-- * moving zones
--
-- Depending on the type of zone selected, a different @{Core.Zone} object needs to be created from a ZONE_ class.
-- Depending on the type of zone selected, a different @{Zone} object needs to be created from a ZONE_ class.
--
--
-- ## 12. Are moving defense coordinates possible?
--
-- Yes, different COORDINATE types are possible to be used.
-- The COORDINATE_UNIT will help you to specify a defense coordinate that is attached to a moving unit.
-- The COORDINATE_UNIT will help you to specify a defense coodinate that is attached to a moving unit.
--
--
-- ## 13. How much defense coordinates do I need to create?
@@ -214,7 +214,7 @@
-- * From a parking spot with running engines
-- * From a parking spot with cold engines
--
-- **The default takeoff method is straight in the air.**
-- **The default takeoff method is staight in the air.**
-- This takeoff method is the most useful if you want to avoid airplane clutter at airbases!
-- But it is the least realistic one!
--
@@ -236,10 +236,10 @@
--
-- For each Squadron, depending on the helicopter or airplane type (modern, old) and payload, which overhead is required to provide any defense?
--
-- In other words, if **X** enemy ground units are detected, how many **Y** defense helicopters or airplanes need to engage (per squadron)?
-- In other words, if **X** enemy ground units are detected, how many **Y** defense helicpters or airplanes need to engage (per squadron)?
-- The **Y** is dependent on the type of airplane (era), payload, fuel levels, skills etc.
-- But the most important factor is the payload, which is the amount of AIR weapons the defense can carry to attack the enemy ground units.
-- For example, a Ka-50 can carry 16 vikrs, that means, that it potentially can destroy at least 8 ground units without a reload of ammunition.
-- For example, a Ka-50 can carry 16 vikrs, that means, that it potentially can destroy at least 8 ground units without a reload of ammunication.
-- That means, that one defender can destroy more enemy ground units.
-- Thus, the overhead is a **factor** that will calculate dynamically how many **Y** defenses will be required based on **X** attackers detected.
--
@@ -259,7 +259,7 @@
--
-- ### Author: **FlightControl** rework of GCICAP + introduction of new concepts (squadrons).
--
-- @module AI.AI_Air_Dispatcher
-- @module AI.AI_AIR_Dispatcher
-- @image AI_Air_To_Ground_Dispatching.JPG
@@ -279,7 +279,7 @@ do -- AI_AIR_DISPATCHER
-- Multiple defense coordinates can be setup. Defense coordinates can be strategic or tactical positions or references to strategic units or scenery.
-- The AIR dispatcher will evaluate every x seconds the tactical situation around each defense coordinate. When a defense coordinate
-- is under threat, it will communicate through the command center that defensive actions need to be taken and will launch groups of air units for defense.
-- The level of threat to the defense coordinate varies upon the strength and types of the enemy units, the distance to the defense point, and the defensiveness parameters.
-- The level of threat to the defense coordinate varyies upon the strength and types of the enemy units, the distance to the defense point, and the defensiveness parameters.
-- Defensive actions are taken through probability, but the closer and the more threat the enemy poses to the defense coordinate, the faster it will be attacked by friendly AIR units.
--
-- Please study carefully the underlying explanations how to setup and use this module, as it has many features.
@@ -328,7 +328,7 @@ do -- AI_AIR_DISPATCHER
-- By spawning in dynamically additional recce, you can ensure that there is sufficient reconnaissance coverage so the defense mechanism is continuously
-- alerted of new enemy ground targets.
--
-- The following example defense a new reconnaissance network using a @{Functional.Detection#DETECTION_AREAS} object.
-- The following example defens a new reconnaissance network using a @{Functional.Detection#DETECTION_AREAS} object.
--
-- -- Define a SET_GROUP object that builds a collection of groups that define the recce network.
-- -- Here we build the network with all the groups that have a name starting with CCCP Recce.
@@ -354,7 +354,7 @@ do -- AI_AIR_DISPATCHER
-- **DetectionSetGroup** is then calling `FilterStart()`, which is starting the dynamic filtering or inclusion of these groups.
-- Note that any destroy or new spawn of a group having a name, starting with the above prefix, will be removed or added to the set.
--
-- Then a new detection object is created from the class `DETECTION_AREAS`. A grouping radius of 1000 meters (1km) is chosen.
-- Then a new detection object is created from the class `DETECTION_AREAS`. A grouping radius of 1000 meters (1km) is choosen.
--
-- The `Detection` object is then passed to the @{#AI_AIR_DISPATCHER.New}() method to indicate the reconnaissance network
-- configuration and setup the AIR defense detection mechanism.
@@ -473,7 +473,7 @@ do -- AI_AIR_DISPATCHER
-- the mission designer can choose to increase or reduce the amount of planes spawned.
--
-- The method @{#AI_AIR_DISPATCHER.SetSquadron}() defines for you a new squadron.
-- The provided parameters are the squadron name, airbase name and a list of template prefixes, and a number that indicates the amount of resources.
-- The provided parameters are the squadron name, airbase name and a list of template prefixe, and a number that indicates the amount of resources.
--
-- For example, this defines 3 new squadrons:
--
@@ -619,7 +619,7 @@ do -- AI_AIR_DISPATCHER
-- Depending on the demand of requested takeoffs by the AIR dispatcher, an airfield can become overloaded. Too many aircraft need to be taken
-- off at the same time, which will result in clutter as described above. In order to better control this behaviour, a takeoff scheduler is implemented,
-- which can be used to control how many aircraft are ordered for takeoff between specific time intervals.
-- The takeoff intervals can be specified per squadron, which make sense, as each squadron have a "home" airfield.
-- The takeff intervals can be specified per squadron, which make sense, as each squadron have a "home" airfield.
--
-- For this purpose, the method @{#AI_AIR_DISPATCHER.SetSquadronTakeOffInterval}() can be used to specify the takeoff intervals of
-- aircraft groups per squadron to avoid cluttering of aircraft at airbases.
@@ -647,7 +647,7 @@ do -- AI_AIR_DISPATCHER
-- * @{#AI_AIR_DISPATCHER.SetSquadronLandingAtRunway}() will despawn the returning aircraft directly after landing at the runway.
-- * @{#AI_AIR_DISPATCHER.SetSquadronLandingAtEngineShutdown}() will despawn the returning aircraft when the aircraft has returned to its parking spot and has turned off its engines.
--
-- You can use these methods to minimize the airbase coordination overhead and to increase the airbase efficiency.
-- You can use these methods to minimize the airbase coodination overhead and to increase the airbase efficiency.
-- When there are lots of aircraft returning for landing, at the same airbase, the takeoff process will be halted, which can cause a complete failure of the
-- A2A defense system, as no new CAP or GCI planes can takeoff.
-- Note that the method @{#AI_AIR_DISPATCHER.SetSquadronLandingNearAirbase}() will only work for returning aircraft, not for damaged or out of fuel aircraft.
@@ -724,13 +724,13 @@ do -- AI_AIR_DISPATCHER
--
-- Use the method @{#AI_AIR_DISPATCHER.SetSquadronEngageLimit}() to limit the amount of aircraft that will engage with the enemy, per squadron.
--
-- ## 4. Set the **fuel threshold**.
-- ## 4. Set the **fuel treshold**.
--
-- When aircraft get **out of fuel** to a certain %, which is by default **15% (0.15)**, there are two possible actions that can be taken:
-- When aircraft get **out of fuel** to a certain %-tage, which is by default **15% (0.15)**, there are two possible actions that can be taken:
-- - The aircraft will go RTB, and will be replaced with a new aircraft if possible.
-- - The aircraft will refuel at a tanker, if a tanker has been specified for the squadron.
--
-- Use the method @{#AI_AIR_DISPATCHER.SetSquadronFuelThreshold}() to set the **squadron fuel threshold** of the aircraft for all squadrons.
-- Use the method @{#AI_AIR_DISPATCHER.SetSquadronFuelThreshold}() to set the **squadron fuel treshold** of the aircraft for all squadrons.
--
-- ## 6. Other configuration options
--
@@ -786,17 +786,17 @@ do -- AI_AIR_DISPATCHER
--
-- Use the method @{#AI_AIR_DISPATCHER.SetDefaultGrouping}() to set the **default grouping** of spawned airplanes for all squadrons.
--
-- ## 10.5. Default RTB fuel threshold.
-- ## 10.5. Default RTB fuel treshold.
--
-- When an airplane gets **out of fuel** to a certain %, which is **15% (0.15)**, it will go RTB, and will be replaced with a new airplane when applicable.
-- When an airplane gets **out of fuel** to a certain %-tage, which is **15% (0.15)**, it will go RTB, and will be replaced with a new airplane when applicable.
--
-- Use the method @{#AI_AIR_DISPATCHER.SetDefaultFuelThreshold}() to set the **default fuel threshold** of spawned airplanes for all squadrons.
-- Use the method @{#AI_AIR_DISPATCHER.SetDefaultFuelThreshold}() to set the **default fuel treshold** of spawned airplanes for all squadrons.
--
-- ## 10.6. Default RTB damage threshold.
-- ## 10.6. Default RTB damage treshold.
--
-- When an airplane is **damaged** to a certain %, which is **40% (0.40)**, it will go RTB, and will be replaced with a new airplane when applicable.
-- When an airplane is **damaged** to a certain %-tage, which is **40% (0.40)**, it will go RTB, and will be replaced with a new airplane when applicable.
--
-- Use the method @{#AI_AIR_DISPATCHER.SetDefaultDamageThreshold}() to set the **default damage threshold** of spawned airplanes for all squadrons.
-- Use the method @{#AI_AIR_DISPATCHER.SetDefaultDamageThreshold}() to set the **default damage treshold** of spawned airplanes for all squadrons.
--
-- ## 10.7. Default settings for **patrol**.
--
@@ -829,7 +829,7 @@ do -- AI_AIR_DISPATCHER
--
-- In the mission editor, setup a group with task Refuelling. A tanker unit of the correct coalition will be automatically selected.
-- Then, use the method @{#AI_AIR_DISPATCHER.SetDefaultTanker}() to set the tanker for the dispatcher.
-- Use the method @{#AI_AIR_DISPATCHER.SetDefaultFuelThreshold}() to set the % left in the defender airplane tanks when a refuel action is needed.
-- Use the method @{#AI_AIR_DISPATCHER.SetDefaultFuelThreshold}() to set the %-tage left in the defender airplane tanks when a refuel action is needed.
--
-- When the tanker specified is alive and in the air, the tanker will be used for refuelling.
--
@@ -843,7 +843,7 @@ do -- AI_AIR_DISPATCHER
-- A2ADispatcher:SetSquadronCapInterval("Sochi", 2, 30, 600, 1 )
-- A2ADispatcher:SetSquadronGci( "Sochi", 900, 1200 )
--
-- -- 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 treshold has reached 90% fuel left.
-- A2ADispatcher:SetDefaultFuelThreshold( 0.9 )
-- A2ADispatcher:SetDefaultTanker( "Tanker" )
--
@@ -882,7 +882,10 @@ do -- AI_AIR_DISPATCHER
-- As a result, the GCI and CAP will stop!
-- 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.
--
--
--
--
--
-- @field #AI_AIR_DISPATCHER
AI_AIR_DISPATCHER = {
ClassName = "AI_AIR_DISPATCHER",
@@ -911,10 +914,10 @@ do -- AI_AIR_DISPATCHER
--- Enumerator for spawns at airbases
-- @type AI_AIR_DISPATCHER.Takeoff
-- @extends Wrapper.Group#GROUP.Takeoff
--- @field #AI_AIR_DISPATCHER.Takeoff Takeoff
AI_AIR_DISPATCHER.Takeoff = GROUP.Takeoff
--- Defnes Landing location.
-- @field #AI_AIR_DISPATCHER.Landing
AI_AIR_DISPATCHER.Landing = {
@@ -922,7 +925,7 @@ do -- AI_AIR_DISPATCHER
AtRunway = 2,
AtEngineShutdown = 3,
}
--- A defense queue item description
-- @type AI_AIR_DISPATCHER.DefenseQueueItem
-- @field Squadron
@@ -933,7 +936,7 @@ do -- AI_AIR_DISPATCHER
-- @field Functional.Detection#DETECTION_BASE AttackerDetection
-- @field DefenderGrouping
-- @field #string SquadronName The name of the squadron.
--- Queue of planned defenses to be launched.
-- This queue exists because defenses must be launched on FARPS, or in the air, or on an airbase, or on carriers.
-- And some of these platforms have very limited amount of "launching" platforms.
@@ -942,39 +945,40 @@ do -- AI_AIR_DISPATCHER
-- This guarantees that launched defenders are also directly existing ...
-- @type AI_AIR_DISPATCHER.DefenseQueue
-- @list<#AI_AIR_DISPATCHER.DefenseQueueItem> DefenseQueueItem A list of all defenses being queued ...
--- @field #AI_AIR_DISPATCHER.DefenseQueue DefenseQueue
AI_AIR_DISPATCHER.DefenseQueue = {}
--- Defense approach types
-- @type #AI_AIR_DISPATCHER.DefenseApproach
AI_AIR_DISPATCHER.DefenseApproach = {
Random = 1,
Distance = 2,
}
--- AI_AIR_DISPATCHER constructor.
-- This is defining the AIR DISPATCHER for one coalition.
-- This is defining the AIR DISPATCHER for one coaliton.
-- The Dispatcher works with a @{Functional.Detection#DETECTION_BASE} object that is taking of the detection of targets using the EWR units.
-- The Detection object is polymorphic, depending on the type of detection object chosen, the detection will work differently.
-- The Detection object is polymorphic, depending on the type of detection object choosen, the detection will work differently.
-- @param #AI_AIR_DISPATCHER self
-- @param Functional.Detection#DETECTION_BASE Detection The DETECTION object that will detects targets using the the Early Warning Radar network.
-- @return #AI_AIR_DISPATCHER self
-- @usage
--
-- -- Setup the Detection, using DETECTION_AREAS.
-- -- First define the SET of GROUPs that are defining the EWR network.
-- -- Here with prefixes DF CCCP AWACS, DF CCCP EWR.
-- DetectionSetGroup = SET_GROUP:New()
-- DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } )
-- DetectionSetGroup:FilterStart()
--
-- -- Define the DETECTION_AREAS, using the DetectionSetGroup, with a 30km grouping radius.
-- Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 )
--
-- -- Now Setup the AIR dispatcher, and initialize it using the Detection object.
-- AIRDispatcher = AI_AIR_DISPATCHER:New( Detection )
--
--
-- -- Setup the Detection, using DETECTION_AREAS.
-- -- First define the SET of GROUPs that are defining the EWR network.
-- -- Here with prefixes DF CCCP AWACS, DF CCCP EWR.
-- DetectionSetGroup = SET_GROUP:New()
-- DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } )
-- DetectionSetGroup:FilterStart()
--
-- -- Define the DETECTION_AREAS, using the DetectionSetGroup, with a 30km grouping radius.
-- Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 )
--
-- -- Now Setup the AIR dispatcher, and initialize it using the Detection object.
-- AIRDispatcher = AI_AIR_DISPATCHER:New( Detection ) --
--
function AI_AIR_DISPATCHER:New( Detection )
-- Inherits from DETECTION_MANAGER
@@ -1021,7 +1025,7 @@ do -- AI_AIR_DISPATCHER
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
-- @param AI.AI_Air#AI_AIR Task
-- @param Tasking.Task_AIR#AI_AIR Task
-- @param Wrapper.Unit#UNIT TaskUnit
-- @param #string PlayerName
@@ -1224,7 +1228,7 @@ do -- AI_AIR_DISPATCHER
self:I( "Captured " .. AirbaseName )
-- Now search for all squadrons located at the airbase, and sanitize them.
-- Now search for all squadrons located at the airbase, and sanatize them.
for SquadronName, Squadron in pairs( self.DefenderSquadrons ) do
if Squadron.AirbaseName == AirbaseName then
Squadron.ResourceCount = -999 -- The base has been captured, and the resources are eliminated. No more spawning.
@@ -1376,7 +1380,7 @@ do -- AI_AIR_DISPATCHER
--- Define a border area to simulate a **cold war** scenario.
-- A **cold war** is one where Patrol aircraft patrol their territory but will not attack enemy aircraft or launch GCI aircraft unless enemy aircraft enter their territory. In other words the EWR may detect an enemy aircraft but will only send aircraft to attack it if it crosses the border.
-- A **hot war** is one where Patrol aircraft will intercept any detected enemy aircraft and GCI aircraft will launch against detected enemy aircraft without regard for territory. In other words if the ground radar can detect the enemy aircraft then it will send Patrol and GCI aircraft to attack it.
-- If it's a cold war then the **borders of red and blue territory** need to be defined using a @{Core.Zone} object derived from @{Core.Zone#ZONE_BASE}. This method needs to be used for this.
-- If it's a cold war then the **borders of red and blue territory** need to be defined using a @{zone} object derived from @{Core.Zone#ZONE_BASE}. This method needs to be used for this.
-- If a hot war is chosen then **no borders** actually need to be defined using the helicopter units other than 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. Set the noborders parameter to 1
-- @param #AI_AIR_DISPATCHER self
-- @param Core.Zone#ZONE_BASE BorderZone An object derived from ZONE_BASE, or a list of objects derived from ZONE_BASE.
@@ -1431,17 +1435,17 @@ do -- AI_AIR_DISPATCHER
end
--- Set the default damage threshold when defenders will RTB.
-- The default damage threshold is by default set to 40%, which means that when the airplane is 40% damaged, it will go RTB.
--- Set the default damage treshold when defenders will RTB.
-- The default damage treshold is by default set to 40%, which means that when the airplane is 40% damaged, it will go RTB.
-- @param #AI_AIR_DISPATCHER self
-- @param #number DamageThreshold A decimal number between 0 and 1, that expresses the % of the damage threshold before going RTB.
-- @param #number DamageThreshold A decimal number between 0 and 1, that expresses the %-tage of the damage treshold before going RTB.
-- @return #AI_AIR_DISPATCHER
-- @usage
--
-- -- Now Setup the AIR dispatcher, and initialize it using the Detection object.
-- AIRDispatcher = AI_AIR_DISPATCHER:New( Detection )
--
-- -- Now Setup the default damage threshold.
-- -- Now Setup the default damage treshold.
-- AIRDispatcher:SetDefaultDamageThreshold( 0.90 ) -- Go RTB when the airplane 90% damaged.
--
function AI_AIR_DISPATCHER:SetDefaultDamageThreshold( DamageThreshold )
@@ -1796,12 +1800,12 @@ do -- AI_AIR_DISPATCHER
--
-- @return #AI_AIR_DISPATCHER
function AI_AIR_DISPATCHER:SetSquadron2( Squadron )
local SquadronName = Squadron:GetName() -- Retrieves the Squadron Name.
self.DefenderSquadrons[SquadronName] = self.DefenderSquadrons[SquadronName] or {}
self.DefenderSquadrons[SquadronName] = self.DefenderSquadrons[SquadronName] or {}
local DefenderSquadron = self.DefenderSquadrons[SquadronName]
return self
end
@@ -1812,15 +1816,15 @@ do -- AI_AIR_DISPATCHER
function AI_AIR_DISPATCHER:GetSquadron( SquadronName )
local DefenderSquadron = self.DefenderSquadrons[SquadronName]
if not DefenderSquadron then
error( "Unknown Squadron for Dispatcher:" .. SquadronName )
end
return DefenderSquadron
end
--- Set the Squadron visible before startup of the dispatcher.
-- All planes will be spawned as uncontrolled on the parking spot.
-- They will lock the parking spot.
@@ -1985,7 +1989,7 @@ do -- AI_AIR_DISPATCHER
--- Defines the default amount of extra planes that will take-off as part of the defense system.
-- @param #AI_AIR_DISPATCHER self
-- @param #number Overhead The % of Units that dispatching command will allocate to intercept in surplus of detected amount of units.
-- @param #number Overhead The %-tage of Units that dispatching command will allocate to intercept in surplus of detected amount of units.
-- The default overhead is 1, so equal balance. The @{#AI_AIR_DISPATCHER.SetOverhead}() method can be used to tweak the defense strength,
-- taking into account the plane types of the squadron. For example, a MIG-31 with full long-distance AIR missiles payload, may still be less effective than a F-15C with short missiles...
-- So in this case, one may want to use the Overhead method to allocate more defending planes as the amount of detected attacking planes.
@@ -2024,7 +2028,7 @@ do -- AI_AIR_DISPATCHER
--- Defines the amount of extra planes that will take-off as part of the defense system.
-- @param #AI_AIR_DISPATCHER self
-- @param #string SquadronName The name of the squadron.
-- @param #number Overhead The % of Units that dispatching command will allocate to intercept in surplus of detected amount of units.
-- @param #number Overhead The %-tage of Units that dispatching command will allocate to intercept in surplus of detected amount of units.
-- The default overhead is 1, so equal balance. The @{#AI_AIR_DISPATCHER.SetOverhead}() method can be used to tweak the defense strength,
-- taking into account the plane types of the squadron. For example, a MIG-31 with full long-distance AIR missiles payload, may still be less effective than a F-15C with short missiles...
-- So in this case, one may want to use the Overhead method to allocate more defending planes as the amount of detected attacking planes.
@@ -2064,7 +2068,7 @@ do -- AI_AIR_DISPATCHER
--- Gets the overhead of planes as part of the defense system, in comparison with the attackers.
-- @param #AI_AIR_DISPATCHER self
-- @param #string SquadronName The name of the squadron.
-- @return #number The % of Units that dispatching command will allocate to intercept in surplus of detected amount of units.
-- @return #number The %-tage of Units that dispatching command will allocate to intercept in surplus of detected amount of units.
-- The default overhead is 1, so equal balance. The @{#AI_AIR_DISPATCHER.SetOverhead}() method can be used to tweak the defense strength,
-- taking into account the plane types of the squadron. For example, a MIG-31 with full long-distance AIR missiles payload, may still be less effective than a F-15C with short missiles...
-- So in this case, one may want to use the Overhead method to allocate more defending planes as the amount of detected attacking planes.
@@ -2670,17 +2674,17 @@ do -- AI_AIR_DISPATCHER
return self
end
--- Set the default fuel threshold when defenders will RTB or Refuel in the air.
-- The fuel threshold is by default set to 15%, which means that an airplane will stay in the air until 15% of its fuel has been consumed.
--- Set the default fuel treshold when defenders will RTB or Refuel in the air.
-- The fuel treshold is by default set to 15%, which means that an airplane will stay in the air until 15% of its fuel has been consumed.
-- @param #AI_AIR_DISPATCHER self
-- @param #number FuelThreshold A decimal number between 0 and 1, that expresses the % of the threshold of fuel remaining in the tank when the plane will go RTB or Refuel.
-- @param #number FuelThreshold A decimal number between 0 and 1, that expresses the %-tage of the treshold of fuel remaining in the tank when the plane will go RTB or Refuel.
-- @return #AI_AIR_DISPATCHER
-- @usage
--
-- -- Now Setup the AIR dispatcher, and initialize it using the Detection object.
-- AIRDispatcher = AI_AIR_DISPATCHER:New( Detection )
--
-- -- Now Setup the default fuel threshold.
-- -- Now Setup the default fuel treshold.
-- AIRDispatcher:SetDefaultFuelThreshold( 0.30 ) -- Go RTB when only 30% of fuel remaining in the tank.
--
function AI_AIR_DISPATCHER:SetDefaultFuelThreshold( FuelThreshold )
@@ -2691,18 +2695,18 @@ do -- AI_AIR_DISPATCHER
end
--- Set the fuel threshold for the squadron when defenders will RTB or Refuel in the air.
-- The fuel threshold is by default set to 15%, which means that an airplane will stay in the air until 15% of its fuel has been consumed.
--- Set the fuel treshold for the squadron when defenders will RTB or Refuel in the air.
-- The fuel treshold is by default set to 15%, which means that an airplane will stay in the air until 15% of its fuel has been consumed.
-- @param #AI_AIR_DISPATCHER self
-- @param #string SquadronName The name of the squadron.
-- @param #number FuelThreshold A decimal number between 0 and 1, that expresses the % of the threshold of fuel remaining in the tank when the plane will go RTB or Refuel.
-- @param #number FuelThreshold A decimal number between 0 and 1, that expresses the %-tage of the treshold of fuel remaining in the tank when the plane will go RTB or Refuel.
-- @return #AI_AIR_DISPATCHER
-- @usage
--
-- -- Now Setup the AIR dispatcher, and initialize it using the Detection object.
-- AIRDispatcher = AI_AIR_DISPATCHER:New( Detection )
--
-- -- Now Setup the default fuel threshold.
-- -- Now Setup the default fuel treshold.
-- AIRDispatcher:SetSquadronRefuelThreshold( "SquadronName", 0.30 ) -- Go RTB when only 30% of fuel remaining in the tank.
--
function AI_AIR_DISPATCHER:SetSquadronFuelThreshold( SquadronName, FuelThreshold )
@@ -2722,7 +2726,7 @@ do -- AI_AIR_DISPATCHER
-- -- Now Setup the AIR dispatcher, and initialize it using the Detection object.
-- AIRDispatcher = AI_AIR_DISPATCHER:New( Detection )
--
-- -- Now Setup the default fuel threshold.
-- -- Now Setup the default fuel treshold.
-- AIRDispatcher:SetDefaultFuelThreshold( 0.30 ) -- Go RTB when only 30% of fuel remaining in the tank.
--
-- -- Now Setup the default tanker.
@@ -2745,7 +2749,7 @@ do -- AI_AIR_DISPATCHER
-- -- Now Setup the AIR dispatcher, and initialize it using the Detection object.
-- AIRDispatcher = AI_AIR_DISPATCHER:New( Detection )
--
-- -- Now Setup the squadron fuel threshold.
-- -- Now Setup the squadron fuel treshold.
-- AIRDispatcher:SetSquadronRefuelThreshold( "SquadronName", 0.30 ) -- Go RTB when only 30% of fuel remaining in the tank.
--
-- -- Now Setup the squadron tanker.
@@ -2843,7 +2847,7 @@ do -- AI_AIR_DISPATCHER
-- @param #AI_AIR_DISPATCHER self
function AI_AIR_DISPATCHER:CountDefendersEngaged( AttackerDetection, AttackerCount )
-- First, count the active AIGroups Units, targeting the DetectedSet
-- First, count the active AIGroups Units, targetting the DetectedSet
local DefendersEngaged = 0
local DefendersTotal = 0
+6 -6
View File
@@ -1,6 +1,6 @@
--- **AI** - Models the process of air to ground engagement for airplanes and helicopters.
--- **AI** -- Models the process of air to ground engagement for airplanes and helicopters.
--
-- This is a class used in the @{AI.AI_A2G_Dispatcher}.
-- This is a class used in the @{AI_A2G_Dispatcher}.
--
-- ===
--
@@ -42,8 +42,8 @@
--
-- ![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.
-- When the fuel threshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
-- Until a fuel or damage treshold has been reached by the AI, or when the AI is commanded to RTB.
-- When the fuel treshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
--
-- ![Process](..\Presentations\AI_GCI\Dia13.JPG)
--
@@ -65,9 +65,9 @@
--
-- ![Zone](..\Presentations\AI_GCI\Dia12.JPG)
--
-- An optional @{Core.Zone} can be set,
-- An optional @{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_ENGAGE.SetEngageZone}() to define that Zone.
-- Use the method @{AI.AI_Cap#AI_AIR_ENGAGE.SetEngageZone}() to define that Zone.
--
-- ===
--
+60 -56
View File
@@ -1,4 +1,4 @@
--- **AI** - Models the process of A2G patrolling and engaging ground targets for airplanes and helicopters.
--- **AI** -- Models the process of A2G patrolling and engaging ground targets for airplanes and helicopters.
--
-- ===
--
@@ -12,7 +12,8 @@
--- @type AI_AIR_PATROL
-- @extends AI.AI_Air#AI_AIR
--- The AI_AIR_PATROL class implements the core functions to patrol a @{Core.Zone} by an AI @{Wrapper.Group}
--- The AI_AIR_PATROL class implements the core functions to patrol a @{Zone} by an AI @{Wrapper.Group} or @{Wrapper.Group}
-- and automatically engage any airborne enemies that are within a certain range or within a certain zone.
--
-- ![Process](..\Presentations\AI_CAP\Dia3.JPG)
@@ -38,8 +39,8 @@
--
-- ![Process](..\Presentations\AI_CAP\Dia10.JPG)
--
-- 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.
-- Until a fuel or damage treshold has been reached by the AI, or when the AI is commanded to RTB.
-- When the fuel treshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
--
-- ![Process](..\Presentations\AI_CAP\Dia13.JPG)
--
@@ -69,7 +70,7 @@
-- * **@{AI.AI_Patrol#AI_PATROL_ZONE.Detected}**: The AI has detected new targets.
-- * **@{#AI_AIR_PATROL.Destroy}**: The AI has destroyed a bogey @{Wrapper.Unit}.
-- * **@{#AI_AIR_PATROL.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 tresholds have been reached, the AI will RTB.
--
-- ## 3. Set the Range of Engagement
--
@@ -85,9 +86,9 @@
--
-- ![Zone](..\Presentations\AI_CAP\Dia12.JPG)
--
-- An optional @{Core.Zone} can be set,
-- An optional @{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.
-- Use the method @{AI.AI_Cap#AI_AIR_PATROL.SetEngageZone}() to define that Zone.
--
-- ===
--
@@ -100,7 +101,7 @@ AI_AIR_PATROL = {
-- @param #AI_AIR_PATROL self
-- @param AI.AI_Air#AI_AIR AI_Air The AI_AIR FSM.
-- @param Wrapper.Group#GROUP AIGroup The AI group.
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Core.Zone} where the patrol needs to be executed.
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
-- @param DCS#Altitude PatrolFloorAltitude (optional, default = 1000m ) The lowest altitude in meters where to execute the patrol.
-- @param DCS#Altitude PatrolCeilingAltitude (optional, default = 1500m ) The highest altitude in meters where to execute the patrol.
-- @param DCS#Speed PatrolMinSpeed (optional, default = 50% of max speed) The minimum speed of the @{Wrapper.Group} in km/h.
@@ -113,17 +114,17 @@ function AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, Pa
local self = BASE:Inherit( self, AI_Air ) -- #AI_AIR_PATROL
local SpeedMax = AIGroup:GetSpeedMax()
self.PatrolZone = PatrolZone
self.PatrolFloorAltitude = PatrolFloorAltitude or 1000
self.PatrolCeilingAltitude = PatrolCeilingAltitude or 1500
self.PatrolMinSpeed = PatrolMinSpeed or SpeedMax * 0.5
self.PatrolMaxSpeed = PatrolMaxSpeed or SpeedMax * 0.75
-- defafult PatrolAltType to "RADIO" if not specified
self.PatrolAltType = PatrolAltType or "RADIO"
self:AddTransition( { "Started", "Airborne", "Refuelling" }, "Patrol", "Patrolling" )
--- OnBefore Transition Handler for Event Patrol.
@@ -134,7 +135,7 @@ function AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, Pa
-- @param #string Event The Event string.
-- @param #string To The To State string.
-- @return #boolean Return false to cancel Transition.
--- OnAfter Transition Handler for Event Patrol.
-- @function [parent=#AI_AIR_PATROL] OnAfterPatrol
-- @param #AI_AIR_PATROL self
@@ -142,16 +143,16 @@ function AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, Pa
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
--- Synchronous Event Trigger for Event Patrol.
-- @function [parent=#AI_AIR_PATROL] Patrol
-- @param #AI_AIR_PATROL self
--- Asynchronous Event Trigger for Event Patrol.
-- @function [parent=#AI_AIR_PATROL] __Patrol
-- @param #AI_AIR_PATROL self
-- @param #number Delay The delay in seconds.
--- OnLeave Transition Handler for State Patrolling.
-- @function [parent=#AI_AIR_PATROL] OnLeavePatrolling
-- @param #AI_AIR_PATROL self
@@ -160,7 +161,7 @@ function AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, Pa
-- @param #string Event The Event string.
-- @param #string To The To State string.
-- @return #boolean Return false to cancel Transition.
--- OnEnter Transition Handler for State Patrolling.
-- @function [parent=#AI_AIR_PATROL] OnEnterPatrolling
-- @param #AI_AIR_PATROL self
@@ -168,9 +169,9 @@ function AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, Pa
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
self:AddTransition( "Patrolling", "PatrolRoute", "Patrolling" ) -- FSM_CONTROLLABLE Transition for type #AI_AIR_PATROL.
--- OnBefore Transition Handler for Event PatrolRoute.
-- @function [parent=#AI_AIR_PATROL] OnBeforePatrolRoute
-- @param #AI_AIR_PATROL self
@@ -179,7 +180,7 @@ function AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, Pa
-- @param #string Event The Event string.
-- @param #string To The To State string.
-- @return #boolean Return false to cancel Transition.
--- OnAfter Transition Handler for Event PatrolRoute.
-- @function [parent=#AI_AIR_PATROL] OnAfterPatrolRoute
-- @param #AI_AIR_PATROL self
@@ -187,21 +188,23 @@ function AI_AIR_PATROL:New( AI_Air, AIGroup, PatrolZone, PatrolFloorAltitude, Pa
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
--- Synchronous Event Trigger for Event PatrolRoute.
-- @function [parent=#AI_AIR_PATROL] PatrolRoute
-- @param #AI_AIR_PATROL self
--- Asynchronous Event Trigger for Event PatrolRoute.
-- @function [parent=#AI_AIR_PATROL] __PatrolRoute
-- @param #AI_AIR_PATROL self
-- @param #number Delay The delay in seconds.
self:AddTransition( "*", "Reset", "Patrolling" ) -- FSM_CONTROLLABLE Transition for type #AI_AIR_PATROL.
return self
end
--- Set the Engage Range when the AI will engage with airborne enemies.
-- @param #AI_AIR_PATROL self
-- @param #number EngageRange The Engage Range.
@@ -227,7 +230,7 @@ end
-- @param #table CapCoordinates Table of coordinates of first race track point. Second point is determined by leg length and heading.
-- @return #AI_AIR_PATROL self
function AI_AIR_PATROL:SetRaceTrackPattern(LegMin, LegMax, HeadingMin, HeadingMax, DurationMin, DurationMax, CapCoordinates)
self.racetrack=true
self.racetracklegmin=LegMin or 10000
self.racetracklegmax=LegMax or 15000
@@ -235,16 +238,18 @@ function AI_AIR_PATROL:SetRaceTrackPattern(LegMin, LegMax, HeadingMin, HeadingMa
self.racetrackheadingmax=HeadingMax or 180
self.racetrackdurationmin=DurationMin
self.racetrackdurationmax=DurationMax
if self.racetrackdurationmax and not self.racetrackdurationmin then
self.racetrackdurationmin=self.racetrackdurationmax
end
self.racetrackcapcoordinates=CapCoordinates
end
--- Defines a new patrol route using the @{AI.AI_Patrol#AI_PATROL_ZONE} parameters and settings.
--- Defines a new patrol route using the @{Process_PatrolZone} parameters and settings.
-- @param #AI_AIR_PATROL self
-- @return #AI_AIR_PATROL self
-- @param Wrapper.Group#GROUP AIPatrol The Group Object managed by the FSM.
@@ -257,7 +262,7 @@ function AI_AIR_PATROL:onafterPatrol( AIPatrol, From, Event, To )
self:ClearTargetDistance()
self:__PatrolRoute( self.TaskDelay )
AIPatrol:OnReSpawn(
function( PatrolGroup )
self:__Reset( self.TaskDelay )
@@ -266,7 +271,7 @@ function AI_AIR_PATROL:onafterPatrol( AIPatrol, From, Event, To )
)
end
--- This static method is called from the route path within the last task at the last waypoint of the AIPatrol.
--- This statis method is called from the route path within the last task at the last waaypoint of the AIPatrol.
-- Note that this method is required, as triggers the next route when patrolling for the AIPatrol.
-- @param Wrapper.Group#GROUP AIPatrol The AI group.
-- @param #AI_AIR_PATROL Fsm The FSM.
@@ -277,10 +282,10 @@ function AI_AIR_PATROL.___PatrolRoute( AIPatrol, Fsm )
if AIPatrol and AIPatrol:IsAlive() then
Fsm:PatrolRoute()
end
end
--- Defines a new patrol route using the @{AI.AI_Patrol#AI_PATROL_ZONE} parameters and settings.
--- Defines a new patrol route using the @{Process_PatrolZone} parameters and settings.
-- @param #AI_AIR_PATROL self
-- @param Wrapper.Group#GROUP AIPatrol The Group managed by the FSM.
-- @param #string From The From State string.
@@ -295,20 +300,21 @@ function AI_AIR_PATROL:onafterPatrolRoute( AIPatrol, From, Event, To )
return
end
if AIPatrol and AIPatrol:IsAlive() then
local PatrolRoute = {}
--- Calculate the target route point.
local CurrentCoord = AIPatrol:GetCoordinate()
local altitude= math.random( self.PatrolFloorAltitude, self.PatrolCeilingAltitude )
local ToTargetCoord = self.PatrolZone:GetRandomPointVec2()
ToTargetCoord:SetAlt( altitude )
self:SetTargetDistance( ToTargetCoord ) -- For RTB status check
local ToTargetSpeed = math.random( self.PatrolMinSpeed, self.PatrolMaxSpeed )
local speedkmh=ToTargetSpeed
@@ -316,31 +322,31 @@ function AI_AIR_PATROL:onafterPatrolRoute( AIPatrol, From, Event, To )
PatrolRoute[#PatrolRoute+1] = FromWP
if self.racetrack then
-- Random heading.
local heading = math.random(self.racetrackheadingmin, self.racetrackheadingmax)
-- Random leg length.
local leg=math.random(self.racetracklegmin, self.racetracklegmax)
-- Random duration if any.
local duration = self.racetrackdurationmin
if self.racetrackdurationmax then
duration=math.random(self.racetrackdurationmin, self.racetrackdurationmax)
end
-- CAP coordinate.
local c0=self.PatrolZone:GetRandomCoordinate()
if self.racetrackcapcoordinates and #self.racetrackcapcoordinates>0 then
c0=self.racetrackcapcoordinates[math.random(#self.racetrackcapcoordinates)]
end
-- Race track points.
local c1=c0:SetAltitude(altitude) --Core.Point#COORDINATE
local c2=c1:Translate(leg, heading):SetAltitude(altitude)
self:SetTargetDistance(c0) -- For RTB status check
-- Debug:
self:T(string.format("Patrol zone race track: v=%.1f knots, h=%.1f ft, heading=%03d, leg=%d m, t=%s sec", UTILS.KmphToKnots(speedkmh), UTILS.MetersToFeet(altitude), heading, leg, tostring(duration)))
--c1:MarkToAll("Race track c1")
@@ -348,41 +354,39 @@ function AI_AIR_PATROL:onafterPatrolRoute( AIPatrol, From, Event, To )
-- Task to orbit.
local taskOrbit=AIPatrol:TaskOrbit(c1, altitude, UTILS.KmphToMps(speedkmh), c2)
-- Task function to redo the patrol at other random position.
local taskPatrol=AIPatrol:TaskFunction("AI_AIR_PATROL.___PatrolRoute", self)
-- Controlled task with task condition.
local taskCond=AIPatrol:TaskCondition(nil, nil, nil, nil, duration, nil)
local taskCont=AIPatrol:TaskControlled(taskOrbit, taskCond)
-- Second waypoint
PatrolRoute[2]=c1:WaypointAirTurningPoint(self.PatrolAltType, speedkmh, {taskCont, taskPatrol}, "CAP Orbit")
else
--- Create a route point of type air.
local ToWP = ToTargetCoord:WaypointAir(self.PatrolAltType, POINT_VEC3.RoutePointType.TurningPoint, POINT_VEC3.RoutePointAction.TurningPoint, ToTargetSpeed, true)
PatrolRoute[#PatrolRoute+1] = ToWP
local Tasks = {}
Tasks[#Tasks+1] = AIPatrol:TaskFunction("AI_AIR_PATROL.___PatrolRoute", self)
PatrolRoute[#PatrolRoute].task = AIPatrol:TaskCombo( Tasks )
end
AIPatrol:OptionROEReturnFire()
AIPatrol:OptionROTEvadeFire()
AIPatrol:Route( PatrolRoute, self.TaskDelay )
end
end
--- Resumes the AIPatrol
-- @param Wrapper.Group#GROUP AIPatrol
-- @param Core.Fsm#FSM Fsm
--- @param Wrapper.Group#GROUP AIPatrol
function AI_AIR_PATROL.Resume( AIPatrol, Fsm )
AIPatrol:F( { "AI_AIR_PATROL.Resume:", AIPatrol:GetName() } )
@@ -390,5 +394,5 @@ function AI_AIR_PATROL.Resume( AIPatrol, Fsm )
Fsm:__Reset( Fsm.TaskDelay )
Fsm:__PatrolRoute( Fsm.TaskDelay )
end
end
@@ -1,6 +1,6 @@
--- **AI** - Models squadrons for airplanes and helicopters.
--
-- This is a class used in the @{AI.AI_Air_Dispatcher} and derived dispatcher classes.
-- This is a class used in the @{AI_Air_Dispatcher} and derived dispatcher classes.
--
-- ===
--
+10 -10
View File
@@ -1,4 +1,4 @@
--- **AI** - Peform Battlefield Area Interdiction (BAI) within an engagement zone.
--- **AI** -- Peform Battlefield Area Interdiction (BAI) within an engagement zone.
--
-- **Features:**
--
@@ -26,17 +26,17 @@
--
-- ===
--
-- @module AI.AI_BAI
-- @module AI.AI_Bai
-- @image AI_Battlefield_Air_Interdiction.JPG
--- AI_BAI_ZONE class
-- @type AI_BAI_ZONE
-- @field Wrapper.Controllable#CONTROLLABLE AIControllable The @{Wrapper.Controllable} patrolling.
-- @field Core.Zone#ZONE_BASE TargetZone The @{Core.Zone} where the patrol needs to be executed.
-- @field Core.Zone#ZONE_BASE TargetZone The @{Zone} where the patrol needs to be executed.
-- @extends AI.AI_Patrol#AI_PATROL_ZONE
--- Implements the core functions to provide BattleGround Air Interdiction in an Engage @{Core.Zone} by an AIR @{Wrapper.Controllable} or @{Wrapper.Group}.
--- Implements the core functions to provide BattleGround Air Interdiction in an Engage @{Zone} by an AIR @{Wrapper.Controllable} or @{Wrapper.Group}.
--
-- The AI_BAI_ZONE runs a process. It holds an AI in a Patrol Zone and when the AI is commanded to engage, it will fly to an Engage Zone.
--
@@ -49,7 +49,7 @@
-- Upon started, The AI will **Route** itself towards the random 3D point within a 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.
-- This cycle will continue until a fuel or damage threshold has been reached by the AI, or when the AI is commanded to RTB.
-- This cycle will continue until a fuel or damage treshold has been reached by the AI, or when the AI is commanded to RTB.
--
-- ![Route Event](..\Presentations\AI_BAI\Dia5.JPG)
--
@@ -87,7 +87,7 @@
-- It will keep patrolling there, until it is notified to RTB or move to another BOMB Zone.
-- It can be notified to go RTB through the **RTB** event.
--
-- When the fuel threshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
-- When the fuel treshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
--
-- ![Engage Event](..\Presentations\AI_BAI\Dia12.JPG)
--
@@ -117,7 +117,7 @@
-- * **@{AI.AI_Patrol#AI_PATROL_ZONE.Detected}**: The AI has detected new targets.
-- * **@{#AI_BAI_ZONE.Destroy}**: The AI has destroyed a target @{Wrapper.Unit}.
-- * **@{#AI_BAI_ZONE.Destroyed}**: The AI has destroyed all target @{Wrapper.Unit}s assigned in the BOMB 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 tresholds have been reached, the AI will RTB.
--
-- ## 3. Modify the Engage Zone behaviour to pinpoint a **map object** or **scenery object**
--
@@ -142,7 +142,7 @@ AI_BAI_ZONE = {
--- Creates a new AI_BAI_ZONE object
-- @param #AI_BAI_ZONE self
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Core.Zone} where the patrol needs to be executed.
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Controllable} in km/h.
@@ -566,7 +566,7 @@ function AI_BAI_ZONE:onafterEngage( Controllable, From, Event, To,
EngageRoute[#EngageRoute].task = Controllable:TaskCombo( AttackTasks )
--- Define a random point in the @{Core.Zone}. The AI will fly to that point within the zone.
--- Define a random point in the @{Zone}. The AI will fly to that point within the zone.
--- Find a random 2D point in EngageZone.
local ToTargetVec2 = self.EngageZone:GetRandomVec2()
@@ -602,7 +602,7 @@ function AI_BAI_ZONE:onafterEngage( Controllable, From, Event, To,
self:SetRefreshTimeInterval( 2 )
self:SetDetectionActivated()
self:__Target( -2 ) -- Start targeting
self:__Target( -2 ) -- Start Targetting
end
end
+2 -2
View File
@@ -1,4 +1,4 @@
--- **AI** - Balance player slots with AI to create an engaging simulation environment, independent of the amount of players.
--- **AI** -- Balance player slots with AI to create an engaging simulation environment, independent of the amount of players.
--
-- **Features:**
--
@@ -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-release/AIB%20-%20AI%20Balancing)
--
-- ===
--
+73 -58
View File
@@ -1,15 +1,16 @@
--- **AI** - Perform Combat Air Patrolling (CAP) for airplanes.
--- **AI** -- Perform Combat Air Patrolling (CAP) for airplanes.
--
-- **Features:**
--
-- * Patrol AI airplanes within a given zone.
-- * Trigger detected events when enemy airplanes are detected.
-- * Manage a fuel threshold to RTB on time.
-- * Manage a fuel treshold to RTB on time.
-- * Engage the enemy when detected.
--
--
-- ===
--
-- ### [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-release/CAP%20-%20Combat%20Air%20Patrol)
--
-- ===
--
@@ -18,25 +19,27 @@
-- ===
--
-- ### Author: **FlightControl**
-- ### Contributions:
-- ### Contributions:
--
-- * **[Quax](https://forums.eagle.ru/member.php?u=90530)**: Concept, Advice & Testing.
-- * **[Pikey](https://forums.eagle.ru/member.php?u=62835)**: Concept, Advice & Testing.
-- * **[Gunterlund](http://forums.eagle.ru:8080/member.php?u=75036)**: Test case revision.
-- * **[Whisper](http://forums.eagle.ru/member.php?u=3829): Testing.
-- * **[Delta99](https://forums.eagle.ru/member.php?u=125166): Testing.
-- * **[Delta99](https://forums.eagle.ru/member.php?u=125166): Testing.
--
-- ===
--
-- @module AI.AI_CAP
-- @module AI.AI_Cap
-- @image AI_Combat_Air_Patrol.JPG
--- @type AI_CAP_ZONE
-- @field Wrapper.Controllable#CONTROLLABLE AIControllable The @{Wrapper.Controllable} patrolling.
-- @field Core.Zone#ZONE_BASE TargetZone The @{Core.Zone} where the patrol needs to be executed.
-- @field Core.Zone#ZONE_BASE TargetZone The @{Zone} where the patrol needs to be executed.
-- @extends AI.AI_Patrol#AI_PATROL_ZONE
--- Implements the core functions to patrol a @{Core.Zone} by an AI @{Wrapper.Controllable} or @{Wrapper.Group}
--- Implements the core functions to patrol a @{Zone} by an AI @{Wrapper.Controllable} or @{Wrapper.Group}
-- and automatically engage any airborne enemies that are within a certain range or within a certain zone.
--
-- ![Process](..\Presentations\AI_CAP\Dia3.JPG)
@@ -62,8 +65,8 @@
--
-- ![Process](..\Presentations\AI_CAP\Dia10.JPG)
--
-- 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.
-- Until a fuel or damage treshold has been reached by the AI, or when the AI is commanded to RTB.
-- When the fuel treshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
--
-- ![Process](..\Presentations\AI_CAP\Dia13.JPG)
--
@@ -93,7 +96,7 @@
-- * **@{AI.AI_Patrol#AI_PATROL_ZONE.Detected}**: The AI has detected new targets.
-- * **@{#AI_CAP_ZONE.Destroy}**: The AI has destroyed a bogey @{Wrapper.Unit}.
-- * **@{#AI_CAP_ZONE.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 tresholds have been reached, the AI will RTB.
--
-- ## 3. Set the Range of Engagement
--
@@ -103,15 +106,15 @@
-- 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_CAP_ZONE.SetEngageRange}() to define that range.
-- Use the method @{AI.AI_CAP#AI_CAP_ZONE.SetEngageRange}() to define that range.
--
-- ## 4. Set the Zone of Engagement
--
-- ![Zone](..\Presentations\AI_CAP\Dia12.JPG)
--
-- An optional @{Core.Zone} can be set,
-- An optional @{Zone} can be set,
-- 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.AI_Cap#AI_CAP_ZONE.SetEngageZone}() to define that Zone.
--
-- ===
--
@@ -120,9 +123,11 @@ AI_CAP_ZONE = {
ClassName = "AI_CAP_ZONE",
}
--- Creates a new AI_CAP_ZONE object
-- @param #AI_CAP_ZONE self
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Core.Zone} where the patrol needs to be executed.
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Controllable} in km/h.
@@ -136,7 +141,7 @@ function AI_CAP_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
self.Accomplished = false
self.Engaging = false
self:AddTransition( { "Patrolling", "Engaging" }, "Engage", "Engaging" ) -- FSM_CONTROLLABLE Transition for type #AI_CAP_ZONE.
--- OnBefore Transition Handler for Event Engage.
@@ -147,7 +152,7 @@ function AI_CAP_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
-- @param #string Event The Event string.
-- @param #string To The To State string.
-- @return #boolean Return false to cancel Transition.
--- OnAfter Transition Handler for Event Engage.
-- @function [parent=#AI_CAP_ZONE] OnAfterEngage
-- @param #AI_CAP_ZONE self
@@ -155,11 +160,11 @@ function AI_CAP_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
--- Synchronous Event Trigger for Event Engage.
-- @function [parent=#AI_CAP_ZONE] Engage
-- @param #AI_CAP_ZONE self
--- Asynchronous Event Trigger for Event Engage.
-- @function [parent=#AI_CAP_ZONE] __Engage
-- @param #AI_CAP_ZONE self
@@ -183,7 +188,7 @@ function AI_CAP_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
-- @param #string To The To State string.
self:AddTransition( "Engaging", "Fired", "Engaging" ) -- FSM_CONTROLLABLE Transition for type #AI_CAP_ZONE.
--- OnBefore Transition Handler for Event Fired.
-- @function [parent=#AI_CAP_ZONE] OnBeforeFired
-- @param #AI_CAP_ZONE self
@@ -192,7 +197,7 @@ function AI_CAP_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
-- @param #string Event The Event string.
-- @param #string To The To State string.
-- @return #boolean Return false to cancel Transition.
--- OnAfter Transition Handler for Event Fired.
-- @function [parent=#AI_CAP_ZONE] OnAfterFired
-- @param #AI_CAP_ZONE self
@@ -200,11 +205,11 @@ function AI_CAP_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
--- Synchronous Event Trigger for Event Fired.
-- @function [parent=#AI_CAP_ZONE] Fired
-- @param #AI_CAP_ZONE self
--- Asynchronous Event Trigger for Event Fired.
-- @function [parent=#AI_CAP_ZONE] __Fired
-- @param #AI_CAP_ZONE self
@@ -220,7 +225,7 @@ function AI_CAP_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
-- @param #string Event The Event string.
-- @param #string To The To State string.
-- @return #boolean Return false to cancel Transition.
--- OnAfter Transition Handler for Event Destroy.
-- @function [parent=#AI_CAP_ZONE] OnAfterDestroy
-- @param #AI_CAP_ZONE self
@@ -228,16 +233,17 @@ function AI_CAP_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
--- Synchronous Event Trigger for Event Destroy.
-- @function [parent=#AI_CAP_ZONE] Destroy
-- @param #AI_CAP_ZONE self
--- Asynchronous Event Trigger for Event Destroy.
-- @function [parent=#AI_CAP_ZONE] __Destroy
-- @param #AI_CAP_ZONE self
-- @param #number Delay The delay in seconds.
self:AddTransition( "Engaging", "Abort", "Patrolling" ) -- FSM_CONTROLLABLE Transition for type #AI_CAP_ZONE.
--- OnBefore Transition Handler for Event Abort.
@@ -248,7 +254,7 @@ function AI_CAP_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
-- @param #string Event The Event string.
-- @param #string To The To State string.
-- @return #boolean Return false to cancel Transition.
--- OnAfter Transition Handler for Event Abort.
-- @function [parent=#AI_CAP_ZONE] OnAfterAbort
-- @param #AI_CAP_ZONE self
@@ -256,11 +262,11 @@ function AI_CAP_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
--- Synchronous Event Trigger for Event Abort.
-- @function [parent=#AI_CAP_ZONE] Abort
-- @param #AI_CAP_ZONE self
--- Asynchronous Event Trigger for Event Abort.
-- @function [parent=#AI_CAP_ZONE] __Abort
-- @param #AI_CAP_ZONE self
@@ -276,7 +282,7 @@ function AI_CAP_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
-- @param #string Event The Event string.
-- @param #string To The To State string.
-- @return #boolean Return false to cancel Transition.
--- OnAfter Transition Handler for Event Accomplish.
-- @function [parent=#AI_CAP_ZONE] OnAfterAccomplish
-- @param #AI_CAP_ZONE self
@@ -284,11 +290,11 @@ function AI_CAP_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
--- Synchronous Event Trigger for Event Accomplish.
-- @function [parent=#AI_CAP_ZONE] Accomplish
-- @param #AI_CAP_ZONE self
--- Asynchronous Event Trigger for Event Accomplish.
-- @function [parent=#AI_CAP_ZONE] __Accomplish
-- @param #AI_CAP_ZONE self
@@ -297,6 +303,7 @@ function AI_CAP_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
return self
end
--- Set the Engage Zone which defines where the AI will engage bogies.
-- @param #AI_CAP_ZONE self
-- @param Core.Zone#ZONE EngageZone The zone where the AI is performing CAP.
@@ -304,7 +311,7 @@ end
function AI_CAP_ZONE:SetEngageZone( EngageZone )
self:F2()
if EngageZone then
if EngageZone then
self.EngageZone = EngageZone
else
self.EngageZone = nil
@@ -339,6 +346,7 @@ function AI_CAP_ZONE:onafterStart( Controllable, From, Event, To )
end
--- @param AI.AI_CAP#AI_CAP_ZONE
-- @param Wrapper.Group#GROUP EngageGroup
function AI_CAP_ZONE.EngageRoute( EngageGroup, Fsm )
@@ -350,6 +358,8 @@ function AI_CAP_ZONE.EngageRoute( EngageGroup, Fsm )
end
end
--- @param #AI_CAP_ZONE self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
@@ -370,11 +380,11 @@ end
function AI_CAP_ZONE:onafterDetected( Controllable, From, Event, To )
if From ~= "Engaging" then
local Engage = false
for DetectedUnit, Detected in pairs( self.DetectedUnits ) do
local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT
self:T( DetectedUnit )
if DetectedUnit:IsAlive() and DetectedUnit:IsAir() then
@@ -382,7 +392,7 @@ function AI_CAP_ZONE:onafterDetected( Controllable, From, Event, To )
break
end
end
if Engage == true then
self:F( 'Detected -> Engaging' )
self:__Engage( 1 )
@@ -390,6 +400,7 @@ function AI_CAP_ZONE:onafterDetected( Controllable, From, Event, To )
end
end
--- @param #AI_CAP_ZONE self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
@@ -400,6 +411,9 @@ function AI_CAP_ZONE:onafterAbort( Controllable, From, Event, To )
self:__Route( 1 )
end
--- @param #AI_CAP_ZONE self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
@@ -413,23 +427,24 @@ function AI_CAP_ZONE:onafterEngage( Controllable, From, Event, To )
--- Calculate the current route point.
local CurrentVec2 = self.Controllable:GetVec2()
if not CurrentVec2 then return self end
--DONE: Create GetAltitude function for GROUP, and delete GetUnit(1).
local CurrentAltitude = self.Controllable:GetAltitude()
local CurrentPointVec3 = POINT_VEC3:New( CurrentVec2.x, CurrentAltitude, CurrentVec2.y )
local ToEngageZoneSpeed = self.PatrolMaxSpeed
local CurrentRoutePoint = CurrentPointVec3:WaypointAir(
self.PatrolAltType,
POINT_VEC3.RoutePointType.TurningPoint,
POINT_VEC3.RoutePointAction.TurningPoint,
ToEngageZoneSpeed,
true
local CurrentRoutePoint = CurrentPointVec3:WaypointAir(
self.PatrolAltType,
POINT_VEC3.RoutePointType.TurningPoint,
POINT_VEC3.RoutePointAction.TurningPoint,
ToEngageZoneSpeed,
true
)
EngageRoute[#EngageRoute+1] = CurrentRoutePoint
--- Find a random 2D point in PatrolZone.
local ToTargetVec2 = self.PatrolZone:GetRandomVec2()
self:T2( ToTargetVec2 )
@@ -438,17 +453,17 @@ function AI_CAP_ZONE:onafterEngage( Controllable, From, Event, To )
local ToTargetAltitude = math.random( self.EngageFloorAltitude, self.EngageCeilingAltitude )
local ToTargetSpeed = math.random( self.PatrolMinSpeed, self.PatrolMaxSpeed )
self:T2( { self.PatrolMinSpeed, self.PatrolMaxSpeed, ToTargetSpeed } )
--- Obtain a 3D @{Point} from the 2D point + altitude.
local ToTargetPointVec3 = POINT_VEC3:New( ToTargetVec2.x, ToTargetAltitude, ToTargetVec2.y )
--- Create a route point of type air.
local ToPatrolRoutePoint = ToTargetPointVec3:WaypointAir(
self.PatrolAltType,
POINT_VEC3.RoutePointType.TurningPoint,
POINT_VEC3.RoutePointAction.TurningPoint,
ToTargetSpeed,
true
local ToPatrolRoutePoint = ToTargetPointVec3:WaypointAir(
self.PatrolAltType,
POINT_VEC3.RoutePointType.TurningPoint,
POINT_VEC3.RoutePointAction.TurningPoint,
ToTargetSpeed,
true
)
EngageRoute[#EngageRoute+1] = ToPatrolRoutePoint
@@ -467,7 +482,7 @@ function AI_CAP_ZONE:onafterEngage( Controllable, From, Event, To )
self:F( {"Within Zone and Engaging ", DetectedUnit } )
AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit )
end
else
else
if self.EngageRange then
if DetectedUnit:GetPointVec3():Get2DDistance(Controllable:GetPointVec3() ) <= self.EngageRange then
self:F( {"Within Range and Engaging", DetectedUnit } )
@@ -491,12 +506,12 @@ function AI_CAP_ZONE:onafterEngage( Controllable, From, Event, To )
AttackTasks[#AttackTasks+1] = Controllable:TaskFunction( "AI_CAP_ZONE.EngageRoute", self )
EngageRoute[1].task = Controllable:TaskCombo( AttackTasks )
self:SetDetectionDeactivated()
end
Controllable:Route( EngageRoute, 0.5 )
end
end
+11 -11
View File
@@ -1,4 +1,4 @@
--- **AI** - Perform Close Air Support (CAS) near friendlies.
--- **AI** -- Perform Close Air Support (CAS) near friendlies.
--
-- **Features:**
--
@@ -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-release/CAS%20-%20Close%20Air%20Support)
--
-- ===
--
@@ -28,16 +28,16 @@
--
-- ===
--
-- @module AI.AI_CAS
-- @module AI.AI_Cas
-- @image AI_Close_Air_Support.JPG
--- AI_CAS_ZONE class
-- @type AI_CAS_ZONE
-- @field Wrapper.Controllable#CONTROLLABLE AIControllable The @{Wrapper.Controllable} patrolling.
-- @field Core.Zone#ZONE_BASE TargetZone The @{Core.Zone} where the patrol needs to be executed.
-- @field Core.Zone#ZONE_BASE TargetZone The @{Zone} where the patrol needs to be executed.
-- @extends AI.AI_Patrol#AI_PATROL_ZONE
--- Implements the core functions to provide Close Air Support in an Engage @{Core.Zone} by an AIR @{Wrapper.Controllable} or @{Wrapper.Group}.
--- Implements the core functions to provide Close Air Support in an Engage @{Zone} by an AIR @{Wrapper.Controllable} or @{Wrapper.Group}.
-- The AI_CAS_ZONE runs a process. It holds an AI in a Patrol Zone and when the AI is commanded to engage, it will fly to an Engage Zone.
--
-- ![HoldAndEngage](..\Presentations\AI_CAS\Dia3.JPG)
@@ -49,7 +49,7 @@
-- Upon started, The AI will **Route** itself towards the random 3D point within a 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.
-- This cycle will continue until a fuel or damage threshold has been reached by the AI, or when the AI is commanded to RTB.
-- This cycle will continue until a fuel or damage treshold has been reached by the AI, or when the AI is commanded to RTB.
--
-- ![Route Event](..\Presentations\AI_CAS\Dia5.JPG)
--
@@ -87,7 +87,7 @@
-- It will keep patrolling there, until it is notified to RTB or move to another CAS Zone.
-- It can be notified to go RTB through the **RTB** event.
--
-- When the fuel threshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
-- When the fuel treshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
--
-- ![Engage Event](..\Presentations\AI_CAS\Dia12.JPG)
--
@@ -117,7 +117,7 @@
-- * **@{AI.AI_Patrol#AI_PATROL_ZONE.Detected}**: The AI has detected new targets.
-- * **@{#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.
-- * **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 tresholds have been reached, the AI will RTB.
--
-- ===
--
@@ -130,7 +130,7 @@ AI_CAS_ZONE = {
--- Creates a new AI_CAS_ZONE object
-- @param #AI_CAS_ZONE self
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Core.Zone} where the patrol needs to be executed.
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Controllable} in km/h.
@@ -496,7 +496,7 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To,
AttackTasks[#AttackTasks+1] = Controllable:TaskFunction( "AI_CAS_ZONE.EngageRoute", self )
EngageRoute[#EngageRoute].task = Controllable:TaskCombo( AttackTasks )
--- Define a random point in the @{Core.Zone}. The AI will fly to that point within the zone.
--- Define a random point in the @{Zone}. The AI will fly to that point within the zone.
--- Find a random 2D point in EngageZone.
local ToTargetVec2 = self.EngageZone:GetRandomVec2()
@@ -520,7 +520,7 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To,
self:SetRefreshTimeInterval( 2 )
self:SetDetectionActivated()
self:__Target( -2 ) -- Start targeting
self:__Target( -2 ) -- Start Targetting
end
end
@@ -1,4 +1,4 @@
--- **AI** - Models the intelligent transportation of infantry and other cargo using Planes.
--- **AI** -- (R2.4) - Models the intelligent transportation of infantry and other cargo using Planes.
--
-- ## Features:
--
@@ -1,4 +1,4 @@
--- **AI** - Models the intelligent transportation of infantry and other cargo using Helicopters.
--- **AI** -- (2.4) - Models the intelligent transportation of infantry and other cargo using Helicopters.
--
-- ## Features:
--
@@ -1,4 +1,4 @@
--- **AI** - Models the intelligent transportation of infantry and other cargo using Ships.
--- **AI** -- (2.5.1) - Models the intelligent transportation of infantry and other cargo using Ships
--
-- ## Features:
--
@@ -37,14 +37,14 @@
--
-- This will be particularly helpful in order to determine how to **Tailor the different cargo handling events**.
--
-- The AI_CARGO_DISPATCHER_SHIP class uses the @{Cargo.Cargo} capabilities within the MOOSE framework.
-- The AI_CARGO_DISPATCHER_SHIP class uses the @{Cargo.Cargo} capabilities within the MOOSE framwork.
-- Also ensure that you fully understand how to declare and setup Cargo objects within the MOOSE framework before using this class.
-- CARGO derived objects must generally be declared within the mission to make the AI_CARGO_DISPATCHER_SHIP object recognize the cargo.
--
--
-- # 1) AI_CARGO_DISPATCHER_SHIP constructor.
--
-- * @{#AI_CARGO_DISPATCHER_SHIP.New}(): Creates a new AI_CARGO_DISPATCHER_SHIP object.
-- * @{AI_CARGO_DISPATCHER_SHIP.New}(): Creates a new AI_CARGO_DISPATCHER_SHIP object.
--
-- ---
--
+3 -3
View File
@@ -1,4 +1,4 @@
--- **AI** - Models the intelligent transportation of infantry and other cargo.
--- **AI** -- (R2.5.1) - Models the intelligent transportation of infantry and other cargo.
--
-- ===
--
@@ -46,12 +46,12 @@
--
-- ## Cargo deployment.
--
-- Using the @{#AI_CARGO_SHIP.Deploy}() method, you are able to direct the Ship towards a Deploy zone to unboard/unload the cargo at the
-- Using the @{AI_CARGO_SHIP.Deploy}() method, you are able to direct the Ship towards a Deploy zone to unboard/unload the cargo at the
-- specified coordinate. The Ship will follow the Shipping Lane to ensure consistent cargo transportation within the simulation environment.
--
-- ## Cargo pickup.
--
-- Using the @{#AI_CARGO_SHIP.Pickup}() method, you are able to direct the Ship towards a Pickup zone to board/load the cargo at the specified
-- Using the @{AI_CARGO_SHIP.Pickup}() method, you are able to direct the Ship towards a Pickup zone to board/load the cargo at the specified
-- coordinate. The Ship will follow the Shipping Lane to ensure consistent cargo transportation within the simulation environment.
--
--
+1 -1
View File
@@ -1,4 +1,4 @@
--- **AI** - Taking the lead of AI escorting your flight or of other AI.
--- **Functional** -- Taking the lead of AI escorting your flight or of other AI.
--
-- ===
--
@@ -11,7 +11,7 @@
--
-- ===
--
-- @module AI.AI_Escort_Dispatcher_Request
-- @module AI.AI_ESCORT_DISPATCHER_REQUEST
-- @image MOOSE.JPG
@@ -1,4 +1,4 @@
--- **AI** - Taking the lead of AI escorting your flight or of other AI, upon request using the menu.
--- **Functional** -- Taking the lead of AI escorting your flight or of other AI, upon request using the menu.
--
-- ===
--
@@ -143,7 +143,7 @@
--
-- ===
--
-- @module AI.AI_Escort_Request
-- @module AI.AI_Escort
-- @image Escorting.JPG
+2 -2
View File
@@ -1,4 +1,4 @@
--- **AI** - Build large airborne formations of aircraft.
--- **AI** -- Build large airborne formations of aircraft.
--
-- **Features:**
--
@@ -41,7 +41,7 @@
--- Build large formations, make AI follow a @{Wrapper.Client#CLIENT} (player) leader or a @{Wrapper.Unit#UNIT} (AI) leader.
--
-- AI_FORMATION makes AI @{Wrapper.Group#GROUP}s fly in formation of various compositions.
-- AI_FORMATION makes AI @{GROUP}s fly in formation of various compositions.
-- The AI_FORMATION class models formations in a different manner than the internal DCS formation logic!!!
-- The purpose of the class is to:
--
+53 -53
View File
@@ -1,10 +1,10 @@
--- **AI** - Perform Air Patrolling for airplanes.
--- **AI** -- Perform Air Patrolling for airplanes.
--
-- **Features:**
--
-- * Patrol AI airplanes within a given zone.
-- * Trigger detected events when enemy airplanes are detected.
-- * Manage a fuel threshold to RTB on time.
-- * Manage a fuel treshold to RTB on time.
--
-- ===
--
@@ -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-release/PAT%20-%20Patrolling)
--
-- ===
--
@@ -38,7 +38,7 @@
--- AI_PATROL_ZONE class
-- @type AI_PATROL_ZONE
-- @field Wrapper.Controllable#CONTROLLABLE AIControllable The @{Wrapper.Controllable} patrolling.
-- @field Core.Zone#ZONE_BASE PatrolZone The @{Core.Zone} where the patrol needs to be executed.
-- @field Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
-- @field DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
-- @field DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
-- @field DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Controllable} in km/h.
@@ -46,7 +46,7 @@
-- @field Core.Spawn#SPAWN CoordTest
-- @extends Core.Fsm#FSM_CONTROLLABLE
--- Implements the core functions to patrol a @{Core.Zone} by an AI @{Wrapper.Controllable} or @{Wrapper.Group}.
--- Implements the core functions to patrol a @{Zone} by an AI @{Wrapper.Controllable} or @{Wrapper.Group}.
--
-- ![Process](..\Presentations\AI_PATROL\Dia3.JPG)
--
@@ -72,8 +72,8 @@
--
-- ![Process](..\Presentations\AI_PATROL\Dia10.JPG)
--
-- 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.
-- Until a fuel or damage treshold has been reached by the AI, or when the AI is commanded to RTB.
-- When the fuel treshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
--
-- ![Process](..\Presentations\AI_PATROL\Dia11.JPG)
--
@@ -101,7 +101,7 @@
-- * **RTB** ( Group ): Route the AI to the home base.
-- * **Detect** ( Group ): The AI is detecting targets.
-- * **Detected** ( Group ): The AI has detected new targets.
-- * **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 tresholds have been reached, the AI will RTB.
--
-- ## 3. Set or Get the AI controllable
--
@@ -133,17 +133,17 @@
-- ## 6. Manage the "out of fuel" in the AI_PATROL_ZONE
--
-- When the AI is out of fuel, it is required that a new AI is started, before the old AI can return to the home base.
-- Therefore, with a parameter and a calculation of the distance to the home base, the fuel threshold is calculated.
-- When the fuel threshold is reached, the AI will continue for a given time its patrol task in orbit,
-- while a new AI is targeted to the AI_PATROL_ZONE.
-- Therefore, with a parameter and a calculation of the distance to the home base, the fuel treshold is calculated.
-- When the fuel treshold is reached, the AI will continue for a given time its patrol task in orbit,
-- while a new AI is targetted to the AI_PATROL_ZONE.
-- Once the time is finished, the old AI will return to the base.
-- Use the method @{#AI_PATROL_ZONE.ManageFuel}() to have this process in place.
-- Use the method @{#AI_PATROL_ZONE.ManageFuel}() to have this proces in place.
--
-- ## 7. Manage "damage" behaviour of the AI in the AI_PATROL_ZONE
--
-- 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).
-- Use the method @{#AI_PATROL_ZONE.ManageDamage}() to have this process in place.
-- Therefore, when the damage treshold is reached, the AI will return immediately to the home base (RTB).
-- Use the method @{#AI_PATROL_ZONE.ManageDamage}() to have this proces in place.
--
-- ===
--
@@ -154,7 +154,7 @@ AI_PATROL_ZONE = {
--- Creates a new AI_PATROL_ZONE object
-- @param #AI_PATROL_ZONE self
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Core.Zone} where the patrol needs to be executed.
-- @param Core.Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
-- @param DCS#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
-- @param DCS#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
-- @param DCS#Speed PatrolMinSpeed The minimum speed of the @{Wrapper.Controllable} in km/h.
@@ -170,27 +170,27 @@ function AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltit
-- Inherits from BASE
local self = BASE:Inherit( self, FSM_CONTROLLABLE:New() ) -- #AI_PATROL_ZONE
self.PatrolZone = PatrolZone
self.PatrolFloorAltitude = PatrolFloorAltitude
self.PatrolCeilingAltitude = PatrolCeilingAltitude
self.PatrolMinSpeed = PatrolMinSpeed
self.PatrolMaxSpeed = PatrolMaxSpeed
-- defafult PatrolAltType to "BARO" if not specified
self.PatrolAltType = PatrolAltType or "BARO"
self:SetRefreshTimeInterval( 30 )
self.CheckStatus = true
self:ManageFuel( .2, 60 )
self:ManageDamage( 1 )
self.DetectedUnits = {} -- This table contains the targets detected during patrol.
self:SetStartState( "None" )
self:AddTransition( "*", "Stop", "Stopped" )
@@ -228,7 +228,7 @@ function AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltit
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
--- Synchronous Event Trigger for Event Stop.
-- @function [parent=#AI_PATROL_ZONE] Stop
-- @param #AI_PATROL_ZONE self
@@ -256,7 +256,7 @@ function AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltit
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
--- Synchronous Event Trigger for Event Start.
-- @function [parent=#AI_PATROL_ZONE] Start
-- @param #AI_PATROL_ZONE self
@@ -329,7 +329,7 @@ function AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltit
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
--- Synchronous Event Trigger for Event Status.
-- @function [parent=#AI_PATROL_ZONE] Status
-- @param #AI_PATROL_ZONE self
@@ -413,7 +413,7 @@ function AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltit
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
--- Synchronous Event Trigger for Event RTB.
-- @function [parent=#AI_PATROL_ZONE] RTB
-- @param #AI_PATROL_ZONE self
@@ -441,11 +441,11 @@ function AI_PATROL_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltit
-- @param #string To The To State string.
self:AddTransition( "*", "Reset", "Patrolling" ) -- FSM_CONTROLLABLE Transition for type #AI_PATROL_ZONE.
self:AddTransition( "*", "Eject", "*" )
self:AddTransition( "*", "Crash", "Crashed" )
self:AddTransition( "*", "PilotDead", "*" )
return self
end
@@ -459,7 +459,7 @@ end
-- @return #AI_PATROL_ZONE self
function AI_PATROL_ZONE:SetSpeed( PatrolMinSpeed, PatrolMaxSpeed )
self:F2( { PatrolMinSpeed, PatrolMaxSpeed } )
self.PatrolMinSpeed = PatrolMinSpeed
self.PatrolMaxSpeed = PatrolMaxSpeed
end
@@ -473,7 +473,7 @@ end
-- @return #AI_PATROL_ZONE self
function AI_PATROL_ZONE:SetAltitude( PatrolFloorAltitude, PatrolCeilingAltitude )
self:F2( { PatrolFloorAltitude, PatrolCeilingAltitude } )
self.PatrolFloorAltitude = PatrolFloorAltitude
self.PatrolCeilingAltitude = PatrolCeilingAltitude
end
@@ -581,56 +581,56 @@ function AI_PATROL_ZONE:ClearDetectedUnits()
end
--- When the AI is out of fuel, it is required that a new AI is started, before the old AI can return to the home base.
-- Therefore, with a parameter and a calculation of the distance to the home base, the fuel threshold is calculated.
-- When the fuel threshold is reached, the AI will continue for a given time its patrol task in orbit, while a new AIControllable is targeted to the AI_PATROL_ZONE.
-- Therefore, with a parameter and a calculation of the distance to the home base, the fuel treshold is calculated.
-- When the fuel treshold is reached, the AI will continue for a given time its patrol task in orbit, while a new AIControllable is targetted to the AI_PATROL_ZONE.
-- Once the time is finished, the old AI will return to the base.
-- @param #AI_PATROL_ZONE self
-- @param #number PatrolFuelThresholdPercentage The threshold in percentage (between 0 and 1) when the AIControllable is considered to get out of fuel.
-- @param #number PatrolFuelThresholdPercentage The treshold in percentage (between 0 and 1) when the AIControllable is considered to get out of fuel.
-- @param #number PatrolOutOfFuelOrbitTime The amount of seconds the out of fuel AIControllable will orbit before returning to the base.
-- @return #AI_PATROL_ZONE self
function AI_PATROL_ZONE:ManageFuel( PatrolFuelThresholdPercentage, PatrolOutOfFuelOrbitTime )
self.PatrolFuelThresholdPercentage = PatrolFuelThresholdPercentage
self.PatrolOutOfFuelOrbitTime = PatrolOutOfFuelOrbitTime
return self
end
--- When the AI is damaged beyond a certain threshold, it is required that the AI returns to the home base.
--- When the AI is damaged beyond a certain treshold, it is required that the AI returns to the home base.
-- However, damage cannot be foreseen early on.
-- Therefore, when the damage threshold is reached,
-- Therefore, when the damage treshold is reached,
-- the AI will return immediately to the home base (RTB).
-- Note that for groups, the average damage of the complete group will be calculated.
-- So, in a group of 4 airplanes, 2 lost and 2 with damage 0.2, the damage threshold will be 0.25.
-- So, in a group of 4 airplanes, 2 lost and 2 with damage 0.2, the damage treshold will be 0.25.
-- @param #AI_PATROL_ZONE self
-- @param #number PatrolDamageThreshold The threshold in percentage (between 0 and 1) when the AI is considered to be damaged.
-- @param #number PatrolDamageThreshold The treshold in percentage (between 0 and 1) when the AI is considered to be damaged.
-- @return #AI_PATROL_ZONE self
function AI_PATROL_ZONE:ManageDamage( PatrolDamageThreshold )
self.PatrolManageDamage = true
self.PatrolDamageThreshold = PatrolDamageThreshold
return self
end
--- Defines a new patrol route using the @{#AI_PATROL_ZONE} parameters and settings.
--- Defines a new patrol route using the @{Process_PatrolZone} parameters and settings.
-- @param #AI_PATROL_ZONE self
-- @return #AI_PATROL_ZONE self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
-- @return #AI_PATROL_ZONE self
function AI_PATROL_ZONE:onafterStart( Controllable, From, Event, To )
self:F2()
self:__Route( 1 ) -- Route to the patrol point. The asynchronous trigger is important, because a spawned group and units takes at least one second to come live.
self:__Status( 60 ) -- Check status status every 30 seconds.
self:SetDetectionActivated()
self:HandleEvent( EVENTS.PilotDead, self.OnPilotDead )
self:HandleEvent( EVENTS.Crash, self.OnCrash )
self:HandleEvent( EVENTS.Ejection, self.OnEjection )
Controllable:OptionROEHoldFire()
Controllable:OptionROTVertical()
@@ -667,12 +667,12 @@ function AI_PATROL_ZONE:onafterDetect( Controllable, From, Event, To )
if TargetObject and TargetObject:isExist() and TargetObject.id_ < 50000000 then
local TargetUnit = UNIT:Find( TargetObject )
-- Check that target is alive due to issue https://github.com/FlightControl-Master/MOOSE/issues/1234
if TargetUnit and TargetUnit:IsAlive() then
local TargetUnitName = TargetUnit:GetName()
if self.DetectionZone then
if TargetUnit:IsInZone( self.DetectionZone ) then
self:T( {"Detected ", TargetUnit } )
@@ -687,13 +687,13 @@ function AI_PATROL_ZONE:onafterDetect( Controllable, From, Event, To )
end
Detected = true
end
end
end
end
self:__Detect( -self.DetectInterval )
if Detected == true then
self:__Detected( 1.5 )
end
@@ -701,7 +701,7 @@ function AI_PATROL_ZONE:onafterDetect( Controllable, From, Event, To )
end
--- @param Wrapper.Controllable#CONTROLLABLE AIControllable
-- This static method is called from the route path within the last task at the last waypoint of the Controllable.
-- This statis method is called from the route path within the last task at the last waaypoint of the Controllable.
-- Note that this method is required, as triggers the next route when patrolling for the Controllable.
function AI_PATROL_ZONE:_NewPatrolRoute( AIControllable )
@@ -710,7 +710,7 @@ function AI_PATROL_ZONE:_NewPatrolRoute( AIControllable )
end
--- Defines a new patrol route using the @{#AI_PATROL_ZONE} parameters and settings.
--- Defines a new patrol route using the @{Process_PatrolZone} parameters and settings.
-- @param #AI_PATROL_ZONE self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable The Controllable Object managed by the FSM.
-- @param #string From The From State string.
@@ -729,7 +729,7 @@ function AI_PATROL_ZONE:onafterRoute( Controllable, From, Event, To )
if self.Controllable:IsAlive() and life > 1 then
-- Determine if the AIControllable is within the PatrolZone.
-- If not, make a waypoint within the to that the AIControllable will fly at maximum speed to that point.
local PatrolRoute = {}
-- Calculate the current route point of the controllable as the start point of the route.
@@ -775,7 +775,7 @@ function AI_PATROL_ZONE:onafterRoute( Controllable, From, Event, To )
end
--- Define a random point in the @{Core.Zone}. The AI will fly to that point within the zone.
--- Define a random point in the @{Zone}. The AI will fly to that point within the zone.
--- Find a random 2D point in PatrolZone.
local ToTargetVec2 = self.PatrolZone:GetRandomVec2()
@@ -1,10 +1,10 @@
--- **Actions** - ACT_ACCOUNT_ classes **account for** (detect, count & report) various DCS events occurring on UNITs.
--- **Actions** - ACT_ACCOUNT_ classes **account for** (detect, count & report) various DCS events occuring on @{Wrapper.Unit}s.
--
-- ![Banner Image](..\Presentations\ACT_ACCOUNT\Dia1.JPG)
--
-- ===
--
-- @module Actions.Act_Account
-- @module Actions.Account
-- @image MOOSE.JPG
do -- ACT_ACCOUNT
@@ -20,7 +20,7 @@ do -- ACT_ACCOUNT
--
-- ### ACT_ACCOUNT States
--
-- * **Assigned**: The player is assigned.
-- * **Asigned**: The player is assigned.
-- * **Waiting**: Waiting for an event.
-- * **Report**: Reporting.
-- * **Account**: Account for an event.
@@ -104,6 +104,7 @@ do -- ACT_ACCOUNT
self:__Wait( 1 )
end
--- StateMachine callback function
-- @param #ACT_ACCOUNT self
-- @param Wrapper.Unit#UNIT ProcessUnit
@@ -140,7 +141,7 @@ do -- ACT_ACCOUNT_DEADS
--- # @{#ACT_ACCOUNT_DEADS} FSM class, extends @{Core.Fsm.Account#ACT_ACCOUNT}
--
-- 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 @{Set} of units that will be tracked upon successful destruction.
-- The process will end after each target has been successfully destroyed.
-- Each successful dead will trigger an Account state transition that can be scored, modified or administered.
--
@@ -156,6 +157,7 @@ do -- ACT_ACCOUNT_DEADS
ClassName = "ACT_ACCOUNT_DEADS",
}
--- Creates a new DESTROY process.
-- @param #ACT_ACCOUNT_DEADS self
-- @param Core.Set#SET_UNIT TargetSetUnit
@@ -193,6 +195,7 @@ do -- ACT_ACCOUNT_DEADS
self:GetCommandCenter():MessageTypeToGroup( MessageText, ProcessUnit:GetGroup(), MESSAGE.Type.Information )
end
--- StateMachine callback function
-- @param #ACT_ACCOUNT_DEADS self
-- @param Wrapper.Unit#UNIT ProcessUnit
@@ -267,6 +270,7 @@ do -- ACT_ACCOUNT_DEADS
end
end
--- DCS Events
--- @param #ACT_ACCOUNT_DEADS self
@@ -77,7 +77,7 @@
--
-- ===
--
-- @module Actions.Act_Assign
-- @module Actions.Assign
-- @image MOOSE.JPG
@@ -50,7 +50,7 @@
--
-- # 1) @{#ACT_ASSIST_SMOKE_TARGETS_ZONE} class, extends @{Core.Fsm.Route#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 @{Zone}.
-- The targets are smoked within a certain range around each target, simulating a realistic smoking behaviour.
-- At random intervals, a new target is smoked.
--
@@ -60,7 +60,7 @@
--
-- ===
--
-- @module Actions.Act_Assist
-- @module Actions.Assist
-- @image MOOSE.JPG
@@ -62,7 +62,7 @@
--
-- # 1) @{#ACT_ROUTE_ZONE} class, extends @{Core.Fsm.Route#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 @{Zone}.
-- The player receives on perioding times messages with the coordinates of the route to follow.
-- Upon arrival at the zone, a confirmation of arrival is sent, and the process will be ended.
--
@@ -72,7 +72,7 @@
--
-- ===
--
-- @module Actions.Act_Route
-- @module Actions.Route
-- @image MOOSE.JPG
+157 -122
View File
@@ -66,7 +66,7 @@
-- you can board the cargo into the carrier `CargoCarrier`.
-- Simple, isn't it? Told you, and this is only the beginning.
--
-- The boarding, unboarding, loading, unloading of cargo is however something that is not meant to be coded manually by mission designers.
-- The boarding, unboarding, loading, unloading of cargo is however something that is not meant to be coded manualy by mission designers.
-- It would be too low-level and not end-user friendly to deal with cargo handling complexity.
-- Things can become really complex if you want to make cargo being handled and behave in multiple scenarios.
--
@@ -77,8 +77,8 @@
--
-- ## 3.1) AI Cargo handlers.
--
-- - @{AI.AI_Cargo_APC} will create for you the capability to make an APC group handle cargo.
-- - @{AI.AI_Cargo_Helicopter} will create for you the capability to make a Helicopter group handle cargo.
-- - @{AI.AI_Cargo_APC} will create for you the capatility to make an APC group handle cargo.
-- - @{AI.AI_Cargo_Helicopter} will create for you the capatility to make a Helicopter group handle cargo.
--
--
-- ## 3.2) AI Cargo transportation dispatchers.
@@ -86,7 +86,7 @@
-- 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_Helicopters} derived classes will create for your dynamic cargo handlers controlled by AI helicopter groups to transport cargo between sites.
-- - @{AI.AI_Cargo_Dispatcher_Helicopters} derived classes will create for your dynamic cargo handlers controlled by AI helicpter groups to transport cargo between sites.
--
-- ## 3.3) Cargo transportation tasking.
--
@@ -94,7 +94,7 @@
--
-- - @{Tasking.Task_CARGO} derived classes will create for you cargo transportation tasks, that allow human players to interact with MOOSE cargo objects to complete tasks.
--
-- Please refer to the documentation reflected within these modules to understand the detailed capabilities.
-- Please refer to the documentation reflected within these modules to understand the detailed capabilties.
--
-- # 4) Cargo SETs.
--
@@ -194,7 +194,7 @@
-- * is of type `Workmaterials`
-- * will report when a carrier is within 500 meters
-- * will board to carriers when the carrier is within 500 meters from the cargo object
-- * will disappear when the cargo is within 25 meters from the carrier during boarding
-- * will dissapear when the cargo is within 25 meters from the carrier during boarding
--
-- So the overall syntax of the #CARGO naming tag and arguments are:
--
@@ -206,29 +206,27 @@
-- * **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.
--
-- ## 5.2) The \#CARGO tag to create CARGO_CRATE or CARGO_SLINGLOAD objects:
-- ## 5.2) The \#CARGO tag to create CARGO_CRATE objects:
--
-- You can also use the \#CARGO tag on **static** objects, including **static cargo** objects of the mission editor.
--
-- For example, the following #CARGO naming in the **static name** of the object, will create a CARGO_CRATE object when the mission starts.
--
-- `Static #CARGO(T=Workmaterials,C=CRATE,RR=500,NR=25)`
-- `Static #CARGO(T=Workmaterials,RR=500,NR=25)`
--
-- This will create a CARGO_CRATE object:
--
-- * with the group name `Static #CARGO`
-- * is of type `Workmaterials`
-- * is of category `CRATE` (as opposed to `SLING`)
-- * will report when a carrier is within 500 meters
-- * will board to carriers when the carrier is within 500 meters from the cargo object
-- * will disappear when the cargo is within 25 meters from the carrier during boarding
-- * will dissapear when the cargo is within 25 meters from the carrier during boarding
--
-- So the overall syntax of the #CARGO naming tag and arguments are:
--
-- `StaticName #CARGO(T=CargoTypeName,C=Category,RR=Range,NR=Range)`
-- `StaticName #CARGO(T=CargoTypeName,RR=Range,NR=Range)`
--
-- * **T=** Provide a text that contains the type name of the cargo object. This type name can be used to filter cargo within a SET_CARGO object.
-- * **C=** Provide either `CRATE` or `SLING` to have this static created as a CARGO_CRATE or CARGO_SLINGLOAD respectively.
-- * **RR=** Provide the minimal range in meters when the report to the carrier, and board to the carrier.
-- 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.
@@ -377,7 +375,7 @@ do -- CARGO
-- @field #boolean Moveable This flag defines if the cargo is moveable.
-- @field #boolean Representable This flag defines if the cargo can be represented by a DCS Unit.
-- @field #boolean Containable This flag defines if the cargo can be contained within a DCS Unit.
--- Defines the core functions that defines a cargo object within MOOSE.
--
-- A cargo is a **logical object** defined that is available for transport, and has a life status within a simulation.
@@ -430,7 +428,8 @@ do -- CARGO
--- @type CARGO.CargoObjects
-- @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.
-- @param #CARGO self
-- @param #string Type
@@ -440,10 +439,10 @@ do -- CARGO
-- @param #number NearRadius (optional)
-- @return #CARGO
function CARGO:New( Type, Name, Weight, LoadRadius, NearRadius ) --R2.1
local self = BASE:Inherit( self, FSM:New() ) -- #CARGO
self:F( { Type, Name, Weight, LoadRadius, NearRadius } )
self:SetStartState( "UnLoaded" )
self:AddTransition( { "UnLoaded", "Boarding" }, "Board", "Boarding" )
self:AddTransition( "Boarding" , "Boarding", "Boarding" )
@@ -458,7 +457,7 @@ do -- CARGO
self:AddTransition( "*", "Destroyed", "Destroyed" )
self:AddTransition( "*", "Respawn", "UnLoaded" )
self:AddTransition( "*", "Reset", "UnLoaded" )
self.Type = Type
self.Name = Name
self.Weight = Weight or 0
@@ -470,29 +469,31 @@ do -- CARGO
self.Containable = false
self.CargoLimit = 0
self.LoadRadius = LoadRadius or 500
--self.NearRadius = NearRadius or 25
self:SetDeployed( false )
self.CargoScheduler = SCHEDULER:New()
CARGOS[self.Name] = self
return self
end
--- Find a CARGO in the _DATABASE.
-- @param #CARGO self
-- @param #string CargoName The Cargo Name.
-- @return #CARGO self
function CARGO:FindByName( CargoName )
local CargoFound = _DATABASE:FindCargo( CargoName )
return CargoFound
end
--- Get the x position of the cargo.
-- @param #CARGO self
-- @return #number
@@ -501,9 +502,9 @@ do -- CARGO
return self.CargoCarrier:GetCoordinate().x
else
return self.CargoObject:GetCoordinate().x
end
end
end
--- Get the y position of the cargo.
-- @param #CARGO self
-- @return #number
@@ -512,9 +513,9 @@ do -- CARGO
return self.CargoCarrier:GetCoordinate().z
else
return self.CargoObject:GetCoordinate().z
end
end
end
--- Get the heading of the cargo.
-- @param #CARGO self
-- @return #number
@@ -523,21 +524,22 @@ do -- CARGO
return self.CargoCarrier:GetHeading()
else
return self.CargoObject:GetHeading()
end
end
end
--- Check if the cargo can be Slingloaded.
-- @param #CARGO self
function CARGO:CanSlingload()
return false
end
--- Check if the cargo can be Boarded.
-- @param #CARGO self
function CARGO:CanBoard()
return true
end
--- Check if the cargo can be Unboarded.
-- @param #CARGO self
function CARGO:CanUnboard()
@@ -549,13 +551,14 @@ do -- CARGO
function CARGO:CanLoad()
return true
end
--- Check if the cargo can be Unloaded.
-- @param #CARGO self
function CARGO:CanUnload()
return true
end
--- Destroy the cargo.
-- @param #CARGO self
function CARGO:Destroy()
@@ -564,14 +567,14 @@ do -- CARGO
end
self:Destroyed()
end
--- Get the name of the Cargo.
-- @param #CARGO self
-- @return #string The name of the Cargo.
function CARGO:GetName() --R2.1
return self.Name
end
--- Get the current active object representing or being the Cargo.
-- @param #CARGO self
-- @return Wrapper.Positionable#POSITIONABLE The object representing or being the Cargo.
@@ -580,9 +583,9 @@ do -- CARGO
return self.CargoCarrier
else
return self.CargoObject
end
end
end
--- Get the object name of the Cargo.
-- @param #CARGO self
-- @return #string The object name of the Cargo.
@@ -591,9 +594,9 @@ do -- CARGO
return self.CargoCarrier:GetName()
else
return self.CargoObject:GetName()
end
end
end
--- Get the amount of Cargo.
-- @param #CARGO self
-- @return #number The amount of Cargo.
@@ -608,6 +611,7 @@ do -- CARGO
return self.Type
end
--- Get the transportation method of the Cargo.
-- @param #CARGO self
-- @return #string The transportation method of the Cargo.
@@ -615,6 +619,7 @@ do -- CARGO
return self.TransportationMethod
end
--- Get the coalition of the Cargo.
-- @param #CARGO self
-- @return Coalition
@@ -623,30 +628,32 @@ do -- CARGO
return self.CargoCarrier:GetCoalition()
else
return self.CargoObject:GetCoalition()
end
end
end
--- Get the current coordinates of the Cargo.
-- @param #CARGO self
-- @return Core.Point#COORDINATE The coordinates of the Cargo.
function CARGO:GetCoordinate()
return self.CargoObject:GetCoordinate()
end
--- Check if cargo is destroyed.
-- @param #CARGO self
-- @return #boolean true if destroyed
function CARGO:IsDestroyed()
return self:Is( "Destroyed" )
end
--- Check if cargo is loaded.
-- @param #CARGO self
-- @return #boolean true if loaded
function CARGO:IsLoaded()
return self:Is( "Loaded" )
end
--- Check if cargo is loaded.
-- @param #CARGO self
-- @param Wrapper.Unit#UNIT Carrier
@@ -654,14 +661,14 @@ do -- CARGO
function CARGO:IsLoadedInCarrier( Carrier )
return self.CargoCarrier and self.CargoCarrier:GetName() == Carrier:GetName()
end
--- Check if cargo is unloaded.
-- @param #CARGO self
-- @return #boolean true if unloaded
function CARGO:IsUnLoaded()
return self:Is( "UnLoaded" )
end
--- Check if cargo is boarding.
-- @param #CARGO self
-- @return #boolean true if boarding
@@ -669,47 +676,52 @@ do -- CARGO
return self:Is( "Boarding" )
end
--- Check if cargo is unboarding.
-- @param #CARGO self
-- @return #boolean true if unboarding
function CARGO:IsUnboarding()
return self:Is( "UnBoarding" )
end
--- Check if cargo is alive.
-- @param #CARGO self
-- @return #boolean true if unloaded
function CARGO:IsAlive()
if self:IsLoaded() then
return self.CargoCarrier:IsAlive()
else
return self.CargoObject:IsAlive()
end
end
end
--- Set the cargo as deployed.
-- @param #CARGO self
-- @param #boolean Deployed true if the cargo is to be deployed. false or nil otherwise.
function CARGO:SetDeployed( Deployed )
self.Deployed = Deployed
end
--- Is the cargo deployed
-- @param #CARGO self
-- @return #boolean
function CARGO:IsDeployed()
return self.Deployed
end
--- Template method to spawn a new representation of the CARGO in the simulator.
-- @param #CARGO self
-- @return #CARGO
function CARGO:Spawn( PointVec2 )
self:F()
end
--- Signal a flare at the position of the CARGO.
-- @param #CARGO self
-- @param Utilities.Utils#FLARECOLOR FlareColor
@@ -718,31 +730,31 @@ do -- CARGO
trigger.action.signalFlare( self.CargoObject:GetVec3(), FlareColor , 0 )
end
end
--- Signal a white flare at the position of the CARGO.
-- @param #CARGO self
function CARGO:FlareWhite()
self:Flare( trigger.flareColor.White )
end
--- Signal a yellow flare at the position of the CARGO.
-- @param #CARGO self
function CARGO:FlareYellow()
self:Flare( trigger.flareColor.Yellow )
end
--- Signal a green flare at the position of the CARGO.
-- @param #CARGO self
function CARGO:FlareGreen()
self:Flare( trigger.flareColor.Green )
end
--- Signal a red flare at the position of the CARGO.
-- @param #CARGO self
function CARGO:FlareRed()
self:Flare( trigger.flareColor.Red )
end
--- Smoke the CARGO.
-- @param #CARGO self
-- @param Utilities.Utils#SMOKECOLOR SmokeColor The color of the smoke.
@@ -756,37 +768,38 @@ do -- CARGO
end
end
end
--- Smoke the CARGO Green.
-- @param #CARGO self
function CARGO:SmokeGreen()
self:Smoke( trigger.smokeColor.Green, Range )
end
--- Smoke the CARGO Red.
-- @param #CARGO self
function CARGO:SmokeRed()
self:Smoke( trigger.smokeColor.Red, Range )
end
--- Smoke the CARGO White.
-- @param #CARGO self
function CARGO:SmokeWhite()
self:Smoke( trigger.smokeColor.White, Range )
end
--- Smoke the CARGO Orange.
-- @param #CARGO self
function CARGO:SmokeOrange()
self:Smoke( trigger.smokeColor.Orange, Range )
end
--- Smoke the CARGO Blue.
-- @param #CARGO self
function CARGO:SmokeBlue()
self:Smoke( trigger.smokeColor.Blue, Range )
end
--- Set the Load radius, which is the radius till when the Cargo can be loaded.
-- @param #CARGO self
-- @param #number LoadRadius The radius till Cargo can be loaded.
@@ -794,21 +807,23 @@ do -- CARGO
function CARGO:SetLoadRadius( LoadRadius )
self.LoadRadius = LoadRadius or 150
end
--- Get the Load radius, which is the radius till when the Cargo can be loaded.
-- @param #CARGO self
-- @return #number The radius till Cargo can be loaded.
function CARGO:GetLoadRadius()
return self.LoadRadius
end
--- Check if Cargo is in the LoadRadius for the Cargo to be Boarded or Loaded.
-- @param #CARGO self
-- @param Core.Point#COORDINATE Coordinate
-- @return #boolean true if the CargoGroup is within the loading radius.
function CARGO:IsInLoadRadius( Coordinate )
self:F( { Coordinate, LoadRadius = self.LoadRadius } )
local Distance = 0
if self:IsUnLoaded() then
local CargoCoordinate = self.CargoObject:GetCoordinate()
@@ -818,17 +833,18 @@ do -- CARGO
return true
end
end
return false
end
--- Check if the Cargo can report itself to be Boarded or Loaded.
-- @param #CARGO self
-- @param Core.Point#COORDINATE Coordinate
-- @return #boolean true if the Cargo can report itself.
function CARGO:IsInReportRadius( Coordinate )
self:F( { Coordinate } )
local Distance = 0
if self:IsUnLoaded() then
Distance = Coordinate:Get2DDistance( self.CargoObject:GetCoordinate() )
@@ -837,7 +853,7 @@ do -- CARGO
return true
end
end
return false
end
@@ -849,7 +865,7 @@ do -- CARGO
-- @return #boolean
function CARGO:IsNear( Coordinate, NearRadius )
--self:F( { PointVec2 = PointVec2, NearRadius = NearRadius } )
if self.CargoObject:IsAlive() then
--local Distance = PointVec2:Get2DDistance( self.CargoObject:GetPointVec2() )
--self:F( { CargoObjectName = self.CargoObject:GetName() } )
@@ -857,24 +873,26 @@ do -- CARGO
--self:F( { PointVec2 = PointVec2:GetVec2() } )
local Distance = Coordinate:Get2DDistance( self.CargoObject:GetCoordinate() )
--self:F( { Distance = Distance, NearRadius = NearRadius or "nil" } )
if Distance <= NearRadius then
--self:F( { PointVec2 = PointVec2, NearRadius = NearRadius, IsNear = true } )
return true
end
end
--self:F( { PointVec2 = PointVec2, NearRadius = NearRadius, IsNear = false } )
return false
end
--- Check if Cargo is the given @{Core.Zone}.
--- Check if Cargo is the given @{Zone}.
-- @param #CARGO self
-- @param Core.Zone#ZONE_BASE Zone
-- @return #boolean **true** if cargo is in the Zone, **false** if cargo is not in the Zone.
function CARGO:IsInZone( Zone )
--self:F( { Zone } )
if self:IsLoaded() then
return Zone:IsPointVec2InZone( self.CargoCarrier:GetPointVec2() )
else
@@ -884,33 +902,34 @@ do -- CARGO
else
return false
end
end
end
return nil
end
--- Get the current PointVec2 of the cargo.
-- @param #CARGO self
-- @return Core.Point#POINT_VEC2
function CARGO:GetPointVec2()
return self.CargoObject:GetPointVec2()
end
--- Get the current Coordinate of the cargo.
-- @param #CARGO self
-- @return Core.Point#COORDINATE
function CARGO:GetCoordinate()
return self.CargoObject:GetCoordinate()
end
--- Get the weight of the cargo.
-- @param #CARGO self
-- @return #number Weight The weight in kg.
function CARGO:GetWeight()
return self.Weight
end
--- Set the weight of the cargo.
-- @param #CARGO self
-- @param #number Weight The weight in kg.
@@ -919,14 +938,14 @@ do -- CARGO
self.Weight = Weight
return self
end
--- Get the volume of the cargo.
-- @param #CARGO self
-- @return #number Volume The volume in kg.
function CARGO:GetVolume()
return self.Volume
end
--- Set the volume of the cargo.
-- @param #CARGO self
-- @param #number Volume The volume in kg.
@@ -935,18 +954,18 @@ do -- CARGO
self.Volume = Volume
return self
end
--- Send a CC message to a @{Wrapper.Group}.
-- @param #CARGO self
-- @param #string Message
-- @param Wrapper.Group#GROUP CarrierGroup The Carrier Group.
-- @param #string Name (optional) The name of the Group used as a prefix for the message to the Group. If not provided, there will be nothing shown.
function CARGO:MessageToGroup( Message, CarrierGroup, Name )
MESSAGE:New( Message, 20, "Cargo " .. self:GetName() ):ToGroup( CarrierGroup )
end
--- Report to a Carrier Group.
-- @param #CARGO self
-- @param #string Action The string describing the action for the cargo.
@@ -972,7 +991,8 @@ do -- CARGO
end
end
end
--- Report to a Carrier Group with a Flaring signal.
-- @param #CARGO self
-- @param Utils#UTILS.FlareColor FlareColor the color of the flare.
@@ -981,7 +1001,8 @@ do -- CARGO
self.ReportFlareColor = FlareColor
end
--- Report to a Carrier Group with a Smoking signal.
-- @param #CARGO self
-- @param Utils#UTILS.SmokeColor SmokeColor the color of the smoke.
@@ -990,7 +1011,8 @@ do -- CARGO
self.ReportSmokeColor = SmokeColor
end
--- Reset the reporting for a Carrier Group.
-- @param #CARGO self
-- @param #string Action The string describing the action for the cargo.
@@ -1000,7 +1022,7 @@ do -- CARGO
self.Reported[CarrierGroup][Action] = nil
end
--- Reset all the reporting for a Carrier Group.
-- @param #CARGO self
-- @param Wrapper.Group#GROUP CarrierGroup The Carrier Group to send the report to.
@@ -1009,7 +1031,7 @@ do -- CARGO
self.Reported[CarrierGroup] = nil
end
--- Respawn the cargo when destroyed
-- @param #CARGO self
-- @param #boolean RespawnDestroyed
@@ -1022,8 +1044,11 @@ do -- CARGO
else
self.onenterDestroyed = nil
end
end
end -- CARGO
@@ -1048,7 +1073,7 @@ do -- CARGO_REPRESENTABLE
-- @param #number NearRadius (optional) Radius in meters when the cargo is loaded into the carrier.
-- @return #CARGO_REPRESENTABLE
function CARGO_REPRESENTABLE:New( CargoObject, Type, Name, LoadRadius, NearRadius )
-- Inherit CARGO.
local self = BASE:Inherit( self, CARGO:New( Type, Name, 0, LoadRadius, NearRadius ) ) -- #CARGO_REPRESENTABLE
self:F( { Type, Name, LoadRadius, NearRadius } )
@@ -1056,10 +1081,10 @@ do -- CARGO_REPRESENTABLE
-- Descriptors.
local Desc=CargoObject:GetDesc()
self:T({Desc=Desc})
-- Weight.
local Weight = math.random( 80, 120 )
-- Adjust weight..
if Desc then
if Desc.typeName == "2B11 mortar" then
@@ -1070,8 +1095,8 @@ do -- CARGO_REPRESENTABLE
end
-- Set weight.
self:SetWeight( Weight )
self:SetWeight( Weight )
return self
end
@@ -1079,14 +1104,14 @@ do -- CARGO_REPRESENTABLE
-- @param #CARGO_REPRESENTABLE self
-- @return #CARGO_REPRESENTABLE
function CARGO_REPRESENTABLE:Destroy()
-- Cargo objects are deleted from the _DATABASE and SET_CARGO objects.
self:F( { CargoName = self:GetName() } )
--_EVENTDISPATCHER:CreateEventDeleteCargo( self )
return self
end
--- Route a cargo unit to a PointVec2.
-- @param #CARGO_REPRESENTABLE self
-- @param Core.Point#POINT_VEC2 ToPointVec2
@@ -1094,19 +1119,19 @@ do -- CARGO_REPRESENTABLE
-- @return #CARGO_REPRESENTABLE
function CARGO_REPRESENTABLE:RouteTo( ToPointVec2, Speed )
self:F2( ToPointVec2 )
local Points = {}
local PointStartVec2 = self.CargoObject:GetPointVec2()
Points[#Points+1] = PointStartVec2:WaypointGround( Speed )
Points[#Points+1] = ToPointVec2:WaypointGround( Speed )
local TaskRoute = self.CargoObject:TaskRoute( Points )
self.CargoObject:SetTask( TaskRoute, 2 )
return self
return self
end
--- Send a message to a @{Wrapper.Group} through a communication channel near the cargo.
-- @param #CARGO_REPRESENTABLE self
-- @param #string Message
@@ -1130,19 +1155,20 @@ do -- CARGO_REPRESENTABLE
end
end
end
end
end -- CARGO_REPRESENTABLE
do -- CARGO_REPORTABLE
--- @type CARGO_REPORTABLE
-- @extends #CARGO
CARGO_REPORTABLE = {
ClassName = "CARGO_REPORTABLE"
}
--- CARGO_REPORTABLE Constructor.
-- @param #CARGO_REPORTABLE self
-- @param #string Type
@@ -1154,23 +1180,31 @@ do -- CARGO_REPORTABLE
function CARGO_REPORTABLE:New( Type, Name, Weight, LoadRadius, NearRadius )
local self = BASE:Inherit( self, CARGO:New( Type, Name, Weight, LoadRadius, NearRadius ) ) -- #CARGO_REPORTABLE
self:F( { Type, Name, Weight, LoadRadius, NearRadius } )
return self
end
--- Send a CC message to a @{Wrapper.Group}.
-- @param #CARGO_REPORTABLE self
-- @param #string Message
-- @param Wrapper.Group#GROUP TaskGroup
-- @param #string Name (optional) The name of the Group used as a prefix for the message to the Group. If not provided, there will be nothing shown.
function CARGO_REPORTABLE:MessageToGroup( Message, TaskGroup, Name )
MESSAGE:New( Message, 20, "Cargo " .. self:GetName() .. " reporting" ):ToGroup( TaskGroup )
end
end
do -- CARGO_PACKAGE
--- @type CARGO_PACKAGE
@@ -1244,10 +1278,10 @@ function CARGO_PACKAGE:IsNear( CargoCarrier )
self:F()
local CargoCarrierPoint = CargoCarrier:GetCoordinate()
local Distance = CargoCarrierPoint:Get2DDistance( self.CargoCarrier:GetCoordinate() )
self:T( Distance )
if Distance <= self.NearRadius then
return true
else
@@ -1298,7 +1332,7 @@ function CARGO_PACKAGE:onafterUnBoard( From, Event, To, CargoCarrier, Speed, UnL
if not self.CargoInAir then
self:_Next( self.FsmP.UnLoad, UnLoadDistance, Angle )
local Points = {}
local StartPointVec2 = CargoCarrier:GetPointVec2()
@@ -1353,7 +1387,7 @@ function CARGO_PACKAGE:onafterLoad( From, Event, To, CargoCarrier, Speed, LoadDi
local CargoCarrierHeading = self.CargoCarrier:GetHeading() -- Get Heading of object in degrees.
local CargoDeployHeading = ( ( CargoCarrierHeading + Angle ) >= 360 ) and ( CargoCarrierHeading + Angle - 360 ) or ( CargoCarrierHeading + Angle )
local CargoDeployPointVec2 = StartPointVec2:Translate( LoadDistance, CargoDeployHeading )
local Points = {}
Points[#Points+1] = StartPointVec2:WaypointGround( Speed )
Points[#Points+1] = CargoDeployPointVec2:WaypointGround( Speed )
@@ -1374,12 +1408,12 @@ end
-- @param #number Angle
function CARGO_PACKAGE:onafterUnLoad( From, Event, To, CargoCarrier, Speed, Distance, Angle )
self:F()
local StartPointVec2 = self.CargoCarrier:GetPointVec2()
local CargoCarrierHeading = self.CargoCarrier:GetHeading() -- Get Heading of object in degrees.
local CargoDeployHeading = ( ( CargoCarrierHeading + Angle ) >= 360 ) and ( CargoCarrierHeading + Angle - 360 ) or ( CargoCarrierHeading + Angle )
local CargoDeployPointVec2 = StartPointVec2:Translate( Distance, CargoDeployHeading )
self.CargoCarrier = CargoCarrier
local Points = {}
@@ -1391,4 +1425,5 @@ function CARGO_PACKAGE:onafterUnLoad( From, Event, To, CargoCarrier, Speed, Dist
end
end
+1 -1
View File
@@ -1,4 +1,4 @@
--- **Cargo** - Management of single cargo crates, which are based on a STATIC object.
--- **Cargo** -- Management of single cargo crates, which are based on a @{Static} object.
--
-- ===
--
+3 -3
View File
@@ -1,4 +1,4 @@
--- **Cargo** - Management of grouped cargo logistics, which are based on a GROUP object.
--- **Cargo** - Management of grouped cargo logistics, which are based on a @{Wrapper.Group} object.
--
-- ===
--
@@ -47,7 +47,7 @@ do -- CARGO_GROUP
--- CARGO_GROUP constructor.
-- This make a new CARGO_GROUP from a @{Wrapper.Group} object.
-- It will "ungroup" the group object within the sim, and will create a @{Core.Set} of individual Unit objects.
-- It will "ungroup" the group object within the sim, and will create a @{Set} of individual Unit objects.
-- @param #CARGO_GROUP self
-- @param Wrapper.Group#GROUP CargoGroup Group to be transported as cargo.
-- @param #string Type Cargo type, e.g. "Infantry". This is the type used in SET_CARGO:New():FilterTypes("Infantry") to define the valid cargo groups of the set.
@@ -727,7 +727,7 @@ do -- CARGO_GROUP
end
end
--- Check if the first element of the CargoGroup is the given @{Core.Zone}.
--- Check if the first element of the CargoGroup is the given @{Zone}.
-- @param #CARGO_GROUP self
-- @param Core.Zone#ZONE_BASE Zone
-- @return #boolean **true** if the first element of the CargoGroup is in the Zone
@@ -1,4 +1,4 @@
--- **Cargo** - Management of single cargo crates, which are based on a STATIC object. The cargo can only be slingloaded.
--- **Cargo** -- Management of single cargo crates, which are based on a @{Static} object. The cargo can only be slingloaded.
--
-- ===
--
+1 -1
View File
@@ -1,4 +1,4 @@
--- **Cargo** - Management of single cargo logistics, which are based on a UNIT object.
--- **Cargo** - Management of single cargo logistics, which are based on a @{Wrapper.Unit} object.
--
-- ===
--
File diff suppressed because it is too large Load Diff
+70 -95
View File
@@ -16,24 +16,24 @@
--- *In order for the light to shine so brightly, the darkness must be present.* -- Francis Bacon
--
-- After attaching a @{#BEACON} to your @{Wrapper.Positionable#POSITIONABLE}, you need to select the right function to activate the kind of beacon you want.
-- There are two types of BEACONs available : the (aircraft) TACAN Beacon and the general purpose Radio Beacon.
-- Note that in both case, you can set an optional parameter : the `BeaconDuration`. This can be very useful to simulate the battery time if your BEACON is
-- attach to a cargo crate, for example.
-- There are two types of BEACONs available : the AA TACAN Beacon and the general purpose Radio Beacon.
-- Note that in both case, you can set an optional parameter : the `BeaconDuration`. This can be very usefull to simulate the battery time if your BEACON is
-- attach to a cargo crate, for exemple.
--
-- ## Aircraft TACAN Beacon usage
-- ## AA TACAN Beacon usage
--
-- This beacon only works with airborne @{Wrapper.Unit#UNIT} or a @{Wrapper.Group#GROUP}. Use @{#BEACON.ActivateTACAN}() to set the beacon parameters and start the beacon.
-- Use @{#BEACON.StopRadioBeacon}() to stop it.
-- This beacon only works with airborne @{Wrapper.Unit#UNIT} or a @{Wrapper.Group#GROUP}. Use @{#BEACON:AATACAN}() to set the beacon parameters and start the beacon.
-- Use @#BEACON:StopAATACAN}() to stop it.
--
-- ## General Purpose Radio Beacon usage
--
-- This beacon will work with any @{Wrapper.Positionable#POSITIONABLE}, but **it won't follow the @{Wrapper.Positionable#POSITIONABLE}** ! This means that you should only use it with
-- @{Wrapper.Positionable#POSITIONABLE} that don't move, or move very slowly. Use @{#BEACON.RadioBeacon}() to set the beacon parameters and start the beacon.
-- Use @{#BEACON.StopRadioBeacon}() to stop it.
-- @{Wrapper.Positionable#POSITIONABLE} that don't move, or move very slowly. Use @{#BEACON:RadioBeacon}() to set the beacon parameters and start the beacon.
-- Use @{#BEACON:StopRadioBeacon}() to stop it.
--
-- @type BEACON
-- @field #string ClassName Name of the class "BEACON".
-- @field Wrapper.Controllable#CONTROLLABLE Positionable The @{Wrapper.Controllable#CONTROLLABLE} that will receive radio capabilities.
-- @field Wrapper.Controllable#CONTROLLABLE Positionable The @{#CONTROLLABLE} that will receive radio capabilities.
-- @extends Core.Base#BASE
BEACON = {
ClassName = "BEACON",
@@ -72,12 +72,12 @@ BEACON.Type={
TACAN = 4,
VORTAC = 5,
RSBN = 128,
BROADCAST_STATION = 1024,
BROADCAST_STATION = 1024,
HOMER = 8,
AIRPORT_HOMER = 4104,
AIRPORT_HOMER_WITH_MARKER = 4136,
AIRPORT_HOMER = 4104,
AIRPORT_HOMER_WITH_MARKER = 4136,
ILS_FAR_HOMER = 16408,
ILS_NEAR_HOMER = 16424,
ILS_NEAR_HOMER = 16424,
ILS_LOCALIZER = 16640,
ILS_GLIDESLOPE = 16896,
PRMG_LOCALIZER = 33024,
@@ -97,24 +97,24 @@ BEACON.Type={
-- @field #number TACAN_TANKER_Y TACtical Air Navigation system for tankers on Y band.
-- @field #number VOR Very High Frequency Omni-Directional Range
-- @field #number ILS_LOCALIZER ILS localizer
-- @field #number ILS_GLIDESLOPE ILS glide slope.
-- @field #number ILS_GLIDESLOPE ILS glideslope.
-- @field #number PRGM_LOCALIZER PRGM localizer.
-- @field #number PRGM_GLIDESLOPE PRGM glide slope.
-- @field #number PRGM_GLIDESLOPE PRGM glideslope.
-- @field #number BROADCAST_STATION Broadcast station.
-- @field #number VORTAC Radio-based navigational aid for aircraft pilots consisting of a co-located VHF omni-directional range (VOR) beacon and a tactical air navigation system (TACAN) beacon.
-- @field #number VORTAC Radio-based navigational aid for aircraft pilots consisting of a co-located VHF omnidirectional range (VOR) beacon and a tactical air navigation system (TACAN) beacon.
-- @field #number TACAN_AA_MODE_X TACtical Air Navigation for aircraft on X band.
-- @field #number TACAN_AA_MODE_Y TACtical Air Navigation for aircraft on Y band.
-- @field #number VORDME Radio beacon that combines a VHF omnidirectional range (VOR) with a distance measuring equipment (DME).
-- @field #number ICLS_LOCALIZER Carrier landing system.
-- @field #number ICLS_GLIDESLOPE Carrier landing system.
BEACON.System={
PAR_10 = 1,
RSBN_5 = 2,
TACAN = 3,
PAR_10 = 1,
RSBN_5 = 2,
TACAN = 3,
TACAN_TANKER_X = 4,
TACAN_TANKER_Y = 5,
VOR = 6,
ILS_LOCALIZER = 7,
VOR = 6,
ILS_LOCALIZER = 7,
ILS_GLIDESLOPE = 8,
PRMG_LOCALIZER = 9,
PRMG_GLIDESLOPE = 10,
@@ -130,16 +130,16 @@ BEACON.System={
--- Create a new BEACON Object. This doesn't activate the beacon, though, use @{#BEACON.ActivateTACAN} etc.
-- If you want to create a BEACON, you probably should use @{Wrapper.Positionable#POSITIONABLE.GetBeacon}() instead.
-- @param #BEACON self
-- @param Wrapper.Positionable#POSITIONABLE Positionable The @{Wrapper.Positionable} that will receive radio capabilities.
-- @param Wrapper.Positionable#POSITIONABLE Positionable The @{Positionable} that will receive radio capabilities.
-- @return #BEACON Beacon object or #nil if the positionable is invalid.
function BEACON:New(Positionable)
-- Inherit BASE.
local self=BASE:Inherit(self, BASE:New()) --#BEACON
-- Debug.
self:F(Positionable)
-- Set positionable.
if Positionable:GetPointVec2() then -- It's stupid, but the only way I found to make sure positionable is valid
self.Positionable = Positionable
@@ -147,11 +147,12 @@ function BEACON:New(Positionable)
self:I(string.format("New BEACON %s", tostring(self.name)))
return self
end
self:E({"The passed positionable is invalid, no BEACON created", Positionable})
return nil
end
--- Activates a TACAN BEACON.
-- @param #BEACON self
-- @param #number Channel TACAN channel, i.e. the "10" part in "10Y".
@@ -168,28 +169,28 @@ end
-- myBeacon:ActivateTACAN(20, "Y", "TEXACO", true) -- Activate the beacon
function BEACON:ActivateTACAN(Channel, Mode, Message, Bearing, Duration)
self:T({channel=Channel, mode=Mode, callsign=Message, bearing=Bearing, duration=Duration})
Mode=Mode or "Y"
-- Get frequency.
local Frequency=UTILS.TACANToFrequency(Channel, Mode)
-- Check.
if not Frequency then
self:E({"The passed TACAN channel is invalid, the BEACON is not emitting"})
return self
end
-- Beacon type.
local Type=BEACON.Type.TACAN
-- Beacon system.
local System=BEACON.System.TACAN
-- Check if unit is an aircraft and set system accordingly.
local AA=self.Positionable:IsAir()
if AA then
System=5 --NOTE: 5 is how you cat the correct tanker behaviour! --BEACON.System.TACAN_TANKER
-- Check if "Y" mode is selected for aircraft.
@@ -200,21 +201,21 @@ function BEACON:ActivateTACAN(Channel, Mode, Message, Bearing, Duration)
System=BEACON.System.TACAN_TANKER_Y
end
end
-- Attached unit.
local UnitID=self.Positionable:GetID()
-- Debug.
self:I({string.format("BEACON Activating TACAN %s: Channel=%d%s, Morse=%s, Bearing=%s, Duration=%s!", tostring(self.name), Channel, Mode, Message, tostring(Bearing), tostring(Duration))})
-- Start beacon.
self.Positionable:CommandActivateBeacon(Type, System, Frequency, UnitID, Channel, Mode, AA, Message, Bearing)
-- Stop scheduler.
-- Stop sheduler.
if Duration then
self.Positionable:DeactivateBeacon(Duration)
end
return self
end
@@ -226,52 +227,25 @@ end
-- @return #BEACON self
function BEACON:ActivateICLS(Channel, Callsign, Duration)
self:F({Channel=Channel, Callsign=Callsign, Duration=Duration})
-- Attached unit.
local UnitID=self.Positionable:GetID()
-- Debug
self:T2({"ICLS BEACON started!"})
-- Start beacon.
self.Positionable:CommandActivateICLS(Channel, UnitID, Callsign)
-- Stop scheduler
-- Stop sheduler
if Duration then -- Schedule the stop of the BEACON if asked by the MD
self.Positionable:DeactivateBeacon(Duration)
end
return self
end
--- Activates a LINK4 BEACON. The unit the BEACON is attached to should be an aircraft carrier supporting this system.
-- @param #BEACON self
-- @param #number Frequency LINK4 FRequency in MHz, eg 336.
-- @param #string Morse The ID that is going to be coded in Morse and broadcasted by the beacon.
-- @param #number Duration How long will the beacon last in seconds. Omit for forever.
-- @return #BEACON self
function BEACON:ActivateLink4(Frequency, Morse, Duration)
self:F({Frequency=Frequency, Morse=Morse, Duration=Duration})
-- Attached unit.
local UnitID=self.Positionable:GetID()
-- Debug
self:T2({"LINK4 BEACON started!"})
-- Start beacon.
self.Positionable:CommandActivateLink4(Frequency,UnitID,Morse)
-- Stop sheduler
if Duration then -- Schedule the stop of the BEACON if asked by the MD
self.Positionable:CommandDeactivateLink4(Duration)
end
return self
end
--- DEPRECATED: Please use @{#BEACON.ActivateTACAN}() instead.
-- Activates a TACAN BEACON on an Aircraft.
--- Activates a TACAN BEACON on an Aircraft.
-- @param #BEACON self
-- @param #number TACANChannel (the "10" part in "10Y"). Note that AA TACAN are only available on Y Channels
-- @param #string Message The Message that is going to be coded in Morse and broadcasted by the beacon
@@ -286,20 +260,20 @@ end
-- myBeacon:AATACAN(20, "TEXACO", true) -- Activate the beacon
function BEACON:AATACAN(TACANChannel, Message, Bearing, BeaconDuration)
self:F({TACANChannel, Message, Bearing, BeaconDuration})
local IsValid = true
if not self.Positionable:IsAir() then
self:E({"The POSITIONABLE you want to attach the AA Tacan Beacon is not an aircraft ! The BEACON is not emitting", self.Positionable})
IsValid = false
end
local Frequency = self:_TACANToFrequency(TACANChannel, "Y")
if not Frequency then
self:E({"The passed TACAN channel is invalid, the BEACON is not emitting"})
IsValid = false
end
-- I'm using the beacon type 4 (BEACON_TYPE_TACAN). For System, I'm using 5 (TACAN_TANKER_MODE_Y) if the bearing shows its bearing or 14 (TACAN_AA_MODE_Y) if it does not
local System
if Bearing then
@@ -307,7 +281,7 @@ function BEACON:AATACAN(TACANChannel, Message, Bearing, BeaconDuration)
else
System = BEACON.System.TACAN_AA_MODE_Y
end
if IsValid then -- Starts the BEACON
self:T2({"AA TACAN BEACON started !"})
self.Positionable:SetCommand({
@@ -322,7 +296,7 @@ function BEACON:AATACAN(TACANChannel, Message, Bearing, BeaconDuration)
modeChannel = "Y",
}
})
if BeaconDuration then -- Schedule the stop of the BEACON if asked by the MD
SCHEDULER:New(nil,
function()
@@ -330,7 +304,7 @@ function BEACON:AATACAN(TACANChannel, Message, Bearing, BeaconDuration)
end, {}, BeaconDuration)
end
end
return self
end
@@ -350,10 +324,11 @@ function BEACON:StopAATACAN()
end
end
--- Activates a general purpose Radio Beacon
--- Activates a general pupose Radio Beacon
-- This uses the very generic singleton function "trigger.action.radioTransmission()" provided by DCS to broadcast a sound file on a specific frequency.
-- Although any frequency could be used, only a few DCS Modules can home on radio beacons at the time of writing, i.e. the Mi-8, Huey, Gazelle etc.
-- The following e.g. can home in on these specific frequencies :
-- Although any frequency could be used, only 2 DCS Modules can home on radio beacons at the time of writing : the Huey and the Mi-8.
-- They can home in on these specific frequencies :
-- * **Mi8**
-- * R-828 -> 20-60MHz
-- * ARKUD -> 100-150MHz (canal 1 : 114166, canal 2 : 114333, canal 3 : 114583, canal 4 : 121500, canal 5 : 123100, canal 6 : 124100) AM
@@ -379,7 +354,7 @@ end
function BEACON:RadioBeacon(FileName, Frequency, Modulation, Power, BeaconDuration)
self:F({FileName, Frequency, Modulation, Power, BeaconDuration})
local IsValid = false
-- Check the filename
if type(FileName) == "string" then
if FileName:find(".ogg") or FileName:find(".wav") then
@@ -392,32 +367,32 @@ function BEACON:RadioBeacon(FileName, Frequency, Modulation, Power, BeaconDurati
if not IsValid then
self:E({"File name invalid. Maybe something wrong with the extension ? ", FileName})
end
-- Check the Frequency
if type(Frequency) ~= "number" and IsValid then
self:E({"Frequency invalid. ", Frequency})
IsValid = false
end
Frequency = Frequency * 1000000 -- Conversion to Hz
-- Check the modulation
if Modulation ~= radio.modulation.AM and Modulation ~= radio.modulation.FM and IsValid then --TODO Maybe make this future proof if ED decides to add an other modulation ?
self:E({"Modulation is invalid. Use DCS's enum radio.modulation.", Modulation})
IsValid = false
end
-- Check the Power
if type(Power) ~= "number" and IsValid then
self:E({"Power is invalid. ", Power})
IsValid = false
end
Power = math.floor(math.abs(Power)) --TODO Find what is the maximum power allowed by DCS and limit power to that
if IsValid then
self:T2({"Activating Beacon on ", Frequency, Modulation})
-- Note that this is looped. I have to give this transmission a unique name, I use the class ID
trigger.action.radioTransmission(FileName, self.Positionable:GetPositionVec3(), Modulation, true, Frequency, Power, tostring(self.ID))
if BeaconDuration then -- Schedule the stop of the BEACON if asked by the MD
SCHEDULER:New( nil,
function()
@@ -427,7 +402,7 @@ function BEACON:RadioBeacon(FileName, Frequency, Modulation, Power, BeaconDurati
end
end
--- Stops the Radio Beacon
--- Stops the AA TACAN BEACON
-- @param #BEACON self
-- @return #BEACON self
function BEACON:StopRadioBeacon()
@@ -451,16 +426,16 @@ function BEACON:_TACANToFrequency(TACANChannel, TACANMode)
return nil -- error in arguments
end
end
-- This code is largely based on ED's code, in DCS World\Scripts\World\Radio\BeaconTypes.lua, line 137.
-- I have no idea what it does but it seems to work
local A = 1151 -- 'X', channel >= 64
local B = 64 -- channel >= 64
if TACANChannel < 64 then
B = 1
end
if TACANMode == 'Y' then
A = 1025
if TACANChannel < 64 then
@@ -471,6 +446,6 @@ function BEACON:_TACANToFrequency(TACANChannel, TACANMode)
A = 962
end
end
return (A + TACANChannel - B) * 1000000
end
end
-464
View File
@@ -1,464 +0,0 @@
--- **Core** - Define any or all conditions to be evaluated.
--
-- **Main Features:**
--
-- * Add arbitrary numbers of conditon functions
-- * Evaluate *any* or *all* conditions
--
-- ===
--
-- ## Example Missions:
--
-- Demo missions can be found on [github](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/OPS%20-%20Operation).
--
-- ===
--
-- ### Author: **funkyfranky**
--
-- ===
-- @module Core.Condition
-- @image MOOSE.JPG
--- CONDITON class.
-- @type CONDITION
-- @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 condition.
-- @field #boolean isAny General functions are evaluated as any condition.
-- @field #boolean negateResult Negate result of evaluation.
-- @field #boolean noneResult Boolean that is returned if no condition functions at all were specified.
-- @field #table functionsGen General condition functions.
-- @field #table functionsAny Any condition functions.
-- @field #table functionsAll All condition functions.
-- @field #number functionCounter Running number to determine the unique ID of condition functions.
-- @field #boolean defaultPersist Default persistence of condition functions.
--
-- @extends Core.Base#BASE
--- *Better three hours too soon than a minute too late.* - William Shakespeare
--
-- ===
--
-- # The CONDITION Concept
--
--
--
-- @field #CONDITION
CONDITION = {
ClassName = "CONDITION",
lid = nil,
functionsGen = {},
functionsAny = {},
functionsAll = {},
functionCounter = 0,
defaultPersist = false,
}
--- Condition function.
-- @type CONDITION.Function
-- @field #number uid Unique ID of the condition function.
-- @field #string type Type of the condition function: "gen", "any", "all".
-- @field #boolean persistence If `true`, this is persistent.
-- @field #function func Callback function to check for a condition. Must return a `#boolean`.
-- @field #table arg (Optional) Arguments passed to the condition callback function if any.
--- CONDITION class version.
-- @field #string version
CONDITION.version="0.3.0"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO list
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO: Make FSM. No sure if really necessary.
-- DONE: Option to remove condition functions.
-- DONE: Persistence option for condition functions.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Constructor
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Create a new CONDITION object.
-- @param #CONDITION self
-- @param #string Name (Optional) Name used in the logs.
-- @return #CONDITION self
function CONDITION:New(Name)
-- Inherit BASE.
local self=BASE:Inherit(self, BASE:New()) --#CONDITION
self.name=Name or "Condition X"
self:SetNoneResult(false)
self.lid=string.format("%s | ", self.name)
return self
end
--- Set that general condition functions return `true` if `any` function returns `true`. Default is that *all* functions must return `true`.
-- @param #CONDITION self
-- @param #boolean Any If `true`, *any* condition can be true. Else *all* conditions must result `true`.
-- @return #CONDITION self
function CONDITION:SetAny(Any)
self.isAny=Any
return self
end
--- Negate result.
-- @param #CONDITION self
-- @param #boolean Negate If `true`, result is negated else not.
-- @return #CONDITION self
function CONDITION:SetNegateResult(Negate)
self.negateResult=Negate
return self
end
--- Set whether `true` or `false` is returned, if no conditions at all were specified. By default `false` is returned.
-- @param #CONDITION self
-- @param #boolean ReturnValue Returns this boolean.
-- @return #CONDITION self
function CONDITION:SetNoneResult(ReturnValue)
if not ReturnValue then
self.noneResult=false
else
self.noneResult=true
end
return self
end
--- Set whether condition functions are persistent, *i.e.* are removed.
-- @param #CONDITION self
-- @param #boolean IsPersistent If `true`, condition functions are persistent.
-- @return #CONDITION self
function CONDITION:SetDefaultPersistence(IsPersistent)
self.defaultPersist=IsPersistent
return self
end
--- Add a function that is evaluated. It must return a `#boolean` value, *i.e.* either `true` or `false` (or `nil`).
-- @param #CONDITION self
-- @param #function Function The function to call.
-- @param ... (Optional) Parameters passed to the function (if any).
--
-- @usage
-- local function isAequalB(a, b)
-- return a==b
-- end
--
-- myCondition:AddFunction(isAequalB, a, b)
--
-- @return #CONDITION.Function Condition function table.
function CONDITION:AddFunction(Function, ...)
-- Condition function.
local condition=self:_CreateCondition(0, Function, ...)
-- Add to table.
table.insert(self.functionsGen, condition)
return condition
end
--- Add a function that is evaluated. It must return a `#boolean` value, *i.e.* either `true` or `false` (or `nil`).
-- @param #CONDITION self
-- @param #function Function The function to call.
-- @param ... (Optional) Parameters passed to the function (if any).
-- @return #CONDITION.Function Condition function table.
function CONDITION:AddFunctionAny(Function, ...)
-- Condition function.
local condition=self:_CreateCondition(1, Function, ...)
-- Add to table.
table.insert(self.functionsAny, condition)
return condition
end
--- Add a function that is evaluated. It must return a `#boolean` value, *i.e.* either `true` or `false` (or `nil`).
-- @param #CONDITION self
-- @param #function Function The function to call.
-- @param ... (Optional) Parameters passed to the function (if any).
-- @return #CONDITION.Function Condition function table.
function CONDITION:AddFunctionAll(Function, ...)
-- Condition function.
local condition=self:_CreateCondition(2, Function, ...)
-- Add to table.
table.insert(self.functionsAll, condition)
return condition
end
--- Remove a condition function.
-- @param #CONDITION self
-- @param #CONDITION.Function ConditionFunction The condition function to be removed.
-- @return #CONDITION self
function CONDITION:RemoveFunction(ConditionFunction)
if ConditionFunction then
local data=nil
if ConditionFunction.type==0 then
data=self.functionsGen
elseif ConditionFunction.type==1 then
data=self.functionsAny
elseif ConditionFunction.type==2 then
data=self.functionsAll
end
if data then
for i=#data,1,-1 do
local cf=data[i] --#CONDITION.Function
if cf.uid==ConditionFunction.uid then
self:T(self.lid..string.format("Removed ConditionFunction UID=%d", cf.uid))
table.remove(data, i)
return self
end
end
end
end
return self
end
--- Remove all non-persistant condition functions.
-- @param #CONDITION self
-- @return #CONDITION self
function CONDITION:RemoveNonPersistant()
for i=#self.functionsGen,1,-1 do
local cf=self.functionsGen[i] --#CONDITION.Function
if not cf.persistence then
table.remove(self.functionsGen, i)
end
end
for i=#self.functionsAll,1,-1 do
local cf=self.functionsAll[i] --#CONDITION.Function
if not cf.persistence then
table.remove(self.functionsAll, i)
end
end
for i=#self.functionsAny,1,-1 do
local cf=self.functionsAny[i] --#CONDITION.Function
if not cf.persistence then
table.remove(self.functionsAny, i)
end
end
return self
end
--- Evaluate conditon functions.
-- @param #CONDITION self
-- @param #boolean AnyTrue If `true`, evaluation return `true` if *any* condition function returns `true`. By default, *all* condition functions must return true.
-- @return #boolean Result of condition functions.
function CONDITION:Evaluate(AnyTrue)
-- Check if at least one function was given.
if #self.functionsAll + #self.functionsAny + #self.functionsAll == 0 then
return self.noneResult
end
-- Any condition for gen.
local evalAny=self.isAny
if AnyTrue~=nil then
evalAny=AnyTrue
end
local isGen=nil
if evalAny then
isGen=self:_EvalConditionsAny(self.functionsGen)
else
isGen=self:_EvalConditionsAll(self.functionsGen)
end
-- Is any?
local isAny=self:_EvalConditionsAny(self.functionsAny)
-- Is all?
local isAll=self:_EvalConditionsAll(self.functionsAll)
-- Result.
local result=isGen and isAny and isAll
-- Negate result.
if self.negateResult then
result=not result
end
-- Debug message.
self:T(self.lid..string.format("Evaluate: isGen=%s, isAny=%s, isAll=%s (negate=%s) ==> result=%s", tostring(isGen), tostring(isAny), tostring(isAll), tostring(self.negateResult), tostring(result)))
return result
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Private Functions
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Check if all given condition are true.
-- @param #CONDITION self
-- @param #table functions Functions to evaluate.
-- @return #boolean If true, all conditions were true (or functions was empty/nil). Returns false if at least one condition returned false.
function CONDITION:_EvalConditionsAll(functions)
-- At least one condition?
local gotone=false
-- Any stop condition must be true.
for _,_condition in pairs(functions or {}) do
local condition=_condition --#CONDITION.Function
-- At least one condition was defined.
gotone=true
-- Call function.
local istrue=condition.func(unpack(condition.arg))
-- Any false will return false.
if not istrue then
return false
end
end
-- All conditions were true.
return true
end
--- Check if any of the given conditions is true.
-- @param #CONDITION self
-- @param #table functions Functions to evaluate.
-- @return #boolean If true, at least one condition is true (or functions was emtpy/nil).
function CONDITION:_EvalConditionsAny(functions)
-- At least one condition?
local gotone=false
-- Any stop condition must be true.
for _,_condition in pairs(functions or {}) do
local condition=_condition --#CONDITION.Function
-- At least one condition was defined.
gotone=true
-- Call function.
local istrue=condition.func(unpack(condition.arg))
-- Any true will return true.
if istrue then
return true
end
end
-- No condition was true.
if gotone then
return false
else
-- No functions passed.
return true
end
end
--- Create conditon function object.
-- @param #CONDITION self
-- @param #number Ftype Function type: 0=Gen, 1=All, 2=Any.
-- @param #function Function The function to call.
-- @param ... (Optional) Parameters passed to the function (if any).
-- @return #CONDITION.Function Condition function.
function CONDITION:_CreateCondition(Ftype, Function, ...)
-- Increase counter.
self.functionCounter=self.functionCounter+1
local condition={} --#CONDITION.Function
condition.uid=self.functionCounter
condition.type=Ftype or 0
condition.persistence=self.defaultPersist
condition.func=Function
condition.arg={}
if arg then
condition.arg=arg
end
return condition
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Global Condition Functions
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Condition to check if time is greater than a given threshold time.
-- @param #number Time Time in seconds.
-- @param #boolean Absolute If `true`, abs. mission time from `timer.getAbsTime()` is checked. Default is relative mission time from `timer.getTime()`.
-- @return #boolean Returns `true` if time is greater than give the time.
function CONDITION.IsTimeGreater(Time, Absolute)
local Tnow=nil
if Absolute then
Tnow=timer.getAbsTime()
else
Tnow=timer.getTime()
end
if Tnow>Time then
return true
else
return false
end
return nil
end
--- Function that returns `true` (success) with a certain probability. For example, if you specify `Probability=80` there is an 80% chance that `true` is returned.
-- Technically, a random number between 0 and 100 is created. If the given success probability is less then this number, `true` is returned.
-- @param #number Probability Success probability in percent. Default 50 %.
-- @return #boolean Returns `true` for success and `false` otherwise.
function CONDITION.IsRandomSuccess(Probability)
Probability=Probability or 50
-- Create some randomness.
math.random()
math.random()
math.random()
-- Number between 0 and 100.
local N=math.random()*100
if N<Probability then
return true
else
return false
end
end
--- Function that returns always `true`
-- @return #boolean Returns `true` unconditionally.
function CONDITION.ReturnTrue()
return true
end
--- Function that returns always `false`
-- @return #boolean Returns `false` unconditionally.
function CONDITION.ReturnFalse()
return false
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+44 -128
View File
@@ -51,7 +51,7 @@
-- * PLAYERS
-- * CARGOS
--
-- 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 DATBASE administers the Unit and Group TEMPLATES as defined within the Mission Editor.
--
-- The singleton object **_DATABASE** is automatically created by MOOSE, that administers all objects within the mission.
-- Moose refers to **_DATABASE** within the framework extensively, but you can also refer to the _DATABASE object within your missions if required.
@@ -211,6 +211,16 @@ function DATABASE:FindStatic( StaticName )
return StaticFound
end
--- Finds a AIRBASE based on the AirbaseName.
-- @param #DATABASE self
-- @param #string AirbaseName
-- @return Wrapper.Airbase#AIRBASE The found AIRBASE.
function DATABASE:FindAirbase( AirbaseName )
local AirbaseFound = self.AIRBASES[AirbaseName]
return AirbaseFound
end
--- Adds a Airbase based on the Airbase Name in the DATABASE.
-- @param #DATABASE self
-- @param #string AirbaseName The name of the airbase.
@@ -218,7 +228,15 @@ end
function DATABASE:AddAirbase( AirbaseName )
if not self.AIRBASES[AirbaseName] then
self.AIRBASES[AirbaseName] = AIRBASE:Register( AirbaseName )
-- Register airbase.
local airbase = AIRBASE:Register( AirbaseName ) --Wrapper.Airbase#AIRBASE
-- Add to airbase.
self.AIRBASES[AirbaseName]=airbase
-- Debug info
self:I(string.format("Adding airbase %s (ID=%d): %s with %d parking spots", tostring(airbase.AirbaseName), airbase.AirbaseID, airbase.AirbaseCategoryName, tonumber(#airbase.parking)))
end
return self.AIRBASES[AirbaseName]
@@ -246,7 +264,7 @@ end
do -- Zones
--- Finds a @{Core.Zone} based on the zone name.
--- Finds a @{Zone} based on the zone name.
-- @param #DATABASE self
-- @param #string ZoneName The name of the zone.
-- @return Core.Zone#ZONE_BASE The found ZONE.
@@ -256,7 +274,7 @@ do -- Zones
return ZoneFound
end
--- Adds a @{Core.Zone} based on the zone name in the DATABASE.
--- Adds a @{Zone} based on the zone name in the DATABASE.
-- @param #DATABASE self
-- @param #string ZoneName The name of the zone.
-- @param Core.Zone#ZONE_BASE Zone The zone.
@@ -268,7 +286,7 @@ do -- Zones
end
--- Deletes a @{Core.Zone} from the DATABASE based on the zone name.
--- Deletes a @{Zone} from the DATABASE based on the zone name.
-- @param #DATABASE self
-- @param #string ZoneName The name of the zone.
function DATABASE:DeleteZone( ZoneName )
@@ -309,7 +327,7 @@ do -- Zones
self:I(string.format("Register ZONE: %s (Polygon, Quad)", ZoneName))
Zone=ZONE_POLYGON:NewFromPointsArray(ZoneName, ZoneData.verticies)
Zone=ZONE_POLYGON_BASE:New(ZoneName, ZoneData.verticies)
--for i,vec2 in pairs(ZoneData.verticies) do
-- local coord=COORDINATE:NewFromVec2(vec2)
@@ -326,17 +344,6 @@ do -- Zones
-- Store zone ID.
Zone.ZoneID=ZoneData.zoneId
-- Store zone properties (if any)
local ZoneProperties = ZoneData.properties or nil
Zone.Properties = {}
if ZoneName and ZoneProperties then
for _,ZoneProp in ipairs(ZoneProperties) do
if ZoneProp.key then
Zone.Properties[ZoneProp.key] = ZoneProp.value
end
end
end
-- Store in DB.
self.ZONENAMES[ZoneName] = ZoneName
@@ -372,63 +379,14 @@ do -- Zones
end
end
-- Drawings as zones
if env.mission.drawings and env.mission.drawings.layers then
-- Loop over layers.
for layerID, layerData in pairs(env.mission.drawings.layers or {}) do
-- Loop over objects in layers.
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)
if objectData.polygonMode=="free" and objectData.points and #objectData.points>=4 then
-- Name of the zone.
local ZoneName=objectData.name or "Unknown Drawing Zone"
-- 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
-- Remove last point.
table.remove(points, #points)
-- Debug output
self:I(string.format("Register ZONE: %s (Polygon drawing with %d verticies)", ZoneName, #points))
-- Create new polygon zone.
local Zone=ZONE_POLYGON:NewFromPointsArray(ZoneName, points)
-- Set color.
Zone:SetColor({1, 0, 0}, 0.15)
-- Store in DB.
self.ZONENAMES[ZoneName] = ZoneName
-- Add zone.
self:AddZone(ZoneName, Zone)
end
end
end
end
end
end -- zone
do -- Zone_Goal
--- Finds a @{Core.Zone} based on the zone name.
--- Finds a @{Zone} based on the zone name.
-- @param #DATABASE self
-- @param #string ZoneName The name of the zone.
-- @return Core.Zone#ZONE_BASE The found ZONE.
@@ -438,7 +396,7 @@ do -- Zone_Goal
return ZoneFound
end
--- Adds a @{Core.Zone} based on the zone name in the DATABASE.
--- Adds a @{Zone} based on the zone name in the DATABASE.
-- @param #DATABASE self
-- @param #string ZoneName The name of the zone.
-- @param Core.Zone#ZONE_BASE Zone The zone.
@@ -450,7 +408,7 @@ do -- Zone_Goal
end
--- Deletes a @{Core.Zone} from the DATABASE based on the zone name.
--- Deletes a @{Zone} from the DATABASE based on the zone name.
-- @param #DATABASE self
-- @param #string ZoneName The name of the zone.
function DATABASE:DeleteZoneGoal( ZoneName )
@@ -1039,15 +997,13 @@ function DATABASE:_RegisterClients()
for ClientName, ClientTemplate in pairs( self.Templates.ClientsByName ) do
self:I(string.format("Register Client: %s", tostring(ClientName)))
local client=self:AddClient( ClientName )
client.SpawnCoord=COORDINATE:New(ClientTemplate.x, ClientTemplate.alt, ClientTemplate.y)
self:AddClient( ClientName )
end
return self
end
--- Private method that registeres all static objects.
-- @param #DATABASE self
--- @param #DATABASE self
function DATABASE:_RegisterStatics()
local CoalitionsData={GroupsRed=coalition.getStaticObjects(coalition.side.RED), GroupsBlue=coalition.getStaticObjects(coalition.side.BLUE), GroupsNeutral=coalition.getStaticObjects(coalition.side.NEUTRAL)}
@@ -1076,26 +1032,11 @@ function DATABASE:_RegisterAirbases()
for DCSAirbaseId, DCSAirbase in pairs(world.getAirbases()) do
self:_RegisterAirbase(DCSAirbase)
end
return self
end
--- Register a DCS airbase.
-- @param #DATABASE self
-- @param DCS#Airbase airbase Airbase.
-- @return #DATABASE self
function DATABASE:_RegisterAirbase(airbase)
if airbase then
-- Get the airbase name.
local DCSAirbaseName = airbase:getName()
local DCSAirbaseName = DCSAirbase:getName()
-- This gave the incorrect value to be inserted into the airdromeID for DCS 2.5.6. Is fixed now.
local airbaseID=airbase:getID()
local airbaseID=DCSAirbase:getID()
-- Add and register airbase.
local airbase=self:AddAirbase( DCSAirbaseName )
@@ -1104,7 +1045,7 @@ function DATABASE:_RegisterAirbase(airbase)
local airbaseUID=airbase:GetID(true)
-- 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 (ID=%d UID=%d), parking=%d [", AIRBASE.CategoryName[airbase.category], tostring(DCSAirbaseName), airbaseID, airbaseUID, airbase.NparkingTotal)
for _,terminalType in pairs(AIRBASE.TerminalType) do
if airbase.NparkingTerminal and airbase.NparkingTerminal[terminalType] then
text=text..string.format("%d=%d ", terminalType, airbase.NparkingTerminal[terminalType])
@@ -1113,6 +1054,11 @@ function DATABASE:_RegisterAirbase(airbase)
text=text.."]"
self:I(text)
-- Check for DCS bug IDs.
if airbaseID~=airbase:GetID() then
--self:E("WARNING: :getID does NOT match :GetID!")
end
end
return self
@@ -1129,23 +1075,20 @@ function DATABASE:_EventOnBirth( Event )
if Event.IniDCSUnit then
if Event.IniObjectCategory == Object.Category.STATIC then
if Event.IniObjectCategory == 3 then
-- Add static object to DB.
self:AddStatic( Event.IniDCSUnitName )
else
if Event.IniObjectCategory == Object.Category.UNIT then
if Event.IniObjectCategory == 1 then
-- Add unit and group to DB.
self:AddUnit( Event.IniDCSUnitName )
self:AddGroup( Event.IniDCSGroupName )
-- A unit can also be an airbase (e.g. ships).
-- Add airbase if it was spawned later in the mission.
local DCSAirbase = Airbase.getByName(Event.IniDCSUnitName)
if DCSAirbase then
-- Add airbase if it was spawned later in the mission.
self:I(string.format("Adding airbase %s", tostring(Event.IniDCSUnitName)))
self:AddAirbase(Event.IniDCSUnitName)
end
@@ -1153,7 +1096,7 @@ function DATABASE:_EventOnBirth( Event )
end
end
if Event.IniObjectCategory == Object.Category.UNIT then
if Event.IniObjectCategory == 1 then
Event.IniUnit = self:FindUnit( Event.IniDCSUnitName )
Event.IniGroup = self:FindGroup( Event.IniDCSGroupName )
@@ -1608,33 +1551,6 @@ function DATABASE:FindOpsGroup(groupname)
return self.FLIGHTGROUPS[groupname]
end
--- Find an OPSGROUP (FLIGHTGROUP, ARMYGROUP, NAVYGROUP) in the data base for a given unit.
-- @param #DATABASE self
-- @param #string unitname Unit name. Can also be passed as UNIT object.
-- @return Ops.OpsGroup#OPSGROUP OPS group object.
function DATABASE:FindOpsGroupFromUnit(unitname)
local unit=nil --Wrapper.Unit#UNIT
local groupname
-- Get group and group name.
if type(unitname)=="string" then
unit=UNIT:FindByName(unitname)
else
unit=unitname
end
if unit then
groupname=unit:GetGroup():GetName()
end
if groupname then
return self.FLIGHTGROUPS[groupname]
else
return nil
end
end
--- Add a flight control to the data base.
-- @param #DATABASE self
-- @param Ops.FlightControl#FLIGHTCONTROL flightcontrol
@@ -1719,7 +1635,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
self:_RegisterGroupTemplate(Template, CoalitionSide, _DATABASECategory[string.lower(CategoryName)], CountryID)
self:_RegisterGroupTemplate(Template, CoalitionSide, _DATABASECategory[string.lower(CategoryName)], CountryID)
else
+14 -93
View File
@@ -14,7 +14,7 @@
-- ![Objects](..\Presentations\EVENT\Dia2.JPG)
--
-- Within a running mission, various DCS events occur. Units are dynamically created, crash, die, shoot stuff, get hit etc.
-- This module provides a mechanism to dispatch those events occurring within your running mission, to the different objects orchestrating your mission.
-- This module provides a mechanism to dispatch those events occuring within your running mission, to the different objects orchestrating your mission.
--
-- ![Objects](..\Presentations\EVENT\Dia3.JPG)
--
@@ -32,11 +32,11 @@
--
-- ![Objects](..\Presentations\EVENT\Dia5.JPG)
--
-- There are 5 types/levels of objects that the _EVENTDISPATCHER services:
-- There are 5 levels of kind of objects that the _EVENTDISPATCHER services:
--
-- * _DATABASE object: The core of the MOOSE objects. Any object that is created, deleted or updated, is done in this database.
-- * SET_ derived classes: These are subsets of the global _DATABASE object (an instance of @{Core.Database#DATABASE}). These subsets are updated by the _EVENTDISPATCHER as the second priority.
-- * UNIT objects: UNIT objects can subscribe to DCS events. Each DCS event will be directly published to the subscribed UNIT object.
-- * SET_ derived classes: Subsets of the _DATABASE object. These subsets are updated by the _EVENTDISPATCHER as the second priority.
-- * UNIT objects: UNIT objects can subscribe to DCS events. Each DCS event will be directly published to teh subscribed UNIT object.
-- * GROUP objects: GROUP objects can subscribe to DCS events. Each DCS event will be directly published to the subscribed GROUP object.
-- * Any other object: Various other objects can subscribe to DCS events. Each DCS event triggered will be published to each subscribed object.
--
@@ -52,7 +52,7 @@
--
-- ![Objects](..\Presentations\EVENT\Dia8.JPG)
--
-- The actual event subscribing and handling is not facilitated through the _EVENTDISPATCHER, but it is done through the @{Core.Base#BASE} class, @{Wrapper.Unit#UNIT} class and @{Wrapper.Group#GROUP} class.
-- The actual event subscribing and handling is not facilitated through the _EVENTDISPATCHER, but it is done through the @{BASE} class, @{UNIT} class and @{GROUP} class.
-- The _EVENTDISPATCHER is a component that is quietly working in the background of MOOSE.
--
-- ![Objects](..\Presentations\EVENT\Dia9.JPG)
@@ -248,18 +248,6 @@ EVENTS = {
TriggerZone = world.event.S_EVENT_TRIGGER_ZONE or -1,
LandingQualityMark = world.event.S_EVENT_LANDING_QUALITY_MARK or -1,
BDA = world.event.S_EVENT_BDA or -1,
-- Added with DCS 2.8.0
AIAbortMission = world.event.S_EVENT_AI_ABORT_MISSION or -1,
DayNight = world.event.S_EVENT_DAYNIGHT or -1,
FlightTime = world.event.S_EVENT_FLIGHT_TIME or -1,
SelfKillPilot = world.event.S_EVENT_PLAYER_SELF_KILL_PILOT or -1,
PlayerCaptureAirfield = world.event.S_EVENT_PLAYER_CAPTURE_AIRFIELD or -1,
EmergencyLanding = world.event.S_EVENT_EMERGENCY_LANDING or -1,
UnitCreateTask = world.event.S_EVENT_UNIT_CREATE_TASK or -1,
UnitDeleteTask = world.event.S_EVENT_UNIT_DELETE_TASK or -1,
SimulationStart = world.event.S_EVENT_SIMULATION_START or -1,
WeaponRearm = world.event.S_EVENT_WEAPON_REARM or -1,
WeaponDrop = world.event.S_EVENT_WEAPON_DROP or -1,
}
--- The Event structure
@@ -572,69 +560,9 @@ local _EVENTMETA = {
Event = "OnEventBDA",
Text = "S_EVENT_BDA"
},
-- Added with DCS 2.8
[EVENTS.AIAbortMission] = {
Order = 1,
Side = "I",
Event = "OnEventAIAbortMission",
Text = "S_EVENT_AI_ABORT_MISSION"
},
[EVENTS.DayNight] = {
Order = 1,
Event = "OnEventDayNight",
Text = "S_EVENT_DAYNIGHT"
},
[EVENTS.FlightTime] = {
Order = 1,
Event = "OnEventFlightTime",
Text = "S_EVENT_FLIGHT_TIME"
},
[EVENTS.SelfKillPilot] = {
Order = 1,
Side = "I",
Event = "OnEventSelfKillPilot",
Text = "S_EVENT_PLAYER_SELF_KILL_PILOT"
},
[EVENTS.PlayerCaptureAirfield] = {
Order = 1,
Event = "OnEventPlayerCaptureAirfield",
Text = "S_EVENT_PLAYER_CAPTURE_AIRFIELD"
},
[EVENTS.EmergencyLanding] = {
Order = 1,
Side = "I",
Event = "OnEventEmergencyLanding",
Text = "S_EVENT_EMERGENCY_LANDING"
},
[EVENTS.UnitCreateTask] = {
Order = 1,
Event = "OnEventUnitCreateTask",
Text = "S_EVENT_UNIT_CREATE_TASK"
},
[EVENTS.UnitDeleteTask] = {
Order = 1,
Event = "OnEventUnitDeleteTask",
Text = "S_EVENT_UNIT_DELETE_TASK"
},
[EVENTS.SimulationStart] = {
Order = 1,
Event = "OnEventSimulationStart",
Text = "S_EVENT_SIMULATION_START"
},
[EVENTS.WeaponRearm] = {
Order = 1,
Side = "I",
Event = "OnEventWeaponRearm",
Text = "S_EVENT_WEAPON_REARM"
},
[EVENTS.WeaponDrop] = {
Order = 1,
Side = "I",
Event = "OnEventWeaponDrop",
Text = "S_EVENT_WEAPON_DROP"
},
}
--- The Events structure
-- @type EVENT.Events
-- @field #number IniUnit
@@ -1004,7 +932,7 @@ do -- Event Creation
--- Creation of a ZoneGoal Deletion Event.
-- @param #EVENT self
-- @param Functional.ZoneGoal#ZONE_GOAL ZoneGoal The ZoneGoal created.
-- @param Core.ZoneGoal#ZONE_GOAL ZoneGoal The ZoneGoal created.
function EVENT:CreateEventDeleteZoneGoal( ZoneGoal )
self:F( { ZoneGoal } )
@@ -1130,7 +1058,7 @@ function EVENT:onEvent( Event )
Event.IniUnitName = Event.IniDCSUnitName
Event.IniDCSGroup = Event.IniDCSUnit:getGroup()
Event.IniUnit = UNIT:FindByName( Event.IniDCSUnitName )
if not Event.IniUnit then
-- Unit can be a CLIENT. Most likely this will be the case ...
Event.IniUnit = CLIENT:FindByName( Event.IniDCSUnitName, '', true )
@@ -1165,7 +1093,8 @@ function EVENT:onEvent( Event )
if Event.IniObjectCategory == Object.Category.SCENERY then
---
-- Scenery
---
---
Event.IniDCSUnit = Event.initiator
Event.IniDCSUnitName = Event.IniDCSUnit:getName()
Event.IniUnitName = Event.IniDCSUnitName
@@ -1185,12 +1114,6 @@ function EVENT:onEvent( Event )
Event.IniCoalition = Event.IniDCSUnit:getCoalition()
Event.IniCategory = Event.IniDCSUnit:getDesc().category
Event.IniTypeName = Event.IniDCSUnit:getTypeName()
-- If the airbase does not exist in the DB, we add it (e.g. when FARPS are spawned).
if not Event.IniUnit then
_DATABASE:_RegisterAirbase(Event.initiator)
Event.IniUnit = AIRBASE:FindByName(Event.IniDCSUnitName)
end
end
end
@@ -1224,7 +1147,7 @@ function EVENT:onEvent( Event )
if Event.TgtObjectCategory == Object.Category.STATIC then
-- get base data
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.TgtUnitName = Event.TgtDCSUnitName
Event.TgtUnit = STATIC:FindByName( Event.TgtDCSUnitName, false )
@@ -1280,11 +1203,9 @@ function EVENT:onEvent( Event )
--local name=Event.place:getName() -- This returns a DCS error "Airbase doesn't exit" :(
-- 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)
else
if Event.place:isExist() and Event.place:getCategory() ~= Object.Category.SCENERY then
Event.Place=AIRBASE:Find(Event.place)
Event.PlaceName=Event.Place:GetName()
end
else
Event.Place=AIRBASE:Find(Event.place)
Event.PlaceName=Event.Place:GetName()
end
end
File diff suppressed because it is too large Load Diff
+49 -40
View File
@@ -1,87 +1,89 @@
--- **Core** - Models the process to achieve goal(s).
--
-- ===
--
--
-- ## Features:
--
--
-- * Define the goal.
-- * Monitor the goal achievement.
-- * Manage goal contribution by players.
--
--
-- ===
--
--
-- Classes that implement a goal achievement, will derive from GOAL to implement the ways how the achievements can be realized.
--
--
-- ===
--
--
-- ### Author: **FlightControl**
-- ### Contributions: **funkyfranky**
--
--
-- ===
--
--
-- @module Core.Goal
-- @image Core_Goal.JPG
do -- Goal
--- @type GOAL
-- @extends Core.Fsm#FSM
--- Models processes that have an objective with a defined achievement. Derived classes implement the ways how the achievements can be realized.
--
--
-- # 1. GOAL constructor
--
--
-- * @{#GOAL.New}(): Creates a new GOAL object.
--
--
-- # 2. GOAL is a finite state machine (FSM).
--
--
-- ## 2.1. GOAL States
--
--
-- * **Pending**: The goal object is in progress.
-- * **Achieved**: The goal objective is Achieved.
--
--
-- ## 2.2. GOAL Events
--
--
-- * **Achieved**: Set the goal objective to Achieved.
--
--
-- # 3. Player contributions.
--
--
-- Goals are most of the time achieved by players. These player achievements can be registered as part of the goal achievement.
-- Use @{#GOAL.AddPlayerContribution}() to add a player contribution to the goal.
-- The player contributions are based on a points system, an internal counter per player.
-- So once the goal has been achieved, the player contributions can be queried using @{#GOAL.GetPlayerContributions}(),
-- So once the goal has been achieved, the player contributions can be queried using @{#GOAL.GetPlayerContributions}(),
-- that retrieves all contributions done by the players. For one player, the contribution can be queried using @{#GOAL.GetPlayerContribution}().
-- The total amount of player contributions can be queried using @{#GOAL.GetTotalContributions}().
--
--
-- # 4. Goal achievement.
--
--
-- Once the goal is achieved, the mission designer will need to trigger the goal achievement using the **Achieved** event.
-- The underlying 2 examples will achieve the goals for the `Goal` object:
--
--
-- Goal:Achieved() -- Achieve the goal immediately.
-- Goal:__Achieved( 30 ) -- Achieve the goal within 30 seconds.
--
--
-- # 5. Check goal achievement.
--
--
-- The method @{#GOAL.IsAchieved}() will return true if the goal is achieved (the trigger **Achieved** was executed).
-- You can use this method to check asynchronously if a goal has been achieved, for example using a scheduler.
--
--
-- @field #GOAL
GOAL = {
ClassName = "GOAL",
}
--- @field #table GOAL.Players
GOAL.Players = {}
--- @field #number GOAL.TotalContributions
GOAL.TotalContributions = 0
--- GOAL Constructor.
-- @param #GOAL self
-- @return #GOAL
function GOAL:New()
local self = BASE:Inherit( self, FSM:New() ) -- #GOAL
self:F( {} )
@@ -102,10 +104,11 @@ do -- Goal
-- @param #string From
-- @param #string Event
-- @param #string To
self:SetStartState( "Pending" )
self:AddTransition( "*", "Achieved", "Achieved" )
self:AddTransition( "*", "Achieved", "Achieved" )
--- Achieved Handler OnBefore for GOAL
-- @function [parent=#GOAL] OnBeforeAchieved
-- @param #GOAL self
@@ -113,44 +116,47 @@ do -- Goal
-- @param #string Event
-- @param #string To
-- @return #boolean
--- Achieved Handler OnAfter for GOAL
-- @function [parent=#GOAL] OnAfterAchieved
-- @param #GOAL self
-- @param #string From
-- @param #string Event
-- @param #string To
--- Achieved Trigger for GOAL
-- @function [parent=#GOAL] Achieved
-- @param #GOAL self
--- Achieved Asynchronous Trigger for GOAL
-- @function [parent=#GOAL] __Achieved
-- @param #GOAL self
-- @param #number Delay
self:SetEventPriority( 5 )
return self
end
--- Add a new contribution by a player.
-- @param #GOAL self
-- @param #string PlayerName The name of the player.
function GOAL:AddPlayerContribution( PlayerName )
self:F( { PlayerName } )
self:F({PlayerName})
self.Players[PlayerName] = self.Players[PlayerName] or 0
self.Players[PlayerName] = self.Players[PlayerName] + 1
self.TotalContributions = self.TotalContributions + 1
end
--- @param #GOAL self
-- @param #number Player contribution.
function GOAL:GetPlayerContribution( PlayerName )
return self.Players[PlayerName] or 0
return self.Players[PlayerName] or 0
end
--- Get the players who contributed to achieve the goal.
-- The result is a list of players, sorted by the name of the players.
-- @param #GOAL self
@@ -159,6 +165,7 @@ do -- Goal
return self.Players or {}
end
--- Gets the total contributions that happened to achieve the goal.
-- The result is a number.
-- @param #GOAL self
@@ -166,7 +173,9 @@ do -- Goal
function GOAL:GetTotalContributions()
return self.TotalContributions or 0
end
--- Validates if the goal is achieved.
-- @param #GOAL self
-- @return #boolean true if the goal is achieved.
@@ -174,4 +183,4 @@ do -- Goal
return self:Is( "Achieved" )
end
end
end
@@ -1,23 +1,16 @@
--- **Core** - Tap into markers added to the F10 map by users.
--- **Core** - MarkerOps_Base.
--
-- **Main Features:**
--
-- * Create an easy way to tap into markers added to the F10 map by users.
-- * Recognize own tag and list of keywords.
-- * Matched keywords are handed down to functions.
-- ##Listen for your tag
-- myMarker = MARKEROPS_BASE:New("tag", {}, false)
-- function myMarker:OnAfterMarkChanged(From, Event, To, Text, Keywords, Coord, idx)
--
-- end
-- Make sure to use the "MarkChanged" event as "MarkAdded" comes in right after the user places a blank marker and your callback will never be called.
--
-- ===
--
-- ### Author: **Applevangelist**
--
-- Date: 5 May 2021
-- Last Update: Sep 2022
--
-- ===
---
@@ -34,7 +27,6 @@
-- @field #string Tag Tag to identify commands.
-- @field #table Keywords Table of keywords to recognize.
-- @field #string version Version of #MARKEROPS_BASE.
-- @field #boolean Casesensitive Enforce case when identifying the Tag, i.e. tag ~= Tag
-- @extends Core.Fsm#FSM
--- *Fiat lux.* -- Latin proverb.
@@ -50,18 +42,16 @@ MARKEROPS_BASE = {
ClassName = "MARKEROPS",
Tag = "mytag",
Keywords = {},
version = "0.1.0",
version = "0.0.1",
debug = false,
Casesensitive = true,
}
--- Function to instantiate a new #MARKEROPS_BASE object.
-- @param #MARKEROPS_BASE self
-- @param #string Tagname Name to identify us from the event text.
-- @param #table Keywords Table of keywords recognized from the event text.
-- @param #boolean Casesensitive (Optional) Switch case sensitive identification of Tagname. Defaults to true.
-- @return #MARKEROPS_BASE self
function MARKEROPS_BASE:New(Tagname,Keywords,Casesensitive)
function MARKEROPS_BASE:New(Tagname,Keywords)
-- Inherit FSM
local self=BASE:Inherit(self, FSM:New()) -- #MARKEROPS_BASE
@@ -71,11 +61,6 @@ function MARKEROPS_BASE:New(Tagname,Keywords,Casesensitive)
self.Tag = Tagname or "mytag"-- #string
self.Keywords = Keywords or {} -- #table - might want to use lua regex here, too
self.debug = false
self.Casesensitive = true
if Casesensitive and Casesensitive == false then
self.Casesensitive = false
end
-----------------------
--- FSM Transitions ---
@@ -138,7 +123,7 @@ function MARKEROPS_BASE:New(Tagname,Keywords,Casesensitive)
end
--- (internal) Handle events.
-- @param #MARKEROPS_BASE self
-- @param #MARKEROPS self
-- @param Core.Event#EVENTDATA Event
function MARKEROPS_BASE:OnEventMark(Event)
self:T({Event})
@@ -188,27 +173,20 @@ function MARKEROPS_BASE:OnEventMark(Event)
end
--- (internal) Match tag.
-- @param #MARKEROPS_BASE self
-- @param #MARKEROPS self
-- @param #string Eventtext Text added to the marker.
-- @return #boolean
function MARKEROPS_BASE:_MatchTag(Eventtext)
local matches = false
if not self.Casesensitive then
local type = string.lower(self.Tag) -- #string
if string.find(string.lower(Eventtext),type) then
matches = true --event text contains tag
end
else
local type = self.Tag -- #string
if string.find(Eventtext,type) then
matches = true --event text contains tag
end
local type = string.lower(self.Tag) -- #string
if string.find(string.lower(Eventtext),type) then
matches = true --event text contains tag
end
return matches
end
--- (internal) Match keywords table.
-- @param #MARKEROPS_BASE self
-- @param #MARKEROPS self
-- @param #string Eventtext Text added to the marker.
-- @return #table
function MARKEROPS_BASE:_MatchKeywords(Eventtext)
-26
View File
@@ -239,7 +239,6 @@ do -- MENU_BASE
function MENU_BASE:GetMenu( MenuText )
return self.Menus[MenuText]
end
--- Sets a menu stamp for later prevention of menu removal.
-- @param #MENU_BASE self
-- @param MenuStamp
@@ -377,7 +376,6 @@ do -- MENU_MISSION
end
end
--- Refreshes a radio item for a mission
-- @param #MENU_MISSION self
-- @return #MENU_MISSION
@@ -815,7 +813,6 @@ do
end
end
--- Refreshes a new radio item for a group and submenus
-- @param #MENU_GROUP self
-- @return #MENU_GROUP
@@ -832,29 +829,6 @@ do
return self
end
--- Refreshes a new radio item for a group and submenus, ordering by (numerical) MenuTag
-- @param #MENU_GROUP self
-- @return #MENU_GROUP
function MENU_GROUP:RefreshAndOrderByTag()
do
missionCommands.removeItemForGroup( self.GroupID, self.MenuPath )
missionCommands.addSubMenuForGroup( self.GroupID, self.MenuText, self.MenuParentPath )
local MenuTable = {}
for MenuText, Menu in pairs( self.Menus or {} ) do
local tag = Menu.MenuTag or math.random(1,10000)
MenuTable[#MenuTable+1] = {Tag=tag, Enty=Menu}
end
table.sort(MenuTable, function (k1, k2) return k1.tag < k2.tag end )
for _, Menu in pairs( MenuTable ) do
Menu.Entry:Refresh()
end
end
return self
end
--- Removes the sub menus recursively of this MENU_GROUP.
-- @param #MENU_GROUP self
-- @param MenuStamp
+166 -231
View File
@@ -1,9 +1,9 @@
--- **Core** - Informs the players using messages during a simulation.
--
--
-- ===
--
--
-- ## Features:
--
--
-- * A more advanced messaging system using the DCS message system.
-- * Time messages.
-- * Send messages based on a message type, which has a pre-defined duration that can be tweaked in SETTINGS.
@@ -13,7 +13,7 @@
-- * Send messages to a specific unit or client.
--
-- ===
--
--
-- @module Core.Message
-- @image Core_Message.JPG
@@ -24,43 +24,43 @@
--- Message System to display Messages to Clients, Coalitions or All.
-- Messages are shown on the display panel for an amount of seconds, and will then disappear.
-- Messages can contain a category which is indicating the category of the message.
--
--
-- ## MESSAGE construction
--
--
-- Messages are created with @{#MESSAGE.New}. Note that when the MESSAGE object is created, no message is sent yet.
-- To send messages, you need to use the To functions.
--
--
-- ## Send messages to an audience
--
--
-- Messages are sent:
--
-- * To a @{Wrapper.Client} using @{#MESSAGE.ToClient}().
-- * To a @{Client} using @{#MESSAGE.ToClient}().
-- * To a @{Wrapper.Group} using @{#MESSAGE.ToGroup}()
-- * To a @{Wrapper.Unit} using @{#MESSAGE.ToUnit}()
-- * To a coalition using @{#MESSAGE.ToCoalition}().
-- * To the red coalition using @{#MESSAGE.ToRed}().
-- * To the blue coalition using @{#MESSAGE.ToBlue}().
-- * To all Players using @{#MESSAGE.ToAll}().
--
--
-- ## Send conditionally to an audience
--
--
-- Messages can be sent conditionally to an audience (when a condition is true):
--
--
-- * To all players using @{#MESSAGE.ToAllIf}().
-- * To a coalition using @{#MESSAGE.ToCoalitionIf}().
--
--
-- ===
--
--
-- ### Author: **FlightControl**
-- ### Contributions:
--
-- ### Contributions:
--
-- ===
--
--
-- @field #MESSAGE
MESSAGE = {
ClassName = "MESSAGE",
MessageCategory = 0,
MessageID = 0,
ClassName = "MESSAGE",
MessageCategory = 0,
MessageID = 0,
}
--- Message Types
@@ -70,9 +70,10 @@ MESSAGE.Type = {
Information = "Information",
Briefing = "Briefing Report",
Overview = "Overview Report",
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.
-- @param self
-- @param #string MessageText is the text of the Message.
@@ -81,119 +82,119 @@ MESSAGE.Type = {
-- @param #boolean ClearScreen (optional) Clear all previous messages if true.
-- @return #MESSAGE
-- @usage
--
-- -- Create a series of new Messages.
-- -- MessageAll is meant to be sent to all players, for 25 seconds, and is classified as "Score".
-- -- MessageRED is meant to be sent to the RED players only, for 10 seconds, and is classified as "End of Mission", with ID "Win".
-- -- MessageClient1 is meant to be sent to a Client, for 25 seconds, and is classified as "Score", with ID "Score".
-- -- MessageClient1 is meant to be sent to a Client, for 25 seconds, and is classified as "Score", with ID "Score".
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", 25, "End of Mission" )
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", 25, "Penalty" )
-- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", 25, "Score" )
-- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", 25, "Score")
--
-- -- Create a series of new Messages.
-- -- MessageAll is meant to be sent to all players, for 25 seconds, and is classified as "Score".
-- -- MessageRED is meant to be sent to the RED players only, for 10 seconds, and is classified as "End of Mission", with ID "Win".
-- -- MessageClient1 is meant to be sent to a Client, for 25 seconds, and is classified as "Score", with ID "Score".
-- -- MessageClient1 is meant to be sent to a Client, for 25 seconds, and is classified as "Score", with ID "Score".
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", 25, "End of Mission" )
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", 25, "Penalty" )
-- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", 25, "Score" )
-- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", 25, "Score")
function MESSAGE:New( MessageText, MessageDuration, MessageCategory, ClearScreen )
local self = BASE:Inherit( self, BASE:New() )
self:F( { MessageText, MessageDuration, MessageCategory } )
local self = BASE:Inherit( self, BASE:New() )
self:F( { MessageText, MessageDuration, MessageCategory } )
self.MessageType = nil
-- When no MessageCategory is given, we don't show it as a title...
if MessageCategory and MessageCategory ~= "" then
if MessageCategory:sub( -1 ) ~= "\n" then
-- When no MessageCategory is given, we don't show it as a title...
if MessageCategory and MessageCategory ~= "" then
if MessageCategory:sub(-1) ~= "\n" then
self.MessageCategory = MessageCategory .. ": "
else
self.MessageCategory = MessageCategory:sub( 1, -2 ) .. ":\n"
self.MessageCategory = MessageCategory:sub( 1, -2 ) .. ":\n"
end
else
self.MessageCategory = ""
end
self.ClearScreen = false
if ClearScreen ~= nil then
self.ClearScreen = ClearScreen
self.ClearScreen=false
if ClearScreen~=nil then
self.ClearScreen=ClearScreen
end
self.MessageDuration = MessageDuration or 5
self.MessageTime = timer.getTime()
self.MessageText = MessageText:gsub( "^\n", "", 1 ):gsub( "\n$", "", 1 )
self.MessageDuration = MessageDuration or 5
self.MessageTime = timer.getTime()
self.MessageText = MessageText:gsub("^\n","",1):gsub("\n$","",1)
self.MessageSent = false
self.MessageGroup = false
self.MessageCoalition = false
self.MessageSent = false
self.MessageGroup = false
self.MessageCoalition = false
return self
return self
end
--- Creates a new MESSAGE object of a certain type.
-- Note that these MESSAGE objects are not yet displayed on the display panel.
--- Creates a new MESSAGE object of a certain type.
-- 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.
-- 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 @{Settings} menu.
-- @param self
-- @param #string MessageText is the text of the Message.
-- @param #MESSAGE.Type MessageType The type of the message.
-- @param #boolean ClearScreen (optional) Clear all previous messages.
-- @return #MESSAGE
-- @usage
--
-- MessageAll = MESSAGE:NewType( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", MESSAGE.Type.Information )
-- MessageRED = MESSAGE:NewType( "To the RED Players: You receive a penalty because you've killed one of your own units", MESSAGE.Type.Information )
-- MessageClient1 = MESSAGE:NewType( "Congratulations, you've just hit a target", MESSAGE.Type.Update )
-- MessageClient2 = MESSAGE:NewType( "Congratulations, you've just killed a target", MESSAGE.Type.Update )
--
function MESSAGE:NewType( MessageText, MessageType, ClearScreen )
local self = BASE:Inherit( self, BASE:New() )
self:F( { MessageText } )
self.MessageType = MessageType
self.ClearScreen = false
if ClearScreen ~= nil then
self.ClearScreen = ClearScreen
self.ClearScreen=false
if ClearScreen~=nil then
self.ClearScreen=ClearScreen
end
self.MessageTime = timer.getTime()
self.MessageText = MessageText:gsub( "^\n", "", 1 ):gsub( "\n$", "", 1 )
self.MessageText = MessageText:gsub("^\n","",1):gsub("\n$","",1)
return self
end
--- Clears all previous messages from the screen before the new message is displayed. Not that this must come before all functions starting with ToX(), e.g. ToAll(), ToGroup() etc.
--- Clears all previous messages from the screen before the new message is displayed. Not that this must come before all functions starting with ToX(), e.g. ToAll(), ToGroup() etc.
-- @param #MESSAGE self
-- @return #MESSAGE
function MESSAGE:Clear()
self:F()
self.ClearScreen = true
self.ClearScreen=true
return self
end
--- Sends a MESSAGE to a Client Group. Note that the Group needs to be defined within the ME with the skillset "Client" or "Player".
-- @param #MESSAGE self
-- @param Wrapper.Client#CLIENT Client is the Group of the Client.
-- @param Core.Settings#SETTINGS Settings used to display the message.
-- @param Core.Settings#SETTINGS Settings Settings used to display the message.
-- @return #MESSAGE
-- @usage
-- -- Send the 2 messages created with the @{New} method to the Client Group.
-- -- Note that the Message of MessageClient2 is overwriting the Message of MessageClient1.
-- ClientGroup = Group.getByName( "ClientGroup" )
--
-- -- Send the 2 messages created with the @{New} method to the Client Group.
-- -- Note that the Message of MessageClient2 is overwriting the Message of MessageClient1.
-- ClientGroup = Group.getByName( "ClientGroup" )
--
-- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25, "Score" ):ToClient( ClientGroup )
-- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25, "Score" ):ToClient( ClientGroup )
-- or
-- MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25 ):ToClient( ClientGroup )
-- MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25 ):ToClient( ClientGroup )
-- or
-- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25 )
-- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25 )
-- MessageClient1:ToClient( ClientGroup )
-- MessageClient2:ToClient( ClientGroup )
--
-- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25, "Score" ):ToClient( ClientGroup )
-- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25, "Score" ):ToClient( ClientGroup )
-- or
-- MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25, "Score" ):ToClient( ClientGroup )
-- MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25, "Score" ):ToClient( ClientGroup )
-- or
-- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25, "Score" )
-- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25, "Score" )
-- MessageClient1:ToClient( ClientGroup )
-- MessageClient2:ToClient( ClientGroup )
function MESSAGE:ToClient( Client, Settings )
self:F( Client )
self:F( Client )
if Client and Client:GetClientGroupID() then
if Client and Client:GetClientGroupID() then
if self.MessageType then
local Settings = Settings or ( Client and _DATABASE:GetPlayerSettings( Client:GetPlayerName() ) ) or _SETTINGS -- Core.Settings#SETTINGS
@@ -204,45 +205,43 @@ function MESSAGE:ToClient( Client, Settings )
local Unit = Client:GetClient()
if self.MessageDuration ~= 0 then
local ClientGroupID = Client:GetClientGroupID()
local ClientGroupID = Client:GetClientGroupID()
self:T( self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$","") .. " / " .. self.MessageDuration )
--trigger.action.outTextForGroup( ClientGroupID, self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration , self.ClearScreen)
trigger.action.outTextForUnit( Unit:GetID(), self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration , self.ClearScreen)
end
end
return self
end
--- Sends a MESSAGE to a Group.
-- @param #MESSAGE self
-- @param Wrapper.Group#GROUP Group to which the message is displayed.
-- @return #MESSAGE Message object.
function MESSAGE:ToGroup( Group, Settings )
self:F( Group.GroupName )
if Group then
if self.MessageType then
local Settings = Settings or ( Group and _DATABASE:GetPlayerSettings( Group:GetPlayerName() ) ) or _SETTINGS -- Core.Settings#SETTINGS
self.MessageDuration = Settings:GetMessageTime( self.MessageType )
self.MessageCategory = "" -- self.MessageType .. ": "
end
if self.MessageDuration ~= 0 then
self:T( self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$","") .. " / " .. self.MessageDuration )
--trigger.action.outTextForGroup( ClientGroupID, self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration , self.ClearScreen)
trigger.action.outTextForUnit( Unit:GetID(), self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration , self.ClearScreen)
trigger.action.outTextForGroup( Group:GetID(), self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration, self.ClearScreen )
end
end
return self
end
--- Sends a MESSAGE to a Group.
-- @param #MESSAGE self
-- @param Wrapper.Group#GROUP Group to which the message is displayed.
-- @param Core.Settings#Settings Settings (Optional) Settings for message display.
-- @return #MESSAGE Message object.
function MESSAGE:ToGroup( Group, Settings )
self:F( Group.GroupName )
if Group then
if self.MessageType then
local Settings = Settings or (Group and _DATABASE:GetPlayerSettings( Group:GetPlayerName() )) or _SETTINGS -- Core.Settings#SETTINGS
self.MessageDuration = Settings:GetMessageTime( self.MessageType )
self.MessageCategory = "" -- self.MessageType .. ": "
end
if self.MessageDuration ~= 0 then
self:T( self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ) .. " / " .. self.MessageDuration )
trigger.action.outTextForGroup( Group:GetID(), self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ), self.MessageDuration, self.ClearScreen )
end
end
return self
end
--- Sends a MESSAGE to a Unit.
-- @param #MESSAGE self
-- @param Wrapper.Unit#UNIT Unit to which the message is displayed.
-- @param Core.Settings#Settings Settings (Optional) Settings for message display.
-- @return #MESSAGE Message object.
function MESSAGE:ToUnit( Unit, Settings )
self:F( Unit.IdentifiableName )
@@ -264,100 +263,59 @@ function MESSAGE:ToUnit( Unit, Settings )
return self
end
--- Sends a MESSAGE to a Country.
-- @param #MESSAGE self
-- @param #number Country to which the message is displayed, e.g. country.id.GERMANY. For all country numbers see here: [Hoggit Wiki](https://wiki.hoggitworld.com/view/DCS_enum_country)
-- @param Core.Settings#Settings Settings (Optional) Settings for message display.
-- @return #MESSAGE Message object.
function MESSAGE:ToCountry( Country, Settings )
self:F(Country )
if Country then
if self.MessageType then
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
self.MessageDuration = Settings:GetMessageTime( self.MessageType )
self.MessageCategory = "" -- self.MessageType .. ": "
end
if self.MessageDuration ~= 0 then
self:T( self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$","") .. " / " .. self.MessageDuration )
trigger.action.outTextForCountry( Country, self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration, self.ClearScreen )
end
end
return self
end
--- Sends a MESSAGE to a Country.
-- @param #MESSAGE self
-- @param #number Country to which the message is displayed, , e.g. country.id.GERMANY. For all country numbers see here: [Hoggit Wiki](https://wiki.hoggitworld.com/view/DCS_enum_country)
-- @param #boolean Condition Sends the message only if the condition is true.
-- @param Core.Settings#Settings Settings (Optional) Settings for message display.
-- @return #MESSAGE Message object.
function MESSAGE:ToCountryIf( Country, Condition, Settings )
self:F(Country )
if Country and Condition == true then
self:ToCountry( Country, Settings )
end
return self
end
--- Sends a MESSAGE to the Blue coalition.
-- @param #MESSAGE self
-- @param #MESSAGE self
-- @return #MESSAGE
-- @usage
--
-- -- Send a message created with the @{New} method to the BLUE coalition.
-- MessageBLUE = MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", "Penalty", 25):ToBlue()
-- or
-- MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 ):ToBlue()
-- or
-- MessageBLUE = MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 )
-- MessageBLUE:ToBlue()
--
-- -- Send a message created with the @{New} method to the BLUE coalition.
-- MessageBLUE = MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" ):ToBlue()
-- or
-- MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" ):ToBlue()
-- or
-- MessageBLUE = MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" )
-- MessageBLUE:ToBlue()
function MESSAGE:ToBlue()
self:F()
self:F()
self:ToCoalition( coalition.side.BLUE )
return self
self:ToCoalition( coalition.side.BLUE )
return self
end
--- Sends a MESSAGE to the Red Coalition.
--- Sends a MESSAGE to the Red Coalition.
-- @param #MESSAGE self
-- @return #MESSAGE
-- @usage
--
-- -- Send a message created with the @{New} method to the RED coalition.
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 ):ToRed()
-- or
-- MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 ):ToRed()
-- or
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 )
-- MessageRED:ToRed()
--
function MESSAGE:ToRed()
self:F()
-- -- Send a message created with the @{New} method to the RED coalition.
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" ):ToRed()
-- or
-- MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" ):ToRed()
-- or
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" )
-- MessageRED:ToRed()
function MESSAGE:ToRed( )
self:F()
self:ToCoalition( coalition.side.RED )
return self
self:ToCoalition( coalition.side.RED )
return self
end
--- Sends a MESSAGE to a Coalition.
--- Sends a MESSAGE to a Coalition.
-- @param #MESSAGE self
-- @param #DCS.coalition.side CoalitionSide @{#DCS.coalition.side} to which the message is displayed.
-- @param Core.Settings#SETTINGS Settings (Optional) Settings for message display.
-- @return #MESSAGE Message object.
-- @usage
--
-- -- Send a message created with the @{New} method to the RED coalition.
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 ):ToCoalition( coalition.side.RED )
-- or
-- MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 ):ToCoalition( coalition.side.RED )
-- or
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25 )
-- MessageRED:ToCoalition( coalition.side.RED )
--
-- -- Send a message created with the @{New} method to the RED coalition.
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" ):ToCoalition( coalition.side.RED )
-- or
-- MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" ):ToCoalition( coalition.side.RED )
-- or
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" )
-- MessageRED:ToCoalition( coalition.side.RED )
function MESSAGE:ToCoalition( CoalitionSide, Settings )
self:F( CoalitionSide )
self:F( CoalitionSide )
if self.MessageType then
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
@@ -365,20 +323,20 @@ function MESSAGE:ToCoalition( CoalitionSide, Settings )
self.MessageCategory = "" -- self.MessageType .. ": "
end
if CoalitionSide then
if CoalitionSide then
if self.MessageDuration ~= 0 then
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 )
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 )
end
end
return self
end
return self
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 CoalitionSide needs to be filled out by the defined structure of the standard scripting engine @{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
function MESSAGE:ToCoalitionIf( CoalitionSide, Condition )
self:F( CoalitionSide )
@@ -386,7 +344,7 @@ function MESSAGE:ToCoalitionIf( CoalitionSide, Condition )
if Condition and Condition == true then
self:ToCoalition( CoalitionSide )
end
return self
end
@@ -395,16 +353,14 @@ end
-- @param Core.Settings#Settings Settings (Optional) Settings for message display.
-- @return #MESSAGE
-- @usage
--
-- -- Send a message created to all players.
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25 ):ToAll()
-- or
-- MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25 ):ToAll()
-- or
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25 )
-- MessageAll:ToAll()
--
function MESSAGE:ToAll( Settings )
-- -- Send a message created to all players.
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25, "Win" ):ToAll()
-- or
-- MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25, "Win" ):ToAll()
-- or
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25, "Win" )
-- MessageAll:ToAll()
function MESSAGE:ToAll(Settings)
self:F()
if self.MessageType then
@@ -414,16 +370,16 @@ function MESSAGE:ToAll( Settings )
end
if self.MessageDuration ~= 0 then
self:T( self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ) .. " / " .. self.MessageDuration )
trigger.action.outText( self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ), self.MessageDuration, self.ClearScreen )
self:T( self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$","") .. " / " .. self.MessageDuration )
trigger.action.outText( self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration, self.ClearScreen )
end
return self
end
--- Sends a MESSAGE to all players if the given Condition is true.
-- @param #MESSAGE self
-- @param #boolean Condition
-- @return #MESSAGE
function MESSAGE:ToAllIf( Condition )
@@ -431,26 +387,5 @@ function MESSAGE:ToAllIf( Condition )
self:ToAll()
end
return self
end
--- Sends a MESSAGE to DCS log file.
-- @param #MESSAGE self
-- @return #MESSAGE self
function MESSAGE:ToLog()
env.info(self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ))
return self
end
--- Sends a MESSAGE to DCS log file if the given Condition is true.
-- @param #MESSAGE self
-- @return #MESSAGE self
function MESSAGE:ToLogIf( Condition )
if Condition and Condition == true then
env.info(self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ))
end
return self
return self
end
+103 -257
View File
@@ -138,7 +138,7 @@ do -- COORDINATE
--
-- Calculate if the coordinate has Line of Sight (LOS) with the other given coordinate.
-- Mountains, trees and other objects can be positioned between the two 3D points, preventing visibilty in a straight continuous line.
-- The method @{#COORDINATE.IsLOS}() returns if the two coordinates have LOS.
-- The method @{#COORDINATE.IsLOS}() returns if the two coodinates have LOS.
--
-- ## 4.7) Check the coordinate position.
--
@@ -406,42 +406,6 @@ do -- COORDINATE
return self
end
--- Returns the magnetic declination at the given coordinate.
-- NOTE that this needs `require` to be available so you need to desanitize the `MissionScripting.lua` file in your DCS/Scrips folder.
-- If `require` is not available, a constant value for the whole map.
-- @param #COORDINATE self
-- @param #number Month (Optional) The month at which the declination is calculated. Default is the mission month.
-- @param #number Year (Optional) The year at which the declination is calculated. Default is the mission year.
-- @return #number Magnetic declination in degrees.
function COORDINATE:GetMagneticDeclination(Month, Year)
local decl=UTILS.GetMagneticDeclination()
if require then
local magvar = require('magvar')
if magvar then
local date, year, month, day=UTILS.GetDCSMissionDate()
magvar.init(Month or month, Year or year)
local lat, lon=self:GetLLDDM()
decl=magvar.get_mag_decl(lat, lon)
if decl then
decl=math.deg(decl)
end
end
else
self:T("The require package is not available. Using constant value for magnetic declination")
end
return decl
end
--- Returns the coordinate from the latitude and longitude given in decimal degrees.
-- @param #COORDINATE self
@@ -540,7 +504,7 @@ do -- COORDINATE
local gotscenery=false
local function EvaluateZone(ZoneObject)
BASE:T({ZoneObject})
if ZoneObject then
-- Get category of scanned object.
@@ -630,7 +594,7 @@ do -- COORDINATE
--- Scan/find SCENERY objects 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 table Table of SCENERY objects.
-- @return table Set of scenery objects.
function COORDINATE:ScanScenery(radius)
local _,_,_,_,_,scenerys=self:ScanObjects(radius, false, false, true)
@@ -690,7 +654,7 @@ do -- COORDINATE
-- @param DCS#Distance Distance The Distance to be added in meters.
-- @param DCS#Angle Angle The Angle in degrees. Defaults to 0 if not specified (nil).
-- @param #boolean Keepalt If true, keep altitude of original coordinate. Default is that the new coordinate is created at the translated land height.
-- @param #boolean Overwrite If true, overwrite the original COORDINATE with the translated one. Otherwise, create a new COORDINATE.
-- @param #boolean Overwrite If true, overwrite the original COORDINATE with the translated one. Otherwise, create a new COODINATE.
-- @return #COORDINATE The new calculated COORDINATE.
function COORDINATE:Translate( Distance, Angle, Keepalt, Overwrite )
@@ -861,11 +825,7 @@ do -- COORDINATE
-- @param #COORDINATE TargetCoordinate The target COORDINATE.
-- @return DCS#Vec3 DirectionVec3 The direction vector in Vec3 format.
function COORDINATE:GetDirectionVec3( TargetCoordinate )
if TargetCoordinate then
return { x = TargetCoordinate.x - self.x, y = TargetCoordinate.y - self.y, z = TargetCoordinate.z - self.z }
else
return { x=0,y=0,z=0}
end
return { x = TargetCoordinate.x - self.x, y = TargetCoordinate.y - self.y, z = TargetCoordinate.z - self.z }
end
@@ -914,11 +874,6 @@ do -- COORDINATE
-- Get the vector from A to B
local vec=UTILS.VecSubstract(ToCoordinate, self)
if f>1 then
local norm=UTILS.VecNorm(vec)
f=Fraction/norm
end
-- Scale the vector.
vec.x=f*vec.x
@@ -928,9 +883,7 @@ do -- COORDINATE
-- Move the vector to start at the end of A.
vec=UTILS.VecAdd(self, vec)
-- Create a new coordiante object.
local coord=COORDINATE:New(vec.x,vec.y,vec.z)
return coord
end
@@ -959,7 +912,7 @@ do -- COORDINATE
return T-273.15
end
--- Returns a text of the temperature according the measurement system @{Core.Settings}.
--- Returns a text of the temperature according the measurement system @{Settings}.
-- The text will reflect the temperature like this:
--
-- - For Russian and European aircraft using the metric system - Degrees Celcius (°C)
@@ -972,7 +925,7 @@ do -- COORDINATE
--
-- @param #COORDINATE self
-- @param height (Optional) parameter specifying the height ASL.
-- @return #string Temperature according the measurement system @{Core.Settings}.
-- @return #string Temperature according the measurement system @{Settings}.
function COORDINATE:GetTemperatureText( height, Settings )
local DegreesCelcius = self:GetTemperature( height )
@@ -1005,7 +958,7 @@ do -- COORDINATE
return P/100
end
--- Returns a text of the pressure according the measurement system @{Core.Settings}.
--- Returns a text of the pressure according the measurement system @{Settings}.
-- The text will contain always the pressure in hPa and:
--
-- - For Russian and European aircraft using the metric system - hPa and mmHg
@@ -1018,7 +971,7 @@ do -- COORDINATE
--
-- @param #COORDINATE self
-- @param height (Optional) parameter specifying the height ASL. E.g. set height=0 for QNH.
-- @return #string Pressure in hPa and mmHg or inHg depending on the measurement system @{Core.Settings}.
-- @return #string Pressure in hPa and mmHg or inHg depending on the measurement system @{Settings}.
function COORDINATE:GetPressureText( height, Settings )
local Pressure_hPa = self:GetPressure( height )
@@ -1098,7 +1051,7 @@ do -- COORDINATE
end
--- Returns a text documenting the wind direction (from) and strength according the measurement system @{Core.Settings}.
--- Returns a text documenting the wind direction (from) and strength according the measurement system @{Settings}.
-- The text will reflect the wind like this:
--
-- - For Russian and European aircraft using the metric system - Wind direction in degrees (°) and wind speed in meters per second (mps).
@@ -1111,7 +1064,7 @@ do -- COORDINATE
--
-- @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.
-- @return #string Wind direction and strength according the measurement system @{Core.Settings}.
-- @return #string Wind direction and strength according the measurement system @{Settings}.
function COORDINATE:GetWindText( height, Settings )
local Direction, Strength = self:GetWind( height )
@@ -1147,25 +1100,15 @@ do -- COORDINATE
-- @param #number AngleRadians The angle in randians.
-- @param #number Precision The precision.
-- @param Core.Settings#SETTINGS Settings
-- @param #boolean MagVar If true, include magentic degrees
-- @return #string The bearing text in degrees.
function COORDINATE:GetBearingText( AngleRadians, Precision, Settings, MagVar )
function COORDINATE:GetBearingText( AngleRadians, Precision, Settings, Language )
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
local AngleDegrees = UTILS.Round( UTILS.ToDegree( AngleRadians ), Precision )
local s = string.format( '%03d°', AngleDegrees )
if MagVar then
local variation = UTILS.GetMagneticDeclination() or 0
local AngleMagnetic = AngleDegrees - variation
if AngleMagnetic < 0 then AngleMagnetic = 360-AngleMagnetic end
s = string.format( '%03d°M|%03d°', AngleMagnetic,AngleDegrees )
end
return s
end
@@ -1179,22 +1122,21 @@ do -- COORDINATE
function COORDINATE:GetDistanceText( Distance, Settings, Language, Precision )
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
local Language = Language or Settings.Locale or _SETTINGS.Locale or "EN"
Language = string.lower(Language)
local Language = Language or "EN"
local Precision = Precision or 0
local DistanceText
if Settings:IsMetric() then
if Language == "en" then
if Language == "EN" then
DistanceText = " for " .. UTILS.Round( Distance / 1000, Precision ) .. " km"
elseif Language == "ru" then
elseif Language == "RU" then
DistanceText = " за " .. UTILS.Round( Distance / 1000, Precision ) .. " километров"
end
else
if Language == "en" then
if Language == "EN" then
DistanceText = " for " .. UTILS.Round( UTILS.MetersToNM( Distance ), Precision ) .. " miles"
elseif Language == "ru" then
elseif Language == "RU" then
DistanceText = " за " .. UTILS.Round( UTILS.MetersToNM( Distance ), Precision ) .. " миль"
end
end
@@ -1208,21 +1150,19 @@ do -- COORDINATE
function COORDINATE:GetAltitudeText( Settings, Language )
local Altitude = self.y
local Settings = Settings or _SETTINGS
local Language = Language or Settings.Locale or _SETTINGS.Locale or "EN"
Language = string.lower(Language)
local Language = Language or "EN"
if Altitude ~= 0 then
if Settings:IsMetric() then
if Language == "en" then
if Language == "EN" then
return " at " .. UTILS.Round( self.y, -3 ) .. " meters"
elseif Language == "ru" then
elseif Language == "RU" then
return " в " .. UTILS.Round( self.y, -3 ) .. " метры"
end
else
if Language == "en" then
if Language == "EN" then
return " at " .. UTILS.Round( UTILS.MetersToFeet( self.y ), -3 ) .. " feet"
elseif Language == "ru" then
elseif Language == "RU" then
return " в " .. UTILS.Round( self.y, -3 ) .. " ноги"
end
end
@@ -1269,14 +1209,12 @@ do -- COORDINATE
-- @param #number AngleRadians The angle in randians
-- @param #number Distance The distance
-- @param Core.Settings#SETTINGS Settings
-- @param #string Language (Optional) Language "en" or "ru"
-- @param #boolean MagVar If true, also state angle in magnetic
-- @return #string The BR Text
function COORDINATE:GetBRText( AngleRadians, Distance, Settings, Language, MagVar )
function COORDINATE:GetBRText( AngleRadians, Distance, Settings, Language )
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
local BearingText = self:GetBearingText( AngleRadians, 0, Settings, MagVar )
local BearingText = self:GetBearingText( AngleRadians, 0, Settings, Language )
local DistanceText = self:GetDistanceText( Distance, Settings, Language, 0 )
local BRText = BearingText .. DistanceText
@@ -1289,14 +1227,12 @@ do -- COORDINATE
-- @param #number AngleRadians The angle in randians
-- @param #number Distance The distance
-- @param Core.Settings#SETTINGS Settings
-- @param #string Language (Optional) Language "en" or "ru"
-- @param #boolean MagVar If true, also state angle in magnetic
-- @return #string The BRA Text
function COORDINATE:GetBRAText( AngleRadians, Distance, Settings, Language, MagVar )
function COORDINATE:GetBRAText( AngleRadians, Distance, Settings, Language )
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
local BearingText = self:GetBearingText( AngleRadians, 0, Settings, MagVar )
local BearingText = self:GetBearingText( AngleRadians, 0, Settings, Language )
local DistanceText = self:GetDistanceText( Distance, Settings, Language, 0 )
local AltitudeText = self:GetAltitudeText( Settings, Language )
@@ -1321,15 +1257,7 @@ do -- COORDINATE
self.y=alt
return self
end
--- Set altitude to be at land height (i.e. on the ground!)
-- @param #COORDINATE self
function COORDINATE:SetAtLandheight()
local alt=self:GetLandHeight()
self.y=alt
return self
end
--- Build an air type route point.
-- @param #COORDINATE self
-- @param #COORDINATE.WaypointAltType AltType The altitude type.
@@ -1580,7 +1508,7 @@ do -- COORDINATE
-- @param #number Coalition (Optional) Coalition of the airbase.
-- @return Wrapper.Airbase#AIRBASE Closest Airbase to the given coordinate.
-- @return #number Distance to the closest airbase in meters.
function COORDINATE:GetClosestAirbase(Category, Coalition)
function COORDINATE:GetClosestAirbase2(Category, Coalition)
-- Get all airbases of the map.
local airbases=AIRBASE.GetAllAirbases(Coalition)
@@ -1614,15 +1542,34 @@ do -- COORDINATE
return closest,distmin
end
--- [kept for downwards compatibility only] Gets the nearest airbase with respect to the current coordinates.
--- Gets the nearest airbase with respect to the current coordinates.
-- @param #COORDINATE self
-- @param #number Category (Optional) Category of the airbase. Enumerator of @{Wrapper.Airbase#AIRBASE.Category}.
-- @param #number Coalition (Optional) Coalition of the airbase.
-- @return Wrapper.Airbase#AIRBASE Closest Airbase to the given coordinate.
-- @return #number Distance to the closest airbase in meters.
function COORDINATE:GetClosestAirbase2(Category, Coalition)
local closest, distmin = self:GetClosestAirbase(Category, Coalition)
return closest, distmin
function COORDINATE:GetClosestAirbase(Category, Coalition)
local a=self:GetVec3()
local distmin=math.huge
local airbase=nil
for DCSairbaseID, DCSairbase in pairs(world.getAirbases(Coalition)) do
local b=DCSairbase:getPoint()
local c=UTILS.VecSubstract(a,b)
local dist=UTILS.VecNorm(c)
--env.info(string.format("Airbase %s dist=%d category=%d", DCSairbase:getName(), dist, DCSairbase:getCategory()))
if dist<distmin and (Category==nil or Category==DCSairbase:getDesc().category) then
distmin=dist
airbase=DCSairbase
end
end
return AIRBASE:Find(airbase)
end
--- Gets the nearest parking spot.
@@ -1955,6 +1902,7 @@ do -- COORDINATE
-- @param #COORDINATE self
-- @param #string name (Optional) Name of the fire to stop it, if not using the same COORDINATE object.
function COORDINATE:StopBigSmokeAndFire( name )
self:F2( { name = name } )
name = name or self.firename
trigger.action.effectSmokeStop( name )
end
@@ -2319,7 +2267,7 @@ do -- COORDINATE
end
--- 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.
-- **NOTE**: A free form polygon must have **at least three points** in total and currently only **up to 10 points** in total are supported.
-- @param #COORDINATE self
-- @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.
@@ -2372,28 +2320,8 @@ do -- COORDINATE
trigger.action.markupToAll(7, Coalition, MarkID, vecs[1], vecs[2], vecs[3], vecs[4], vecs[5], vecs[6], vecs[7], vecs[8], vecs[9], Color, FillColor, LineType, ReadOnly, Text or "")
elseif #vecs==10 then
trigger.action.markupToAll(7, Coalition, MarkID, vecs[1], vecs[2], vecs[3], vecs[4], vecs[5], vecs[6], vecs[7], vecs[8], vecs[9], vecs[10], Color, FillColor, LineType, ReadOnly, Text or "")
elseif #vecs==11 then
trigger.action.markupToAll(7, Coalition, MarkID, vecs[1], vecs[2], vecs[3], vecs[4], vecs[5], vecs[6], vecs[7], vecs[8], vecs[9], vecs[10],
vecs[11],
Color, FillColor, LineType, ReadOnly, Text or "")
elseif #vecs==12 then
trigger.action.markupToAll(7, Coalition, MarkID, vecs[1], vecs[2], vecs[3], vecs[4], vecs[5], vecs[6], vecs[7], vecs[8], vecs[9], vecs[10],
vecs[11], vecs[12],
Color, FillColor, LineType, ReadOnly, Text or "")
elseif #vecs==13 then
trigger.action.markupToAll(7, Coalition, MarkID, vecs[1], vecs[2], vecs[3], vecs[4], vecs[5], vecs[6], vecs[7], vecs[8], vecs[9], vecs[10],
vecs[11], vecs[12], vecs[13],
Color, FillColor, LineType, ReadOnly, Text or "")
elseif #vecs==14 then
trigger.action.markupToAll(7, Coalition, MarkID, vecs[1], vecs[2], vecs[3], vecs[4], vecs[5], vecs[6], vecs[7], vecs[8], vecs[9], vecs[10],
vecs[11], vecs[12], vecs[13], vecs[14],
Color, FillColor, LineType, ReadOnly, Text or "")
elseif #vecs==15 then
trigger.action.markupToAll(7, Coalition, MarkID, vecs[1], vecs[2], vecs[3], vecs[4], vecs[5], vecs[6], vecs[7], vecs[8], vecs[9], vecs[10],
vecs[11], vecs[12], vecs[13], vecs[14], vecs[15],
Color, FillColor, LineType, ReadOnly, Text or "")
else
self:E("ERROR: Currently a free form polygon can only have 15 points in total!")
self:E("ERROR: Currently a free form polygon can only have 10 points in total!")
-- 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 "")
end
@@ -2815,27 +2743,25 @@ do -- COORDINATE
-- @param #COORDINATE self
-- @param #COORDINATE FromCoordinate The coordinate to measure the distance and the bearing from.
-- @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 #boolean MagVar If true, also get angle in MagVar for BR/BRA
-- @return #string The BR text.
function COORDINATE:ToStringBR( FromCoordinate, Settings, MagVar )
function COORDINATE:ToStringBR( FromCoordinate, Settings )
local DirectionVec3 = FromCoordinate:GetDirectionVec3( self )
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
local Distance = self:Get2DDistance( FromCoordinate )
return "BR, " .. self:GetBRText( AngleRadians, Distance, Settings, nil, MagVar )
return "BR, " .. self:GetBRText( AngleRadians, Distance, Settings )
end
--- Return a BRA string from a COORDINATE to the COORDINATE.
-- @param #COORDINATE self
-- @param #COORDINATE FromCoordinate The coordinate to measure the distance and the bearing from.
-- @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 #boolean MagVar If true, also get angle in MagVar for BR/BRA
-- @return #string The BR text.
function COORDINATE:ToStringBRA( FromCoordinate, Settings, MagVar )
function COORDINATE:ToStringBRA( FromCoordinate, Settings, Language )
local DirectionVec3 = FromCoordinate:GetDirectionVec3( self )
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
local Distance = FromCoordinate:Get2DDistance( self )
local Altitude = self:GetAltitudeText()
return "BRA, " .. self:GetBRAText( AngleRadians, Distance, Settings, nil, MagVar )
return "BRA, " .. self:GetBRAText( AngleRadians, Distance, Settings, Language )
end
--- Create a BRAA NATO call string to this COORDINATE from the FromCOORDINATE. Note - BRA delivered if no aspect can be obtained and "Merged" if range < 3nm
@@ -2843,11 +2769,8 @@ do -- COORDINATE
-- @param #COORDINATE FromCoordinate The coordinate to measure the distance and the bearing from.
-- @param #boolean Bogey Add "Bogey" at the end if true (not yet declared hostile or friendly)
-- @param #boolean Spades Add "Spades" at the end if true (no IFF/VID ID yet known)
-- @param #boolean SSML Add SSML tags speaking aspect as 0 1 2 and "brah" instead of BRAA
-- @param #boolean Angels If true, altitude is e.g. "Angels 25" (i.e., a friendly plane), else "25 thousand"
-- @param #boolean Zeros If using SSML, be aware that Google TTS will say "oh" and not "zero" for "0"; if Zeros is set to true, "0" will be replaced with "zero"
-- @return #string The BRAA text.
function COORDINATE:ToStringBRAANATO(FromCoordinate,Bogey,Spades,SSML,Angels,Zeros)
function COORDINATE:ToStringBRAANATO(FromCoordinate,Bogey,Spades)
-- Thanks to @Pikey
local BRAANATO = "Merged."
@@ -2865,64 +2788,25 @@ do -- COORDINATE
local alt = UTILS.Round(UTILS.MetersToFeet(self.y)/1000,0)--*1000
local alttext = string.format("%d thousand",alt)
if Angels then
alttext = string.format("Angels %d",alt)
end
if alt < 1 then
alttext = "very low"
end
local track = UTILS.BearingToCardinal(bearing) or "North"
if rangeNM > 3 then
if SSML then -- google says "oh" instead of zero, be aware
if Zeros then
bearing = string.format("%03d",bearing)
local AngleDegText = string.gsub(bearing,"%d","%1 ") -- "0 5 1 "
AngleDegText = string.gsub(AngleDegText," $","") -- "0 5 1"
AngleDegText = string.gsub(AngleDegText,"0","zero")
if aspect == "" then
BRAANATO = string.format("brah %s, %d miles, %s, Track %s", AngleDegText, rangeNM, alttext, track)
else
BRAANATO = string.format("brah %s, %d miles, %s, %s, Track %s", AngleDegText, rangeNM, alttext, aspect, track)
end
else
if aspect == "" then
BRAANATO = string.format("brah <say-as interpret-as='characters'>%03d</say-as>, %d miles, %s, Track %s", bearing, rangeNM, alttext, track)
else
BRAANATO = string.format("brah <say-as interpret-as='characters'>%03d</say-as>, %d miles, %s, %s, Track %s", bearing, rangeNM, alttext, aspect, track)
end
end
if Bogey and Spades then
BRAANATO = BRAANATO..", Bogey, Spades."
elseif Bogey then
BRAANATO = BRAANATO..", Bogey."
elseif Spades then
BRAANATO = BRAANATO..", Spades."
else
BRAANATO = BRAANATO.."."
end
if aspect == "" then
BRAANATO = string.format("BRA, %03d, %d miles, Angels %d, Track %s",bearing, rangeNM, alt, track)
else
if aspect == "" then
BRAANATO = string.format("BRA %03d, %d miles, %s, Track %s",bearing, rangeNM, alttext, track)
else
BRAANATO = string.format("BRAA %03d, %d miles, %s, %s, Track %s",bearing, rangeNM, alttext, aspect, track)
end
if Bogey and Spades then
BRAANATO = BRAANATO..", Bogey, Spades."
elseif Bogey then
BRAANATO = BRAANATO..", Bogey."
elseif Spades then
BRAANATO = BRAANATO..", Spades."
else
BRAANATO = BRAANATO.."."
end
BRAANATO = string.format("BRAA, %03d, %d miles, Angels %d, %s, Track %s",bearing, rangeNM, alt, aspect, track)
end
if Bogey and Spades then
BRAANATO = BRAANATO..", Bogey, Spades."
elseif Bogey then
BRAANATO = BRAANATO..", Bogey."
elseif Spades then
BRAANATO = BRAANATO..", Spades."
else
BRAANATO = BRAANATO.."."
end
end
return BRAANATO
end
@@ -2930,15 +2814,14 @@ do -- COORDINATE
-- @param #COORDINATE self
-- @param DCS#coalition.side Coalition The coalition.
-- @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 #boolean MagVar If true, als get angle in magnetic
-- @return #string The BR text.
function COORDINATE:ToStringBULLS( Coalition, Settings, MagVar )
function COORDINATE:ToStringBULLS( Coalition, Settings )
local BullsCoordinate = COORDINATE:NewFromVec3( coalition.getMainRefPoint( Coalition ) )
local DirectionVec3 = BullsCoordinate:GetDirectionVec3( self )
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
local Distance = self:Get2DDistance( BullsCoordinate )
local Altitude = self:GetAltitudeText()
return "BULLS, " .. self:GetBRText( AngleRadians, Distance, Settings, nil, MagVar )
return "BULLS, " .. self:GetBRText( AngleRadians, Distance, Settings )
end
--- Return an aspect string from a COORDINATE to the Angle of the object.
@@ -3002,7 +2885,7 @@ do -- COORDINATE
-- @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 The MGRS Text
function COORDINATE:ToStringMGRS( Settings )
function COORDINATE:ToStringMGRS( Settings ) --R2.1 Fixes issue #424.
local MGRS_Accuracy = Settings and Settings.MGRS_Accuracy or _SETTINGS.MGRS_Accuracy
local lat, lon = coord.LOtoLL( self:GetVec3() )
@@ -3014,13 +2897,12 @@ do -- COORDINATE
-- * Uses default settings in COORDINATE.
-- * Can be overridden if for a GROUP containing x clients, a menu was selected to override the default.
-- @param #COORDINATE self
-- @param #COORDINATE ReferenceCoord The reference coordinate.
-- @param #string ReferenceName The reference name.
-- @param #COORDINATE ReferenceCoord The refrence coordinate.
-- @param #string ReferenceName The refrence name.
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
-- @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 #boolean MagVar If true also show angle in magnetic
-- @return #string The coordinate Text in the configured coordinate system.
function COORDINATE:ToStringFromRP( ReferenceCoord, ReferenceName, Controllable, Settings, MagVar )
function COORDINATE:ToStringFromRP( ReferenceCoord, ReferenceName, Controllable, Settings )
self:F2( { ReferenceCoord = ReferenceCoord, ReferenceName = ReferenceName } )
@@ -3032,59 +2914,24 @@ do -- COORDINATE
local DirectionVec3 = ReferenceCoord:GetDirectionVec3( self )
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
local Distance = self:Get2DDistance( ReferenceCoord )
return "Targets are the last seen " .. self:GetBRText( AngleRadians, Distance, Settings, nil, MagVar ) .. " from " .. ReferenceName
return "Targets are the last seen " .. self:GetBRText( AngleRadians, Distance, Settings ) .. " from " .. ReferenceName
else
local DirectionVec3 = ReferenceCoord:GetDirectionVec3( self )
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
local Distance = self:Get2DDistance( ReferenceCoord )
return "Target are located " .. self:GetBRText( AngleRadians, Distance, Settings, nil, MagVar ) .. " from " .. ReferenceName
return "Target are located " .. self:GetBRText( AngleRadians, Distance, Settings ) .. " from " .. ReferenceName
end
return nil
end
--- Provides a coordinate string of the point, based on a coordinate format system:
-- * Uses default settings in COORDINATE.
-- * Can be overridden if for a GROUP containing x clients, a menu was selected to override the default.
-- @param #COORDINATE self
-- @param #COORDINATE ReferenceCoord The reference coordinate.
-- @param #string ReferenceName The reference name.
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
-- @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 #boolean MagVar If true also get the angle as magnetic
-- @return #string The coordinate Text in the configured coordinate system.
function COORDINATE:ToStringFromRPShort( ReferenceCoord, ReferenceName, Controllable, Settings, MagVar )
self:F2( { ReferenceCoord = ReferenceCoord, ReferenceName = ReferenceName } )
local Settings = Settings or ( Controllable and _DATABASE:GetPlayerSettings( Controllable:GetPlayerName() ) ) or _SETTINGS
local IsAir = Controllable and Controllable:IsAirPlane() or false
if IsAir then
local DirectionVec3 = ReferenceCoord:GetDirectionVec3( self )
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
local Distance = self:Get2DDistance( ReferenceCoord )
return self:GetBRText( AngleRadians, Distance, Settings, nil, MagVar ) .. " from " .. ReferenceName
else
local DirectionVec3 = ReferenceCoord:GetDirectionVec3( self )
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
local Distance = self:Get2DDistance( ReferenceCoord )
return self:GetBRText( AngleRadians, Distance, Settings, nil, MagVar ) .. " from " .. ReferenceName
end
return nil
end
--- Provides a coordinate string of the point, based on the A2G coordinate format system.
-- @param #COORDINATE self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
-- @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 #boolean MagVar If true, also get angle in MagVar for BR/BRA
-- @return #string The coordinate Text in the configured coordinate system.
function COORDINATE:ToStringA2G( Controllable, Settings, MagVar )
function COORDINATE:ToStringA2G( Controllable, Settings )
self:F2( { Controllable = Controllable and Controllable:GetName() } )
@@ -3094,7 +2941,7 @@ do -- COORDINATE
-- If no Controllable is given to calculate the BR from, then MGRS will be used!!!
if Controllable then
local Coordinate = Controllable:GetCoordinate()
return Controllable and self:ToStringBR( Coordinate, Settings, MagVar ) or self:ToStringMGRS( Settings )
return Controllable and self:ToStringBR( Coordinate, Settings ) or self:ToStringMGRS( Settings )
else
return self:ToStringMGRS( Settings )
end
@@ -3118,34 +2965,33 @@ do -- COORDINATE
-- @param #COORDINATE self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
-- @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 #boolean MagVar If true, also get angle in MagVar for BR/BRA
-- @return #string The coordinate Text in the configured coordinate system.
function COORDINATE:ToStringA2A( Controllable, Settings, MagVar )
function COORDINATE:ToStringA2A( Controllable, Settings, Language ) -- R2.2
self:F2( { Controllable = Controllable and Controllable:GetName() } )
local Settings = Settings or ( Controllable and _DATABASE:GetPlayerSettings( Controllable:GetPlayerName() ) ) or _SETTINGS
if Settings:IsA2A_BRAA() then
if Settings:IsA2A_BRAA() then
if Controllable then
local Coordinate = Controllable:GetCoordinate()
return self:ToStringBRA( Coordinate, Settings, MagVar )
return self:ToStringBRA( Coordinate, Settings, Language )
else
return self:ToStringMGRS( Settings )
return self:ToStringMGRS( Settings, Language )
end
end
if Settings:IsA2A_BULLS() then
local Coalition = Controllable:GetCoalition()
return self:ToStringBULLS( Coalition, Settings, MagVar )
return self:ToStringBULLS( Coalition, Settings, Language )
end
if Settings:IsA2A_LL_DMS() then
return self:ToStringLLDMS( Settings )
return self:ToStringLLDMS( Settings, Language )
end
if Settings:IsA2A_LL_DDM() then
return self:ToStringLLDDM( Settings )
return self:ToStringLLDDM( Settings, Language )
end
if Settings:IsA2A_MGRS() then
return self:ToStringMGRS( Settings )
return self:ToStringMGRS( Settings, Language )
end
return nil
@@ -3213,7 +3059,7 @@ do -- COORDINATE
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
-- @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 The pressure text in the configured measurement system.
function COORDINATE:ToStringPressure( Controllable, Settings )
function COORDINATE:ToStringPressure( Controllable, Settings ) -- R2.3
self:F2( { Controllable = Controllable and Controllable:GetName() } )
@@ -3390,21 +3236,21 @@ do -- POINT_VEC3
--- Return the x coordinate of the POINT_VEC3.
-- @param #POINT_VEC3 self
-- @return #number The x coordinate.
-- @return #number The x coodinate.
function POINT_VEC3:GetX()
return self.x
end
--- Return the y coordinate of the POINT_VEC3.
-- @param #POINT_VEC3 self
-- @return #number The y coordinate.
-- @return #number The y coodinate.
function POINT_VEC3:GetY()
return self.y
end
--- Return the z coordinate of the POINT_VEC3.
-- @param #POINT_VEC3 self
-- @return #number The z coordinate.
-- @return #number The z coodinate.
function POINT_VEC3:GetZ()
return self.z
end
@@ -3438,7 +3284,7 @@ do -- POINT_VEC3
--- Add to the x coordinate of the POINT_VEC3.
-- @param #POINT_VEC3 self
-- @param #number x The x coordinate value to add to the current x coordinate.
-- @param #number x The x coordinate value to add to the current x coodinate.
-- @return #POINT_VEC3
function POINT_VEC3:AddX( x )
self.x = self.x + x
@@ -3447,7 +3293,7 @@ do -- POINT_VEC3
--- Add to the y coordinate of the POINT_VEC3.
-- @param #POINT_VEC3 self
-- @param #number y The y coordinate value to add to the current y coordinate.
-- @param #number y The y coordinate value to add to the current y coodinate.
-- @return #POINT_VEC3
function POINT_VEC3:AddY( y )
self.y = self.y + y
@@ -3456,7 +3302,7 @@ do -- POINT_VEC3
--- Add to the z coordinate of the POINT_VEC3.
-- @param #POINT_VEC3 self
-- @param #number z The z coordinate value to add to the current z coordinate.
-- @param #number z The z coordinate value to add to the current z coodinate.
-- @return #POINT_VEC3
function POINT_VEC3:AddZ( z )
self.z = self.z +z
@@ -3562,14 +3408,14 @@ do -- POINT_VEC2
--- Return the x coordinate of the POINT_VEC2.
-- @param #POINT_VEC2 self
-- @return #number The x coordinate.
-- @return #number The x coodinate.
function POINT_VEC2:GetX()
return self.x
end
--- Return the y coordinate of the POINT_VEC2.
-- @param #POINT_VEC2 self
-- @return #number The y coordinate.
-- @return #number The y coodinate.
function POINT_VEC2:GetY()
return self.z
end
@@ -3594,7 +3440,7 @@ do -- POINT_VEC2
--- Return Return the Lat(itude) coordinate of the POINT_VEC2 (ie: (parent)POINT_VEC3.x).
-- @param #POINT_VEC2 self
-- @return #number The x coordinate.
-- @return #number The x coodinate.
function POINT_VEC2:GetLat()
return self.x
end
@@ -3610,7 +3456,7 @@ do -- POINT_VEC2
--- Return the Lon(gitude) coordinate of the POINT_VEC2 (ie: (parent)POINT_VEC3.z).
-- @param #POINT_VEC2 self
-- @return #number The y coordinate.
-- @return #number The y coodinate.
function POINT_VEC2:GetLon()
return self.z
end
+15 -12
View File
@@ -1,13 +1,13 @@
--- **Core** - Provides a handy means to create messages and reports.
--
-- ===
--
--
-- ## Features:
--
--
-- * Create text blocks that are formatted.
-- * Create automatic indents.
-- * Variate the delimiters between reporting lines.
--
--
-- ===
--
-- ### Authors: FlightControl : Design & Programming
@@ -15,6 +15,7 @@
-- @module Core.Report
-- @image Core_Report.JPG
--- @type REPORT
-- @extends Core.Base#BASE
@@ -35,7 +36,7 @@ function REPORT:New( Title )
self.Report = {}
self:SetTitle( Title or "" )
self:SetTitle( Title or "" )
self:SetIndent( 3 )
return self
@@ -44,26 +45,28 @@ end
--- Has the REPORT Text?
-- @param #REPORT self
-- @return #boolean
function REPORT:HasText() -- R2.1
function REPORT:HasText() --R2.1
return #self.Report > 0
end
--- Set indent of a REPORT.
-- @param #REPORT self
-- @param #number Indent
-- @return #REPORT
function REPORT:SetIndent( Indent ) -- R2.1
function REPORT:SetIndent( Indent ) --R2.1
self.Indent = Indent
return self
end
--- Add a new line to a REPORT.
-- @param #REPORT self
-- @param #string Text
-- @return #REPORT
function REPORT:Add( Text )
self.Report[#self.Report + 1] = Text
self.Report[#self.Report+1] = Text
return self
end
@@ -73,17 +76,17 @@ end
-- @param #string Separator (optional) The start of each report line can begin with an optional separator character. This can be a "-", or "#", or "*". You're free to choose what you find the best.
-- @return #REPORT
function REPORT:AddIndent( Text, Separator )
self.Report[#self.Report + 1] = ((Separator and Separator .. string.rep( " ", self.Indent - 1 )) or string.rep( " ", self.Indent )) .. Text:gsub( "\n", "\n" .. string.rep( " ", self.Indent ) )
self.Report[#self.Report+1] = ( ( Separator and Separator .. string.rep( " ", self.Indent - 1 ) ) or string.rep(" ", self.Indent ) ) .. Text:gsub("\n","\n"..string.rep( " ", self.Indent ) )
return self
end
--- Produces the text of the report, taking into account an optional delimiter, which is \n by default.
--- Produces the text of the report, taking into account an optional delimeter, which is \n by default.
-- @param #REPORT self
-- @param #string Delimiter (optional) A delimiter text.
-- @return #string The report text.
function REPORT:Text( Delimiter )
Delimiter = Delimiter or "\n"
local ReportText = (self.Title ~= "" and self.Title .. Delimiter or self.Title) .. table.concat( self.Report, Delimiter ) or ""
local ReportText = ( self.Title ~= "" and self.Title .. Delimiter or self.Title ) .. table.concat( self.Report, Delimiter ) or ""
return ReportText
end
@@ -92,7 +95,7 @@ end
-- @param #string Title The title of the report.
-- @return #REPORT
function REPORT:SetTitle( Title )
self.Title = Title
self.Title = Title
return self
end
@@ -1,36 +1,36 @@
--- **Core** - SCHEDULEDISPATCHER dispatches the different schedules.
--
--- **Core** -- SCHEDULEDISPATCHER dispatches the different schedules.
--
-- ===
--
--
-- Takes care of the creation and dispatching of scheduled functions for SCHEDULER objects.
--
--
-- This class is tricky and needs some thorough explanation.
-- SCHEDULE classes are used to schedule functions for objects, or as persistent objects.
-- The SCHEDULEDISPATCHER class ensures that:
--
--
-- - Scheduled functions are planned according the SCHEDULER object parameters.
-- - Scheduled functions are repeated when requested, according the SCHEDULER object parameters.
-- - Scheduled functions are automatically removed when the schedule is finished, according the SCHEDULER object parameters.
--
--
-- The SCHEDULEDISPATCHER class will manage SCHEDULER object in memory during garbage collection:
--
--
-- - When a SCHEDULER object is not attached to another object (that is, it's first :Schedule() parameter is nil), then the SCHEDULER object is _persistent_ within memory.
-- - When a SCHEDULER object *is* attached to another object, then the SCHEDULER object is _not persistent_ within memory after a garbage collection!
--
-- The non-persistency of SCHEDULERS attached to objects is required to allow SCHEDULER objects to be garbage collected when the parent object is destroyed, or set to nil and garbage collected.
-- Even when there are pending timer scheduled functions to be executed for the SCHEDULER object,
--
-- The none persistency of SCHEDULERS attached to objects is required to allow SCHEDULER objects to be garbage collectged, when the parent object is also desroyed or nillified and garbage collected.
-- Even when there are pending timer scheduled functions to be executed for the SCHEDULER object,
-- these will not be executed anymore when the SCHEDULER object has been destroyed.
--
--
-- The SCHEDULEDISPATCHER allows multiple scheduled functions to be planned and executed for one SCHEDULER object.
-- The SCHEDULER object therefore keeps a table of "CallID's", which are returned after each planning of a new scheduled function by the SCHEDULEDISPATCHER.
-- The SCHEDULER object plans new scheduled functions through the @{Core.Scheduler#SCHEDULER.Schedule}() method.
-- The SCHEDULER object plans new scheduled functions through the @{Core.Scheduler#SCHEDULER.Schedule}() method.
-- The Schedule() method returns the CallID that is the reference ID for each planned schedule.
--
--
-- ===
--
--
-- ### Contributions: -
-- ### Authors: FlightControl : Design & Programming
--
--
-- @module Core.ScheduleDispatcher
-- @image Core_Schedule_Dispatcher.JPG
@@ -38,7 +38,7 @@
-- @type SCHEDULEDISPATCHER
-- @field #string ClassName Name of the class.
-- @field #number CallID Call ID counter.
-- @field #table PersistentSchedulers Persistent schedulers.
-- @field #table PersistentSchedulers Persistant schedulers.
-- @field #table ObjectSchedulers Schedulers that only exist as long as the master object exists.
-- @field #table Schedule Meta table setmetatable( {}, { __mode = "k" } ).
-- @extends Core.Base#BASE
@@ -46,11 +46,11 @@
--- The SCHEDULEDISPATCHER structure
-- @type SCHEDULEDISPATCHER
SCHEDULEDISPATCHER = {
ClassName = "SCHEDULEDISPATCHER",
CallID = 0,
PersistentSchedulers = {},
ObjectSchedulers = {},
Schedule = nil,
ClassName = "SCHEDULEDISPATCHER",
CallID = 0,
PersistentSchedulers = {},
ObjectSchedulers = {},
Schedule = nil,
}
--- Player data table holding all important parameters of each player.
@@ -58,7 +58,7 @@ SCHEDULEDISPATCHER = {
-- @field #function Function The schedule function to be called.
-- @field #table Arguments Schedule function arguments.
-- @field #number Start Start time in seconds.
-- @field #number Repeat Repeat time interval in seconds.
-- @field #number Repeat Repeat time intervall in seconds.
-- @field #number Randomize Randomization factor [0,1].
-- @field #number Stop Stop time in seconds.
-- @field #number StartTime Time in seconds when the scheduler is created.
@@ -77,7 +77,7 @@ end
--- Add a Schedule to the ScheduleDispatcher.
-- The development of this method was really tidy.
-- It is constructed as such that a garbage collection is executed on the weak tables, when the Scheduler is set to nil.
-- It is constructed as such that a garbage collection is executed on the weak tables, when the Scheduler is nillified.
-- Nothing of this code should be modified without testing it thoroughly.
-- @param #SCHEDULEDISPATCHER self
-- @param Core.Scheduler#SCHEDULER Scheduler Scheduler object.
@@ -85,7 +85,7 @@ end
-- @param #table ScheduleArguments Table of arguments passed to the ScheduleFunction.
-- @param #number Start Start time in seconds.
-- @param #number Repeat Repeat interval in seconds.
-- @param #number Randomize Randomization factor [0,1].
-- @param #number Randomize Radomization factor [0,1].
-- @param #number Stop Stop time in seconds.
-- @param #number TraceLevel Trace level [0,3].
-- @param Core.Fsm#FSM Fsm Finite state model.
@@ -95,32 +95,32 @@ function SCHEDULEDISPATCHER:AddSchedule( Scheduler, ScheduleFunction, ScheduleAr
-- Increase counter.
self.CallID = self.CallID + 1
-- Create ID.
local CallID = self.CallID .. "#" .. (Scheduler.MasterObject and Scheduler.MasterObject.GetClassNameAndID and Scheduler.MasterObject:GetClassNameAndID() or "") or ""
self:T2( string.format( "Adding schedule #%d CallID=%s", self.CallID, CallID ) )
local CallID = self.CallID .. "#" .. ( Scheduler.MasterObject and Scheduler.MasterObject.GetClassNameAndID and Scheduler.MasterObject:GetClassNameAndID() or "" ) or ""
self:T2(string.format("Adding schedule #%d CallID=%s", self.CallID, CallID))
-- Initialize PersistentSchedulers
self.PersistentSchedulers = self.PersistentSchedulers or {}
-- Initialize the ObjectSchedulers array, which is a weakly coupled table.
-- If the object used as the key is nil, then the garbage collector will remove the item from the Functions array.
self.ObjectSchedulers = self.ObjectSchedulers or setmetatable( {}, { __mode = "v" } )
self.ObjectSchedulers = self.ObjectSchedulers or setmetatable( {}, { __mode = "v" } )
if Scheduler.MasterObject then
--env.info("FF Object Scheduler")
self.ObjectSchedulers[CallID] = Scheduler
self:F3( { CallID = CallID, ObjectScheduler = tostring( self.ObjectSchedulers[CallID] ), MasterObject = tostring( Scheduler.MasterObject ) } )
self:F3( { CallID = CallID, ObjectScheduler = tostring(self.ObjectSchedulers[CallID]), MasterObject = tostring(Scheduler.MasterObject) } )
else
--env.info("FF Persistent Scheduler")
self.PersistentSchedulers[CallID] = Scheduler
self:F3( { CallID = CallID, PersistentScheduler = self.PersistentSchedulers[CallID] } )
end
self.Schedule = self.Schedule or setmetatable( {}, { __mode = "k" } )
self.Schedule[Scheduler] = self.Schedule[Scheduler] or {}
self.Schedule[Scheduler][CallID] = {} -- #SCHEDULEDISPATCHER.ScheduleData
self.Schedule[Scheduler][CallID] = {} --#SCHEDULEDISPATCHER.ScheduleData
self.Schedule[Scheduler][CallID].Function = ScheduleFunction
self.Schedule[Scheduler][CallID].Arguments = ScheduleArguments
self.Schedule[Scheduler][CallID].StartTime = timer.getTime() + ( Start or 0 )
@@ -128,7 +128,8 @@ function SCHEDULEDISPATCHER:AddSchedule( Scheduler, ScheduleFunction, ScheduleAr
self.Schedule[Scheduler][CallID].Repeat = Repeat or 0
self.Schedule[Scheduler][CallID].Randomize = Randomize or 0
self.Schedule[Scheduler][CallID].Stop = Stop
-- This section handles the tracing of the scheduled calls.
-- Because these calls will be executed with a delay, we inspect the place where these scheduled calls are initiated.
-- The Info structure contains the output of the debug.getinfo() calls, which inspects the call stack for the function name, line number and source name.
@@ -150,10 +151,10 @@ function SCHEDULEDISPATCHER:AddSchedule( Scheduler, ScheduleFunction, ScheduleAr
-- Therefore, in the call stack, at the TraceLevel these functions are mentioned as "tail calls", and the Info.name field will be nil as a result.
-- To obtain the correct function name for FSM object calls, the function is mentioned in the call stack at a higher stack level.
-- So when function name stored in Info.name is nil, then I inspect the function name within the call stack one level higher.
-- So this little piece of code does its magic wonderfully, performance overhead is negligible, as scheduled calls don't happen that often.
-- So this little piece of code does its magic wonderfully, preformance overhead is neglectible, as scheduled calls don't happen that often.
local Info = {}
if debug then
TraceLevel = TraceLevel or 2
Info = debug.getinfo( TraceLevel, "nlS" )
@@ -167,7 +168,7 @@ function SCHEDULEDISPATCHER:AddSchedule( Scheduler, ScheduleFunction, ScheduleAr
--- Function passed to the DCS timer.scheduleFunction()
self.Schedule[Scheduler][CallID].CallHandler = function( Params )
local CallID = Params.CallID
local Info = Params.Info or {}
local Source = Info.source or "?"
@@ -181,27 +182,27 @@ function SCHEDULEDISPATCHER:AddSchedule( Scheduler, ScheduleFunction, ScheduleAr
end
return errmsg
end
-- Get object or persistent scheduler object.
local Scheduler = self.ObjectSchedulers[CallID] -- Core.Scheduler#SCHEDULER
-- Get object or persistant scheduler object.
local Scheduler = self.ObjectSchedulers[CallID] --Core.Scheduler#SCHEDULER
if not Scheduler then
Scheduler = self.PersistentSchedulers[CallID]
end
-- self:T3( { Scheduler = Scheduler } )
--self:T3( { Scheduler = Scheduler } )
if Scheduler then
local MasterObject = tostring( Scheduler.MasterObject )
local MasterObject = tostring(Scheduler.MasterObject)
-- Schedule object.
local Schedule = self.Schedule[Scheduler][CallID] -- #SCHEDULEDISPATCHER.ScheduleData
local Schedule = self.Schedule[Scheduler][CallID] --#SCHEDULEDISPATCHER.ScheduleData
--self:T3( { Schedule = Schedule } )
-- self:T3( { Schedule = Schedule } )
local SchedulerObject = Scheduler.MasterObject -- Scheduler.SchedulerObject Now is this the Master or Scheduler object?
local SchedulerObject = Scheduler.MasterObject --Scheduler.SchedulerObject Now is this the Maste or Scheduler object?
local ShowTrace = Scheduler.ShowTrace
local ScheduleFunction = Schedule.Function
local ScheduleArguments = Schedule.Arguments or {}
local Start = Schedule.Start
@@ -209,11 +210,12 @@ function SCHEDULEDISPATCHER:AddSchedule( Scheduler, ScheduleFunction, ScheduleAr
local Randomize = Schedule.Randomize or 0
local Stop = Schedule.Stop or 0
local ScheduleID = Schedule.ScheduleID
local Prefix = (Repeat == 0) and "--->" or "+++>"
local Prefix = ( Repeat == 0 ) and "--->" or "+++>"
local Status, Result
-- self:E( { SchedulerObject = SchedulerObject } )
--self:E( { SchedulerObject = SchedulerObject } )
if SchedulerObject then
local function Timer()
if ShowTrace then
@@ -228,39 +230,40 @@ function SCHEDULEDISPATCHER:AddSchedule( Scheduler, ScheduleFunction, ScheduleAr
if ShowTrace then
self:T( Prefix .. Name .. ":" .. Line .. " (" .. Source .. ")" )
end
return ScheduleFunction( unpack( ScheduleArguments ) )
return ScheduleFunction( unpack( ScheduleArguments ) )
end
Status, Result = xpcall( Timer, ErrorHandler )
end
local CurrentTime = timer.getTime()
local StartTime = Schedule.StartTime
-- Debug info.
self:F3( { CallID = CallID, ScheduleID = ScheduleID, Master = MasterObject, CurrentTime = CurrentTime, StartTime = StartTime, Start = Start, Repeat = Repeat, Randomize = Randomize, Stop = Stop } )
if Status and ((Result == nil) or (Result and Result ~= false)) then
if Repeat ~= 0 and ((Stop == 0) or (Stop ~= 0 and CurrentTime <= StartTime + Stop)) then
local ScheduleTime = CurrentTime + Repeat + math.random( -(Randomize * Repeat / 2), (Randomize * Repeat / 2) ) + 0.0001 -- Accuracy
-- self:T3( { Repeat = CallID, CurrentTime, ScheduleTime, ScheduleArguments } )
self:F3( { CallID=CallID, ScheduleID=ScheduleID, Master = MasterObject, CurrentTime = CurrentTime, StartTime = StartTime, Start = Start, Repeat = Repeat, Randomize = Randomize, Stop = Stop } )
if Status and (( Result == nil ) or ( Result and Result ~= false ) ) then
if Repeat ~= 0 and ( ( Stop == 0 ) or ( Stop ~= 0 and CurrentTime <= StartTime + Stop ) ) then
local ScheduleTime = CurrentTime + Repeat + math.random(- ( Randomize * Repeat / 2 ), ( Randomize * Repeat / 2 )) + 0.0001 -- Accuracy
--self:T3( { Repeat = CallID, CurrentTime, ScheduleTime, ScheduleArguments } )
return ScheduleTime -- returns the next time the function needs to be called.
else
self:Stop( Scheduler, CallID )
end
else
self:Stop( Scheduler, CallID )
end
else
self:I( "<<<>" .. Name .. ":" .. Line .. " (" .. Source .. ")" )
end
return nil
end
self:Start( Scheduler, CallID, Info )
return CallID
end
@@ -284,33 +287,33 @@ end
-- @param #string Info (Optional) Debug info.
function SCHEDULEDISPATCHER:Start( Scheduler, CallID, Info )
self:F2( { Start = CallID, Scheduler = Scheduler } )
if CallID then
local Schedule = self.Schedule[Scheduler][CallID] -- #SCHEDULEDISPATCHER.ScheduleData
local Schedule = self.Schedule[Scheduler][CallID] --#SCHEDULEDISPATCHER.ScheduleData
-- Only start when there is no ScheduleID defined!
-- This prevents to "Start" the scheduler twice with the same CallID...
if not Schedule.ScheduleID then
-- Current time in seconds.
local Tnow = timer.getTime()
Schedule.StartTime = Tnow -- Set the StartTime field to indicate when the scheduler started.
local Tnow=timer.getTime()
Schedule.StartTime = Tnow -- Set the StartTime field to indicate when the scheduler started.
-- Start DCS schedule function https://wiki.hoggitworld.com/view/DCS_func_scheduleFunction
Schedule.ScheduleID = timer.scheduleFunction( Schedule.CallHandler, { CallID = CallID, Info = Info }, Tnow + Schedule.Start )
self:T( string.format( "Starting SCHEDULEDISPATCHER Call ID=%s ==> Schedule ID=%s", tostring( CallID ), tostring( Schedule.ScheduleID ) ) )
Schedule.ScheduleID = timer.scheduleFunction(Schedule.CallHandler, { CallID = CallID, Info = Info }, Tnow + Schedule.Start)
self:T(string.format("Starting scheduledispatcher Call ID=%s ==> Schedule ID=%s", tostring(CallID), tostring(Schedule.ScheduleID)))
end
else
-- Recursive.
for CallID, Schedule in pairs( self.Schedule[Scheduler] or {} ) do
self:Start( Scheduler, CallID, Info ) -- Recursive
end
end
end
@@ -322,29 +325,29 @@ function SCHEDULEDISPATCHER:Stop( Scheduler, CallID )
self:F2( { Stop = CallID, Scheduler = Scheduler } )
if CallID then
local Schedule = self.Schedule[Scheduler][CallID] -- #SCHEDULEDISPATCHER.ScheduleData
local Schedule = self.Schedule[Scheduler][CallID] --#SCHEDULEDISPATCHER.ScheduleData
-- Only stop when there is a ScheduleID defined for the CallID. So, when the scheduler was stopped before, do nothing.
if Schedule.ScheduleID then
self:T( string.format( "SCHEDULEDISPATCHER stopping scheduler CallID=%s, ScheduleID=%s", tostring( CallID ), tostring( Schedule.ScheduleID ) ) )
self:T(string.format("scheduledispatcher stopping scheduler CallID=%s, ScheduleID=%s", tostring(CallID), tostring(Schedule.ScheduleID)))
-- Remove schedule function https://wiki.hoggitworld.com/view/DCS_func_removeFunction
timer.removeFunction( Schedule.ScheduleID )
timer.removeFunction(Schedule.ScheduleID)
Schedule.ScheduleID = nil
else
self:T( string.format( "Error no ScheduleID for CallID=%s", tostring( CallID ) ) )
self:T(string.format("Error no ScheduleID for CallID=%s", tostring(CallID)))
end
else
for CallID, Schedule in pairs( self.Schedule[Scheduler] or {} ) do
self:Stop( Scheduler, CallID ) -- Recursive
end
end
end
@@ -359,7 +362,7 @@ function SCHEDULEDISPATCHER:Clear( Scheduler )
end
end
--- Show tracing info.
--- Shopw tracing info.
-- @param #SCHEDULEDISPATCHER self
-- @param Core.Scheduler#SCHEDULER Scheduler Scheduler object.
function SCHEDULEDISPATCHER:ShowTrace( Scheduler )
+105 -103
View File
@@ -3,39 +3,39 @@
-- ===
--
-- ## Features:
--
--
-- * Schedule functions over time,
-- * optionally in an optional specified time interval,
-- * optionally **repeating** with a specified time repeat interval,
-- * optionally **randomizing** with a specified time interval randomization factor,
-- * optionally **stop** the repeating after a specified time interval.
-- * optionally in an optional specified time interval,
-- * optionally **repeating** with a specified time repeat interval,
-- * optionally **randomizing** with a specified time interval randomization factor,
-- * optionally **stop** the repeating after a specified time interval.
--
-- ===
--
--
-- # Demo Missions
--
-- ### [SCHEDULER Demo Missions source code](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SCH%20-%20Scheduler)
-- ### [SCHEDULER Demo Missions source code](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master-release/SCH%20-%20Scheduler)
--
-- ### [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
--
--
-- ### [SCHEDULER YouTube Channel (none)]()
--
--
-- ===
--
-- ### Contributions:
--
-- ### Contributions:
--
-- * FlightControl : Concept & Testing
--
-- ### Authors:
--
--
-- ### Authors:
--
-- * FlightControl : Design & Programming
--
--
-- ===
--
-- @module Core.Scheduler
@@ -48,61 +48,62 @@
-- @field #boolean ShowTrace Trace info if true.
-- @extends Core.Base#BASE
--- Creates and handles schedules over time, which allow to execute code at specific time intervals with randomization.
--
--
-- 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.
-- 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.
--
-- ## SCHEDULER constructor
--
--
-- The SCHEDULER class is quite easy to use, but note that the New constructor has variable parameters:
--
--
-- The @{#SCHEDULER.New}() method returns 2 variables:
--
--
-- 1. The SCHEDULER object reference.
-- 2. The first schedule planned in the SCHEDULER object.
--
--
-- To clarify the different appliances, lets have a look at the following examples:
--
--
-- ### Construct a SCHEDULER object without a persistent schedule.
--
--
-- * @{#SCHEDULER.New}( nil ): Setup a new SCHEDULER object, which is persistently executed after garbage collection.
--
--
-- MasterObject = SCHEDULER:New()
-- SchedulerID = MasterObject:Schedule( nil, ScheduleFunction, {} )
--
--
-- The above example creates a new MasterObject, but does not schedule anything.
-- A separate schedule is created by using the MasterObject using the method :Schedule..., which returns a ScheduleID
--
--
-- ### Construct a SCHEDULER object without a volatile schedule, but volatile to the Object existence...
--
-- * @{#SCHEDULER.New}( Object ): Setup a new SCHEDULER object, which is linked to the Object. When the Object is set to nil or destroyed, the SCHEDULER object will also be destroyed and stopped after garbage collection.
--
--
-- * @{#SCHEDULER.New}( Object ): Setup a new SCHEDULER object, which is linked to the Object. When the Object is nillified or destroyed, the SCHEDULER object will also be destroyed and stopped after garbage collection.
--
-- ZoneObject = ZONE:New( "ZoneName" )
-- MasterObject = SCHEDULER:New( ZoneObject )
-- SchedulerID = MasterObject:Schedule( ZoneObject, ScheduleFunction, {} )
-- ...
-- ZoneObject = nil
-- garbagecollect()
--
--
-- The above example creates a new MasterObject, but does not schedule anything, and is bound to the existence of ZoneObject, which is a ZONE.
-- A separate schedule is created by using the MasterObject using the method :Schedule()..., which returns a ScheduleID
-- Later in the logic, the ZoneObject is put to nil, and garbage is collected.
-- As a result, the MasterObject will cancel any planned schedule.
--
--
-- ### Construct a SCHEDULER object with a persistent schedule.
--
--
-- * @{#SCHEDULER.New}( nil, Function, FunctionArguments, Start, ... ): Setup a new persistent SCHEDULER object, and start a new schedule for the Function with the defined FunctionArguments according the Start and sequent parameters.
--
--
-- MasterObject, SchedulerID = SCHEDULER:New( nil, ScheduleFunction, {} )
--
--
-- The above example creates a new MasterObject, and does schedule the first schedule as part of the call.
-- Note that 2 variables are returned here: MasterObject, ScheduleID...
--
--
-- ### Construct a SCHEDULER object without a schedule, but volatile to the Object existence...
--
--
-- * @{#SCHEDULER.New}( Object, Function, FunctionArguments, Start, ... ): Setup a new SCHEDULER object, linked to Object, and start a new schedule for the Function with the defined FunctionArguments according the Start and sequent parameters.
--
-- ZoneObject = ZONE:New( "ZoneName" )
@@ -111,13 +112,13 @@
-- ...
-- ZoneObject = nil
-- garbagecollect()
--
--
-- The above example creates a new MasterObject, and schedules a method call (ScheduleFunction),
-- and is bound to the existence of ZoneObject, which is a ZONE object (ZoneObject).
-- Both a MasterObject and a SchedulerID variable are returned.
-- Later in the logic, the ZoneObject is put to nil, and garbage is collected.
-- As a result, the MasterObject will cancel the planned schedule.
--
--
-- ## SCHEDULER timer stopping and (re-)starting.
--
-- The SCHEDULER can be stopped and restarted with the following methods:
@@ -132,70 +133,70 @@
-- MasterObject:Stop( SchedulerID )
-- ...
-- MasterObject:Start( SchedulerID )
--
--
-- The above example creates a new MasterObject, and does schedule the first schedule as part of the call.
-- Note that 2 variables are returned here: MasterObject, ScheduleID...
-- Later in the logic, the repeating schedule with SchedulerID is stopped.
-- A bit later, the repeating schedule with SchedulerId is (re)-started.
--
-- Note that 2 variables are returned here: MasterObject, ScheduleID...
-- Later in the logic, the repeating schedule with SchedulerID is stopped.
-- A bit later, the repeating schedule with SchedulerId is (re)-started.
--
-- ## Create a new schedule
--
-- With the method @{#SCHEDULER.Schedule}() a new time event can be scheduled.
--
-- With the method @{#SCHEDULER.Schedule}() a new time event can be scheduled.
-- This method is used by the :New() constructor when a new schedule is planned.
--
--
-- Consider the following code fragment of the SCHEDULER object creation.
--
--
-- ZoneObject = ZONE:New( "ZoneName" )
-- MasterObject = SCHEDULER:New( ZoneObject )
--
-- Several parameters can be specified that influence the behavior of a Schedule.
--
--
-- Several parameters can be specified that influence the behaviour of a Schedule.
--
-- ### A single schedule, immediately executed
--
--
-- SchedulerID = MasterObject:Schedule( ZoneObject, ScheduleFunction, {} )
--
-- The above example schedules a new ScheduleFunction call to be executed asynchronously, within milliseconds ...
--
--
-- The above example schedules a new ScheduleFunction call to be executed asynchronously, within milleseconds ...
--
-- ### A single schedule, planned over time
--
--
-- SchedulerID = MasterObject:Schedule( ZoneObject, ScheduleFunction, {}, 10 )
--
--
-- The above example schedules a new ScheduleFunction call to be executed asynchronously, within 10 seconds ...
--
--
-- ### A schedule with a repeating time interval, planned over time
--
--
-- SchedulerID = MasterObject:Schedule( ZoneObject, ScheduleFunction, {}, 10, 60 )
--
-- The above example schedules a new ScheduleFunction call to be executed asynchronously, within 10 seconds,
--
-- The above example schedules a new ScheduleFunction call to be executed asynchronously, within 10 seconds,
-- and repeating 60 every seconds ...
--
--
-- ### A schedule with a repeating time interval, planned over time, with time interval randomization
--
--
-- SchedulerID = MasterObject:Schedule( ZoneObject, ScheduleFunction, {}, 10, 60, 0.5 )
--
-- The above example schedules a new ScheduleFunction call to be executed asynchronously, within 10 seconds,
--
-- The above example schedules a new ScheduleFunction call to be executed asynchronously, within 10 seconds,
-- and repeating 60 seconds, with a 50% time interval randomization ...
-- So the repeating time interval will be randomized using the **0.5**,
-- and will calculate between **60 - ( 60 * 0.5 )** and **60 + ( 60 * 0.5 )** for each repeat,
-- So the repeating time interval will be randomized using the **0.5**,
-- and will calculate between **60 - ( 60 * 0.5 )** and **60 + ( 60 * 0.5 )** for each repeat,
-- which is in this example between **30** and **90** seconds.
--
--
-- ### A schedule with a repeating time interval, planned over time, with time interval randomization, and stop after a time interval
--
--
-- SchedulerID = MasterObject:Schedule( ZoneObject, ScheduleFunction, {}, 10, 60, 0.5, 300 )
--
-- The above example schedules a new ScheduleFunction call to be executed asynchronously, within 10 seconds,
--
-- The above example schedules a new ScheduleFunction call to be executed asynchronously, within 10 seconds,
-- The schedule will repeat every 60 seconds.
-- So the repeating time interval will be randomized using the **0.5**,
-- and will calculate between **60 - ( 60 * 0.5 )** and **60 + ( 60 * 0.5 )** for each repeat,
-- So the repeating time interval will be randomized using the **0.5**,
-- and will calculate between **60 - ( 60 * 0.5 )** and **60 + ( 60 * 0.5 )** for each repeat,
-- which is in this example between **30** and **90** seconds.
-- The schedule will stop after **300** seconds.
--
--
-- @field #SCHEDULER
SCHEDULER = {
ClassName = "SCHEDULER",
Schedules = {},
MasterObject = nil,
ShowTrace = nil,
ClassName = "SCHEDULER",
Schedules = {},
MasterObject = nil,
ShowTrace = nil,
}
--- SCHEDULER constructor.
@@ -210,15 +211,15 @@ SCHEDULER = {
-- @return #SCHEDULER self.
-- @return #table The ScheduleID of the planned schedule.
function SCHEDULER:New( MasterObject, SchedulerFunction, SchedulerArguments, Start, Repeat, RandomizeFactor, Stop )
local self = BASE:Inherit( self, BASE:New() ) -- #SCHEDULER
self:F2( { Start, Repeat, RandomizeFactor, Stop } )
local ScheduleID = nil
self.MasterObject = MasterObject
self.ShowTrace = false
if SchedulerFunction then
ScheduleID = self:Schedule( MasterObject, SchedulerFunction, SchedulerArguments, Start, Repeat, RandomizeFactor, Stop, 3 )
end
@@ -234,7 +235,7 @@ end
-- @param #number Start Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.
-- @param #number Repeat Specifies the time interval in seconds when the scheduler will call the event function.
-- @param #number RandomizeFactor Specifies a randomization factor between 0 and 1 to randomize the Repeat.
-- @param #number Stop Time interval in seconds after which the scheduler will be stopped.
-- @param #number Stop Time interval in seconds after which the scheduler will be stoppe.
-- @param #number TraceLevel Trace level [0,3]. Default 3.
-- @param Core.Fsm#FSM Fsm Finite state model.
-- @return #string The Schedule ID of the planned schedule.
@@ -244,27 +245,28 @@ function SCHEDULER:Schedule( MasterObject, SchedulerFunction, SchedulerArguments
-- Debug info.
local ObjectName = "-"
if MasterObject and MasterObject.ClassName and MasterObject.ClassID then
if MasterObject and MasterObject.ClassName and MasterObject.ClassID then
ObjectName = MasterObject.ClassName .. MasterObject.ClassID
end
self:F3( { "Schedule :", ObjectName, tostring( MasterObject ), Start, Repeat, RandomizeFactor, Stop } )
self:F3( { "Schedule :", ObjectName, tostring( MasterObject ), Start, Repeat, RandomizeFactor, Stop } )
-- Set master object.
self.MasterObject = MasterObject
-- Add schedule.
local ScheduleID = _SCHEDULEDISPATCHER:AddSchedule( self,
SchedulerFunction,
SchedulerArguments,
Start,
Repeat,
RandomizeFactor,
Stop,
TraceLevel or 3,
Fsm
)
self.Schedules[#self.Schedules + 1] = ScheduleID
local ScheduleID = _SCHEDULEDISPATCHER:AddSchedule(
self,
SchedulerFunction,
SchedulerArguments,
Start,
Repeat,
RandomizeFactor,
Stop,
TraceLevel or 3,
Fsm
)
self.Schedules[#self.Schedules+1] = ScheduleID
return ScheduleID
end
@@ -274,7 +276,7 @@ end
-- @param #string ScheduleID (Optional) The Schedule ID of the planned (repeating) schedule.
function SCHEDULER:Start( ScheduleID )
self:F3( { ScheduleID } )
self:T( string.format( "Starting scheduler ID=%s", tostring( ScheduleID ) ) )
self:T(string.format("Starting scheduler ID=%s", tostring(ScheduleID)))
_SCHEDULEDISPATCHER:Start( self, ScheduleID )
end
@@ -283,7 +285,7 @@ end
-- @param #string ScheduleID (Optional) The ScheduleID of the planned (repeating) schedule.
function SCHEDULER:Stop( ScheduleID )
self:F3( { ScheduleID } )
self:T( string.format( "Stopping scheduler ID=%s", tostring( ScheduleID ) ) )
self:T(string.format("Stopping scheduler ID=%s", tostring(ScheduleID)))
_SCHEDULEDISPATCHER:Stop( self, ScheduleID )
end
@@ -292,15 +294,15 @@ end
-- @param #string ScheduleID (optional) The ScheduleID of the planned (repeating) schedule.
function SCHEDULER:Remove( ScheduleID )
self:F3( { ScheduleID } )
self:T( string.format( "Removing scheduler ID=%s", tostring( ScheduleID ) ) )
self:T(string.format("Removing scheduler ID=%s", tostring(ScheduleID)))
_SCHEDULEDISPATCHER:RemoveSchedule( self, ScheduleID )
end
--- Clears all pending schedules.
-- @param #SCHEDULER self
function SCHEDULER:Clear()
self:F3()
self:T( string.format( "Clearing scheduler" ) )
self:F3( )
self:T(string.format("Clearing scheduler"))
_SCHEDULEDISPATCHER:Clear( self )
end
File diff suppressed because it is too large Load Diff
+125 -114
View File
@@ -1,4 +1,4 @@
--- **Core** - Manages various settings for missions, providing a menu for players to tweak settings in running missions.
--- **Core** - Manages various settings for running missions, consumed by moose classes and provides a menu system for players to tweak settings in running missions.
--
-- ===
--
@@ -29,14 +29,15 @@
-- @module Core.Settings
-- @image Core_Settings.JPG
--- @type SETTINGS
-- @extends Core.Base#BASE
--- Takes care of various settings that influence the behavior of certain functionalities and classes within the MOOSE framework.
--- Takes care of various settings that influence the behaviour of certain functionalities and classes within the MOOSE framework.
--
-- ===
--
-- The SETTINGS class takes care of various settings that influence the behavior of certain functionalities and classes within the MOOSE framework.
-- The SETTINGS class takes care of various settings that influence the behaviour of certain functionalities and classes within the MOOSE framework.
-- SETTINGS can work on 2 levels:
--
-- - **Default settings**: A running mission has **Default settings**.
@@ -58,7 +59,7 @@
--
-- A menu is created automatically per Command Center that allows to modify the **Default** settings.
-- So, when joining a CC unit, a menu will be available that allows to change the settings parameters **FOR ALL THE PLAYERS**!
-- Note that the **Default settings** will only be used when a player has not chosen its own settings.
-- Note that the **Default settings** will only be used when a player has not choosen its own settings.
--
-- ## 2.2) Player settings menu
--
@@ -68,7 +69,7 @@
--
-- ## 2.3) Show or Hide the Player Setting menus
--
-- Of course, it may be required not to show any setting menus. In this case, a method is available on the **\_SETTINGS object**.
-- Of course, it may be requried not to show any setting menus. In this case, a method is available on the **\_SETTINGS object**.
-- Use @{#SETTINGS.SetPlayerMenuOff}() to hide the player menus, and use @{#SETTINGS.SetPlayerMenuOn}() show the player menus.
-- Note that when this method is used, any player already in a slot will not have its menus visibility changed.
-- The option will only have effect when a player enters a new slot or changes a slot.
@@ -93,8 +94,8 @@
--
-- - 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 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 DMS: Lattitude Longitude [Degrees Minutes Seconds](https://en.wikipedia.org/wiki/Geographic_coordinate_conversion). The accuracy can also be adapted.
-- - A2G LL DDM: Lattitude Longitude [Decimal Degrees Minutes](https://en.wikipedia.org/wiki/Decimal_degrees). The accuracy can also be adapted.
--
-- ### 3.1.2) A2G coordinates setting **menu**
--
@@ -182,7 +183,7 @@
-- The settings can be changed by using the **Default settings menu** on the Command Center or the **Player settings menu** on the Player Slot.
--
-- Each Message Type has specific timings that will be applied when the message is displayed.
-- The Settings Menu will provide for each Message Type a selection of proposed durations from which can be chosen.
-- The Settings Menu will provide for each Message Type a selection of proposed durations from which can be choosen.
-- So the player can choose its own amount of seconds how long a message should be displayed of a certain type.
-- Note that **Update** messages can be chosen not to be displayed at all!
--
@@ -195,7 +196,7 @@
--
-- ## 3.5) **Era** of the battle
--
-- The threat level metric is scaled according the era of the battle. A target that is AAA, will pose a much greater threat in WWII than on modern warfare.
-- The threat level metric is scaled according the era of the battle. A target that is AAA, will pose a much greather threat in WWII than on modern warfare.
-- Therefore, there are 4 era that are defined within the settings:
--
-- - **WWII** era: Use for warfare with equipment during the world war II time.
@@ -212,8 +213,8 @@
SETTINGS = {
ClassName = "SETTINGS",
ShowPlayerMenu = true,
MenuShort = false,
MenuStatic = false,
MenuShort = false,
MenuStatic = false,
}
SETTINGS.__Enum = {}
@@ -230,6 +231,7 @@ SETTINGS.__Enum.Era = {
Modern = 4,
}
do -- SETTINGS
--- SETTINGS constructor.
@@ -267,14 +269,14 @@ do -- SETTINGS
-- Short text are better suited for, e.g., VR.
-- @param #SETTINGS self
-- @param #boolean onoff If *true* use short menu texts. If *false* long ones (default).
function SETTINGS:SetMenutextShort( onoff )
function SETTINGS:SetMenutextShort(onoff)
_SETTINGS.MenuShort = onoff
end
--- Set menu to be static.
-- @param #SETTINGS self
-- @param #boolean onoff If *true* menu is static. If *false* menu will be updated after changes (default).
function SETTINGS:SetMenuStatic( onoff )
function SETTINGS:SetMenuStatic(onoff)
_SETTINGS.MenuStatic = onoff
end
@@ -302,7 +304,7 @@ do -- SETTINGS
-- @param #SETTINGS self
-- @return #boolean true if metric.
function SETTINGS:IsMetric()
return (self.Metric ~= nil and self.Metric == true) or (self.Metric == nil and _SETTINGS:IsMetric())
return ( self.Metric ~= nil and self.Metric == true ) or ( self.Metric == nil and _SETTINGS:IsMetric() )
end
--- Sets the SETTINGS imperial.
@@ -315,7 +317,7 @@ do -- SETTINGS
-- @param #SETTINGS self
-- @return #boolean true if imperial.
function SETTINGS:IsImperial()
return (self.Metric ~= nil and self.Metric == false) or (self.Metric == nil and _SETTINGS:IsImperial())
return ( self.Metric ~= nil and self.Metric == false ) or ( self.Metric == nil and _SETTINGS:IsMetric() )
end
--- Sets the SETTINGS LL accuracy.
@@ -335,7 +337,7 @@ do -- SETTINGS
--- Sets the SETTINGS MGRS accuracy.
-- @param #SETTINGS self
-- @param #number MGRS_Accuracy 0 to 5
-- @param #number MGRS_Accuracy
-- @return #SETTINGS
function SETTINGS:SetMGRS_Accuracy( MGRS_Accuracy )
self.MGRS_Accuracy = MGRS_Accuracy
@@ -357,12 +359,13 @@ do -- SETTINGS
self.MessageTypeTimings[MessageType] = MessageTime
end
--- Gets the SETTINGS Message Display Timing of a MessageType
-- @param #SETTINGS self
-- @param Core.Message#MESSAGE MessageType The type of the message.
-- @return #number
function SETTINGS:GetMessageTime( MessageType )
return (self.MessageTypeTimings and self.MessageTypeTimings[MessageType]) or _SETTINGS:GetMessageTime( MessageType )
return ( self.MessageTypeTimings and self.MessageTypeTimings[MessageType] ) or _SETTINGS:GetMessageTime( MessageType )
end
--- Sets A2G LL DMS
@@ -383,14 +386,14 @@ do -- SETTINGS
-- @param #SETTINGS self
-- @return #boolean true if LL DMS
function SETTINGS:IsA2G_LL_DMS()
return (self.A2GSystem and self.A2GSystem == "LL DMS") or (not self.A2GSystem and _SETTINGS:IsA2G_LL_DMS())
return ( self.A2GSystem and self.A2GSystem == "LL DMS" ) or ( not self.A2GSystem and _SETTINGS:IsA2G_LL_DMS() )
end
--- Is LL DDM
-- @param #SETTINGS self
-- @return #boolean true if LL DDM
function SETTINGS:IsA2G_LL_DDM()
return (self.A2GSystem and self.A2GSystem == "LL DDM") or (not self.A2GSystem and _SETTINGS:IsA2G_LL_DDM())
return ( self.A2GSystem and self.A2GSystem == "LL DDM" ) or ( not self.A2GSystem and _SETTINGS:IsA2G_LL_DDM() )
end
--- Sets A2G MGRS
@@ -404,7 +407,7 @@ do -- SETTINGS
-- @param #SETTINGS self
-- @return #boolean true if MGRS
function SETTINGS:IsA2G_MGRS()
return (self.A2GSystem and self.A2GSystem == "MGRS") or (not self.A2GSystem and _SETTINGS:IsA2G_MGRS())
return ( self.A2GSystem and self.A2GSystem == "MGRS" ) or ( not self.A2GSystem and _SETTINGS:IsA2G_MGRS() )
end
--- Sets A2G BRA
@@ -418,7 +421,7 @@ do -- SETTINGS
-- @param #SETTINGS self
-- @return #boolean true if BRA
function SETTINGS:IsA2G_BR()
return (self.A2GSystem and self.A2GSystem == "BR") or (not self.A2GSystem and _SETTINGS:IsA2G_BR())
return ( self.A2GSystem and self.A2GSystem == "BR" ) or ( not self.A2GSystem and _SETTINGS:IsA2G_BR() )
end
--- Sets A2A BRA
@@ -432,7 +435,7 @@ do -- SETTINGS
-- @param #SETTINGS self
-- @return #boolean true if BRA
function SETTINGS:IsA2A_BRAA()
return (self.A2ASystem and self.A2ASystem == "BRAA") or (not self.A2ASystem and _SETTINGS:IsA2A_BRAA())
return ( self.A2ASystem and self.A2ASystem == "BRAA" ) or ( not self.A2ASystem and _SETTINGS:IsA2A_BRAA() )
end
--- Sets A2A BULLS
@@ -446,7 +449,7 @@ do -- SETTINGS
-- @param #SETTINGS self
-- @return #boolean true if BULLS
function SETTINGS:IsA2A_BULLS()
return (self.A2ASystem and self.A2ASystem == "BULLS") or (not self.A2ASystem and _SETTINGS:IsA2A_BULLS())
return ( self.A2ASystem and self.A2ASystem == "BULLS" ) or ( not self.A2ASystem and _SETTINGS:IsA2A_BULLS() )
end
--- Sets A2A LL DMS
@@ -467,14 +470,14 @@ do -- SETTINGS
-- @param #SETTINGS self
-- @return #boolean true if LL DMS
function SETTINGS:IsA2A_LL_DMS()
return (self.A2ASystem and self.A2ASystem == "LL DMS") or (not self.A2ASystem and _SETTINGS:IsA2A_LL_DMS())
return ( self.A2ASystem and self.A2ASystem == "LL DMS" ) or ( not self.A2ASystem and _SETTINGS:IsA2A_LL_DMS() )
end
--- Is LL DDM
-- @param #SETTINGS self
-- @return #boolean true if LL DDM
function SETTINGS:IsA2A_LL_DDM()
return (self.A2ASystem and self.A2ASystem == "LL DDM") or (not self.A2ASystem and _SETTINGS:IsA2A_LL_DDM())
return ( self.A2ASystem and self.A2ASystem == "LL DDM" ) or ( not self.A2ASystem and _SETTINGS:IsA2A_LL_DDM() )
end
--- Sets A2A MGRS
@@ -488,7 +491,7 @@ do -- SETTINGS
-- @param #SETTINGS self
-- @return #boolean true if MGRS
function SETTINGS:IsA2A_MGRS()
return (self.A2ASystem and self.A2ASystem == "MGRS") or (not self.A2ASystem and _SETTINGS:IsA2A_MGRS())
return ( self.A2ASystem and self.A2ASystem == "MGRS" ) or ( not self.A2ASystem and _SETTINGS:IsA2A_MGRS() )
end
--- @param #SETTINGS self
@@ -507,37 +510,37 @@ do -- SETTINGS
-- A2G Coordinate System
-------
local text = "A2G Coordinate System"
local text="A2G Coordinate System"
if _SETTINGS.MenuShort then
text = "A2G Coordinates"
text="A2G Coordinates"
end
local A2GCoordinateMenu = MENU_GROUP:New( MenuGroup, text, SettingsMenu ):SetTime( MenuTime )
-- Set LL DMS
if not self:IsA2G_LL_DMS() then
local text = "Lat/Lon Degree Min Sec (LL DMS)"
local text="Lat/Lon Degree Min Sec (LL DMS)"
if _SETTINGS.MenuShort then
text = "LL DMS"
text="LL DMS"
end
MENU_GROUP_COMMAND:New( MenuGroup, text, A2GCoordinateMenu, self.A2GMenuSystem, self, MenuGroup, RootMenu, "LL DMS" ):SetTime( MenuTime )
end
-- Set LL DDM
if not self:IsA2G_LL_DDM() then
local text = "Lat/Lon Degree Dec Min (LL DDM)"
local text="Lat/Lon Degree Dec Min (LL DDM)"
if _SETTINGS.MenuShort then
text = "LL DDM"
text="LL DDM"
end
MENU_GROUP_COMMAND:New( MenuGroup, "Lat/Lon Degree Dec Min (LL DDM)", A2GCoordinateMenu, self.A2GMenuSystem, self, MenuGroup, RootMenu, "LL DDM" ):SetTime( MenuTime )
end
-- Set LL DMS accuracy.
if self:IsA2G_LL_DDM() then
local text1 = "LL DDM Accuracy 1"
local text2 = "LL DDM Accuracy 2"
local text3 = "LL DDM Accuracy 3"
local text1="LL DDM Accuracy 1"
local text2="LL DDM Accuracy 2"
local text3="LL DDM Accuracy 3"
if _SETTINGS.MenuShort then
text1 = "LL DDM"
text1="LL DDM"
end
MENU_GROUP_COMMAND:New( MenuGroup, "LL DDM Accuracy 1", A2GCoordinateMenu, self.MenuLL_DDM_Accuracy, self, MenuGroup, RootMenu, 1 ):SetTime( MenuTime )
MENU_GROUP_COMMAND:New( MenuGroup, "LL DDM Accuracy 2", A2GCoordinateMenu, self.MenuLL_DDM_Accuracy, self, MenuGroup, RootMenu, 2 ):SetTime( MenuTime )
@@ -546,18 +549,18 @@ do -- SETTINGS
-- Set BR.
if not self:IsA2G_BR() then
local text = "Bearing, Range (BR)"
local text="Bearing, Range (BR)"
if _SETTINGS.MenuShort then
text = "BR"
text="BR"
end
MENU_GROUP_COMMAND:New( MenuGroup, text, A2GCoordinateMenu, self.A2GMenuSystem, self, MenuGroup, RootMenu, "BR" ):SetTime( MenuTime )
MENU_GROUP_COMMAND:New( MenuGroup, text , A2GCoordinateMenu, self.A2GMenuSystem, self, MenuGroup, RootMenu, "BR" ):SetTime( MenuTime )
end
-- Set MGRS.
if not self:IsA2G_MGRS() then
local text = "Military Grid (MGRS)"
local text="Military Grid (MGRS)"
if _SETTINGS.MenuShort then
text = "MGRS"
text="MGRS"
end
MENU_GROUP_COMMAND:New( MenuGroup, text, A2GCoordinateMenu, self.A2GMenuSystem, self, MenuGroup, RootMenu, "MGRS" ):SetTime( MenuTime )
end
@@ -575,24 +578,24 @@ do -- SETTINGS
-- A2A Coordinate System
-------
local text = "A2A Coordinate System"
local text="A2A Coordinate System"
if _SETTINGS.MenuShort then
text = "A2A Coordinates"
text="A2A Coordinates"
end
local A2ACoordinateMenu = MENU_GROUP:New( MenuGroup, text, SettingsMenu ):SetTime( MenuTime )
if not self:IsA2A_LL_DMS() then
local text = "Lat/Lon Degree Min Sec (LL DMS)"
local text="Lat/Lon Degree Min Sec (LL DMS)"
if _SETTINGS.MenuShort then
text = "LL DMS"
text="LL DMS"
end
MENU_GROUP_COMMAND:New( MenuGroup, text, A2ACoordinateMenu, self.A2AMenuSystem, self, MenuGroup, RootMenu, "LL DMS" ):SetTime( MenuTime )
end
if not self:IsA2A_LL_DDM() then
local text = "Lat/Lon Degree Dec Min (LL DDM)"
local text="Lat/Lon Degree Dec Min (LL DDM)"
if _SETTINGS.MenuShort then
text = "LL DDM"
text="LL DDM"
end
MENU_GROUP_COMMAND:New( MenuGroup, text, A2ACoordinateMenu, self.A2AMenuSystem, self, MenuGroup, RootMenu, "LL DDM" ):SetTime( MenuTime )
end
@@ -605,25 +608,25 @@ do -- SETTINGS
end
if not self:IsA2A_BULLS() then
local text = "Bullseye (BULLS)"
local text="Bullseye (BULLS)"
if _SETTINGS.MenuShort then
text = "Bulls"
text="Bulls"
end
MENU_GROUP_COMMAND:New( MenuGroup, text, A2ACoordinateMenu, self.A2AMenuSystem, self, MenuGroup, RootMenu, "BULLS" ):SetTime( MenuTime )
end
if not self:IsA2A_BRAA() then
local text = "Bearing Range Altitude Aspect (BRAA)"
local text="Bearing Range Altitude Aspect (BRAA)"
if _SETTINGS.MenuShort then
text = "BRAA"
text="BRAA"
end
MENU_GROUP_COMMAND:New( MenuGroup, text, A2ACoordinateMenu, self.A2AMenuSystem, self, MenuGroup, RootMenu, "BRAA" ):SetTime( MenuTime )
end
if not self:IsA2A_MGRS() then
local text = "Military Grid (MGRS)"
local text="Military Grid (MGRS)"
if _SETTINGS.MenuShort then
text = "MGRS"
text="MGRS"
end
MENU_GROUP_COMMAND:New( MenuGroup, text, A2ACoordinateMenu, self.A2AMenuSystem, self, MenuGroup, RootMenu, "MGRS" ):SetTime( MenuTime )
end
@@ -636,31 +639,31 @@ do -- SETTINGS
MENU_GROUP_COMMAND:New( MenuGroup, "MGRS Accuracy 5", A2ACoordinateMenu, self.MenuMGRS_Accuracy, self, MenuGroup, RootMenu, 5 ):SetTime( MenuTime )
end
local text = "Measures and Weights System"
local text="Measures and Weights System"
if _SETTINGS.MenuShort then
text = "Unit System"
text="Unit System"
end
local MetricsMenu = MENU_GROUP:New( MenuGroup, text, SettingsMenu ):SetTime( MenuTime )
if self:IsMetric() then
local text = "Imperial (Miles,Feet)"
local text="Imperial (Miles,Feet)"
if _SETTINGS.MenuShort then
text = "Imperial"
text="Imperial"
end
MENU_GROUP_COMMAND:New( MenuGroup, text, MetricsMenu, self.MenuMWSystem, self, MenuGroup, RootMenu, false ):SetTime( MenuTime )
end
if self:IsImperial() then
local text = "Metric (Kilometers,Meters)"
local text="Metric (Kilometers,Meters)"
if _SETTINGS.MenuShort then
text = "Metric"
text="Metric"
end
MENU_GROUP_COMMAND:New( MenuGroup, text, MetricsMenu, self.MenuMWSystem, self, MenuGroup, RootMenu, true ):SetTime( MenuTime )
end
local text = "Messages and Reports"
local text="Messages and Reports"
if _SETTINGS.MenuShort then
text = "Messages & Reports"
text="Messages & Reports"
end
local MessagesMenu = MENU_GROUP:New( MenuGroup, text, SettingsMenu ):SetTime( MenuTime )
@@ -701,6 +704,7 @@ do -- SETTINGS
MENU_GROUP_COMMAND:New( MenuGroup, "2 minutes", DetailedReportsMenu, self.MenuMessageTimingsSystem, self, MenuGroup, RootMenu, MESSAGE.Type.DetailedReportsMenu, 120 ):SetTime( MenuTime )
MENU_GROUP_COMMAND:New( MenuGroup, "3 minutes", DetailedReportsMenu, self.MenuMessageTimingsSystem, self, MenuGroup, RootMenu, MESSAGE.Type.DetailedReportsMenu, 180 ):SetTime( MenuTime )
SettingsMenu:Remove( MenuTime )
return self
@@ -744,11 +748,11 @@ do -- SETTINGS
self.PlayerMenu = PlayerMenu
self:I( string.format( "Setting menu for player %s", tostring( PlayerName ) ) )
self:I(string.format("Setting menu for player %s", tostring(PlayerName)))
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 1 Decimal", submenu, self.MenuGroupLL_DDM_AccuracySystem, self, PlayerUnit, PlayerGroup, PlayerName, 1 )
MENU_GROUP_COMMAND:New( PlayerGroup, "LL 1 Decimal", submenu, self.MenuGroupLL_DDM_AccuracySystem, self, PlayerUnit, PlayerGroup, PlayerName, 1 )
MENU_GROUP_COMMAND:New( PlayerGroup, "LL 2 Decimals", submenu, self.MenuGroupLL_DDM_AccuracySystem, self, PlayerUnit, PlayerGroup, PlayerName, 2 )
MENU_GROUP_COMMAND:New( PlayerGroup, "LL 3 Decimals", submenu, self.MenuGroupLL_DDM_AccuracySystem, self, PlayerUnit, PlayerGroup, PlayerName, 3 )
MENU_GROUP_COMMAND:New( PlayerGroup, "LL 4 Decimals", submenu, self.MenuGroupLL_DDM_AccuracySystem, self, PlayerUnit, PlayerGroup, PlayerName, 4 )
@@ -765,40 +769,40 @@ do -- SETTINGS
-- A2G Coordinate System
------
local text = "A2G Coordinate System"
local text="A2G Coordinate System"
if _SETTINGS.MenuShort then
text = "A2G Coordinates"
text="A2G Coordinates"
end
local A2GCoordinateMenu = MENU_GROUP:New( PlayerGroup, text, PlayerMenu )
if not self:IsA2G_LL_DMS() or _SETTINGS.MenuStatic then
local text = "Lat/Lon Degree Min Sec (LL DMS)"
local text="Lat/Lon Degree Min Sec (LL DMS)"
if _SETTINGS.MenuShort then
text = "A2G LL DMS"
text="A2G LL DMS"
end
MENU_GROUP_COMMAND:New( PlayerGroup, text, A2GCoordinateMenu, self.MenuGroupA2GSystem, self, PlayerUnit, PlayerGroup, PlayerName, "LL DMS" )
end
if not self:IsA2G_LL_DDM() or _SETTINGS.MenuStatic then
local text = "Lat/Lon Degree Dec Min (LL DDM)"
local text="Lat/Lon Degree Dec Min (LL DDM)"
if _SETTINGS.MenuShort then
text = "A2G LL DDM"
text="A2G LL DDM"
end
MENU_GROUP_COMMAND:New( PlayerGroup, text, A2GCoordinateMenu, self.MenuGroupA2GSystem, self, PlayerUnit, PlayerGroup, PlayerName, "LL DDM" )
end
if not self:IsA2G_BR() or _SETTINGS.MenuStatic then
local text = "Bearing, Range (BR)"
local text="Bearing, Range (BR)"
if _SETTINGS.MenuShort then
text = "A2G BR"
text="A2G BR"
end
MENU_GROUP_COMMAND:New( PlayerGroup, text, A2GCoordinateMenu, self.MenuGroupA2GSystem, self, PlayerUnit, PlayerGroup, PlayerName, "BR" )
end
if not self:IsA2G_MGRS() or _SETTINGS.MenuStatic then
local text = "Military Grid (MGRS)"
local text="Military Grid (MGRS)"
if _SETTINGS.MenuShort then
text = "A2G MGRS"
text="A2G MGRS"
end
MENU_GROUP_COMMAND:New( PlayerGroup, text, A2GCoordinateMenu, self.MenuGroupA2GSystem, self, PlayerUnit, PlayerGroup, PlayerName, "MGRS" )
end
@@ -807,48 +811,49 @@ do -- SETTINGS
-- A2A Coordinates Menu
------
local text = "A2A Coordinate System"
local text="A2A Coordinate System"
if _SETTINGS.MenuShort then
text = "A2A Coordinates"
text="A2A Coordinates"
end
local A2ACoordinateMenu = MENU_GROUP:New( PlayerGroup, text, PlayerMenu )
if not self:IsA2A_LL_DMS() or _SETTINGS.MenuStatic then
local text = "Lat/Lon Degree Min Sec (LL DMS)"
local text="Lat/Lon Degree Min Sec (LL DMS)"
if _SETTINGS.MenuShort then
text = "A2A LL DMS"
text="A2A LL DMS"
end
MENU_GROUP_COMMAND:New( PlayerGroup, text, A2ACoordinateMenu, self.MenuGroupA2GSystem, self, PlayerUnit, PlayerGroup, PlayerName, "LL DMS" )
end
if not self:IsA2A_LL_DDM() or _SETTINGS.MenuStatic then
local text = "Lat/Lon Degree Dec Min (LL DDM)"
local text="Lat/Lon Degree Dec Min (LL DDM)"
if _SETTINGS.MenuShort then
text = "A2A LL DDM"
text="A2A LL DDM"
end
MENU_GROUP_COMMAND:New( PlayerGroup, text, A2ACoordinateMenu, self.MenuGroupA2ASystem, self, PlayerUnit, PlayerGroup, PlayerName, "LL DDM" )
end
if not self:IsA2A_BULLS() or _SETTINGS.MenuStatic then
local text = "Bullseye (BULLS)"
local text="Bullseye (BULLS)"
if _SETTINGS.MenuShort then
text = "A2A BULLS"
text="A2A BULLS"
end
MENU_GROUP_COMMAND:New( PlayerGroup, text, A2ACoordinateMenu, self.MenuGroupA2ASystem, self, PlayerUnit, PlayerGroup, PlayerName, "BULLS" )
end
if not self:IsA2A_BRAA() or _SETTINGS.MenuStatic then
local text = "Bearing Range Altitude Aspect (BRAA)"
local text="Bearing Range Altitude Aspect (BRAA)"
if _SETTINGS.MenuShort then
text = "A2A BRAA"
text="A2A BRAA"
end
MENU_GROUP_COMMAND:New( PlayerGroup, text, A2ACoordinateMenu, self.MenuGroupA2ASystem, self, PlayerUnit, PlayerGroup, PlayerName, "BRAA" )
end
if not self:IsA2A_MGRS() or _SETTINGS.MenuStatic then
local text = "Military Grid (MGRS)"
local text="Military Grid (MGRS)"
if _SETTINGS.MenuShort then
text = "A2A MGRS"
text="A2A MGRS"
end
MENU_GROUP_COMMAND:New( PlayerGroup, text, A2ACoordinateMenu, self.MenuGroupA2ASystem, self, PlayerUnit, PlayerGroup, PlayerName, "MGRS" )
end
@@ -857,24 +862,24 @@ do -- SETTINGS
-- Unit system
---
local text = "Measures and Weights System"
local text="Measures and Weights System"
if _SETTINGS.MenuShort then
text = "Unit System"
text="Unit System"
end
local MetricsMenu = MENU_GROUP:New( PlayerGroup, text, PlayerMenu )
if self:IsMetric() or _SETTINGS.MenuStatic then
local text = "Imperial (Miles,Feet)"
local text="Imperial (Miles,Feet)"
if _SETTINGS.MenuShort then
text = "Imperial"
text="Imperial"
end
MENU_GROUP_COMMAND:New( PlayerGroup, text, MetricsMenu, self.MenuGroupMWSystem, self, PlayerUnit, PlayerGroup, PlayerName, false )
end
if self:IsImperial() or _SETTINGS.MenuStatic then
local text = "Metric (Kilometers,Meters)"
local text="Metric (Kilometers,Meters)"
if _SETTINGS.MenuShort then
text = "Metric"
text="Metric"
end
MENU_GROUP_COMMAND:New( PlayerGroup, text, MetricsMenu, self.MenuGroupMWSystem, self, PlayerUnit, PlayerGroup, PlayerName, true )
end
@@ -883,9 +888,9 @@ do -- SETTINGS
-- Messages and Reports
---
local text = "Messages and Reports"
local text="Messages and Reports"
if _SETTINGS.MenuShort then
text = "Messages & Reports"
text="Messages & Reports"
end
local MessagesMenu = MENU_GROUP:New( PlayerGroup, text, PlayerMenu )
@@ -945,38 +950,39 @@ do -- SETTINGS
return self
end
--- @param #SETTINGS self
function SETTINGS:A2GMenuSystem( MenuGroup, RootMenu, A2GSystem )
self.A2GSystem = A2GSystem
MESSAGE:New( string.format( "Settings: Default A2G coordinate system set to %s for all players!", A2GSystem ), 5 ):ToAll()
MESSAGE:New( string.format("Settings: Default A2G coordinate system set to %s for all players!", A2GSystem ), 5 ):ToAll()
self:SetSystemMenu( MenuGroup, RootMenu )
end
--- @param #SETTINGS self
function SETTINGS:A2AMenuSystem( MenuGroup, RootMenu, A2ASystem )
self.A2ASystem = A2ASystem
MESSAGE:New( string.format( "Settings: Default A2A coordinate system set to %s for all players!", A2ASystem ), 5 ):ToAll()
MESSAGE:New( string.format("Settings: Default A2A coordinate system set to %s for all players!", A2ASystem ), 5 ):ToAll()
self:SetSystemMenu( MenuGroup, RootMenu )
end
--- @param #SETTINGS self
function SETTINGS:MenuLL_DDM_Accuracy( MenuGroup, RootMenu, LL_Accuracy )
self.LL_Accuracy = LL_Accuracy
MESSAGE:New( string.format( "Settings: Default LL accuracy set to %s for all players!", LL_Accuracy ), 5 ):ToAll()
MESSAGE:New( string.format("Settings: Default LL accuracy set to %s for all players!", LL_Accuracy ), 5 ):ToAll()
self:SetSystemMenu( MenuGroup, RootMenu )
end
--- @param #SETTINGS self
function SETTINGS:MenuMGRS_Accuracy( MenuGroup, RootMenu, MGRS_Accuracy )
self.MGRS_Accuracy = MGRS_Accuracy
MESSAGE:New( string.format( "Settings: Default MGRS accuracy set to %s for all players!", MGRS_Accuracy ), 5 ):ToAll()
MESSAGE:New( string.format("Settings: Default MGRS accuracy set to %s for all players!", MGRS_Accuracy ), 5 ):ToAll()
self:SetSystemMenu( MenuGroup, RootMenu )
end
--- @param #SETTINGS self
function SETTINGS:MenuMWSystem( MenuGroup, RootMenu, MW )
self.Metric = MW
MESSAGE:New( string.format( "Settings: Default measurement format set to %s for all players!", MW and "Metric" or "Imperial" ), 5 ):ToAll()
MESSAGE:New( string.format("Settings: Default measurement format set to %s for all players!", MW and "Metric" or "Imperial" ), 5 ):ToAll()
self:SetSystemMenu( MenuGroup, RootMenu )
end
@@ -989,12 +995,12 @@ do -- SETTINGS
do
--- @param #SETTINGS self
function SETTINGS:MenuGroupA2GSystem( PlayerUnit, PlayerGroup, PlayerName, A2GSystem )
BASE:E( { self, PlayerUnit:GetName(), A2GSystem } )
BASE:E( {self, PlayerUnit:GetName(), A2GSystem} )
self.A2GSystem = A2GSystem
MESSAGE:New( string.format( "Settings: A2G format set to %s for player %s.", A2GSystem, PlayerName ), 5 ):ToGroup( PlayerGroup )
if _SETTINGS.MenuStatic == false then
self:RemovePlayerMenu( PlayerUnit )
self:SetPlayerMenu( PlayerUnit )
if _SETTINGS.MenuStatic==false then
self:RemovePlayerMenu(PlayerUnit)
self:SetPlayerMenu(PlayerUnit)
end
end
@@ -1002,9 +1008,9 @@ do -- SETTINGS
function SETTINGS:MenuGroupA2ASystem( PlayerUnit, PlayerGroup, PlayerName, A2ASystem )
self.A2ASystem = A2ASystem
MESSAGE:New( string.format( "Settings: A2A format set to %s for player %s.", A2ASystem, PlayerName ), 5 ):ToGroup( PlayerGroup )
if _SETTINGS.MenuStatic == false then
self:RemovePlayerMenu( PlayerUnit )
self:SetPlayerMenu( PlayerUnit )
if _SETTINGS.MenuStatic==false then
self:RemovePlayerMenu(PlayerUnit)
self:SetPlayerMenu(PlayerUnit)
end
end
@@ -1012,9 +1018,9 @@ do -- SETTINGS
function SETTINGS:MenuGroupLL_DDM_AccuracySystem( PlayerUnit, PlayerGroup, PlayerName, LL_Accuracy )
self.LL_Accuracy = LL_Accuracy
MESSAGE:New( string.format( "Settings: LL format accuracy set to %d decimal places for player %s.", LL_Accuracy, PlayerName ), 5 ):ToGroup( PlayerGroup )
if _SETTINGS.MenuStatic == false then
self:RemovePlayerMenu( PlayerUnit )
self:SetPlayerMenu( PlayerUnit )
if _SETTINGS.MenuStatic==false then
self:RemovePlayerMenu(PlayerUnit)
self:SetPlayerMenu(PlayerUnit)
end
end
@@ -1022,9 +1028,9 @@ do -- SETTINGS
function SETTINGS:MenuGroupMGRS_AccuracySystem( PlayerUnit, PlayerGroup, PlayerName, MGRS_Accuracy )
self.MGRS_Accuracy = MGRS_Accuracy
MESSAGE:New( string.format( "Settings: MGRS format accuracy set to %d for player %s.", MGRS_Accuracy, PlayerName ), 5 ):ToGroup( PlayerGroup )
if _SETTINGS.MenuStatic == false then
self:RemovePlayerMenu( PlayerUnit )
self:SetPlayerMenu( PlayerUnit )
if _SETTINGS.MenuStatic==false then
self:RemovePlayerMenu(PlayerUnit)
self:SetPlayerMenu(PlayerUnit)
end
end
@@ -1032,9 +1038,9 @@ do -- SETTINGS
function SETTINGS:MenuGroupMWSystem( PlayerUnit, PlayerGroup, PlayerName, MW )
self.Metric = MW
MESSAGE:New( string.format( "Settings: Measurement format set to %s for player %s.", MW and "Metric" or "Imperial", PlayerName ), 5 ):ToGroup( PlayerGroup )
if _SETTINGS.MenuStatic == false then
self:RemovePlayerMenu( PlayerUnit )
self:SetPlayerMenu( PlayerUnit )
if _SETTINGS.MenuStatic==false then
self:RemovePlayerMenu(PlayerUnit)
self:SetPlayerMenu(PlayerUnit)
end
end
@@ -1064,6 +1070,7 @@ do -- SETTINGS
end
--- Configures the era of the mission to be Cold war.
-- @param #SETTINGS self
-- @return #SETTINGS self
@@ -1073,6 +1080,7 @@ do -- SETTINGS
end
--- Configures the era of the mission to be Modern war.
-- @param #SETTINGS self
-- @return #SETTINGS self
@@ -1082,4 +1090,7 @@ do -- SETTINGS
end
end
File diff suppressed because it is too large Load Diff
+13 -24
View File
@@ -57,15 +57,15 @@
-- @extends Core.Base#BASE
--- Allows to spawn dynamically new @{Wrapper.Static}s into your mission.
--- Allows to spawn dynamically new @{Static}s into your mission.
--
-- Through creating a copy of an existing static object template as defined in the Mission Editor (ME), SPAWNSTATIC can retireve the properties of the defined static object template (like type, category etc),
-- and "copy" these properties to create a new static object and place it at the desired coordinate.
--
-- New spawned @{Wrapper.Static}s get **the same name** as the name of the template Static, or gets the given name when a new name is provided at the Spawn method.
-- By default, spawned @{Wrapper.Static}s will follow a naming convention at run-time:
-- New spawned @{Static}s get **the same name** as the name of the template Static, or gets the given name when a new name is provided at the Spawn method.
-- By default, spawned @{Static}s will follow a naming convention at run-time:
--
-- * Spawned @{Wrapper.Static}s will have the name _StaticName_#_nnn_, where _StaticName_ is the name of the **Template Static**, and _nnn_ is a **counter from 0 to 99999**.
-- * Spawned @{Static}s will have the name _StaticName_#_nnn_, where _StaticName_ is the name of the **Template Static**, and _nnn_ is a **counter from 0 to 99999**.
--
-- # SPAWNSTATIC Constructors
--
@@ -106,7 +106,7 @@
-- * @{#SPAWNSTATIC.Spawn}(Heading, NewName) spawns the static with the set parameters. Optionally, heading and name can be given. The name **must be unique**!
-- * @{#SPAWNSTATIC.SpawnFromCoordinate}(Coordinate, Heading, NewName) spawn the static at the given coordinate. Optionally, heading and name can be given. The name **must be unique**!
-- * @{#SPAWNSTATIC.SpawnFromPointVec2}(PointVec2, Heading, NewName) spawns the static at a POINT_VEC2 coordinate. Optionally, heading and name can be given. The name **must be unique**!
-- * @{#SPAWNSTATIC.SpawnFromZone}(Zone, Heading, NewName) spawns the static at the center of a @{Core.Zone}. Optionally, heading and name can be given. The name **must be unique**!
-- * @{#SPAWNSTATIC.SpawnFromZone}(Zone, Heading, NewName) spawns the static at the center of a @{Zone}. Optionally, heading and name can be given. The name **must be unique**!
--
-- @field #SPAWNSTATIC SPAWNSTATIC
--
@@ -131,7 +131,7 @@ SPAWNSTATIC = {
-- @field #number mass Cargo mass in kg.
-- @field #boolean canCargo Static can be a cargo.
--- Creates the main object to spawn a @{Wrapper.Static} defined in the mission editor (ME).
--- Creates the main object to spawn a @{Static} defined in the mission editor (ME).
-- @param #SPAWNSTATIC self
-- @param #string SpawnTemplateName Name of the static object in the ME. Each new static will have the name starting with this prefix.
-- @param DCS#country.id SpawnCountryID (Optional) The ID of the country.
@@ -158,7 +158,7 @@ function SPAWNSTATIC:NewFromStatic(SpawnTemplateName, SpawnCountryID)
return self
end
--- Creates the main object to spawn a @{Wrapper.Static} given a template table.
--- Creates the main object to spawn a @{Static} given a template table.
-- @param #SPAWNSTATIC self
-- @param #table SpawnTemplate Template used for spawning.
-- @param DCS#country.id CountryID The ID of the country. Default `country.id.USA`.
@@ -174,7 +174,7 @@ function SPAWNSTATIC:NewFromTemplate(SpawnTemplate, CountryID)
return self
end
--- Creates the main object to spawn a @{Wrapper.Static} from a given type.
--- Creates the main object to spawn a @{Static} from a given type.
-- NOTE that you have to init many other parameters as spawn coordinate etc.
-- @param #SPAWNSTATIC self
-- @param #string StaticType Type of the static.
@@ -275,7 +275,7 @@ end
--- Initialize as dead.
-- @param #SPAWNSTATIC self
-- @param #boolean IsDead If true, this static is dead.
-- @param #boolean IsCargo If true, this static is dead.
-- @return #SPAWNSTATIC self
function SPAWNSTATIC:InitDead(IsDead)
self.InitStaticDead=IsDead
@@ -336,7 +336,7 @@ function SPAWNSTATIC:Spawn(Heading, NewName)
end
--- Creates a new @{Wrapper.Static} from a POINT_VEC2.
--- Creates a new @{Static} from a POINT_VEC2.
-- @param #SPAWNSTATIC self
-- @param Core.Point#POINT_VEC2 PointVec2 The 2D coordinate where to spawn the static.
-- @param #number Heading The heading of the static, which is a number in degrees from 0 to 360.
@@ -352,7 +352,7 @@ function SPAWNSTATIC:SpawnFromPointVec2(PointVec2, Heading, NewName)
end
--- Creates a new @{Wrapper.Static} from a COORDINATE.
--- Creates a new @{Static} from a COORDINATE.
-- @param #SPAWNSTATIC self
-- @param Core.Point#COORDINATE Coordinate The 3D coordinate where to spawn the static.
-- @param #number Heading (Optional) Heading The heading of the static in degrees. Default is 0 degrees.
@@ -375,7 +375,7 @@ function SPAWNSTATIC:SpawnFromCoordinate(Coordinate, Heading, NewName)
end
--- Creates a new @{Wrapper.Static} from a @{Core.Zone}.
--- Creates a new @{Static} from a @{Zone}.
-- @param #SPAWNSTATIC self
-- @param Core.Zone#ZONE_BASE Zone The Zone where to spawn the static.
-- @param #number Heading (Optional)The heading of the static in degrees. Default is the heading of the template.
@@ -467,7 +467,7 @@ function SPAWNSTATIC:_SpawnStatic(Template, CountryID)
self:T(Template)
-- Add static to the game.
local Static=nil --DCS#StaticObject
local Static=nil
if self.InitFarp then
@@ -487,17 +487,6 @@ function SPAWNSTATIC:_SpawnStatic(Template, CountryID)
-- ED's dirty way to spawn FARPS.
Static=coalition.addGroup(CountryID, -1, TemplateGroup)
-- Currently DCS 2.8 does not trigger birth events if FAPRS are spawned!
-- We create such an event. The airbase is registered in Core.Event
local Event = {
id = EVENTS.Birth,
time = timer.getTime(),
initiator = Static
}
-- Create BIRTH event.
world.onEvent(Event)
else
self:T("Spawning Static")
self:T2({Template=Template})
+3 -17
View File
@@ -249,10 +249,8 @@ do
local RecceDcsUnit = self.Recce:GetDCSObject()
local relativespot = self.relstartpos or { x = 0, y = 2, z = 0 }
self.SpotIR = Spot.createInfraRed( RecceDcsUnit, relativespot, Target:GetPointVec3():AddY(1):GetVec3() )
self.SpotLaser = Spot.createLaser( RecceDcsUnit, relativespot, Target:GetPointVec3():AddY(1):GetVec3(), LaserCode )
self.SpotIR = Spot.createInfraRed( RecceDcsUnit, { x = 0, y = 2, z = 0 }, Target:GetPointVec3():AddY(1):GetVec3() )
self.SpotLaser = Spot.createLaser( RecceDcsUnit, { x = 0, y = 2, z = 0 }, Target:GetPointVec3():AddY(1):GetVec3(), LaserCode )
if Duration then
self.ScheduleID = self.LaseScheduler:Schedule( self, StopLase, {self}, Duration )
@@ -370,16 +368,4 @@ do
return self.Lasing
end
--- Set laser start position relative to the lasing unit.
-- @param #SPOT self
-- @param #table position Start position of the laser relative to the lasing unit. Default is { x = 0, y = 2, z = 0 }
-- @return #SPOT self
-- @usage
-- -- Set lasing position to be the position of the optics of the Gazelle M:
-- myspot:SetRelativeStartPosition({ x = 1.7, y = 1.2, z = 0 })
function SPOT:SetRelativeStartPosition(position)
self.relstartpos = position or { x = 0, y = 2, z = 0 }
return self
end
end
end
@@ -1,4 +1,4 @@
--- **Core** - A Moose GetText system.
--- **Core** - TEXTANDSOUND (MOOSE gettext) system
--
-- ===
--
+2 -16
View File
@@ -155,7 +155,7 @@ function TIMER:New(Function, ...)
return self
end
--- Start TIMER object.
--- Create a new TIMER object.
-- @param #TIMER self
-- @param #number Tstart Relative start time in seconds.
-- @param #number dT Interval between function calls in seconds. If not specified `nil`, the function is called only once.
@@ -167,7 +167,7 @@ function TIMER:Start(Tstart, dT, Duration)
local Tnow=timer.getTime()
-- Start time in sec.
self.Tstart=Tstart and Tnow+math.max(Tstart, 0.001) or Tnow+0.001 -- one millisecond delay if Tstart=nil
self.Tstart=Tstart and Tnow+Tstart or Tnow+0.001 -- one millisecond delay if Tstart=nil
-- Set time interval.
self.dT=dT
@@ -192,20 +192,6 @@ function TIMER:Start(Tstart, dT, Duration)
return self
end
--- Start TIMER object if a condition is met. Useful for e.g. debugging.
-- @param #TIMER self
-- @param #boolean Condition Must be true for the TIMER to start
-- @param #number Tstart Relative start time in seconds.
-- @param #number dT Interval between function calls in seconds. If not specified `nil`, the function is called only once.
-- @param #number Duration Time in seconds for how long the timer is running. If not specified `nil`, the timer runs forever or until stopped manually by the `TIMER:Stop()` function.
-- @return #TIMER self
function TIMER:StartIf(Condition,Tstart, dT, Duration)
if Condition then
self:Start(Tstart, dT, Duration)
end
return self
end
--- Stop the timer by removing the timer function.
-- @param #TIMER self
-- @param #number Delay (Optional) Delay in seconds, before the timer is stopped.
+14 -11
View File
@@ -35,13 +35,13 @@ do -- UserFlag
ClassName = "USERFLAG",
UserFlagName = nil,
}
--- USERFLAG Constructor.
-- @param #USERFLAG self
-- @param #string UserFlagName The name of the userflag, which is a free text string.
-- @return #USERFLAG
function USERFLAG:New( UserFlagName ) --R2.3
local self = BASE:Inherit( self, BASE:New() ) -- #USERFLAG
self.UserFlagName = UserFlagName
@@ -52,7 +52,7 @@ do -- UserFlag
--- Get the userflag name.
-- @param #USERFLAG self
-- @return #string Name of the user flag.
function USERFLAG:GetName()
function USERFLAG:GetName()
return self.UserFlagName
end
@@ -66,17 +66,18 @@ do -- UserFlag
-- BlueVictory:Set( 100 ) -- Set the UserFlag VictoryBlue to 100.
--
function USERFLAG:Set( Number, Delay ) --R2.3
if Delay and Delay>0 then
self:ScheduleOnce(Delay, USERFLAG.Set, self, Number)
else
--env.info(string.format("Setting flag \"%s\" to %d at T=%.1f", self.UserFlagName, Number, timer.getTime()))
trigger.action.setUserFlag( self.UserFlagName, Number )
end
return self
end
end
--- Get the userflag Number.
-- @param #USERFLAG self
-- @return #number Number The number value to be checked if it is the same as the userflag.
@@ -85,10 +86,12 @@ do -- UserFlag
-- local BlueVictoryValue = BlueVictory:Get() -- Get the UserFlag VictoryBlue value.
--
function USERFLAG:Get() --R2.3
return trigger.misc.getUserFlag( self.UserFlagName )
end
end
--- Check if the userflag has a value of Number.
-- @param #USERFLAG self
-- @param #number Number The number value to be checked if it is the same as the userflag.
@@ -99,9 +102,9 @@ do -- UserFlag
-- return "Blue has won"
-- end
function USERFLAG:Is( Number ) --R2.3
return trigger.misc.getUserFlag( self.UserFlagName ) == Number
end
end
end
+12 -11
View File
@@ -54,7 +54,7 @@ do -- Velocity
self.Velocity = VelocityMps
return self
end
--- Get the velocity in Mps (meters per second).
-- @param #VELOCITY self
-- @return #number The velocity in meters per second.
@@ -70,12 +70,12 @@ do -- Velocity
self.Velocity = UTILS.KmphToMps( VelocityKmph )
return self
end
--- Get the velocity in Kmph (kilometers per hour).
-- @param #VELOCITY self
-- @return #number The velocity in kilometers per hour.
function VELOCITY:GetKmph()
return UTILS.MpsToKmph( self.Velocity )
end
@@ -87,7 +87,7 @@ do -- Velocity
self.Velocity = UTILS.MiphToMps( VelocityMiph )
return self
end
--- Get the velocity in Miph (miles per hour).
-- @param #VELOCITY self
-- @return #number The velocity in miles per hour.
@@ -95,7 +95,8 @@ do -- Velocity
return UTILS.MpsToMiph( self.Velocity )
end
--- Get the velocity in text, according the player @{Core.Settings}.
--- Get the velocity in text, according the player @{Settings}.
-- @param #VELOCITY self
-- @param Core.Settings#SETTINGS Settings
-- @return #string The velocity in text.
@@ -112,11 +113,11 @@ do -- Velocity
end
end
--- Get the velocity in text, according the player or default @{Core.Settings}.
--- Get the velocity in text, according the player or default @{Settings}.
-- @param #VELOCITY self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable
-- @param Core.Settings#SETTINGS Settings
-- @return #string The velocity in text according the player or default @{Core.Settings}
-- @return #string The velocity in text according the player or default @{Settings}
function VELOCITY:ToString( VelocityGroup, Settings ) -- R2.3
self:F( { Group = VelocityGroup and VelocityGroup:GetName() } )
local Settings = Settings or ( VelocityGroup and _DATABASE:GetPlayerSettings( VelocityGroup:GetPlayerName() ) ) or _SETTINGS
@@ -133,7 +134,7 @@ do -- VELOCITY_POSITIONABLE
--- # VELOCITY_POSITIONABLE class, extends @{Core.Base#BASE}
--
-- @{#VELOCITY_POSITIONABLE} monitors the speed of a @{Wrapper.Positionable#POSITIONABLE} in the simulation, which can be expressed in various formats according the Settings.
-- VELOCITY_POSITIONABLE monitors the speed of an @{Positionable} in the simulation, which can be expressed in various formats according the Settings.
--
-- ## 1. VELOCITY_POSITIONABLE constructor
--
@@ -166,7 +167,7 @@ do -- VELOCITY_POSITIONABLE
-- @param #VELOCITY_POSITIONABLE self
-- @return #number The velocity in kilometers per hour.
function VELOCITY_POSITIONABLE:GetKmph()
return UTILS.MpsToKmph( self.Positionable:GetVelocityMPS() or 0)
end
@@ -177,9 +178,9 @@ do -- VELOCITY_POSITIONABLE
return UTILS.MpsToMiph( self.Positionable:GetVelocityMPS() or 0 )
end
--- Get the velocity in text, according the player or default @{Core.Settings}.
--- Get the velocity in text, according the player or default @{Settings}.
-- @param #VELOCITY_POSITIONABLE self
-- @return #string The velocity in text according the player or default @{Core.Settings}
-- @return #string The velocity in text according the player or default @{Settings}
function VELOCITY_POSITIONABLE:ToString() -- R2.3
self:F( { Group = self.Positionable and self.Positionable:GetName() } )
local Settings = Settings or ( self.Positionable and _DATABASE:GetPlayerSettings( self.Positionable:GetPlayerName() ) ) or _SETTINGS
File diff suppressed because it is too large Load Diff
@@ -1,8 +1,6 @@
--- **Core** - The ZONE_DETECTION class, defined by a zone name, a detection object and a radius.
-- @module Core.Zone_Detection
-- @image MOOSE.JPG
--- @type ZONE_DETECTION
--- The ZONE_DETECTION class, defined by a zone name, a detection object and a radius.
-- @type ZONE_DETECTION
-- @field DCS#Vec2 Vec2 The current location of the zone.
-- @field DCS#Distance Radius The radius of the zone.
-- @extends #ZONE_BASE
@@ -31,7 +29,7 @@ function ZONE_DETECTION:New( ZoneName, Detection, Radius )
self.Detection = Detection
self.Radius = Radius
return self
end
@@ -50,14 +48,15 @@ function ZONE_DETECTION:BoundZone( Points, CountryID, UnBound )
local Angle
local RadialBase = math.pi*2
--
for Angle = 0, 360, (360 / Points ) do
local Radial = Angle * RadialBase / 360
Point.x = Vec2.x + math.cos( Radial ) * self:GetRadius()
Point.y = Vec2.y + math.sin( Radial ) * self:GetRadius()
local CountryName = _DATABASE.COUNTRY_NAME[CountryID]
local Tire = {
["country"] = CountryName,
["category"] = "Fortifications",
+5 -85
View File
@@ -1,6 +1,4 @@
--- **DCS API** Prototypes.
--
-- ===
--- **DCS API** Prototypes
--
-- See the [Simulator Scripting Engine Documentation](https://wiki.hoggitworld.com/view/Simulator_Scripting_Engine_Documentation) on Hoggit for further explanation and examples.
--
@@ -308,11 +306,6 @@ do -- country
-- @field Argentinia
-- @field Cyprus
-- @field Slovenia
-- @field BOLIVIA
-- @field GHANA
-- @field NIGERIA
-- @field PERU
-- @field ECUADOR
country = {} --#country
@@ -341,23 +334,9 @@ do -- coalition
-- @field RED
-- @field BLUE
--- Get country coalition.
-- @function [parent=#coalition] getCountryCoalition
-- @param #number countryId Country ID.
-- @return #number coalitionId Coalition ID.
--- Dynamically spawns a group. See [hoggit](https://wiki.hoggitworld.com/view/DCS_func_addGroup)
-- @function [parent=#coalition] addGroup
-- @param #number countryId Id of the country.
-- @param #number groupCategory Group category. Set -1 for spawning FARPS.
-- @param #table groupData Group data table.
-- @return DCS#Group The spawned Group object.
--- Dynamically spawns a static object. See [hoggit](https://wiki.hoggitworld.com/view/DCS_func_addGroup)
-- @function [parent=#coalition] addStaticObject
-- @param #number countryId Id of the country.
-- @param #table groupData Group data table.
-- @return DCS#Static The spawned static object.
--- @function [parent=#coalition] getCountryCoalition
-- @param #number countryId
-- @return #number coalitionId
coalition = {} -- #coalition
@@ -1308,42 +1287,6 @@ do -- Group
end -- Group
do -- StaticObject
--- Represents a static object.
-- @type StaticObject
-- @extends DCS#Object
--- Returns the static object.
-- @function [parent=#StaticObject] getByName
-- @param #string name Name of the static object.
-- @return #StaticObject
StaticObject = {} --#StaticObject
end
do --Event
--- Event structure. Note that present fields depend on type of event.
-- @type Event
-- @field #number id Event ID.
-- @field #number time Mission time in seconds.
-- @field DCS#Unit initiator Unit initiating the event.
-- @field DCS#Unit target Target unit.
-- @field DCS#Airbase place Airbase.
-- @field number subPlace Subplace. Unknown and often just 0.
-- @field #string weapon_name Weapoin name.
-- @field #number idx Mark ID.
-- @field #number coalition Coalition ID.
-- @field #number groupID Group ID, *e.g.* of group that added mark point.
-- @field #string text Text, *e.g.* of mark point.
-- @field DCS#Vec3 pos Position vector, *e.g.* of mark point.
-- @field #string comment Comment, *e.g.* LSO score.
Event={} --#Event
end
do -- AI
@@ -1431,9 +1374,7 @@ do -- AI
--- @type AI.Option.Ground
-- @field #AI.Option.Ground.id id
-- @field #AI.Option.Ground.val val
-- @field #AI.Option.Ground.mid mid
-- @field #AI.Option.Ground.mval mval
--
--- @type AI.Option.Naval
-- @field #AI.Option.Naval.id id
-- @field #AI.Option.Naval.val val
@@ -1456,11 +1397,6 @@ do -- AI
-- @field PROHIBIT_AG
-- @field MISSILE_ATTACK
-- @field PROHIBIT_WP_PASS_REPORT
-- @field OPTION_RADIO_USAGE_CONTACT
-- @field OPTION_RADIO_USAGE_ENGAGE
-- @field OPTION_RADIO_USAGE_KILL
-- @field JETT_TANKS_IF_EMPTY
-- @field FORCED_ATTACK
--- @type AI.Option.Air.id.FORMATION
-- @field LINE_ABREAST
@@ -1530,35 +1466,19 @@ do -- AI
--- @type AI.Option.Ground.id
-- @field NO_OPTION
-- @field ROE @{#AI.Option.Ground.val.ROE}
-- @field FORMATION
-- @field DISPERSE_ON_ATTACK true or false
-- @field ALARM_STATE @{#AI.Option.Ground.val.ALARM_STATE}
-- @field ENGAGE_AIR_WEAPONS
-- @field AC_ENGAGEMENT_RANGE_RESTRICTION
--- @type AI.Option.Ground.mid -- Moose added
-- @field RESTRICT_AAA_MIN 27
-- @field RESTRICT_AAA_MAX 29
-- @field RESTRICT_TARGETS @{#AI.Option.Ground.mval.ENGAGE_TARGETS} 28
--- @type AI.Option.Ground.val
-- @field #AI.Option.Ground.val.ROE ROE
-- @field #AI.Option.Ground.val.ALARM_STATE ALARM_STATE
-- @field #AI.Option.Ground.val.ENGAGE_TARGETS RESTRICT_TARGETS
--- @type AI.Option.Ground.val.ROE
-- @field OPEN_FIRE
-- @field RETURN_FIRE
-- @field WEAPON_HOLD
--- @type AI.Option.Ground.mval -- Moose added
-- @field #AI.Option.Ground.mval.ENGAGE_TARGETS ENGAGE_TARGETS
--- @type AI.Option.Ground.mval.ENGAGE_TARGETS -- Moose added
-- @field ANY_TARGET -- 0
-- @field AIR_UNITS_ONLY -- 1
-- @field GROUND_UNITS_ONLY -- 2
--- @type AI.Option.Ground.val.ALARM_STATE
-- @field AUTO
-- @field GREEN
@@ -0,0 +1,980 @@
--- **Functional** - AI CSAR system
--
-- ## Main Features:
--
-- * Send out helicopters to downed pilots
-- * Rescues players and AI alike
-- * Coalition specific
-- * Starting from a FARP or Airbase
-- * Dedicated MASH zone
-- * Some FSM functions to include in your mission scripts
-- * Limit number of available helos
--
-- ===
--
-- ## Example Missions:
--
-- Demo missions can be found on [github](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/CSR-001%20-%20Basics).
--
-- ===
--
-- ### Author: **applevangelist**
-- Last Update April 2022
--
-- ===
-- @module Functional.AICSAR
-- @image MOOSE.JPG
--- AI CSAR class.
-- @type AICSAR
-- @field #string ClassName Name of this class.
-- @field #string version Versioning.
-- @field #string lid LID for log entries.
-- @field #number coalition Colition side.
-- @field #string template Template for pilot.
-- @field #string helotemplate Template for CSAR helo.
-- @field #string alias Alias Name.
-- @field Wrapper.Airbase#AIRBASE farp FARP object from where to start.
-- @field Core.Zone#ZONE farpzone MASH zone to drop rescued pilots.
-- @field #number maxdistance Max distance to go for a rescue.
-- @field #table pilotqueue Queue of pilots to rescue.
-- @field #number pilotindex Table index to bind pilot to helo.
-- @field #table helos Table of Ops.FlightGroup#FLIGHTGROUP objects
-- @field #boolean verbose Switch more output.
-- @field #number rescuezoneradius Radius around downed pilot for the helo to land in.
-- @field #table rescued Track number of rescued pilot.
-- @field #boolean autoonoff Only send a helo when no human heli pilots are available.
-- @field Core.Set#SET_CLIENT playerset Track if alive heli pilots are available.
-- @field #boolean limithelos limit available number of helos going on mission (defaults to true)
-- @field #number helonumber number of helos available (default: 3)
-- @extends Core.Fsm#FSM
--- *I once donated a pint of my finest red corpuscles to the great American Red Cross and the doctor opined my blood was very helpful; contained so much alcohol they could use it to sterilize their instruments.*
-- W.C.Fields
--
-- ===
--
-- # AICSAR Concept
--
-- For an AI or human pilot landing with a parachute, a rescue mission will be spawned. The helicopter will fly to the pilot, pick him or her up,
-- and fly back to a designated MASH (medical) zone, drop the pilot and then return to base.
-- Operational maxdistance can be set as well as the landing radius around the downed pilot.
-- Keep in mind that AI helicopters cannot hover-load at the time of writing, so rescue operations over water or in the mountains might not
-- work.
-- Optionally, if you have a CSAR operation with human pilots in your mission, you can set AICSAR to ignore missions when human helicopter
-- pilots are around.
--
-- ## Setup
--
-- Setup is a one-liner:
--
-- -- @param #string Alias Name of this instance.
-- -- @param #number Coalition Coalition as in coalition.side.BLUE, can also be passed as "blue", "red" or "neutral"
-- -- @param #string Pilottemplate Pilot template name.
-- -- @param #string Helotemplate Helicopter template name.
-- -- @param Wrapper.Airbase#AIRBASE FARP FARP object or Airbase from where to start.
-- -- @param Core.Zone#ZONE MASHZone Zone where to drop pilots after rescue.
-- local my_aicsar=AICSAR:New("Luftrettung",coalition.side.BLUE,"Downed Pilot","Rescue Helo",AIRBASE:FindByName("Test FARP"),ZONE:New("MASH"))
--
-- ## Options are
--
-- my_aicsar.maxdistance -- maximum operational distance in meters. Defaults to 50NM or 92.6km
-- my_aicsar.rescuezoneradius -- landing zone around downed pilot. Defaults to 200m
-- my_aicsar.autoonoff -- stop operations when human helicopter pilots are around. Defaults to true.
-- my_aicsar.verbose -- text messages to own coalition about ongoing operations. Defaults to true.
-- my_aicsarlimithelos -- limit available number of helos going on mission (defaults to true)
-- my_aicsar.helonumber -- number of helos available (default: 3)
--
-- ## Radio options
--
-- Radio messages, soundfile names and (for SRS) lengths are defined in three enumerators, so you can customize, localize messages and soundfiles to your liking:
--
-- Defaults are:
--
-- AICSAR.Messages = {
-- EN = {
-- INITIALOK = "Roger, Pilot, we hear you. Stay where you are, a helo is on the way!",
-- INITIALNOTOK = "Sorry, Pilot. You're behind maximum operational distance! Good Luck!",
-- PILOTDOWN = "Pilot down at ", -- note that this will be appended with the position
-- PILOTKIA = "Pilot KIA!",
-- HELODOWN = "CSAR Helo Down!",
-- PILOTRESCUED = "Pilot rescued!",
-- PILOTINHELO = "Pilot picked up!",
-- },
-- }
--
-- Correspondingly, sound file names are defined as these defaults:
--
-- AICSAR.RadioMessages = {
-- EN = {
-- INITIALOK = "initialok.ogg",
-- INITIALNOTOK = "initialnotok.ogg",
-- PILOTDOWN = "pilotdown.ogg",
-- PILOTKIA = "pilotkia.ogg",
-- HELODOWN = "helodown.ogg",
-- PILOTRESCUED = "pilotrescued.ogg",
-- PILOTINHELO = "pilotinhelo.ogg",
-- },
-- }
--
-- and these default transmission lengths in seconds:
--
-- AICSAR.RadioLength = {
-- EN = {
-- INITIALOK = 4.1,
-- INITIALNOTOK = 4.6,
-- PILOTDOWN = 2.6,
-- PILOTKIA = 1.1,
-- HELODOWN = 2.1,
-- PILOTRESCUED = 3.5,
-- PILOTINHELO = 2.6,
-- },
-- }
--
-- The easiest way to add a soundfile to your mission is to use the "Sound to..." trigger in the mission editor. This will effectively
-- save your sound file inside of the .miz mission file.
--
-- To customize or localize your texts and sounds, you can take e.g. the following approach to add a German language version:
--
-- -- parameters are: locale, ID, text, soundfilename, duration
-- my_aicsar.gettext:AddEntry("de","INITIALOK","Copy, Pilot, wir hören Sie. Bleiben Sie, wo Sie sind, ein Hubschrauber sammelt Sie auf!","okneu.ogg",5.0)
-- my_aicsar.locale = "de" -- plays and shows the defined German language texts and sound. Fallback is "en", if something is undefined.
--
-- Switch on radio transmissions via **either** SRS **or** "normal" DCS radio e.g. like so:
--
-- my_aicsar:SetSRSRadio(true,"C:\\Program Files\\DCS-SimpleRadio-Standalone",270,radio.modulation.AM,5002)
--
-- or
--
-- my_aicsar:SetDCSRadio(true,300,radio.modulation.AM,GROUP:FindByName("FARP-Radio"))
--
-- See the function documentation for parameter details.
--
-- ===
---
--
-- @field #AICSAR
AICSAR = {
ClassName = "AICSAR",
version = "0.0.8",
lid = "",
coalition = coalition.side.BLUE,
template = "",
helotemplate = "",
alias = "",
farp = nil,
farpzone = nil,
maxdistance = UTILS.NMToMeters(50),
pilotqueue = {},
pilotindex = 0,
helos = {},
verbose = true,
rescuezoneradius = 200,
rescued = {},
autoonoff = true,
playerset = nil,
Messages = {},
SRS = nil,
SRSRadio = false,
SRSFrequency = 243,
SRSPath = "\\",
SRSModulation = radio.modulation.AM,
SRSSoundPath = nil, -- defaults to "l10n/DEFAULT/", i.e. add messages via "Sount to..." in the ME
SRSPort = 5002,
DCSRadio = false,
DCSFrequency = 243,
DCSModulation = radio.modulation.AM,
DCSRadioGroup = nil,
limithelos = true,
helonumber = 3,
gettext = nil,
locale ="en", -- default text language
}
-- TODO Messages
--- Messages enum
-- @field Messages
AICSAR.Messages = {
EN = {
INITIALOK = "Roger, Pilot, we hear you. Stay where you are, a helo is on the way!",
INITIALNOTOK = "Sorry, Pilot. You're behind maximum operational distance! Good Luck!",
PILOTDOWN = "Pilot down at ",
PILOTKIA = "Pilot KIA!",
HELODOWN = "CSAR Helo Down!",
PILOTRESCUED = "Pilot rescued!",
PILOTINHELO = "Pilot picked up!",
},
DE = {
INITIALOK = "Copy, Pilot, wir hören Sie. Bleiben Sie, wo Sie sind!\nEin Hubschrauber sammelt Sie auf!",
INITIALNOTOK = "Verstehe, Pilot. Sie sind zu weit weg von uns.\nViel Glück!",
PILOTDOWN = "Pilot abgestürzt: ",
PILOTKIA = "Pilot gefallen!",
HELODOWN = "CSAR Hubschrauber verloren!",
PILOTRESCUED = "Pilot gerettet!",
PILOTINHELO = "Pilot an Bord geholt!",
},
}
-- TODO Radio Messages
--- Radio Messages enum for ogg files
-- @field RadioMessages
AICSAR.RadioMessages = {
EN = {
INITIALOK = "initialok.ogg", -- 4.1 secs
INITIALNOTOK = "initialnotok.ogg", -- 4.6 secs
PILOTDOWN = "pilotdown.ogg", -- 2.6 secs
PILOTKIA = "pilotkia.ogg", -- 1.1 sec
HELODOWN = "helodown.ogg", -- 2.1 secs
PILOTRESCUED = "pilotrescued.ogg", -- 3.5 secs
PILOTINHELO = "pilotinhelo.ogg", -- 2.6 secs
},
}
-- TODO Radio Messages
--- Radio Messages enum for ogg files length in secs
-- @field RadioLength
AICSAR.RadioLength = {
EN = {
INITIALOK = 4.1,
INITIALNOTOK = 4.6,
PILOTDOWN = 2.6,
PILOTKIA = 1.1,
HELODOWN = 2.1,
PILOTRESCUED = 3.5,
PILOTINHELO = 2.6,
},
}
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Constructor
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Function to create a new AICSAR object
-- @param #AICSAR self
-- @param #string Alias Name of this instance.
-- @param #number Coalition Coalition as in coalition.side.BLUE, can also be passed as "blue", "red" or "neutral"
-- @param #string Pilottemplate Pilot template name.
-- @param #string Helotemplate Helicopter template name.
-- @param Wrapper.Airbase#AIRBASE FARP FARP object or Airbase from where to start.
-- @param Core.Zone#ZONE MASHZone Zone where to drop pilots after rescue.
-- @return #AICSAR self
function AICSAR:New(Alias,Coalition,Pilottemplate,Helotemplate,FARP,MASHZone)
-- Inherit everything from FSM class.
local self=BASE:Inherit(self, FSM:New())
--set Coalition
if Coalition and type(Coalition)=="string" then
if Coalition=="blue" then
self.coalition=coalition.side.BLUE
self.coalitiontxt = Coalition
elseif Coalition=="red" then
self.coalition=coalition.side.RED
self.coalitiontxt = Coalition
elseif Coalition=="neutral" then
self.coalition=coalition.side.NEUTRAL
self.coalitiontxt = Coalition
else
self:E("ERROR: Unknown coalition in AICSAR!")
end
else
self.coalition = Coalition
self.coalitiontxt = string.lower(UTILS.GetCoalitionName(self.coalition))
end
-- Set alias.
if Alias then
self.alias=tostring(Alias)
else
self.alias="Red Cross"
if self.coalition then
if self.coalition==coalition.side.RED then
self.alias="IFRC"
elseif self.coalition==coalition.side.BLUE then
self.alias="CSAR"
end
end
end
self.template = Pilottemplate
self.helotemplate = Helotemplate
self.farp = FARP
self.farpzone = MASHZone
self.playerset = SET_CLIENT:New():FilterActive(true):FilterCategories("helicopter"):FilterStart()
-- Radio
self.SRS = nil
self.SRSRadio = false
self.SRSFrequency = 243
self.SRSPath = "\\"
self.SRSModulation = radio.modulation.AM
self.SRSSoundPath = nil -- defaults to "l10n/DEFAULT/", i.e. add messages via "Sound to..." in the ME
self.SRSPort = 5002
-- DCS Radio - add messages via "Sound to..." in the ME
self.DCSRadio = false
self.DCSFrequency = 243
self.DCSModulation = radio.modulation.AM
self.DCSRadioGroup = nil
self.DCSRadioQueue = nil
self.MGRS_Accuracy = 2
-- limit number of available helos at the same time
self.limithelos = true
self.helonumber = 3
-- localization
self:InitLocalization()
-- Set some string id for output to DCS.log file.
self.lid=string.format("%s (%s) | ", self.alias, self.coalition and UTILS.GetCoalitionName(self.coalition) or "unknown")
-- Start State.
self:SetStartState("Stopped")
-- Add FSM transitions.
-- From State --> Event --> To State
self:AddTransition("Stopped", "Start", "Running") -- Start FSM.
self:AddTransition("*", "Status", "*") -- CSAR status update.
self:AddTransition("*", "PilotDown", "*") -- Pilot down
self:AddTransition("*", "PilotPickedUp", "*") -- Pilot in helo
self:AddTransition("*", "PilotRescued", "*") -- Pilot Rescued
self:AddTransition("*", "PilotKIA", "*") -- Pilot dead
self:AddTransition("*", "HeloDown", "*") -- Helo dead
self:AddTransition("*", "Stop", "Stopped") -- Stop FSM.
self:HandleEvent(EVENTS.LandingAfterEjection)
self:__Start(math.random(2,5))
local text = string.format("%sAICSAR Version %s Starting",self.lid,self.version)
self:I(text)
------------------------
--- Pseudo Functions ---
------------------------
--- Triggers the FSM event "Status".
-- @function [parent=#AICSAR] Status
-- @param #AICSAR self
--- Triggers the FSM event "Status" after a delay.
-- @function [parent=#AICSAR] __Status
-- @param #AICSAR self
-- @param #number delay Delay in seconds.
--- Triggers the FSM event "Stop".
-- @function [parent=#AICSAR] Stop
-- @param #AICSAR self
--- Triggers the FSM event "Stop" after a delay.
-- @function [parent=#AICSAR] __Stop
-- @param #AICSAR self
-- @param #number delay Delay in seconds.
--- On after "PilotDown" event.
-- @function [parent=#AICSAR] OnAfterPilotDown
-- @param #AICSAR self
-- @param #string From From state.
-- @param #string Event Event.
-- @param #string To To state.
-- @param Core.Point#COORDINATE Coordinate Location of the pilot.
-- @param #boolean InReach True if in maxdistance else false.
--- On after "PilotPickedUp" event.
-- @function [parent=#AICSAR] OnAfterPilotPickedUp
-- @param #AICSAR self
-- @param #string From From state.
-- @param #string Event Event.
-- @param #string To To state.
-- @param Ops.FlightGroup#FLIGHTGROUP Helo
-- @param #table CargoTable of Ops.OpsGroup#OPSGROUP Cargo objects
-- @param #number Index
--- On after "PilotRescued" event.
-- @function [parent=#AICSAR] OnAfterPilotRescued
-- @param #AICSAR self
-- @param #string From From state.
-- @param #string Event Event.
-- @param #string To To state.
--- On after "PilotKIA" event.
-- @function [parent=#AICSAR] OnAfterPilotKIA
-- @param #AICSAR self
-- @param #string From From state.
-- @param #string Event Event.
-- @param #string To To state.
--- On after "HeloDown" event.
-- @function [parent=#AICSAR] OnAfterHeloDown
-- @param #AICSAR self
-- @param #string From From state.
-- @param #string Event Event.
-- @param #string To To state.
-- @param Ops.FlightGroup#FLIGHTGROUP Helo
-- @param #number Index
return self
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Functions
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- [Internal] Create the Moose TextAndSoundEntries
-- @param #AICSAR self
-- @return #AICSAR self
function AICSAR:InitLocalization()
self:T(self.lid .. "InitLocalization")
-- English standard localization
self.gettext=TEXTANDSOUND:New(self.ClassName, "en")
self.gettext:AddEntry("en","INITIALOK",AICSAR.Messages.EN.INITIALOK,AICSAR.RadioMessages.EN.INITIALOK,AICSAR.RadioLength.INITIALOK)
self.gettext:AddEntry("en","INITIALNOTOK",AICSAR.Messages.EN.INITIALNOTOK,AICSAR.RadioMessages.EN.INITIALNOTOK,AICSAR.RadioLength.EN.INITIALNOTOK)
self.gettext:AddEntry("en","HELODOWN",AICSAR.Messages.EN.HELODOWN,AICSAR.RadioMessages.EN.HELODOWN,AICSAR.RadioLength.EN.HELODOWN)
self.gettext:AddEntry("en","PILOTDOWN",AICSAR.Messages.EN.PILOTDOWN,AICSAR.RadioMessages.EN.PILOTDOWN,AICSAR.RadioLength.EN.PILOTDOWN)
self.gettext:AddEntry("en","PILOTINHELO",AICSAR.Messages.EN.PILOTINHELO,AICSAR.RadioMessages.EN.PILOTINHELO,AICSAR.RadioLength.EN.PILOTINHELO)
self.gettext:AddEntry("en","PILOTKIA",AICSAR.Messages.EN.PILOTKIA,AICSAR.RadioMessages.EN.PILOTKIA,AICSAR.RadioLength.EN.PILOTKIA)
self.gettext:AddEntry("en","PILOTRESCUED",AICSAR.Messages.EN.PILOTRESCUED,AICSAR.RadioMessages.EN.PILOTRESCUED,AICSAR.RadioLength.EN.PILOTRESCUED)
-- German localization - we keep the sound files English
self.gettext:AddEntry("de","INITIALOK",AICSAR.Messages.DE.INITIALOK,AICSAR.RadioMessages.EN.INITIALOK,AICSAR.RadioLength.INITIALOK)
self.gettext:AddEntry("de","INITIALNOTOK",AICSAR.Messages.DE.INITIALNOTOK,AICSAR.RadioMessages.EN.INITIALNOTOK,AICSAR.RadioLength.EN.INITIALNOTOK)
self.gettext:AddEntry("de","HELODOWN",AICSAR.Messages.DE.HELODOWN,AICSAR.RadioMessages.EN.HELODOWN,AICSAR.RadioLength.EN.HELODOWN)
self.gettext:AddEntry("de","PILOTDOWN",AICSAR.Messages.DE.PILOTDOWN,AICSAR.RadioMessages.EN.PILOTDOWN,AICSAR.RadioLength.EN.PILOTDOWN)
self.gettext:AddEntry("de","PILOTINHELO",AICSAR.Messages.DE.PILOTINHELO,AICSAR.RadioMessages.EN.PILOTINHELO,AICSAR.RadioLength.EN.PILOTINHELO)
self.gettext:AddEntry("de","PILOTKIA",AICSAR.Messages.DE.PILOTKIA,AICSAR.RadioMessages.EN.PILOTKIA,AICSAR.RadioLength.EN.PILOTKIA)
self.gettext:AddEntry("de","PILOTRESCUED",AICSAR.Messages.DE.PILOTRESCUED,AICSAR.RadioMessages.EN.PILOTRESCUED,AICSAR.RadioLength.EN.PILOTRESCUED)
self.locale = "en"
return self
end
--- [User] Switch sound output on and use SRS
-- @param #AICSAR self
-- @param #boolean OnOff Switch on (true) or off (false).
-- @param #string Path Path to your SRS Server Component, e.g. "E:\\\\Program Files\\\\DCS-SimpleRadio-Standalone"
-- @param #number Frequency Defaults to 243 (guard)
-- @param #number Modulation Radio modulation. Defaults to radio.modulation.AM
-- @param #string SoundPath Where to find the audio files. Defaults to nil, i.e. add messages via "Sound to..." in the Mission Editor.
-- @param #number Port Port of the SRS, defaults to 5002.
-- @return #AICSAR self
function AICSAR:SetSRSRadio(OnOff,Path,Frequency,Modulation,SoundPath,Port)
self:T(self.lid .. "SetSRSRadio")
self:T(self.lid .. "SetSRSRadio to "..tostring(OnOff))
self.SRSRadio = OnOff and true
self.SRSFrequency = Frequency or 243
self.SRSPath = Path or "c:\\"
self.SRSModulation = Modulation or radio.modulation.AM
local soundpath = os.getenv('TMP') .. "\\DCS\\Mission\\l10n\\DEFAULT" -- defaults to "l10n/DEFAULT/", i.e. add messages by "Sound to..." in the ME
self.SRSSoundPath = SoundPath or soundpath
self.SRSPort = Port or 5002
if OnOff then
self.SRS = MSRS:New(Path,Frequency,Modulation)
self.SRS:SetPort(self.SRSPort)
end
return self
end
--- [User] Switch sound output on and use normale (DCS) radio
-- @param #AICSAR self
-- @param #boolean OnOff Switch on (true) or off (false).
-- @param #number Frequency Defaults to 243 (guard).
-- @param #number Modulation Radio modulation. Defaults to radio.modulation.AM.
-- @param Wrapper.Group#GROUP Group The group to use as sending station.
-- @return #AICSAR self
function AICSAR:SetDCSRadio(OnOff,Frequency,Modulation,Group)
self:T(self.lid .. "SetDCSRadio")
self:T(self.lid .. "SetDCSRadio to "..tostring(OnOff))
self.DCSRadio = OnOff and true
self.DCSFrequency = Frequency or 243
self.DCSModulation = Modulation or radio.modulation.AM
self.DCSRadioGroup = Group
if self.DCSRadio then
self.DCSRadioQueue = RADIOQUEUE:New(Frequency,Modulation,"AI-CSAR")
self.DCSRadioQueue:Start(5,5)
self.DCSRadioQueue:SetRadioPower(1000)
self.DCSRadioQueue:SetSenderCoordinate(Group:GetCoordinate())
else
if self.DCSRadioQueue then
self.DCSRadioQueue:Stop()
end
end
return self
end
--- [Internal] Sound output via non-SRS Radio. Add message files (.ogg) via "Sound to..." in the ME.
-- @param #AICSAR self
-- @param #string Soundfile Name of the soundfile
-- @param #number Duration Duration of the sound
-- @param #string Subtitle Text to display
-- @return #AICSAR self
function AICSAR:DCSRadioBroadcast(Soundfile,Duration,Subtitle)
self:T(self.lid .. "DCSRadioBroadcast")
local radioqueue = self.DCSRadioQueue -- Sound.RadioQueue#RADIOQUEUE
radioqueue:NewTransmission(Soundfile,Duration,nil,2,nil,Subtitle,10)
return self
end
--- [Internal] Catch the landing after ejection and spawn a pilot in situ.
-- @param #AICSAR self
-- @param Core.Event#EVENTDATA EventData
-- @return #AICSAR self
function AICSAR:OnEventLandingAfterEjection(EventData)
self:T(self.lid .. "OnEventLandingAfterEjection ID=" .. EventData.id)
-- autorescue on off?
if self.autoonoff then
if self.playerset:CountAlive() > 0 then
return self
end
end
local _event = EventData -- Core.Event#EVENTDATA
-- get position and spawn in a template pilot
local _LandingPos = COORDINATE:NewFromVec3(_event.initiator:getPosition().p)
local _country = _event.initiator:getCountry()
local _coalition = coalition.getCountryCoalition( _country )
-- DONE: add distance check
local distancetofarp = _LandingPos:Get2DDistance(self.farp:GetCoordinate())
-- Mayday Message
local Text,Soundfile,Soundlength,Subtitle = self.gettext:GetEntry("PILOTDOWN",self.locale)
local text = ""
if _coalition == self.coalition then
if self.verbose then
local setting = {}
setting.MGRS_Accuracy = self.MGRS_Accuracy
local location = _LandingPos:ToStringMGRS(setting)
text = Text .. location .. "!"
MESSAGE:New(text,15,"AICSAR"):ToCoalition(self.coalition)
end
if self.SRSRadio then
local sound = SOUNDFILE:New(Soundfile,self.SRSSoundPath,Soundlength)
sound:SetPlayWithSRS(true)
self.SRS:PlaySoundFile(sound,2)
elseif self.DCSRadio then
self:DCSRadioBroadcast(Soundfile,Soundlength,text)
end
end
-- further processing
if _coalition == self.coalition and distancetofarp <= self.maxdistance then
-- in reach
self:T(self.lid .. "Spawning new Pilot")
self.pilotindex = self.pilotindex + 1
local newpilot = SPAWN:NewWithAlias(self.template,string.format("%s-AICSAR-%d",self.template, self.pilotindex))
newpilot:InitDelayOff()
newpilot:OnSpawnGroup(
function (grp)
self.pilotqueue[self.pilotindex] = grp
end
)
newpilot:SpawnFromCoordinate(_LandingPos)
Unit.destroy(_event.initiator) -- shagrat remove static Pilot model
self:__PilotDown(2,_LandingPos,true)
elseif _coalition == self.coalition and distancetofarp > self.maxdistance then
-- out of reach, apologies, too far off
self:T(self.lid .. "Pilot out of reach")
self:__PilotDown(2,_LandingPos,false)
end
return self
end
--- [Internal] Get FlightGroup
-- @param #AICSAR self
-- @return Ops.FlightGroup#FLIGHTGROUP The FlightGroup
function AICSAR:_GetFlight()
self:T(self.lid .. "_GetFlight")
-- Helo Carrier.
local newhelo = SPAWN:NewWithAlias(self.helotemplate,self.helotemplate..math.random(1,10000))
:InitDelayOff()
:InitUnControlled(true)
:Spawn()
local nhelo=FLIGHTGROUP:New(newhelo)
nhelo:SetHomebase(self.farp)
nhelo:Activate()
return nhelo
end
--- [Internal] Create a new rescue mission
-- @param #AICSAR self
-- @param Wrapper.Group#GROUP Pilot The pilot to be rescued.
-- @param #number Index Index number of this pilot
-- @return #AICSAR self
function AICSAR:_InitMission(Pilot,Index)
self:T(self.lid .. "_InitMission")
local pickupzone = ZONE_GROUP:New(Pilot:GetName(),Pilot,self.rescuezoneradius)
--local pilotset = SET_GROUP:New()
--pilotset:AddGroup(Pilot)
-- Cargo transport assignment.
local opstransport=OPSTRANSPORT:New(Pilot, pickupzone, self.farpzone)
local helo = self:_GetFlight()
-- inject reservation
helo.AICSARReserved = true
-- Cargo transport assignment to first Huey group.
helo:AddOpsTransport(opstransport)
-- callback functions
local function AICPickedUp(Helo,Cargo,Index)
self:__PilotPickedUp(2,Helo,Cargo,Index)
end
local function AICHeloDead(Helo,Index)
self:__HeloDown(2,Helo,Index)
end
function helo:OnAfterLoadingDone(From,Event,To)
AICPickedUp(helo,helo:GetCargoGroups(),Index)
end
function helo:OnAfterDead(From,Event,To)
AICHeloDead(helo,Index)
end
self.helos[Index] = helo
return self
end
--- [Internal] Check if pilot arrived in rescue zone (MASH)
-- @param #AICSAR self
-- @param Wrapper.Group#GROUP Pilot The pilot to be rescued.
-- @return #boolean outcome
function AICSAR:_CheckInMashZone(Pilot)
self:T(self.lid .. "_CheckQueue")
if Pilot:IsInZone(self.farpzone) then
return true
else
return false
end
end
--- [Internal] Check helo queue
-- @param #AICSAR self
-- @return #AICSAR self
function AICSAR:_CheckHelos()
self:T(self.lid .. "_CheckHelos")
for _index,_helo in pairs(self.helos) do
local helo = _helo -- Ops.FlightGroup#FLIGHTGROUP
if helo and helo.ClassName == "FLIGHTGROUP" then
local state = helo:GetState()
local name = helo:GetName()
self:T("Helo group "..name.." in state "..state)
if state == "Arrived" then
helo:__Stop(5)
self.helos[_index] = nil
end
else
self.helos[_index] = nil
end
end
return self
end
--- [Internal] Count helos queue
-- @param #AICSAR self
-- @return #number Number of helos on mission
function AICSAR:_CountHelos()
self:T(self.lid .. "_CountHelos")
local count = 0
for _index,_helo in pairs(self.helos) do
count = count + 1
end
return count
end
--- [Internal] Check pilot queue for next mission
-- @param #AICSAR self
-- @return #AICSAR self
function AICSAR:_CheckQueue()
self:T(self.lid .. "_CheckQueue")
for _index, _pilot in pairs(self.pilotqueue) do
local classname = _pilot.ClassName and _pilot.ClassName or "NONE"
local name = _pilot.GroupName and _pilot.GroupName or "NONE"
local helocount = self:_CountHelos()
--self:T("Looking at " .. classname .. " " .. name)
-- find one w/o mission
if _pilot and _pilot.ClassName and _pilot.ClassName == "GROUP" then
local flightgroup = self.helos[_index] -- Ops.FlightGroup#FLIGHTGROUP
-- rescued?
if self:_CheckInMashZone(_pilot) then
self:T("Pilot" .. _pilot.GroupName .. " rescued!")
_pilot:Destroy(false)
self.pilotqueue[_index] = nil
self.rescued[_index] = true
self:__PilotRescued(2)
if flightgroup then
flightgroup.AICSARReserved = false
end
end -- end rescued
-- has no mission assigned?
if not _pilot.AICSAR then
-- helo available?
if self.limithelos and helocount >= self.helonumber then
-- none free
break
end -- end limit
_pilot.AICSAR = {}
_pilot.AICSAR.Status = "Initiated"
_pilot.AICSAR.Boarded = false
self:_InitMission(_pilot,_index)
break
else
-- update status from OPSGROUP
if flightgroup then
local state = flightgroup:GetState()
_pilot.AICSAR.Status = state
end
--self:T("Flight for " .. _pilot.GroupName .. " in state " .. state)
end -- end has mission
end -- end if pilot
end -- end loop
return self
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- FSM Functions
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- [Internal] onafterStart
-- @param #AICSAR self
-- @param #string From
-- @param #string Event
-- @param #string To
-- @return #AICSAR self
function AICSAR:onafterStart(From, Event, To)
self:T({From, Event, To})
self:__Status(3)
return self
end
--- [Internal] onafterStatus
-- @param #AICSAR self
-- @param #string From
-- @param #string Event
-- @param #string To
-- @return #AICSAR self
function AICSAR:onafterStatus(From, Event, To)
self:T({From, Event, To})
self:_CheckQueue()
self:_CheckHelos()
self:__Status(30)
return self
end
--- [Internal] onafterStop
-- @param #AICSAR self
-- @param #string From
-- @param #string Event
-- @param #string To
-- @return #AICSAR self
function AICSAR:onafterStop(From, Event, To)
self:T({From, Event, To})
self:UnHandleEvent(EVENTS.LandingAfterEjection)
if self.DCSRadioQueue then
self.DCSRadioQueue:Stop()
end
return self
end
--- [Internal] onafterPilotDown
-- @param #AICSAR self
-- @param #string From
-- @param #string Event
-- @param #string To
-- @param Core.Point#COORDINATE Coordinate Location of the pilot.
-- @param #boolean InReach True if in maxdistance else false.
-- @return #AICSAR self
function AICSAR:onafterPilotDown(From, Event, To, Coordinate, InReach)
self:T({From, Event, To})
local CoordinateText = Coordinate:ToStringMGRS()
local inreach = tostring(InReach)
--local text = string.format("Pilot down at %s. In reach = %s",CoordinateText,inreach)
if InReach then
local text,Soundfile,Soundlength,Subtitle = self.gettext:GetEntry("INITIALOK",self.locale)
--local text = AICSAR.Messages.EN.INITIALOK
self:T(text)
if self.verbose then
MESSAGE:New(text,15,"AICSAR"):ToCoalition(self.coalition)
end
if self.SRSRadio then
local sound = SOUNDFILE:New(Soundfile,self.SRSSoundPath,Soundlength)
sound:SetPlayWithSRS(true)
self.SRS:PlaySoundFile(sound,2)
elseif self.DCSRadio then
self:DCSRadioBroadcast(Soundfile,Soundlength,text)
end
else
local text,Soundfile,Soundlength,Subtitle = self.gettext:GetEntry("INITIALNOTOK",self.locale)
--local text = AICSAR.Messages.EN.INITIALNOTOK
self:T(text)
if self.verbose then
MESSAGE:New(text,15,"AICSAR"):ToCoalition(self.coalition)
end
if self.SRSRadio then
local sound = SOUNDFILE:New(Soundfile,self.SRSSoundPath,Soundlength)
sound:SetPlayWithSRS(true)
self.SRS:PlaySoundFile(sound,2)
elseif self.DCSRadio then
self:DCSRadioBroadcast(Soundfile,Soundlength,text)
end
end
return self
end
--- [Internal] onafterPilotKIA
-- @param #AICSAR self
-- @param #string From
-- @param #string Event
-- @param #string To
-- @return #AICSAR self
function AICSAR:onafterPilotKIA(From, Event, To)
self:T({From, Event, To})
local text,Soundfile,Soundlength,Subtitle = self.gettext:GetEntry("PILOTKIA",self.locale)
if self.verbose then
MESSAGE:New(text,15,"AICSAR"):ToCoalition(self.coalition)
end
if self.SRSRadio then
local sound = SOUNDFILE:New(Soundfile,self.SRSSoundPath,Soundlength)
sound:SetPlayWithSRS(true)
self.SRS:PlaySoundFile(sound,2)
elseif self.DCSRadio then
self:DCSRadioBroadcast(Soundfile,Soundlength,text)
end
return self
end
--- [Internal] onafterHeloDown
-- @param #AICSAR self
-- @param #string From
-- @param #string Event
-- @param #string To
-- @param Ops.FlightGroup#FLIGHTGROUP Helo
-- @param #number Index
-- @return #AICSAR self
function AICSAR:onafterHeloDown(From, Event, To, Helo, Index)
self:T({From, Event, To})
local text,Soundfile,Soundlength,Subtitle = self.gettext:GetEntry("HELODOWN",self.locale)
if self.verbose then
MESSAGE:New(text,15,"AICSAR"):ToCoalition(self.coalition)
end
if self.SRSRadio then
local sound = SOUNDFILE:New(Soundfile,self.SRSSoundPath,Soundlength)
sound:SetPlayWithSRS(true)
self.SRS:PlaySoundFile(sound,2)
elseif self.DCSRadio then
self:DCSRadioBroadcast(Soundfile,Soundlength,text)
end
local findex = 0
local fhname = Helo:GetName()
-- find index of Helo
if Index and Index > 0 then
findex=Index
else
for _index, _helo in pairs(self.helos) do
local helo = _helo -- Ops.FlightGroup#FLIGHTGROUP
local hname = helo:GetName()
if fhname == hname then
findex = _index
break
end
end
end
-- find pilot
if findex > 0 and not self.rescued[findex] then
local pilot = self.pilotqueue[findex]
self.helos[findex] = nil
if pilot.AICSAR.Boarded then
self:T("Helo Down: Found DEAD Pilot ID " .. findex .. " with name " .. pilot:GetName())
-- pilot also dead
self:__PilotKIA(2)
self.pilotqueue[findex] = nil
else
-- initiate new mission
self:T("Helo Down: Found ALIVE Pilot ID " .. findex .. " with name " .. pilot:GetName())
self:_InitMission(pilot,findex)
end
end
return self
end
--- [Internal] onafterPilotRescued
-- @param #AICSAR self
-- @param #string From
-- @param #string Event
-- @param #string To
-- @return #AICSAR self
function AICSAR:onafterPilotRescued(From, Event, To)
self:T({From, Event, To})
local text,Soundfile,Soundlength,Subtitle = self.gettext:GetEntry("PILOTRESCUED",self.locale)
if self.verbose then
MESSAGE:New(text,15,"AICSAR"):ToCoalition(self.coalition)
end
if self.SRSRadio then
local sound = SOUNDFILE:New(Soundfile,self.SRSSoundPath,Soundlength)
sound:SetPlayWithSRS(true)
self.SRS:PlaySoundFile(sound,2)
elseif self.DCSRadio then
self:DCSRadioBroadcast(Soundfile,Soundlength,text)
end
return self
end
--- [Internal] onafterPilotPickedUp
-- @param #AICSAR self
-- @param #string From
-- @param #string Event
-- @param #string To
-- @param Ops.FlightGroup#FLIGHTGROUP Helo
-- @param #table CargoTable of Ops.OpsGroup#OPSGROUP Cargo objects
-- @param #number Index
-- @return #AICSAR self
function AICSAR:onafterPilotPickedUp(From, Event, To, Helo, CargoTable, Index)
self:T({From, Event, To})
local text,Soundfile,Soundlength,Subtitle = self.gettext:GetEntry("PILOTINHELO",self.locale)
if self.verbose then
MESSAGE:New(text,15,"AICSAR"):ToCoalition(self.coalition)
end
if self.SRSRadio then
local sound = SOUNDFILE:New(Soundfile,self.SRSSoundPath,Soundlength)
sound:SetPlayWithSRS(true)
self.SRS:PlaySoundFile(sound,2)
elseif self.DCSRadio then
self:DCSRadioBroadcast(Soundfile,Soundlength,text)
end
local findex = 0
local fhname = Helo:GetName()
if Index and Index > 0 then
findex = Index
else
-- find index of Helo
for _index, _helo in pairs(self.helos) do
local helo = _helo -- Ops.FlightGroup#FLIGHTGROUP
local hname = helo:GetName()
if fhname == hname then
findex = _index
break
end
end
end
-- find pilot
if findex > 0 then
local pilot = self.pilotqueue[findex]
self:T("Boarded: Found Pilot ID " .. findex .. " with name " .. pilot:GetName())
pilot.AICSAR.Boarded = true -- mark as boarded
end
return self
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- END AICSAR
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
File diff suppressed because it is too large Load Diff
@@ -30,7 +30,7 @@
-- ### Contributions: [FlightControl](https://forums.eagle.ru/member.php?u=89536)
--
-- ====
-- @module Functional.Artillery
-- @module Functional.Arty
-- @image Artillery.JPG
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -73,7 +73,7 @@
-- @field Core.Point#COORDINATE RearmingPlaceCoord Coordinates of the rearming place. If the place is more than 100 m away from the ARTY group, the group will go there.
-- @field #boolean RearmingArtyOnRoad If true, ARTY group will move to rearming place using mainly roads. Default false.
-- @field Core.Point#COORDINATE InitialCoord Initial coordinates of the ARTY group.
-- @field #boolean report Arty group sends messages about their current state or target to its coalition.
-- @field #boolean report Arty group sends messages about their current state or target to its coaliton.
-- @field #table ammoshells Table holding names of the shell types which are included when counting the ammo. Default is {"weapons.shells"} which include most shells.
-- @field #table ammorockets Table holding names of the rocket types which are included when counting the ammo. Default is {"weapons.nurs"} which includes most unguided rockets.
-- @field #table ammomissiles Table holding names of the missile types which are included when counting the ammo. Default is {"weapons.missiles"} which includes some guided missiles.
@@ -108,7 +108,7 @@
--- 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
-- interact with the process at certain events or states.
--
-- A new ARTY object can be created with the @{#ARTY.New}(*group*) constructor.
-- A new ARTY object can be created with the @{#ARTY.New}(*group*) contructor.
-- The parameter *group* has to be a MOOSE Group object and defines ARTY group.
--
-- The ARTY FSM process can be started by the @{#ARTY.Start}() command.
@@ -146,7 +146,7 @@
-- When a new target is assigned via the @{#ARTY.AssignTargetCoord}() function (see below), the **NewTarget** event is triggered.
--
-- ## Assigning Targets
-- Assigning targets is a central point of the ARTY class. Multiple targets can be assigned simultaneously and are put into a queue.
-- Assigning targets is a central point of the ARTY class. Multiple targets can be assigned simultanioulsly and are put into a queue.
-- Of course, targets can be added at any time during the mission. For example, once they are detected by a reconnaissance unit.
--
-- In order to add a target, the function @{#ARTY.AssignTargetCoord}(*coord*, *prio*, *radius*, *nshells*, *maxengage*, *time*, *weapontype*, *name*) has to be used.
@@ -161,7 +161,7 @@
-- * *maxengage*: Number of times a target is engaged.
-- * *time*: Time of day the engagement is schedule in the format "hh:mm:ss" for hh=hours, mm=minutes, ss=seconds.
-- For example "10:15:35". In the case the attack will be executed at a quarter past ten in the morning at the day the mission started.
-- If the engagement should start on the following day the format can be specified as "10:15:35+1", where the +1 denotes the following day.
-- If the engagement should start on the following day the format can be specified as "10:15:35+1", where the +1 denots the following day.
-- This is useful for longer running missions or if the mission starts at 23:00 hours and the attack should be scheduled at 01:00 hours on the following day.
-- Of course, later days are also possible by appending "+2", "+3", etc.
-- **Note** that the time has to be given as a string. So the enclosing quotation marks "" are important.
@@ -179,7 +179,7 @@
-- Let's first consider the case that none of the targets is scheduled to be executed at a certain time (*time*=nil).
-- The ARTY group will first engage the target with higher priority (*prio*=10). After the engagement is finished, the target with lower priority is attacked.
-- This is because the target with lower prio has been attacked one time less. After the attack on the lower priority task is finished and both targets
-- have been engaged equally often, the target with the higher priority is engaged again. This continues until a target has engaged three times.
-- have been engaged equally often, the target with the higher priority is engaged again. This coninues until a target has engaged three times.
-- Once the maximum number of engagements is reached, the target is deleted from the queue.
--
-- In other words, the queue is first sorted with respect to the number of engagements and targets with the same number of engagements are sorted with
@@ -190,7 +190,7 @@
-- As mentioned above, targets can be engaged at a specific time of the day via the *time* parameter.
--
-- If the *time* parameter is specified for a target, the first engagement of that target will happen at that time of the day and not before.
-- This also applies when multiple engagements are requested via the *maxengage* parameter. The first attack will not happen before the specified time.
-- This also applies when multiple engagements are requested via the *maxengage* parameter. The first attack will not happen before the specifed time.
-- When that timed attack is finished, the *time* parameter is deleted and the remaining engagements are carried out in the same manner as for untimed targets (described above).
--
-- Of course, it can happen that a scheduled task should be executed at a time, when another target is already under attack.
@@ -201,7 +201,7 @@
--
-- ## Determining the Amount of Ammo
--
-- In order to determine when a unit is out of ammo and possible initiate the rearming process it is necessary to know which types of weapons have to be counted.
-- In order to determin when a unit is out of ammo and possible initiate the rearming process it is necessary to know which types of weapons have to be counted.
-- For most artillery unit types, this is simple because they only have one type of weapon and hence ammunition.
--
-- However, there are more complex scenarios. For example, naval units carry a big arsenal of different ammunition types ranging from various cannon shell types
@@ -217,7 +217,7 @@
-- **Note** that the default parameters "weapons.shells", "weapons.nurs", "weapons.missiles" **should in priciple** capture all the corresponding ammo types.
-- However, the logic searches for the string "weapon.missies" in the ammo type. Especially for missiles, this string is often not contained in the ammo type descriptor.
--
-- One way to determine which types of ammo the unit carries, one can use the debug mode of the arty class via @{#ARTY.SetDebugON}().
-- One way to determin which types of ammo the unit carries, one can use the debug mode of the arty class via @{#ARTY.SetDebugON}().
-- In debug mode, the all ammo types of the group are printed to the monitor as message and can be found in the DCS.log file.
--
-- ## Employing Selected Weapons
@@ -274,7 +274,7 @@
--
-- ## Simulated Weapons
--
-- In addition to the standard weapons a group has available some special weapon types that are not possible to use in the native DCS environment are simulated.
-- In addtion to the standard weapons a group has available some special weapon types that are not possible to use in the native DCS environment are simulated.
--
-- ### Tactical Nukes
--
@@ -283,9 +283,9 @@
--
-- By default, they group does not have any nukes available. To give the group the ability the function @{#ARTY.SetTacNukeShells}(*n*) can be used.
-- This supplies the group with *n* nuclear shells, where *n* is restricted to the number of conventional shells the group can carry.
-- Note that the group must always have conventional shells left in order to fire a nuclear shell.
-- Note that the group must always have convenctional shells left in order to fire a nuclear shell.
--
-- The default explosion strength is 0.075 kilo tons TNT. The can be changed with the @{#ARTY.SetTacNukeWarhead}(*strength*), where *strength* is given in kilo tons TNT.
-- The default explostion strength is 0.075 kilo tons TNT. The can be changed with the @{#ARTY.SetTacNukeWarhead}(*strength*), where *strength* is given in kilo tons TNT.
--
-- ### Illumination Shells
--
@@ -301,12 +301,12 @@
--
-- ### Smoke Shells
--
-- In a similar way to illumination shells, ARTY groups can also employ smoke shells. The number of smoke shells the group has available is set by the function
-- In a similar way to illumination shells, ARTY groups can also employ smoke shells. The numer of smoke shells the group has available is set by the function
-- @{#ARTY.SetSmokeShells}(*n*, *color*), where *n* is the number of shells and *color* defines the smoke color. Default is SMOKECOLOR.Red.
--
-- The weapon type to be used in the @{#ARTY.AssignTargetCoord}() function is *ARTY.WeaponType.SmokeShells*.
--
-- The explosive shell the group fired is destroyed shortly before its impact on the ground and smoke of the specified color is triggered at that position.
-- The explosive shell the group fired is destroyed shortly before its impact on the ground and smoke of the speficied color is triggered at that position.
--
--
-- ## Assignments via Markers on F10 Map
@@ -320,15 +320,15 @@
-- ### Target Assignments
-- A new target can be assigned by writing **arty engage** in the marker text.
-- This is followed by a **comma separated list** of (optional) keywords and parameters.
-- First, it is important to address the ARTY group or groups that should engage. This can be done in numerous ways. The keywords are *battery*, *alias*, *cluster*.
-- First, it is important to address the ARTY group or groups that should engage. This can be done in numrous ways. The keywords are *battery*, *alias*, *cluster*.
-- It is also possible to address all ARTY groups by the keyword *everyone* or *allbatteries*. These two can be used synonymously.
-- **Note that**, if no battery is assigned nothing will happen.
--
-- * *everyone* or *allbatteries* The target is assigned to all batteries.
-- * *battery* Name of the ARTY group that the target is assigned to. Note that **the name is case sensitive** and has to be given in quotation marks. Default is all ARTY groups of the right coalition.
-- * *alias* Alias of the ARTY group that the target is assigned to. The alias is **case sensitive** and needs to be in quotation marks.
-- * *cluster* The cluster of ARTY groups that is addressed. Clusters can be defined by the function @{#ARTY.AddToCluster}(*clusters*). Names are **case sensitive** and need to be in quotation marks.
-- * *key* A number to authorize the target assignment. Only specifying the correct number will trigger an engagement.
-- * *cluster* The cluster of ARTY groups that is addessed. Clusters can be defined by the function @{#ARTY.AddToCluster}(*clusters*). Names are **case sensitive** and need to be in quotation marks.
-- * *key* A number to authorize the target assignment. Only specifing the correct number will trigger an engagement.
-- * *time* Time for which which the engagement is schedules, e.g. 08:42. Default is as soon as possible.
-- * *prio* Priority of the engagement as number between 1 (high prio) and 100 (low prio). Default is 50, i.e. medium priority.
-- * *shots* Number of shots (shells, rockets or missiles) fired at each engagement. Default is 5.
@@ -353,8 +353,8 @@
-- arty engage, battery "Paladin Alpha", weapon nukes, shots 1, time 20:15
-- arty engage, battery "Horwitzer 1", lldms 41:51:00N 41:47:58E
--
-- Note that the keywords and parameters are *case insensitive*. Only exception are the battery, alias and cluster names.
-- These must be exactly the same as the names of the groups defined in the mission editor or the aliases and cluster names defined in the script.
-- Note that the keywords and parameters are *case insensitve*. Only exception are the battery, alias and cluster names.
-- These must be exactly the same as the names of the goups defined in the mission editor or the aliases and cluster names defined in the script.
--
-- ### Relocation Assignments
--
@@ -363,11 +363,11 @@
-- * *time* Time for which which the relocation/move is schedules, e.g. 08:42. Default is as soon as possible.
-- * *speed* The speed in km/h the group will drive at. Default is 70% of its max possible speed.
-- * *on road* Group will use mainly roads. Default is off, i.e. it will go in a straight line from its current position to the assigned coordinate.
-- * *canceltarget* Group will cancel all running firing engagements and immediately start to move. Default is that group will wait until is current assignment is over.
-- * *canceltarget* Group will cancel all running firing engagements and immidiately start to move. Default is that group will wait until is current assignment is over.
-- * *battery* Name of the ARTY group that the relocation is assigned to.
-- * *alias* Alias of the ARTY group that the target is assigned to. The alias is **case sensitive** and needs to be in quotation marks.
-- * *cluster* The cluster of ARTY groups that is addressed. Clusters can be defined by the function @{#ARTY.AddToCluster}(*clusters*). Names are **case sensitive** and need to be in quotation marks.
-- * *key* A number to authorize the target assignment. Only specifying the correct number will trigger an engagement.
-- * *cluster* The cluster of ARTY groups that is addessed. Clusters can be defined by the function @{#ARTY.AddToCluster}(*clusters*). Names are **case sensitive** and need to be in quotation marks.
-- * *key* A number to authorize the target assignment. Only specifing the correct number will trigger an engagement.
-- * *lldms* Specify the coordinates in Lat/Long degrees, minutes and seconds format. The actual location of the marker is unimportant. The group will move to the coordinates given in the lldms keyword.
-- Format is DD:MM:SS[N,S] DD:MM:SS[W,E]. See example below.
-- * *readonly* Marker cannot be deleted by users any more. Hence, assignment cannot be cancelled by removing the marker.
@@ -410,12 +410,12 @@
--
-- A few options can be set by marks. The corresponding keyword is **arty set**. This can be used to define the rearming place and group for a battery.
--
-- To set the rearming place of a group at the marker position type
-- To set the reamring place of a group at the marker position type
-- arty set, battery "Paladin Alpha", rearming place
--
-- Setting the rearming group is independent of the position of the mark. Just create one anywhere on the map and type
-- arty set, battery "Mortar Bravo", rearming group "Ammo Truck M818"
-- Note that the name of the rearming group has to be given in quotation marks and spelt exactly as the group name defined in the mission editor.
-- Note that the name of the rearming group has to be given in quotation marks and spellt exactly as the group name defined in the mission editor.
--
-- ## Transporting
--
@@ -3422,7 +3422,7 @@ function ARTY:onafterMove(Controllable, From, Event, To, move)
-- Set current move.
self.currentMove=move
-- Route group to coordinate.
-- Route group to coodinate.
self:_Move(self.Controllable, move.coord, move.speed, move.onroad)
end
@@ -0,0 +1,961 @@
--- **Functional** - Autolase targets in the field.
--
-- ===
--
-- **AUOTLASE** - Autolase targets in the field.
--
-- ===
--
-- ## Missions:
--
-- ### [Autolase](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/)
--
-- ===
--
-- **Main Features:**
--
-- * Detect and lase contacts automatically
-- * Targets are lased by threat priority order
-- * Use FSM events to link functionality into your scripts
-- * Easy setup
--
-- ===
--
--- Spot on!
--
-- ===
--
-- # 1 Autolase concept
--
-- * Detect and lase contacts automatically
-- * Targets are lased by threat priority order
-- * Use FSM events to link functionality into your scripts
-- * Set laser codes and smoke colors per Recce unit
-- * Easy set-up
--
-- # 2 Basic usage
--
-- ## 2.2 Set up a group of Recce Units:
--
-- local FoxSet = SET_GROUP:New():FilterPrefixes("Recce"):FilterCoalitions("blue"):FilterStart()
--
-- ## 2.3 (Optional) Set up a group of pilots, this will drive who sees the F10 menu entry:
--
-- local Pilotset = SET_CLIENT:New():FilterCoalitions("blue"):FilterActive(true):FilterStart()
--
-- ## 2.4 Set up and start Autolase:
--
-- local autolaser = AUTOLASE:New(FoxSet,coalition.side.BLUE,"Wolfpack",Pilotset)
--
-- ## 2.5 Example - Using a fixed laser code and color for a specific Recce unit:
--
-- local recce = SPAWN:New("Reaper")
-- :InitDelayOff()
-- :OnSpawnGroup(
-- function (group)
-- local unit = group:GetUnit(1)
-- local name = unit:GetName()
-- autolaser:SetRecceLaserCode(name,1688)
-- autolaser:SetRecceSmokeColor(name,SMOKECOLOR.Red)
-- end
-- )
-- :InitCleanUp(60)
-- :InitLimit(1,0)
-- :SpawnScheduled(30,0.5)
--
-- ## 2.6 Example - Inform pilots about events:
--
-- autolaser:SetNotifyPilots(true) -- defaults to true, also shown if debug == true
-- -- Note - message are shown to pilots in the #SET_CLIENT only if using the pilotset option, else to the coalition.
--
--
-- ### Author: **applevangelist**
-- @module Functional.Autolase
-- @image Designation.JPG
--
-- Date: 24 Oct 2021
--
--- Class AUTOLASE
-- @type AUTOLASE
-- @field #string ClassName
-- @field #string lid
-- @field #number verbose
-- @field #string alias
-- @field #boolean debug
-- @field #string version
-- @extends Ops.Intel#INTEL
---
-- @field #AUTOLASE
AUTOLASE = {
ClassName = "AUTOLASE",
lid = "",
verbose = 0,
alias = "",
debug = false,
}
--- Laser spot info
-- @type AUTOLASE.LaserSpot
-- @field Core.Spot#SPOT laserspot
-- @field Wrapper.Unit#UNIT lasedunit
-- @field Wrapper.Unit#UNIT lasingunit
-- @field #number lasercode
-- @field #string location
-- @field #number timestamp
-- @field #string unitname
-- @field #string reccename
-- @field #string unittype
--- AUTOLASE class version.
-- @field #string version
AUTOLASE.version = "0.0.11"
-------------------------------------------------------------------
-- Begin Functional.Autolase.lua
-------------------------------------------------------------------
--- Constructor for a new Autolase instance.
-- @param #AUTOLASE self
-- @param Core.Set#SET_GROUP RecceSet Set of detecting and lasing units
-- @param #number Coalition Coalition side. Can also be passed as a string "red", "blue" or "neutral".
-- @param #string Alias (Optional) An alias how this object is called in the logs etc.
-- @param Core.Set#SET_CLIENT PilotSet (Optional) Set of clients for precision bombing, steering menu creation. Leave nil for a coalition-wide F10 entry and display.
-- @return #AUTOLASE self
function AUTOLASE:New(RecceSet, Coalition, Alias, PilotSet)
BASE:T({RecceSet, Coalition, Alias, PilotSet})
-- Inherit everything from BASE class.
local self=BASE:Inherit(self, BASE:New()) -- #AUTOLASE
if Coalition and type(Coalition)=="string" then
if Coalition=="blue" then
self.coalition=coalition.side.BLUE
elseif Coalition=="red" then
self.coalition=coalition.side.RED
elseif Coalition=="neutral" then
self.coalition=coalition.side.NEUTRAL
else
self:E("ERROR: Unknown coalition in AUTOLASE!")
end
end
-- Set alias.
if Alias then
self.alias=tostring(Alias)
else
self.alias="Lion"
if self.coalition then
if self.coalition==coalition.side.RED then
self.alias="Wolf"
elseif self.coalition==coalition.side.BLUE then
self.alias="Fox"
end
end
end
-- inherit from INTEL
local self=BASE:Inherit(self, INTEL:New(RecceSet, Coalition, Alias)) -- #AUTOLASE
self.RecceSet = RecceSet
self.DetectVisual = true
self.DetectOptical = true
self.DetectRadar = true
self.DetectIRST = true
self.DetectRWR = true
self.DetectDLINK = true
self.LaserCodes = UTILS.GenerateLaserCodes()
self.LaseDistance = 5000
self.LaseDuration = 300
self.GroupsByThreat = {}
self.UnitsByThreat = {}
self.RecceNames = {}
self.RecceLaserCode = {}
self.RecceSmokeColor = {}
self.RecceUnitNames= {}
self.maxlasing = 4
self.CurrentLasing = {}
self.lasingindex = 0
self.deadunitnotes = {}
self.usepilotset = false
self.reporttimeshort = 10
self.reporttimelong = 30
self.smoketargets = false
self.smokecolor = SMOKECOLOR.Red
self.notifypilots = true
self.targetsperrecce = {}
self.RecceUnits = {}
self.forcecooldown = true
self.cooldowntime = 60
self.useSRS = false
self.SRSPath = ""
self.SRSFreq = 251
self.SRSMod = radio.modulation.AM
-- Set some string id for output to DCS.log file.
self.lid=string.format("AUTOLASE %s (%s) | ", self.alias, self.coalition and UTILS.GetCoalitionName(self.coalition) or "unknown")
-- Add FSM transitions.
-- From State --> Event --> To State
self:AddTransition("*", "Monitor", "*") -- Start FSM
self:AddTransition("*", "Lasing", "*") -- Lasing target
self:AddTransition("*", "TargetLost", "*") -- Lost target
self:AddTransition("*", "TargetDestroyed", "*") -- Target destroyed
self:AddTransition("*", "RecceKIA", "*") -- Recce KIA
self:AddTransition("*", "LaserTimeout", "*") -- Laser timed out
self:AddTransition("*", "Cancel", "*") -- Stop Autolase
-- Menu Entry
if not PilotSet then
self.Menu = MENU_COALITION_COMMAND:New(self.coalition,"Autolase",nil,self.ShowStatus,self)
else
self.usepilotset = true
self.pilotset = PilotSet
self:HandleEvent(EVENTS.PlayerEnterAircraft)
self:SetPilotMenu()
end
self:SetClusterAnalysis(false, false)
self:__Start(2)
self:__Monitor(math.random(5,10))
return self
------------------------
--- Pseudo Functions ---
------------------------
--- Triggers the FSM event "Monitor".
-- @function [parent=#AUTOLASE] Status
-- @param #AUTOLASE self
--- Triggers the FSM event "Monitor" after a delay.
-- @function [parent=#AUTOLASE] __Status
-- @param #AUTOLASE self
-- @param #number delay Delay in seconds.
--- Triggers the FSM event "Cancel".
-- @function [parent=#AUTOLASE] Cancel
-- @param #AUTOLASE self
--- Triggers the FSM event "Cancel" after a delay.
-- @function [parent=#AUTOLASE] __Cancel
-- @param #AUTOLASE self
-- @param #number delay Delay in seconds.
--- On After "RecceKIA" event.
-- @function [parent=#AUTOLASE] OnAfterRecceKIA
-- @param #AUTOLASE self
-- @param #string From The from state
-- @param #string Event The event
-- @param #string To The to state
-- @param #string RecceName The lost Recce
--- On After "TargetDestroyed" event.
-- @function [parent=#AUTOLASE] OnAfterTargetDestroyed
-- @param #AUTOLASE self
-- @param #string From The from state
-- @param #string Event The event
-- @param #string To The to state
-- @param #string UnitName The destroyed unit\'s name
-- @param #string RecceName The Recce name lasing
--- On After "TargetLost" event.
-- @function [parent=#AUTOLASE] OnAfterTargetLost
-- @param #AUTOLASE self
-- @param #string From The from state
-- @param #string Event The event
-- @param #string To The to state
-- @param #string UnitName The lost unit\'s name
-- @param #string RecceName The Recce name lasing
--- On After "LaserTimeout" event.
-- @function [parent=#AUTOLASE] OnAfterLaserTimeout
-- @param #AUTOLASE self
-- @param #string From The from state
-- @param #string Event The event
-- @param #string To The to state
-- @param #string UnitName The lost unit\'s name
-- @param #string RecceName The Recce name lasing
--- On After "Lasing" event.
-- @function [parent=#AUTOLASE] OnAfterLasing
-- @param #AUTOLASE self
-- @param #string From The from state
-- @param #string Event The event
-- @param #string To The to state
-- @param Functional.Autolase#AUTOLASE.LaserSpot LaserSpot The LaserSpot data table
end
-------------------------------------------------------------------
-- Helper Functions
-------------------------------------------------------------------
--- (Internal) Function to set pilot menu.
-- @param #AUTOLASE self
-- @return #AUTOLASE self
function AUTOLASE:SetPilotMenu()
if self.usepilotset then
local pilottable = self.pilotset:GetSetObjects() or {}
for _,_unit in pairs (pilottable) do
local Unit = _unit -- Wrapper.Unit#UNIT
if Unit and Unit:IsAlive() then
local Group = Unit:GetGroup()
local lasemenu = MENU_GROUP_COMMAND:New(Group,"Autolase Status",nil,self.ShowStatus,self,Group)
lasemenu:Refresh()
end
end
end
return self
end
--- (Internal) Event function for new pilots.
-- @param #AUTOLASE self
-- @param Core.Event#EVENTDATA EventData
-- @return #AUTOLASE self
function AUTOLASE:OnEventPlayerEnterAircraft(EventData)
self:SetPilotMenu()
return self
end
--- (Internal) Function to get a laser code by recce name
-- @param #AUTOLASE self
-- @param #string RecceName Unit(!) name of the Recce
-- @return #AUTOLASE self
function AUTOLASE:GetLaserCode(RecceName)
local code = 1688
if self.RecceLaserCode[RecceName] == nil then
code = self.LaserCodes[math.random(#self.LaserCodes)]
self.RecceLaserCode[RecceName] = code
else
code = self.RecceLaserCode[RecceName]
end
return code
end
--- (Internal) Function to get a smoke color by recce name
-- @param #AUTOLASE self
-- @param #string RecceName Unit(!) name of the Recce
-- @return #AUTOLASE self
function AUTOLASE:GetSmokeColor(RecceName)
local color = self.smokecolor
if self.RecceSmokeColor[RecceName] == nil then
self.RecceSmokeColor[RecceName] = color
else
color = self.RecceSmokeColor[RecceName]
end
return color
end
--- (User) Function enable sending messages via SRS.
-- @param #AUTOLASE self
-- @param #boolean OnOff Switch usage on and off
-- @param #string Path Path to SRS directory, e.g. C:\\Program Files\\DCS-SimpleRadio-Standalon
-- @param #number Frequency Frequency to send, e.g. 243
-- @param #number Modulation Modulation i.e. radio.modulation.AM or radio.modulation.FM
-- @return #AUTOLASE self
function AUTOLASE:SetUsingSRS(OnOff,Path,Frequency,Modulation)
self.useSRS = OnOff or true
self.SRSPath = Path or "E:\\Program Files\\DCS-SimpleRadio-Standalone"
self.SRSFreq = Frequency or 271
self.SRSMod = Modulation or radio.modulation.AM
return self
end
--- (User) Function set max lasing targets
-- @param #AUTOLASE self
-- @param #number Number Max number of targets to lase at once
-- @return #AUTOLASE self
function AUTOLASE:SetMaxLasingTargets(Number)
self.maxlasing = Number or 4
return self
end
--- (Internal) Function set notify pilots on events
-- @param #AUTOLASE self
-- @param #boolean OnOff Switch messaging on (true) or off (false)
-- @return #AUTOLASE self
function AUTOLASE:SetNotifyPilots(OnOff)
self.notifypilots = OnOff and true
return self
end
--- (User) Function to set a specific code to a Recce.
-- @param #AUTOLASE self
-- @param #string RecceName (Unit!) Name of the Recce
-- @param #number Code The lase code
-- @return #AUTOLASE self
function AUTOLASE:SetRecceLaserCode(RecceName, Code)
local code = Code or 1688
self.RecceLaserCode[RecceName] = code
return self
end
--- (User) Function to set a specific smoke color for a Recce.
-- @param #AUTOLASE self
-- @param #string RecceName (Unit!) Name of the Recce
-- @param #number Color The color, e.g. SMOKECOLOR.Red, SMOKECOLOR.Green etc
-- @return #AUTOLASE self
function AUTOLASE:SetRecceSmokeColor(RecceName, Color)
local color = Color or self.smokecolor
self.RecceSmokeColor[RecceName] = color
return self
end
--- (User) Function to force laser cooldown and cool down time
-- @param #AUTOLASE self
-- @param #boolean OnOff Switch cool down on (true) or off (false) - defaults to true
-- @param #number Seconds Number of seconds for cooldown - dafaults to 60 seconds
-- @return #AUTOLASE self
function AUTOLASE:SetLaserCoolDown(OnOff, Seconds)
self.forcecooldown = OnOff and true
self.cooldowntime = Seconds or 60
return self
end
--- (User) Function to set message show times.
-- @param #AUTOLASE self
-- @param #number long Longer show time
-- @param #number short Shorter show time
-- @return #AUTOLASE self
function AUTOLASE:SetReportingTimes(long, short)
self.reporttimeshort = short or 10
self.reporttimelong = long or 30
return self
end
--- (User) Function to set lasing distance in meters and duration in seconds
-- @param #AUTOLASE self
-- @param #number Distance (Max) distance for lasing in meters - default 5000 meters
-- @param #number Duration (Max) duration for lasing in seconds - default 300 secs
-- @return #AUTOLASE self
function AUTOLASE:SetLasingParameters(Distance, Duration)
self.LaseDistance = Distance or 5000
self.LaseDuration = Duration or 300
return self
end
--- (User) Function to set smoking of targets.
-- @param #AUTOLASE self
-- @param #boolean OnOff Switch smoking on or off
-- @param #number Color Smokecolor, e.g. SMOKECOLOR.Red
-- @return #AUTOLASE self
function AUTOLASE:SetSmokeTargets(OnOff,Color)
self.smoketargets = OnOff
self.smokecolor = Color or SMOKECOLOR.Red
return self
end
--- (Internal) Function to calculate line of sight.
-- @param #AUTOLASE self
-- @param Wrapper.Unit#UNIT Unit
-- @return #number LOS Line of sight in meters
function AUTOLASE:GetLosFromUnit(Unit)
local lasedistance = self.LaseDistance
local unitheight = Unit:GetHeight()
local coord = Unit:GetCoordinate()
local landheight = coord:GetLandHeight()
local asl = unitheight - landheight
if asl > 100 then
local absquare = lasedistance^2+asl^2
lasedistance = math.sqrt(absquare)
end
return lasedistance
end
--- (Internal) Function to check on lased targets.
-- @param #AUTOLASE self
-- @return #AUTOLASE self
function AUTOLASE:CleanCurrentLasing()
local lasingtable = self.CurrentLasing
local newtable = {}
local newreccecount = {}
local lasing = 0
for _ind,_entry in pairs(lasingtable) do
local entry = _entry -- #AUTOLASE.LaserSpot
if not newreccecount[entry.reccename] then
newreccecount[entry.reccename] = 0
end
end
for _,_recce in pairs (self.RecceSet:GetSetObjects()) do
local recce = _recce --Wrapper.Group#GROUP
if recce and recce:IsAlive() then
local unit = recce:GetUnit(1)
local name = unit:GetName()
if not self.RecceUnits[name] then
self.RecceUnits[name] = { name=name, unit=unit, cooldown = false, timestamp = timer.getAbsTime() }
end
end
end
for _ind,_entry in pairs(lasingtable) do
local entry = _entry -- #AUTOLASE.LaserSpot
local valid = 0
local reccedead = false
local unitdead = false
local lostsight = false
local timeout = false
local Tnow = timer.getAbsTime()
-- check recce dead
local recce = entry.lasingunit
if recce and recce:IsAlive() then
valid = valid + 1
else
reccedead = true
self:__RecceKIA(2,entry.reccename)
end
-- check entry dead
local unit = entry.lasedunit
if unit and unit:IsAlive() == true then
valid = valid + 1
else
unitdead = true
if not self.deadunitnotes[entry.unitname] then
self.deadunitnotes[entry.unitname] = true
self:__TargetDestroyed(2,entry.unitname,entry.reccename)
end
end
-- check entry out of sight
if not reccedead and not unitdead then
if self:CanLase(recce,unit) then
valid = valid + 1
else
lostsight = true
entry.laserspot:LaseOff()
self:__TargetLost(2,entry.unitname,entry.reccename)
end
end
-- check timed out
local timestamp = entry.timestamp
if Tnow - timestamp < self.LaseDuration and not lostsight then
valid = valid + 1
else
timeout = true
entry.laserspot:LaseOff()
self.RecceUnits[entry.reccename].cooldown = true
self.RecceUnits[entry.reccename].timestamp = timer.getAbsTime()
if not lostsight then
self:__LaserTimeout(2,entry.unitname,entry.reccename)
end
end
if valid == 4 then
self.lasingindex = self.lasingindex + 1
newtable[self.lasingindex] = entry
newreccecount[entry.reccename] = newreccecount[entry.reccename] + 1
lasing = lasing + 1
end
end
self.CurrentLasing = newtable
self.targetsperrecce = newreccecount
return lasing
end
--- (Internal) Function to show status.
-- @param #AUTOLASE self
-- @param Wrapper.Group#GROUP Group (Optional) show to a certain group
-- @return #AUTOLASE self
function AUTOLASE:ShowStatus(Group)
local report = REPORT:New("Autolase")
local reccetable = self.RecceSet:GetSetObjects()
for _,_recce in pairs(reccetable) do
if _recce and _recce:IsAlive() then
local unit = _recce:GetUnit(1)
local name = unit:GetName()
local code = self:GetLaserCode(name)
report:Add(string.format("Recce %s has code %d",name,code))
end
end
local lines = 0
for _ind,_entry in pairs(self.CurrentLasing) do
local entry = _entry -- #AUTOLASE.LaserSpot
local reccename = entry.reccename
local typename = entry.unittype
local code = entry.lasercode
local locationstring = entry.location
local text = string.format("%s lasing %s code %d\nat %s",reccename,typename,code,locationstring)
report:Add(text)
lines = lines + 1
end
if lines == 0 then
report:Add("No targets!")
end
local reporttime = self.reporttimelong
if lines == 0 then reporttime = self.reporttimeshort end
if Group and Group:IsAlive() then
local m = MESSAGE:New(report:Text(),reporttime,"Info"):ToGroup(Group)
else
local m = MESSAGE:New(report:Text(),reporttime,"Info"):ToCoalition(self.coalition)
end
return self
end
--- (Internal) Function to show messages.
-- @param #AUTOLASE self
-- @param #string Message The message to be sent
-- @param #number Duration Duration in seconds
-- @return #AUTOLASE self
function AUTOLASE:NotifyPilots(Message,Duration)
if self.usepilotset then
local pilotset = self.pilotset:GetSetObjects() --#table
for _,_pilot in pairs(pilotset) do
local pilot = _pilot -- Wrapper.Unit#UNIT
if pilot and pilot:IsAlive() then
local Group = pilot:GetGroup()
local m = MESSAGE:New(Message,Duration,"Autolase"):ToGroup(Group)
end
end
elseif not self.debug then
local m = MESSAGE:New(Message,Duration,"Autolase"):ToCoalition(self.coalition)
else
local m = MESSAGE:New(Message,Duration,"Autolase"):ToAll()
end
if self.debug then self:I(Message) end
return self
end
--- (User) Send messages via SRS.
-- @param #AUTOLASE self
-- @param #string Message The (short!) message to be sent, e.g. "Lasing target!"
-- @return #AUTOLASE self
-- @usage Step 1 - set up the radio basics **once** with
-- my_autolase:SetUsingSRS(true,"C:\\path\\SRS-Folder",251,radio.modulation.AM)
-- Step 2 - send a message, e.g.
-- function my_autolase:OnAfterLasing(From, Event, To, LaserSpot)
-- my_autolase:NotifyPilotsWithSRS("Reaper lasing new target!")
-- end
function AUTOLASE:NotifyPilotsWithSRS(Message)
if self.useSRS then
-- Create a SOUNDTEXT object.
if self.debug then
BASE:TraceOn()
BASE:TraceClass("SOUNDTEXT")
BASE:TraceClass("MSRS")
end
local path = self.SRSPath or "C:\\Program Files\\DCS-SimpleRadio-Standalone"
local freq = self.SRSFreq or 271
local mod = self.SRSMod or radio.modulation.AM
local text=SOUNDTEXT:New(Message)
-- MOOSE SRS
local msrs=MSRS:New(path, freq, mod)
-- Text-to speech with default voice after 2 seconds.
msrs:PlaySoundText(text, 2)
end
if self.debug then self:I(Message) end
return self
end
--- (Internal) Function to check if a unit is already lased.
-- @param #AUTOLASE self
-- @param #string unitname Name of the unit to check
-- @return #boolean outcome True or false
function AUTOLASE:CheckIsLased(unitname)
local outcome = false
for _,_laserspot in pairs(self.CurrentLasing) do
local spot = _laserspot -- #AUTOLASE.LaserSpot
if spot.unitname == unitname then
outcome = true
break
end
end
return outcome
end
--- (Internal) Function to check if a unit can be lased.
-- @param #AUTOLASE self
-- @param Wrapper.Unit#UNIT Recce The Recce #UNIT
-- @param Wrapper.Unit#UNIT Unit The lased #UNIT
-- @return #boolean outcome True or false
function AUTOLASE:CanLase(Recce,Unit)
local canlase = false
-- cooldown?
if Recce and Recce:IsAlive() == true then
local name = Recce:GetName()
local cooldown = self.RecceUnits[name].cooldown and self.forcecooldown
if cooldown then
local Tdiff = timer.getAbsTime() - self.RecceUnits[name].timestamp
if Tdiff < self.cooldowntime then
return false
else
self.RecceUnits[name].cooldown = false
end
end
-- calculate LOS
local reccecoord = Recce:GetCoordinate()
local unitcoord = Unit:GetCoordinate()
local islos = reccecoord:IsLOS(unitcoord,2.5)
-- calculate distance
local distance = math.floor(reccecoord:Get3DDistance(unitcoord))
local lasedistance = self:GetLosFromUnit(Recce)
if distance <= lasedistance and islos then
canlase = true
end
end
return canlase
end
-------------------------------------------------------------------
-- FSM Functions
-------------------------------------------------------------------
--- (Internal) FSM Function for monitoring
-- @param #AUTOLASE self
-- @param #string From The from state
-- @param #string Event The event
-- @param #string To The to state
-- @return #AUTOLASE self
function AUTOLASE:onbeforeMonitor(From, Event, To)
self:T({From, Event, To})
-- Check if group has detected any units.
self:UpdateIntel()
return self
end
--- (Internal) FSM Function for monitoring
-- @param #AUTOLASE self
-- @param #string From The from state
-- @param #string Event The event
-- @param #string To The to state
-- @return #AUTOLASE self
function AUTOLASE:onafterMonitor(From, Event, To)
self:T({From, Event, To})
-- Housekeeping
local countlases = self:CleanCurrentLasing()
self:SetPilotMenu()
local detecteditems = self.Contacts or {} -- #table of Ops.Intelligence#INTEL.Contact
local groupsbythreat = {}
local report = REPORT:New("Detections")
local lines = 0
for _,_contact in pairs(detecteditems) do
local contact = _contact -- Ops.Intelligence#INTEL.Contact
local grp = contact.group
local coord = contact.position
local reccename = contact.recce or "none"
local reccegrp = UNIT:FindByName(reccename)
if reccegrp then
local reccecoord = reccegrp:GetCoordinate()
local distance = math.floor(reccecoord:Get3DDistance(coord))
local text = string.format("%s of %s | Distance %d km | Threatlevel %d",contact.attribute, contact.groupname, math.floor(distance/1000), contact.threatlevel)
report:Add(text)
self:T(text)
if self.debug then self:I(text) end
lines = lines + 1
-- sort out groups beyond sight
local lasedistance = self:GetLosFromUnit(reccegrp)
if grp:IsGround() and lasedistance >= distance then
table.insert(groupsbythreat,{contact.group,contact.threatlevel})
self.RecceNames[contact.groupname] = contact.recce
end
end
end
self.GroupsByThreat = groupsbythreat
if self.verbose > 2 and lines > 0 then
local m=MESSAGE:New(report:Text(),self.reporttimeshort,"Autolase"):ToAll()
end
table.sort(self.GroupsByThreat, function(a,b)
local aNum = a[2] -- Coin value of a
local bNum = b[2] -- Coin value of b
return aNum > bNum -- Return their comparisons, < for ascending, > for descending
end)
-- build table of Units
local unitsbythreat = {}
for _,_entry in pairs(self.GroupsByThreat) do
local group = _entry[1] -- Wrapper.Group#GROUP
if group and group:IsAlive() then
local units = group:GetUnits()
local reccename = self.RecceNames[group:GetName()]
for _,_unit in pairs(units) do
local unit = _unit -- Wrapper.Unit#UNIT
if unit and unit:IsAlive() then
local threat = unit:GetThreatLevel()
local coord = unit:GetCoordinate()
if threat > 0 then
local unitname = unit:GetName()
table.insert(unitsbythreat,{unit,threat})
self.RecceUnitNames[unitname] = reccename
end
end
end
end
end
self.UnitsByThreat = unitsbythreat
table.sort(self.UnitsByThreat, function(a,b)
local aNum = a[2] -- Coin value of a
local bNum = b[2] -- Coin value of b
return aNum > bNum -- Return their comparisons, < for ascending, > for descending
end)
local unitreport = REPORT:New("Detected Units")
local lines = 0
for _,_entry in pairs(self.UnitsByThreat) do
local threat = _entry[2]
local unit = _entry[1]
local unitname = unit:GetName()
local text = string.format("Unit %s | Threatlevel %d | Detected by %s",unitname,threat,self.RecceUnitNames[unitname])
unitreport:Add(text)
lines = lines + 1
self:T(text)
if self.debug then self:I(text) end
end
if self.verbose > 2 and lines > 0 then
local m=MESSAGE:New(unitreport:Text(),self.reporttimeshort,"Autolase"):ToAll()
end
for _,_detectingunit in pairs(self.RecceUnits) do
local reccename = _detectingunit.name
local recce = _detectingunit.unit
local reccecount = self.targetsperrecce[reccename] or 0
local targets = 0
for _,_entry in pairs(self.UnitsByThreat) do
local unit = _entry[1] -- Wrapper.Unit#UNIT
local unitname = unit:GetName()
local canlase = self:CanLase(recce,unit)
if targets+reccecount < self.maxlasing and not self:CheckIsLased(unitname) and unit:IsAlive() and canlase then
targets = targets + 1
local code = self:GetLaserCode(reccename)
local spot = SPOT:New(recce)
spot:LaseOn(unit,code,self.LaseDuration)
local locationstring = unit:GetCoordinate():ToStringLLDDM()
local laserspot = { -- #AUTOLASE.LaserSpot
laserspot = spot,
lasedunit = unit,
lasingunit = recce,
lasercode = code,
location = locationstring,
timestamp = timer.getAbsTime(),
unitname = unitname,
reccename = reccename,
unittype = unit:GetTypeName(),
}
if self.smoketargets then
local coord = unit:GetCoordinate()
local color = self:GetSmokeColor(reccename)
coord:Smoke(color)
end
self.lasingindex = self.lasingindex + 1
self.CurrentLasing[self.lasingindex] = laserspot
self:__Lasing(2,laserspot)
end
end
end
self:__Monitor(-30)
return self
end
--- (Internal) FSM Function onbeforeRecceKIA
-- @param #AUTOLASE self
-- @param #string From The from state
-- @param #string Event The event
-- @param #string To The to state
-- @param #string RecceName The lost Recce
-- @return #AUTOLASE self
function AUTOLASE:onbeforeRecceKIA(From,Event,To,RecceName)
self:T({From, Event, To, RecceName})
if self.notifypilots or self.debug then
local text = string.format("Recce %s KIA!",RecceName)
self:NotifyPilots(text,self.reporttimeshort)
end
return self
end
--- (Internal) FSM Function onbeforeTargetDestroyed
-- @param #AUTOLASE self
-- @param #string From The from state
-- @param #string Event The event
-- @param #string To The to state
-- @param #string UnitName The destroyed unit\'s name
-- @param #string RecceName The Recce name lasing
-- @return #AUTOLASE self
function AUTOLASE:onbeforeTargetDestroyed(From,Event,To,UnitName,RecceName)
self:T({From, Event, To, UnitName, RecceName})
if self.notifypilots or self.debug then
local text = string.format("Unit %s destroyed! Good job!",UnitName)
self:NotifyPilots(text,self.reporttimeshort)
end
return self
end
--- (Internal) FSM Function onbeforeTargetLost
-- @param #AUTOLASE self
-- @param #string From The from state
-- @param #string Event The event
-- @param #string To The to state
-- @param #string UnitName The lost unit\'s name
-- @param #string RecceName The Recce name lasing
-- @return #AUTOLASE self
function AUTOLASE:onbeforeTargetLost(From,Event,To,UnitName,RecceName)
self:T({From, Event, To, UnitName,RecceName})
if self.notifypilots or self.debug then
local text = string.format("%s lost sight of unit %s.",RecceName,UnitName)
self:NotifyPilots(text,self.reporttimeshort)
end
return self
end
--- (Internal) FSM Function onbeforeLaserTimeout
-- @param #AUTOLASE self
-- @param #string From The from state
-- @param #string Event The event
-- @param #string To The to state
-- @param #string UnitName The lost unit\'s name
-- @param #string RecceName The Recce name lasing
-- @return #AUTOLASE self
function AUTOLASE:onbeforeLaserTimeout(From,Event,To,UnitName,RecceName)
self:T({From, Event, To, UnitName,RecceName})
if self.notifypilots or self.debug then
local text = string.format("%s laser timeout on unit %s.",RecceName,UnitName)
self:NotifyPilots(text,self.reporttimeshort)
end
return self
end
--- (Internal) FSM Function onbeforeLasing
-- @param #AUTOLASE self
-- @param #string From The from state
-- @param #string Event The event
-- @param #string To The to state
-- @param Functional.Autolase#AUTOLASE.LaserSpot LaserSpot The LaserSpot data table
-- @return #AUTOLASE self
function AUTOLASE:onbeforeLasing(From,Event,To,LaserSpot)
self:T({From, Event, To, LaserSpot.unittype})
if self.notifypilots or self.debug then
local laserspot = LaserSpot -- #AUTOLASE.LaserSpot
local text = string.format("%s is lasing %s code %d\nat %s",laserspot.reccename,laserspot.unittype,laserspot.lasercode,laserspot.location)
self:NotifyPilots(text,self.reporttimeshort+5)
end
return self
end
--- (Internal) FSM Function onbeforeCancel
-- @param #AUTOLASE self
-- @param #string From The from state
-- @param #string Event The event
-- @param #string To The to state
-- @return #AUTOLASE self
function AUTOLASE:onbeforeCancel(From,Event,To)
self:UnHandleEvent(EVENTS.PlayerEnterAircraft)
self:__Stop(2)
return self
end
-------------------------------------------------------------------
-- End Functional.Autolase.lua
-------------------------------------------------------------------
@@ -1,4 +1,4 @@
--- **Functional** - Keep airbases clean of crashing or colliding airplanes, and kill missiles when being fired at airbases.
--- **Functional** -- Keep airbases clean of crashing or colliding airplanes, and kill missiles when being fired at airbases.
--
-- ===
--
@@ -1,4 +1,4 @@
--- **Functional** - Management of target **Designation**. Lase, smoke and illuminate targets.
--- **Functional** -- Management of target **Designation**. Lase, smoke and illuminate targets.
--
-- ===
--
@@ -48,7 +48,7 @@
--
-- ![Banner Image](..\Presentations\DESIGNATE\Dia3.JPG)
--
-- A typical mission setup would require Recce (a @{Core.Set} of Recce) to be detecting potential targets.
-- A typical mission setup would require Recce (a @{Set} of Recce) to be detecting potential targets.
-- The DetectionObject will group the detected targets based on the detection method being used.
-- Possible detection methods could be by Area, by Type or by Unit.
-- Each grouping will result in a **TargetGroup**, for terminology and clarity we will use this term throughout the document.
@@ -213,7 +213,7 @@ do -- DESIGNATE
-- In order to prevent an overflow of designations due to many Detected Targets, there is a
-- Maximum Designations scope that is set in the DesignationObject.
--
-- The method @{#DESIGNATE.SetMaximumDesignations}() will put a limit on the amount of designations (target groups) put in scope of the DesignationObject.
-- The method @{#DESIGNATE.SetMaximumDesignations}() will put a limit on the amount of designations put in scope of the DesignationObject.
-- Using the menu system, the player can "forget" a designation, so that gradually a new designation can be put in scope when detected.
--
-- # 4. Laser codes
@@ -276,7 +276,7 @@ do -- DESIGNATE
-- # 7. Designate Menu Location for a Mission
--
-- You can make DESIGNATE work for a @{Tasking.Mission#MISSION} object. In this way, the designate menu will not appear in the root of the radio menu, but in the menu of the Mission.
-- Use the method @{#DESIGNATE.SetMission}() to set the @{Tasking.Mission} object for the designate function.
-- Use the method @{#DESIGNATE.SetMission}() to set the @{Mission} object for the designate function.
--
-- # 8. Status Report
--
@@ -562,8 +562,7 @@ do -- DESIGNATE
end
--- Set the maximum amount of designations (target groups). This will put a limit on the amount of designations in scope.
-- Using the menu system, the player can "forget" a designation, so that gradually a new designation can be put in scope when detected.
--- Set the maximum amount of designations.
-- @param #DESIGNATE self
-- @param #number MaximumDesignations
-- @return #DESIGNATE
@@ -603,7 +602,7 @@ do -- DESIGNATE
end
--- Set the maximum amount of markings FACs will do, per designated target group. This will limit the number of parallelly marked units of a target group.
--- Set the maximum amount of markings FACs will do, per designated target group.
-- @param #DESIGNATE self
-- @param #number MaximumMarkings Maximum markings FACs will do, per designated target group.
-- @return #DESIGNATE
@@ -912,8 +911,8 @@ do -- DESIGNATE
for DesignateIndex, Designating in pairs( self.Designating ) do
local DetectedItem = DetectedItems[DesignateIndex]
if DetectedItem then
local Report = self.Detection:DetectedItemReportSummary( DetectedItem, AttackGroup, nil, true ):Text( ", " )
DetectedReport:Add( string.rep( "-", 40 ) )
local Report = self.Detection:DetectedItemReportSummary( DetectedItem, AttackGroup ):Text( ", " )
DetectedReport:Add( string.rep( "-", 140 ) )
DetectedReport:Add( " - " .. Report )
if string.find( Designating, "L" ) then
DetectedReport:Add( " - " .. "Lasing Targets" )
@@ -1193,8 +1192,8 @@ do -- DESIGNATE
local MarkingCount = 0
local MarkedTypes = {}
--local ReportTypes = REPORT:New()
--local ReportLaserCodes = REPORT:New()
local ReportTypes = REPORT:New()
local ReportLaserCodes = REPORT:New()
TargetSetUnit:Flush( self )
@@ -1244,8 +1243,8 @@ do -- DESIGNATE
if not Recce then
self:F( "Lasing..." )
--self.RecceSet:Flush( self)
self.RecceSet:Flush( self)
for RecceGroupID, RecceGroup in pairs( self.RecceSet:GetSet() ) do
for UnitID, UnitData in pairs( RecceGroup:GetUnits() or {} ) do
@@ -1283,13 +1282,13 @@ do -- DESIGNATE
-- OK. We have assigned for the Recce a TargetUnit. We can exit the function.
MarkingCount = MarkingCount + 1
local TargetUnitType = TargetUnit:GetTypeName()
RecceUnit:MessageToSetGroup( "Marking " .. TargetUnit:GetTypeName() .. " with laser " .. RecceUnit:GetSpot().LaserCode .. " for " .. Duration .. "s.",
10, self.AttackSet, DesignateName )
--RecceUnit:MessageToSetGroup( "Marking " .. TargetUnit:GetTypeName() .. " with laser " .. RecceUnit:GetSpot().LaserCode .. " for " .. Duration .. "s.",
-- 5, self.AttackSet, DesignateName )
if not MarkedTypes[TargetUnitType] then
MarkedTypes[TargetUnitType] = true
--ReportTypes:Add(TargetUnitType)
ReportTypes:Add(TargetUnitType)
end
--ReportLaserCodes:Add(RecceUnit.LaserCode)
ReportLaserCodes:Add(RecceUnit.LaserCode)
return
end
else
@@ -1304,16 +1303,16 @@ do -- DESIGNATE
if Recce then
Recce:LaseOff()
Recce:MessageToSetGroup( "Target " .. TargetUnit:GetTypeName() "out of LOS. Cancelling lase!", 10, self.AttackSet, self.DesignateName )
Recce:MessageToSetGroup( "Target " .. TargetUnit:GetTypeName() "out of LOS. Cancelling lase!", 5, self.AttackSet, self.DesignateName )
end
else
--MarkingCount = MarkingCount + 1
local TargetUnitType = TargetUnit:GetTypeName()
if not MarkedTypes[TargetUnitType] then
MarkedTypes[TargetUnitType] = true
--ReportTypes:Add(TargetUnitType)
ReportTypes:Add(TargetUnitType)
end
--ReportLaserCodes:Add(RecceUnit.LaserCode)
ReportLaserCodes:Add(RecceUnit.LaserCode)
end
end
end
@@ -1323,19 +1322,19 @@ do -- DESIGNATE
local TargetUnitType = TargetUnit:GetTypeName()
if not MarkedTypes[TargetUnitType] then
MarkedTypes[TargetUnitType] = true
--ReportTypes:Add(TargetUnitType)
ReportTypes:Add(TargetUnitType)
end
--ReportLaserCodes:Add(Recce.LaserCode)
Recce:MessageToSetGroup( self.DesignateName .. ": Marking " .. TargetUnit:GetTypeName() .. " with laser " .. Recce.LaserCode .. ".", 10, self.AttackSet )
ReportLaserCodes:Add(Recce.LaserCode)
--Recce:MessageToSetGroup( self.DesignateName .. ": Marking " .. TargetUnit:GetTypeName() .. " with laser " .. Recce.LaserCode .. ".", 5, self.AttackSet )
end
end
end
end
)
--local MarkedTypesText = ReportTypes:Text(', ')
--local MarkedLaserCodesText = ReportLaserCodes:Text(', ')
--self.CC:GetPositionable():MessageToSetGroup( "Marking " .. MarkingCount .. " x " .. MarkedTypesText .. ", code " .. MarkedLaserCodesText .. ".", 5, self.AttackSet, self.DesignateName )
local MarkedTypesText = ReportTypes:Text(', ')
local MarkedLaserCodesText = ReportLaserCodes:Text(', ')
self.CC:GetPositionable():MessageToSetGroup( "Marking " .. MarkingCount .. " x " .. MarkedTypesText .. ", code " .. MarkedLaserCodesText .. ".", 5, self.AttackSet, self.DesignateName )
self:__Lasing( -self.LaseDuration, Index, Duration, LaserCodeRequested )
File diff suppressed because it is too large Load Diff
@@ -1,12 +1,8 @@
--- **Functional** - Captures the class DETECTION_ZONES.
-- @module Functional.DetectionZones
-- @image MOOSE.JPG
do -- DETECTION_ZONES
--- @type DETECTION_ZONES
-- @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, @{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
--- (old, to be revised ) Detect units within the battle zone for a list of @{Core.Zone}s detecting targets following (a) detection method(s),
@@ -44,27 +40,27 @@ do -- DETECTION_ZONES
ClassName = "DETECTION_ZONES",
DetectionZoneRange = nil,
}
--- DETECTION_ZONES constructor.
-- @param #DETECTION_ZONES self
-- @param Core.Set#SET_ZONE DetectionSetZone The @{Core.Set} of ZONE_RADIUS.
-- @param Core.Set#SET_ZONE DetectionSetZone The @{Set} of ZONE_RADIUS.
-- @param DCS#Coalition.side DetectionCoalition The coalition of the detection.
-- @return #DETECTION_ZONES
function DETECTION_ZONES:New( DetectionSetZone, DetectionCoalition )
-- Inherits from DETECTION_BASE
local self = BASE:Inherit( self, DETECTION_BASE:New( DetectionSetZone ) ) -- #DETECTION_ZONES
self.DetectionSetZone = DetectionSetZone -- Core.Set#SET_ZONE
self.DetectionCoalition = DetectionCoalition
self._SmokeDetectedUnits = false
self._FlareDetectedUnits = false
self._SmokeDetectedZones = false
self._FlareDetectedZones = false
self._BoundDetectedZones = false
return self
end
@@ -1,4 +1,4 @@
--- **Functional** - Taking the lead of AI escorting your flight.
--- **Functional** -- Taking the lead of AI escorting your flight.
--
-- ===
--
@@ -0,0 +1,730 @@
--- **Functional** - (R2.5) - Monitor and export flight model data.
--
-- Record flight data and export it to a csv file.
--
-- ## Recorded Data:
--
-- * Time,
-- * Altitude,
-- * Temperature,
-- * Pressure,
-- * Velocity (total and x,y,z components),
-- * Acceleration (total and x,y,z components),
-- * AoA,
-- * Pitch and pitch rate,
-- * Roll and roll rate,
-- * Yaw and yaw rate,
-- * Turn rate.
--
-- ===
--
-- ### Author: **funkyfranky**
-- @module Functional.FMData
-- @image Functional_Rat2.png
--- FMD class.
-- @type FMD
-- @field #string ClassName Name of the class.
-- @field #boolean Debug Debug mode. Messages to all about status.
-- @field #string lid Class id string for output to DCS log file.
-- @field #table players Player table.
-- @field #table menuadded Table of units where the F10 radio menu was added.
-- @field #string savepath Path to save data files.
-- @extends Core.Fsm#FSM
--- Be sure!
--
-- ===
--
-- ![Banner Image](..\Presentations\FMD\FMD_Main.png)
--
-- # The FMD Concept
--
-- This class can be used to record flight data such as velocity, acceleration, pitch, roll, yaw and turn rates. The output is written to a csv file for later analysis.
--
-- # Usage
--
-- The script is very easy to use. It only requires the line
--
-- fmd=FMD:New()
--
-- This will automatically start the FMD script.
--
-- Each player will get an entry "FMD" in the F-10 radio menu. There he can start or stop the data recording.
--
-- **IMPORTANT**
-- Due to a DCS bug, it is necessary that (in single player mode), player/clients have to **hit ESC twice** before entering an aircraft client slot.
-- Otherwise, the script will not load and now menus will be created for the player.
--
-- # Output
--
-- After the data recording is completed, the data is written to a csv file. The file name starts with **FMD** and contains the employed airframe plus a running number.
--
-- However, one must desanitize the **io** and **lfs** lines the DCS root directory. Otherwise, DCS will not allow data to be written to file.
--
-- @field #FMD
FMD = {
ClassName = "FMD",
Debug = false,
lid = nil,
players = {},
menuadded = {},
savepath = nil,
}
--- Player data table.
-- @type FMD.PlayerData
-- @field Core.Scheduler#SCHEDULER scheduler Scheduler
-- @field Wrapper.Unit#UNIT unit Player unit.
-- @field #string unitname Name of the unit.
-- @field Wrapper.Client#CLIENT client Player client.
-- @field #string actype Aircraft type.
-- @field #string name Player name.
-- @field #number dt Time step for data recording in seconds. Default 0.01 sec ==> 100 data points per second!
-- @field #number rd Recording duration in seconds.
-- @field #boolean recording If true, recording started.
-- @field #table data Data table.
-- @field #number SID Scheduler ID.
--- Data point table.
-- @type FMD.DataPoint
-- @field #number time Abs mission time.
-- @field #number T Temperature in degrees Celsius.
-- @field #number P Pressure.
-- @field #number Alt Altitude ASL in meters.
-- @field #number AoA Angle of Attack in degrees.
-- @field #number Pitch Pitch angle in degrees.
-- @field #number Roll Roll angle in degrees.
-- @field #number Yaw Yaw angle in degrees.
-- @field #number Climbrate Climb rate in m/s.
-- @field #number Vtot Total velocity in m/s.
-- @field DCS#Vec3 v Velocity vector. Components x,y,z in m/s.
-- @field DCS#Vec3 o Orientation vector. Components x,y,z in meters.
-- @field #number omega Angle velocity in m/s.
-- @field #number Hdg Heading in degrees.
-- @field #number Atot Total acceleration m/s^2.
-- @field DCS#Vec3 a Acceleration vector.
-- @field #number DRoll Roll speed in degrees/second.
-- @field #number DPitch Pitch speed in degrees/second.
-- @field #number DYaw Yaw speed in degrees/second.
--- Main group level radio menu: F10 Other/FMD.
-- @field #table MenuF10
FMD.MenuF10={}
--- FMD mission level F10 root menu.
-- @field #table MenuF10Root
FMD.MenuF10Root=nil
--- FMD script version.
-- @field #string version
FMD.version="0.1.0"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Constructor
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Create a new FMD class object.
-- @param #FMD self
-- @return #FMD self.
function FMD:New()
-- Inherit everthing from FSM class.
local self=BASE:Inherit(self, FSM:New()) -- #FMD
-- Start State.
self:SetStartState("Stopped")
-- Log string.
self.lid="FMD | "
-- Add FSM transitions.
-- From State --> Event --> To State
self:AddTransition("Stopped", "Start", "Running") -- Start FMD script.
self:AddTransition("*", "Status", "*") -- Start FMD script.
-- Start FMD.
self:Start()
return self
end
--- On after Start event.
-- @param #FMD self
-- @param #string From From state.
-- @param #string Event Event.
-- @param #string To To state.
function FMD:onafterStart(From, Event, To)
-- Short info.
local text=string.format("Starting Flight Model Data script version %s", FMD.version)
self:I(self.lid..text)
-- Handle events.
self:HandleEvent(EVENTS.Birth)
end
--- On after Stop event.
-- @param #FMD self
-- @param #string From From state.
-- @param #string Event Event.
-- @param #string To To state.
function FMD:onafterStop(From, Event, To)
-- Short info.
local text=string.format("Stopping Flight Model Data script version %s", FMD.version)
self:I(self.lid..text)
-- Handle events.
self:UnHandleEvent(EVENTS.Birth)
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Event Functions
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- FMD event handler for event birth.
-- @param #FMD self
-- @param Core.Event#EVENTDATA EventData
function FMD:OnEventBirth(EventData)
self:F3({eventbirth = EventData})
local _unitName=EventData.IniUnitName
local _unit, _playername=self:_GetPlayerUnitAndName(_unitName)
self:T2(self.lid.."BIRTH: unit = "..tostring(EventData.IniUnitName))
self:T2(self.lid.."BIRTH: group = "..tostring(EventData.IniGroupName))
self:T2(self.lid.."BIRTH: player = "..tostring(_playername))
if _unit and _playername then
local _uid=_unit:GetID()
local _group=_unit:GetGroup()
local _callsign=_unit:GetCallsign()
-- Debug output.
local text=string.format("Pilot %s, callsign %s entered unit %s of group %s.", _playername, _callsign, _unitName, _group:GetName())
self:T(self.lid..text)
MESSAGE:New(text, 5):ToAllIf(self.Debug)
-- Add Menu commands.
self:_AddF10Commands(_unitName)
-- Player data.
self.players[_playername]={}
local player=self.players[_playername] --#FMD.PlayerData
player.scheduler=SCHEDULER:New()
player.unit=_unit
player.unitname=_unitName
player.name=_playername
player.client=CLIENT:FindByName(_unitName, nil, true)
player.actype=_unit:GetTypeName()
player.dt=0.01
player.rd=30
player.recording=false
player.data={}
end
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Data Functions
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Get data of unit.
-- @param #FMD self
-- @param Wrapper.Unit#UNIT unit
-- @return #FMD.DataPoint Datapoint.
function FMD:_GetDataPoint(unit)
if unit and unit:IsAlive() then
-- Current coordinate.
local coord=unit:GetCoordinate()
local dp={} --#FMD.DataPoint
dp.a={}
dp.Alt=coord.y
dp.AoA=unit:GetAoA()
dp.Atot=nil
dp.P=coord:GetPressure()
dp.Pitch=unit:GetPitch()
dp.Roll=unit:GetRoll()
dp.time=timer.getAbsTime()
dp.T=coord:GetTemperature()
dp.v=unit:GetVelocityVec3()
dp.Vtot=UTILS.VecNorm(dp.v)
dp.Yaw=unit:GetYaw()
dp.o=unit:GetOrientationX()
dp.Hdg=unit:GetHeading()
return dp
else
return nil
end
end
--- Get data of unit.
-- @param #FMD self
-- @param #FMD.PlayerData playerData Player data.
-- @return #FMD.DataPoint Datapoint.
function FMD:_Derivative(playerData)
local function numderiv(fpm,fpp,h)
return 0.5*(fpp-fpm)/h
end
local datapoints=playerData.data
--local dt=playerData.dt
for i=2,#datapoints-1 do
local dpm=datapoints[i-1] --#FMD.DataPoint
local dpp=datapoints[i+1] --#FMD.DataPoint
local dpi=datapoints[i] --#FMD.DataPoint
-- Time step.
local dt=0.5*(dpp.time-dpm.time)
dpi.Atot=numderiv(dpm.Vtot, dpp.Vtot, dt)
dpi.a.x=numderiv(dpm.v.x, dpp.v.x, dt)
dpi.a.y=numderiv(dpm.v.y, dpp.v.y, dt)
dpi.a.z=numderiv(dpm.v.z, dpp.v.z, dt)
dpi.DPitch=numderiv(dpm.Pitch, dpp.Pitch, dt)
--dpi.DRoll=numderiv(dpm.Roll, dpp.Roll, dt)
dpi.DYaw=numderiv(dpm.Yaw, dpp.Yaw, dt)
-- Roll shortcuts.
local r1=dpm.Roll
local r2=dpp.Roll
-- Put roll in [0,360)
if (r1<0) then
r1=r1+360
end
if (r2<0) then
r2=r2+360
end
-- Handle case where 360 deg periodicity strikes.
if r1<90 and r2>270 then
r1=r1+360
end
if r1>270 and r2<90 then
r2=r2+360
end
--
dpi.DRoll=numderiv(r1, r2, dt)
local ang=UTILS.VecAngle(dpm.o, dpp.o)
dpi.omega=numderiv(0, ang, dt)
end
end
--- Record data
-- @param #FMD self
-- @param #FMD.PlayerData playerData Player data table.
function FMD:_RecordData(playerData)
-- Check if we are recording already.
if not playerData.recording then
-- Inform player.
local text=string.format("Data recording starts for %.1f sec.", playerData.rd)
MESSAGE:New(text, 3, "FMD"):ToClient(playerData.client)
-- Activate recording switch.
playerData.recording=true
end
-- Check if unit is alive.
if playerData.unit and playerData.unit:IsAlive() then
-- Get data point.
local dp=self:_GetDataPoint(playerData.unit)
-- Add data point to player table.
table.insert(playerData.data, dp)
else
-- Stop recording if player unit is not alive.
self:_StopRecording(playerData.unitname)
end
end
--- Save data.
-- @param #FMD self
-- @param #FMD.PlayerData playerData Player data table.
function FMD:_SaveData(playerData)
-- Nothing to save.
if playerData==nil or #playerData.data==0 or not io then
return
end
--- Function that saves data to file
local function _savefile(filename, data)
local f = assert(io.open(filename, "wb"))
f:write(data)
f:close()
end
-- Set path or default.
local path=self.savepath
if lfs then
path=path or lfs.writedir()
end
-- Create unused file name.
local filename=nil
for i=1,9999 do
-- Create file name.
filename=string.format("FMD-%s_%s-%04d.csv", playerData.name, playerData.actype, i)
-- Set path.
if path~=nil then
filename=path.."\\"..filename
end
-- Check if file exists.
local _exists=UTILS.FileExists(filename)
if not _exists then
break
end
end
-- Info
local text=string.format("Saving player %s flight data to file %s", playerData.name, filename)
self:I(self.lid..text)
-- Header line
local data="#Time,Altitude,Temperature,Pressure,Vtot,Vx,Vy,Vz,Atot,ax,ay,az,AoA,Pitch,dPitch/dt,Roll,dRoll/dt,Yaw,dYaw/dt,Turn Rate\n"
local g0=playerData.data[1] --#FMD.DataPoint
local T0=g0.time
-- Calculate derivatives.
self:_Derivative(playerData)
for i=2,#playerData.data-1 do
local dp=playerData.data[i] --#FMD.DataPoint
-- Conversion m/s == Mach.
local ms2mach=0.00291545
local t=(dp.time-T0) or 0
local a=dp.Alt or 0
local b=dp.T or 0
local c=dp.P or 0
local d=dp.Vtot or 0
local e=dp.v.x or 0
local f=dp.v.y or 0
local g=dp.v.z or 0
local h=dp.Atot or 0
local i=dp.a.x or 0
local j=dp.a.y or 0
local k=dp.a.z or 0
local l=dp.AoA or 0
local m=dp.Pitch or 0
local n=dp.DPitch or 0
local roll=dp.Roll or 0
if roll<0 then
roll=roll+360
end
local o=roll --dp.Roll or 0
local p=dp.DRoll or 0
local q=dp.Yaw or 0
local r=dp.DYaw or 0
local s=dp.omega or 0
-- Debug output.
self:T3(t)
self:T3(a)
self:T3(b)
self:T3(c)
self:T3(d)
self:T3(e)
self:T3(f)
self:T3(g)
self:T3(h)
self:T3(i)
self:T3(j)
self:T3(k)
self:T3(l)
self:T3(m)
self:T3(n)
self:T3(o)
self:T3(p)
self:T3(q)
self:T3(r)
self:T3(s)
-- t a b c d e f g h i j k l m n o p q r s
data=data..string.format("%.2f,%.2f,%.2f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\n",
t, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s)
end
-- Save file.
_savefile(filename, data)
-- Clear data.
playerData.data={}
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- RADIO MENU Functions
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Add menu commands for player.
-- @param #FMD self
-- @param #string _unitName Name of player unit.
function FMD:_AddF10Commands(_unitName)
self:F(_unitName)
-- Get player unit and name.
local _unit, playername = self:_GetPlayerUnitAndName(_unitName)
-- Check for player unit.
if _unit and playername then
-- Get group and ID.
local group=_unit:GetGroup()
local gid=group:GetID()
if group and gid then
if not self.menuadded[gid] then
-- Enable switch so we don't do this twice.
self.menuadded[gid]=true
-- Set menu root path.
local _rootPath=nil
if FMD.MenuF10Root then
------------------------
-- MISSON LEVEL MENUE --
------------------------
-- F10/FMD/...
_rootPath=FMD.MenuF10Root
else
------------------------
-- GROUP LEVEL MENUES --
------------------------
-- Main F10 menu: F10/FMD/
if FMD.MenuF10[gid]==nil then
FMD.MenuF10[gid]=missionCommands.addSubMenuForGroup(gid, "FMD")
end
-- F10/FMD/...
_rootPath=FMD.MenuF10[gid]
end
--------------------------------
-- F10/F<X> FMD/F1 Time Interval
--------------------------------
local _timePath=missionCommands.addSubMenuForGroup(gid, "Time Interval", _rootPath)
-- F10/FMD/F1 Time Interval/
missionCommands.addCommandForGroup(gid, "Delta t=0.01 s", _timePath, self._SetTimeInterval, self, _unitName, 0.01)
missionCommands.addCommandForGroup(gid, "Delta t=0.1 s", _timePath, self._SetTimeInterval, self, _unitName, 0.1)
missionCommands.addCommandForGroup(gid, "Delta t=1.0 s", _timePath, self._SetTimeInterval, self, _unitName, 1.0)
missionCommands.addCommandForGroup(gid, "Delta t=10 s", _timePath, self._SetTimeInterval, self, _unitName, 10.0)
missionCommands.addCommandForGroup(gid, "Delta t=30 s", _timePath, self._SetTimeInterval, self, _unitName, 30.0)
missionCommands.addCommandForGroup(gid, "Delta t=60 s", _timePath, self._SetTimeInterval, self, _unitName, 60.0)
-------------------------------
-- F10/F<X> FMD/F1 Rec Duration
-------------------------------
local _durPath=missionCommands.addSubMenuForGroup(gid, "Rec Duration", _rootPath)
-- F10/FMD/F1 Rec Duration/
missionCommands.addCommandForGroup(gid, "T=10 s", _durPath, self._SetRecDuration, self, _unitName, 10)
missionCommands.addCommandForGroup(gid, "T=30 s", _durPath, self._SetRecDuration, self, _unitName, 30)
missionCommands.addCommandForGroup(gid, "T=60 s", _durPath, self._SetRecDuration, self, _unitName, 60)
missionCommands.addCommandForGroup(gid, "T=5 min", _durPath, self._SetRecDuration, self, _unitName, 5*60)
missionCommands.addCommandForGroup(gid, "T=10 min", _durPath, self._SetRecDuration, self, _unitName, 10*60)
--------------------------------
-- F10/F<X> FMD/
--------------------------------
-- F10/FMD/Start Recording
missionCommands.addCommandForGroup(gid, "Start Recording", _rootPath, self._StartRecording, self, _unitName) -- F1
missionCommands.addCommandForGroup(gid, "Stop Recording", _rootPath, self._StopRecording, self, _unitName) -- F2
end
end
end
end
--- Set recording duration.
-- @param #FMD self
-- @param #string _unitName Name of player unit.
-- @param #number rd Recording duration in sec.
function FMD:_SetRecDuration(_unitName, rd)
-- Get player unit and name.
local _unit, _playername = self:_GetPlayerUnitAndName(_unitName)
-- Check if we have a unit which is a player.
if _unit and _playername then
local playerData=self.players[_playername] --#FMD.PlayerData
if playerData then
-- Set dt.
playerData.rd=rd
-- Inform player.
local text=string.format("Data recording duration set to %.1f sec.", playerData.rd)
MESSAGE:New(text, 10, "FMD"):ToClient(playerData.client)
end
end
end
--- Set time interval for data recording.
-- @param #FMD self
-- @param #string _unitName Name of player unit.
-- @param #number dt Time interval in seconds.
function FMD:_SetTimeInterval(_unitName, dt)
-- Get player unit and name.
local _unit, _playername = self:_GetPlayerUnitAndName(_unitName)
-- Check if we have a unit which is a player.
if _unit and _playername then
local playerData=self.players[_playername] --#FMD.PlayerData
if playerData then
-- Set dt.
playerData.dt=dt
-- Inform player.
local text=string.format("Data recording time interval set to %.3f sec.", playerData.dt)
MESSAGE:New(text, 10, "FMD"):ToClient(playerData.client)
end
end
end
--- Start data recording.
-- @param #FMD self
-- @param #string _unitName Name of player unit.
function FMD:_StartRecording(_unitName)
-- Get player unit and name.
local _unit, _playername = self:_GetPlayerUnitAndName(_unitName)
-- Check if we have a unit which is a player.
if _unit and _playername then
local playerData=self.players[_playername] --#FMD.PlayerData
if playerData then
-- Delay before recording starts.
local delay=3
-- Inform player.
local text=string.format("Data recording will be started in %d seconds with %.3f sec timestep for %.1f sec.", delay, playerData.dt, playerData.rd)
MESSAGE:New(text, 3, "FMD"):ToClient(playerData.client)
-- Start scheduler.
playerData.SID=playerData.scheduler:Schedule(nil, self._RecordData, {self, playerData}, delay, playerData.dt, 0.0)
-- Stop scheduler once.
playerData.scheduler:ScheduleOnce(playerData.rd+delay, self._StopRecording, self,_unitName)
end
end
end
--- Stop data recording.
-- @param #FMD self
-- @param #string _unitName Name of player unit.
function FMD:_StopRecording(_unitName)
-- Get player unit and name.
local _unit, _playername = self:_GetPlayerUnitAndName(_unitName)
-- Check if we have a unit which is a player.
if _unit and _playername then
local playerData=self.players[_playername] --#FMD.PlayerData
if playerData then
local ndata=#playerData.data
-- Inform player.
local text=string.format("Data recording stopped. Data points recorded: %d", ndata)
MESSAGE:New(text, 10, "FMD"):ToClient(playerData.client)
-- No recording switch.
playerData.recording=false
-- Stop scheduler.
playerData.scheduler:Stop(playerData.SID)
-- Save data.
self:_SaveData(playerData)
end
end
end
--- Returns the unit of a player and the player name. If the unit does not belong to a player, nil is returned.
-- @param #FMD self
-- @param #string _unitName Name of the player unit.
-- @return Wrapper.Unit#UNIT Unit of player or nil.
-- @return #string Name of the player or nil.
function FMD:_GetPlayerUnitAndName(_unitName)
self:F2(_unitName)
if _unitName ~= nil then
-- Get DCS unit from its name.
local DCSunit=Unit.getByName(_unitName)
if DCSunit then
local playername=DCSunit:getPlayerName()
local unit=UNIT:Find(DCSunit)
self:T2({DCSunit=DCSunit, unit=unit, playername=playername})
if DCSunit and unit and playername then
return unit, playername
end
end
end
-- Return nil if we could not find a player.
return nil,nil
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+7 -23
View File
@@ -1,4 +1,4 @@
--- **Functional** - Yet Another Missile Trainer.
--- **Functional** - (R2.5) - Yet Another Missile Trainer.
--
--
-- Practice to evade missiles without being destroyed.
@@ -20,7 +20,7 @@
-- ===
--
-- ### Author: **funkyfranky**
-- @module Functional.Fox
-- @module Functional.FOX
-- @image Functional_FOX.png
--- FOX class.
@@ -492,6 +492,7 @@ end
--- Disable F10 menu for all players.
-- @param #FOX self
-- @param #boolean switch If true debug mode on. If false/nil debug mode off
-- @return #FOX self
function FOX:SetDisableF10Menu()
@@ -500,16 +501,6 @@ function FOX:SetDisableF10Menu()
return self
end
--- Enable F10 menu for all players.
-- @param #FOX self
-- @return #FOX self
function FOX:SetEnableF10Menu()
self.menudisabled=false
return self
end
--- Set default player setting for missile destruction.
-- @param #FOX self
-- @param #boolean switch If true missiles are destroyed. If false/nil missiles are not destroyed.
@@ -801,7 +792,7 @@ function FOX:onafterMissileLaunch(From, Event, To, missile)
local text=string.format("Missile launch detected! Distance %.1f NM, bearing %03d°.", UTILS.MetersToNM(distance), bearing)
-- Say notching headings.
self:ScheduleOnce(5, FOX._SayNotchingHeadings, self, player, missile.weapon)
BASE:ScheduleOnce(5, FOX._SayNotchingHeadings, self, player, missile.weapon)
--TODO: ALERT or INFO depending on whether this is a direct target.
--TODO: lauchalertall option.
@@ -1123,13 +1114,6 @@ end
-- Event Functions
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- FOX event handler for event birth.
-- @param #FOX self
-- @param Core.Event#EVENTDATA EventData
function FOX:OnEventPlayerEnterAircraft(EventData)
end
--- FOX event handler for event birth.
-- @param #FOX self
-- @param Core.Event#EVENTDATA EventData
@@ -1171,7 +1155,7 @@ function FOX:OnEventBirth(EventData)
-- Add F10 radio menu for player.
if not self.menudisabled then
self:ScheduleOnce(0.1, self._AddF10Commands, self, _unitName)
SCHEDULER:New(nil, self._AddF10Commands, {self,_unitName}, 0.1)
end
-- Player data.
@@ -1438,10 +1422,10 @@ function FOX:_AddF10Commands(_unitName)
end
else
self:E(self.lid..string.format("ERROR: Could not find group or group ID in AddF10Menu() function. Unit name: %s.", _unitName or "unknown"))
self:E(self.lid..string.format("ERROR: Could not find group or group ID in AddF10Menu() function. Unit name: %s.", _unitName))
end
else
self:E(self.lid..string.format("ERROR: Player unit does not exist in AddF10Menu() function. Unit name: %s.", _unitName or "unknown"))
self:E(self.lid..string.format("ERROR: Player unit does not exist in AddF10Menu() function. Unit name: %s.", _unitName))
end
end
+22 -56
View File
@@ -1,13 +1,11 @@
--- **Functional** - Modular, Automatic and Network capable Targeting and Interception System for Air Defenses.
--- **Functional** -- Modular, Automatic and Network capable Targeting and Interception System for Air Defenses
--
-- ===
--
-- ## Features:
--
-- * Moose derived Modular, Automatic and Network capable Targeting and Interception System.
-- * Controls a network of SAM sites. Uses detection to switch on the AA site closest to the enemy.
-- * Automatic mode (default since 0.8) can set-up your SAM site network automatically for you.
-- * Leverage evasiveness from SEAD, leverage attack range setting.
-- **MANTIS** - Moose derived Modular, Automatic and Network capable Targeting and Interception System
-- Controls a network of SAM sites. Uses detection to switch on the AA site closest to the enemy.
-- Automatic mode (default since 0.8) can set-up your SAM site network automatically for you.
-- Leverage evasiveness from SEAD, leverage attack range setting.
--
-- ===
--
@@ -22,7 +20,7 @@
-- @module Functional.Mantis
-- @image Functional.Mantis.jpg
--
-- Last Update: Oct 2022
-- Date: Dec 2021
-------------------------------------------------------------------------
--- **MANTIS** class, extends Core.Base#BASE
@@ -63,11 +61,10 @@
--- *The worst thing that can happen to a good cause is, not to be skillfully attacked, but to be ineptly defended.* - Frédéric Bastiat
--
-- Moose class for a more intelligent Air Defense System
-- Simple Class for a more intelligent Air Defense System
--
-- # MANTIS
--
-- * Moose derived Modular, Automatic and Network capable Targeting and Interception System.
-- #MANTIS
-- Moose derived Modular, Automatic and Network capable Targeting and Interception System.
-- * Controls a network of SAM sites. Uses detection to switch on the SAM site closest to the enemy.
-- * **Automatic mode** (default since 0.8) can set-up your SAM site network automatically for you
-- * **Classic mode** behaves like before
@@ -103,11 +100,9 @@
-- * Roland
-- * 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
-- * 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
-- **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"
-- * and from HDS (see note below): SA-2, SA-3, SA-10B, SA-10C, SA-12, SA-17, SA-20A, SA-20B, SA-23, HQ-2
--
-- 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":
--
-- * SA-2 (with V759 missile, e.g. "Red SAM SA-2 HDS")
@@ -128,7 +123,7 @@
-- Set up your SHORAD systems. They need to be **close** to (i.e. around) the SAM sites to be effective. Use **one** group per SAM location. SA-15 TOR systems offer a good missile defense.
--
-- [optional] Set up your HQ. Can be any group, e.g. a command vehicle.
--
--
-- # 1. Basic tactical considerations when setting up your SAM sites
--
-- ## 1.1 Radar systems and AWACS
@@ -152,7 +147,7 @@
-- * overestimation how far units can "see" and
-- * not taking into account that a SAM site will take (e.g for a SA-6) 30-40 seconds between switching on, acquiring the target and firing.
--
-- An attacker doing 350knots will cover ca 180meters/second or thus more than 6km until the SA-6 fires. Use triggers zones and the ruler in the mission editor to understand distances and zones. Take into account that the ranges given by the circles
-- An attacker doing 350knots will cover ca 180meters/second or thus more than 6km until the SA-6 fires. Use triggers zones and the ruler in the missione editor to understand distances and zones. Take into account that the ranges given by the circles
-- in the mission editor are absolute maximum ranges; in-game this is rather 50-75% of that depending on the system. Fiddle with placement and options to see what works best for your scenario, and remember **everything in here is in meters**.
--
-- # 2. Start up your MANTIS with a basic setting
@@ -216,7 +211,7 @@
-- * grouping = 5000 (meters) - Detection (EWR) will group enemy flights to areas of 5km for tracking - `MANTIS:SetEWRGrouping(radius)`
-- * detectinterval = 30 (seconds) - MANTIS will decide every 30 seconds which SAM to activate - `MANTIS:SetDetectInterval(interval)`
-- * engagerange = 95 (percent) - SAMs will only fire if flights are inside of a 95% radius of their max firerange - `MANTIS:SetSAMRange(range)`
-- * dynamic = false - Group filtering is set to once, i.e. newly added groups will not be part of the setup by default - `MANTIS:New(name,samprefix,ewrprefix,hq,coalition,dynamic)`
-- * dynamic = false - Group filtering is set to once, i.e. newly added groups will not be part of the setup by default - `MANTIS:New(name,samprefix,ewrprefix,hq,coaltion,dynamic)`
-- * autorelocate = false - HQ and (mobile) EWR system will not relocate in random intervals between 30mins and 1 hour - `MANTIS:SetAutoRelocate(hq, ewr)`
-- * debug = false - Debugging reports on screen are set to off - `MANTIS:Debug(onoff)`
--
@@ -392,29 +387,6 @@ MANTIS.SamDataHDS = {
["HQ-2 HDS"] = { Range=50, Blindspot=6, Height=35, Type="Medium", Radar="HQ_2_Guideline_LN" },
}
--- SAM data SMA
-- @type MANTIS.SamDataSMA
-- @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.SamDataSMA = {
-- units from SMA Mod (Sweedish Military Assets)
-- https://forum.dcs.world/topic/295202-swedish-military-assets-for-dcs-by-currenthill/
-- group name MUST contain SMA to ID launcher type correctly!
["RBS98M SMA"] = { Range=20, Blindspot=0, Height=8, Type="Short", Radar="RBS-98" },
["RBS70 SMA"] = { Range=8, Blindspot=0, Height=5.5, Type="Short", Radar="RBS-70" },
["RBS70M SMA"] = { Range=8, Blindspot=0, Height=5.5, Type="Short", Radar="BV410_RBS70" },
["RBS90 SMA"] = { Range=8, Blindspot=0, Height=5.5, Type="Short", Radar="RBS-90" },
["RBS90M SMA"] = { Range=8, Blindspot=0, Height=5.5, Type="Short", Radar="BV410_RBS90" },
["RBS103A SMA"] = { Range=150, Blindspot=3, Height=24.5, Type="Long", Radar="LvS-103_Lavett103_Rb103A" },
["RBS103B SMA"] = { Range=35, Blindspot=0, Height=36, Type="Medium", Radar="LvS-103_Lavett103_Rb103B" },
["RBS103AM SMA"] = { Range=150, Blindspot=3, Height=24.5, Type="Long", Radar="LvS-103_Lavett103_HX_Rb103A" },
["RBS103BM SMA"] = { Range=35, Blindspot=0, Height=36, Type="Medium", Radar="LvS-103_Lavett103_HX_Rb103B" },
["Lvkv9040M SMA"] = { Range=4, Blindspot=0, Height=2.5, Type="Short", Radar="LvKv9040" },
}
-----------------------------------------------------------------------
-- MANTIS System
-----------------------------------------------------------------------
@@ -426,7 +398,7 @@ do
--@param #string samprefix Prefixes for the SAM groups from the ME, e.g. all groups starting with "Red Sam..."
--@param #string ewrprefix Prefixes for the EWR groups from the ME, e.g. all groups starting with "Red EWR..."
--@param #string hq Group name of your HQ (optional)
--@param #string coalition Coalition side of your setup, e.g. "blue", "red" or "neutral"
--@param #string coaltion Coalition side of your setup, e.g. "blue", "red" or "neutral"
--@param #boolean dynamic Use constant (true) filtering or just filter once (false, default) (optional)
--@param #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)
@@ -449,7 +421,7 @@ do
-- mybluemantis = MANTIS:New("bluemantis","Blue SAM","Blue EWR",nil,"blue",false,"Blue Awacs")
-- mybluemantis:Start()
--
function MANTIS:New(name,samprefix,ewrprefix,hq,coalition,dynamic,awacs, EmOnOff, Padding)
function MANTIS:New(name,samprefix,ewrprefix,hq,coaltion,dynamic,awacs, EmOnOff, Padding)
-- DONE: Create some user functions for these
-- DONE: Make HQ useful
@@ -462,7 +434,7 @@ do
self.SAM_Templates_Prefix = samprefix or "Red SAM"
self.EWR_Templates_Prefix = ewrprefix or "Red EWR"
self.HQ_Template_CC = hq or nil
self.Coalition = coalition or "red"
self.Coalition = coaltion or "red"
self.SAM_Table = {}
self.SAM_Table_Long = {}
self.SAM_Table_Medium = {}
@@ -578,7 +550,7 @@ do
-- TODO Version
-- @field #string version
self.version="0.8.9"
self.version="0.8.8"
self:I(string.format("***** Starting MANTIS Version %s *****", self.version))
--- FSM Functions ---
@@ -1298,12 +1270,11 @@ do
-- @param #MANTIS self
-- @param #string grpname Name of the group
-- @param #boolean mod HDS mod flag
-- @param #boolean sma SMA mod flag
-- @return #number range Max firing range
-- @return #number height Max firing height
-- @return #string type Long, medium or short range
-- @return #number blind "blind" spot
function MANTIS:_GetSAMDataFromUnits(grpname,mod,sma)
function MANTIS:_GetSAMDataFromUnits(grpname,mod)
self:T(self.lid.."_GetSAMRangeFromUnits")
local found = false
local range = self.checkradius
@@ -1316,8 +1287,6 @@ do
local SAMData = self.SamData
if mod then
SAMData = self.SamDataHDS
elseif sma then
SAMData = self.SamDataSMA
end
--self:I("Looking to auto-match for "..grpname)
for _,_unit in pairs(units) do
@@ -1363,11 +1332,8 @@ do
local blind = 0
local found = false
local HDSmod = false
local SMAMod = false
if string.find(grpname,"HDS",1,true) then
HDSmod = true
elseif string.find(grpname,"SMA",1,true) then
SMAMod = true
end
if self.automode then
for idx,entry in pairs(self.SamData) do
@@ -1386,8 +1352,8 @@ do
end
end
-- secondary filter if not found
if (not found and self.automode) or HDSmod or SMAMod then
range, height, type = self:_GetSAMDataFromUnits(grpname,HDSmod,SMAMod)
if (not found and self.automode) or HDSmod then
range, height, type = self:_GetSAMDataFromUnits(grpname,HDSmod)
elseif not found then
self:E(self.lid .. string.format("*****Could not match radar data for %s! Will default to midrange values!",grpname))
end
@@ -1549,7 +1515,7 @@ do
-- @param #table samset Table of SAM data
-- @param #table detset Table of COORDINATES
-- @param #boolean dlink Using DLINK
-- @param #number limit of SAM sites to go active on a contact
-- @param #limit limit of SAM sites to go active on a contact
-- @return #MANTIS self
function MANTIS:_CheckLoop(samset,detset,dlink,limit)
self:T(self.lid .. "CheckLoop " .. #detset .. " Coordinates")
@@ -1,4 +1,4 @@
--- **Functional** - Train missile defence and deflection.
--- **Functional** -- Train missile defence and deflection.
--
-- ===
--
@@ -28,14 +28,14 @@
-- * **Messages Off**: Disable all messages.
-- * **Tracking**: Menu to configure missile tracking messages.
-- * **To All**: Shows missile tracking messages to all players.
-- * **To Target**: Shows missile tracking messages only to the player where the missile is targeted at.
-- * **To Target**: Shows missile tracking messages only to the player where the missile is targetted at.
-- * **Tracking On**: Show missile tracking messages.
-- * **Tracking Off**: Disable missile tracking messages.
-- * **Frequency Increase**: Increases the missile tracking message frequency with one second.
-- * **Frequency Decrease**: Decreases the missile tracking message frequency with one second.
-- * **Alerts**: Menu to configure alert messages.
-- * **To All**: Shows alert messages to all players.
-- * **To Target**: Shows alert messages only to the player where the missile is (was) targeted at.
-- * **To Target**: Shows alert messages only to the player where the missile is (was) targetted at.
-- * **Hits On**: Show missile hit alert messages.
-- * **Hits Off**: Disable missile hit alert messages.
-- * **Launches On**: Show missile launch messages.
@@ -88,7 +88,7 @@
-- A MISSILETRAINER object will behave differently based on the usage of initialization methods:
--
-- * @{#MISSILETRAINER.InitMessagesOnOff}: Sets by default the display of any message to be ON or OFF.
-- * @{#MISSILETRAINER.InitTrackingToAll}: Sets by default the missile tracking report for all players or only for those missiles targeted to you.
-- * @{#MISSILETRAINER.InitTrackingToAll}: Sets by default the missile tracking report for all players or only for those missiles targetted to you.
-- * @{#MISSILETRAINER.InitTrackingOnOff}: Sets by default the display of missile tracking report to be ON or OFF.
-- * @{#MISSILETRAINER.InitTrackingFrequency}: Increases, decreases the missile tracking message display frequency with the provided time interval in seconds.
-- * @{#MISSILETRAINER.InitAlertsToAll}: Sets by default the display of alerts to be shown to all players or only to you.
@@ -256,7 +256,7 @@ function MISSILETRAINER:InitMessagesOnOff( MessagesOnOff )
return self
end
--- Sets by default the missile tracking report for all players or only for those missiles targeted to you.
--- Sets by default the missile tracking report for all players or only for those missiles targetted to you.
-- @param #MISSILETRAINER self
-- @param #boolean TrackingToAll true or false
-- @return #MISSILETRAINER self
+12 -12
View File
@@ -1,4 +1,4 @@
--- **Functional** - Limit the movement of simulaneous moving ground vehicles.
--- **Functional** -- Limit the movement of simulaneous moving ground vehicles.
--
-- ===
--
@@ -30,23 +30,23 @@ MOVEMENT = {
function MOVEMENT:New( MovePrefixes, MoveMaximum )
local self = BASE:Inherit( self, BASE:New() ) -- #MOVEMENT
self:F( { MovePrefixes, MoveMaximum } )
if type( MovePrefixes ) == 'table' then
self.MovePrefixes = MovePrefixes
else
self.MovePrefixes = { MovePrefixes }
end
self.MoveCount = 0 -- The internal counter of the amount of Moving the has happened since MoveStart.
self.MoveMaximum = MoveMaximum -- Contains the Maximum amount of units that are allowed to move.
self.AliveUnits = 0 -- Contains the counter how many units are currently alive.
self.MoveUnits = {} -- Reflects if the Moving for this MovePrefixes is going to be scheduled or not.
self.MoveCount = 0 -- The internal counter of the amount of Moveing the has happened since MoveStart.
self.MoveMaximum = MoveMaximum -- Contains the Maximum amount of units that are allowed to move...
self.AliveUnits = 0 -- Contains the counter how many units are currently alive
self.MoveUnits = {} -- Reflects if the Moving for this MovePrefixes is going to be scheduled or not.
self:HandleEvent( EVENTS.Birth )
-- self:AddEvent( world.event.S_EVENT_BIRTH, self.OnBirth )
--
-- self:EnableEvents()
self:ScheduleStart()
return self
@@ -67,7 +67,7 @@ function MOVEMENT:ScheduleStop()
end
--- Captures the birth events when new Units were spawned.
-- @todo This method should become obsolete. The global _DATABASE object (an instance of @{Core.Database#DATABASE}) will handle the collection administration.
-- @todo This method should become obsolete. The new @{DATABASE} class will handle the collection administration.
-- @param #MOVEMENT self
-- @param Core.Event#EVENTDATA self
function MOVEMENT:OnEventBirth( EventData )
@@ -86,14 +86,14 @@ function MOVEMENT:OnEventBirth( EventData )
end
end
end
EventData.IniUnit:HandleEvent( EVENTS.DEAD, self.OnDeadOrCrash )
end
end
--- Captures the Dead or Crash events when Units crash or are destroyed.
-- @todo This method should become obsolete. The global _DATABASE object (an instance of @{Core.Database#DATABASE}) will handle the collection administration.
-- @todo This method should become obsolete. The new @{DATABASE} class will handle the collection administration.
function MOVEMENT:OnDeadOrCrash( Event )
self:F( { Event } )
@@ -1,4 +1,4 @@
--- **Functional** - Basic ATC.
--- **Functional** - Rudimentary ATC.
--
-- ![Banner Image](..\Presentations\PSEUDOATC\PSEUDOATC_Main.jpg)
--
@@ -45,7 +45,6 @@
-- @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 eventsmoose 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
-- @extends Core.Base#BASE
--- Adds some rudimentary ATC functionality via the radio menu.
@@ -89,7 +88,6 @@ PSEUDOATC={
talt=3,
chatty=true,
eventsmoose=true,
reportplayername = false,
}
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -100,7 +98,7 @@ PSEUDOATC.id="PseudoATC | "
--- PSEUDOATC version.
-- @field #number version
PSEUDOATC.version="0.9.5"
PSEUDOATC.version="0.9.2"
-----------------------------------------------------------------------------------------------------------------------------------------
@@ -185,13 +183,6 @@ function PSEUDOATC:SetMessageDuration(duration)
self.mdur=duration or 30
end
--- Use player name, not call sign, in callouts
-- @param #PSEUDOATC self
function PSEUDOATC:SetReportPlayername()
self.reportplayername = true
return self
end
--- Set time interval after which the F10 radio menu is refreshed.
-- @param #PSEUDOATC self
-- @param #number interval Interval in seconds. Default is every 120 sec.
@@ -450,18 +441,14 @@ function PSEUDOATC:PlayerLanded(unit, place)
local group=unit:GetGroup()
local GID=group: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 UnitName = unit:GetName() or "Ghostplane"
local GroupName = group:GetName() or "Ghostgroup"
if self.Debug then
-- Debug message.
local text=string.format("Player %s in unit %s of group %s landed at %s.", PlayerName, UnitName, GroupName, place)
self:T(PSEUDOATC.id..text)
MESSAGE:New(text, 30):ToAllIf(self.Debug)
end
local PlayerName=self.group[GID].player[UID].playername
local UnitName=self.group[GID].player[UID].unitname
local GroupName=self.group[GID].player[UID].groupname
-- Debug message.
local text=string.format("Player %s in unit %s of group %s (id=%d) landed at %s.", PlayerName, UnitName, GroupName, GID, place)
self:T(PSEUDOATC.id..text)
MESSAGE:New(text, 30):ToAllIf(self.Debug)
-- Stop altitude reporting timer if its activated.
self:AltitudeTimerStop(GID,UID)
@@ -483,28 +470,21 @@ function PSEUDOATC:PlayerTakeOff(unit, place)
-- Gather some information.
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 UnitName = unit:GetName() or "Ghostplane"
local GroupName = group:GetName() or "Ghostgroup"
local CallSign = unit:GetCallsign() or "Ghost11"
if self.Debug then
-- Debug message.
local text=string.format("Player %s in unit %s of group %s took off at %s.", PlayerName, UnitName, GroupName, place)
self:T(PSEUDOATC.id..text)
MESSAGE:New(text, 30):ToAllIf(self.Debug)
end
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
-- Debug message.
local text=string.format("Player %s in unit %s of group %s (id=%d) took off at %s.", PlayerName, UnitName, GroupName, GID, place)
self:T(PSEUDOATC.id..text)
MESSAGE:New(text, 30):ToAllIf(self.Debug)
-- Bye-Bye message.
if place and self.chatty then
local text=string.format("%s, %s, you are airborne. Have a safe trip!", place, CallSign)
if self.reportplayername then
text=string.format("%s, %s, you are airborne. Have a safe trip!", place, PlayerName)
end
MESSAGE:New(text, self.mdur):ToGroup(group)
end
@@ -521,7 +501,7 @@ function PSEUDOATC:PlayerLeft(unit)
local GID=group:GetID()
local UID=unit:GetDCSObject():getID()
if self.group[GID] and self.group[GID].player and self.group[GID].player[UID] then
if self.group[GID].player[UID] then
local PlayerName=self.group[GID].player[UID].playername
local CallSign=self.group[GID].player[UID].callsign
local UnitName=self.group[GID].player[UID].unitname
@@ -707,9 +687,7 @@ function PSEUDOATC:MenuWaypoints(GID, UID)
-- Position of Waypoint
local pos=COORDINATE:New(wp.x, wp.alt, wp.y)
local name=string.format("Waypoint %d", i-1)
if wp.name and wp.name ~= "" then
name = string.format("Waypoint %s",wp.name)
end
-- "F10/PseudoATC/Waypoints/Waypoint X"
local submenu=missionCommands.addSubMenuForGroup(GID, name, self.group[GID].player[UID].menu_waypoints)
@@ -866,8 +844,7 @@ function PSEUDOATC:ReportHeight(GID, UID, dt, _clear)
local position=unit:GetCoordinate()
local height=get_AGL(position)
local callsign=unit:GetCallsign()
local PlayerName=self.group[GID].player[UID].playername
-- Settings.
local settings=_DATABASE:GetPlayerSettings(self.group[GID].player[UID].playername) or _SETTINGS --Core.Settings#SETTINGS
@@ -879,9 +856,7 @@ function PSEUDOATC:ReportHeight(GID, UID, dt, _clear)
-- Message text.
local _text=string.format("%s, your altitude is %s AGL.", callsign, Hs)
if self.reportplayername then
_text=string.format("%s, your altitude is %s AGL.", PlayerName, Hs)
end
-- Append flight level.
if _clear==false then
_text=_text..string.format(" FL%03d.", position.y/30.48)
@@ -974,14 +949,11 @@ function PSEUDOATC:LocalAirports(GID, UID)
for _,airbase in pairs(airports) do
local name=airbase:getName()
local a=AIRBASE:FindByName(name)
if a then
local q=a:GetCoordinate()
local d=q:Get2DDistance(pos)
local q=AIRBASE:FindByName(name):GetCoordinate()
local d=q:Get2DDistance(pos)
-- Add to table.
table.insert(self.group[GID].player[UID].airports, {distance=d, name=name})
end
-- Add to table.
table.insert(self.group[GID].player[UID].airports, {distance=d, name=name})
end
end
@@ -1069,3 +1041,6 @@ function PSEUDOATC:_myname(unitname)
return string.format("%s (%s)", csign, pname)
end
+11 -23
View File
@@ -51,7 +51,7 @@
-- ### Contributions: [FlightControl](https://forums.eagle.ru/member.php?u=89536)
--
-- ===
-- @module Functional.RAT
-- @module Functional.Rat
-- @image RAT.JPG
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -69,7 +69,7 @@
-- @field #string category Category of aircarft: "plane" or "heli".
-- @field #number groupsize Number of aircraft in group.
-- @field #string friendly Possible departure/destination airport: all=blue+red+neutral, same=spawn+neutral, spawnonly=spawn, blue=blue+neutral, blueonly=blue, red=red+neutral, redonly=red.
-- @field #table ctable Table with the valid coalitions from choice self.friendly.
-- @field #table ctable Table with the valid coalitons from choice self.friendly.
-- @field #table aircraft Table which holds the basic aircraft properties (speed, range, ...).
-- @field #number Vcruisemax Max cruise speed in m/s (250 m/s = 900 km/h = 486 kt) set by user.
-- @field #number Vclimb Default climb rate in ft/min.
@@ -348,7 +348,7 @@ RAT={
category = nil, -- Category of aircarft: "plane" or "heli".
groupsize=nil, -- Number of aircraft in the group.
friendly = "same", -- Possible departure/destination airport: same=spawn+neutral, spawnonly=spawn, blue=blue+neutral, blueonly=blue, red=red+neutral, redonly=red, neutral.
ctable = {}, -- Table with the valid coalitions from choice self.friendly.
ctable = {}, -- Table with the valid coalitons from choice self.friendly.
aircraft = {}, -- Table which holds the basic aircraft properties (speed, range, ...).
Vcruisemax=nil, -- Max cruise speed in set by user.
Vclimb=1500, -- Default climb rate in ft/min.
@@ -657,7 +657,7 @@ end
-- @param #RAT self
-- @param #number naircraft (Optional) Number of aircraft to spawn. Default is one aircraft.
-- @return #boolean True if spawning was successful or nil if nothing was spawned.
-- @usage yak:Spawn(5) will spawn five aircraft. By default aircraft will spawn at neutral and red airports if the template group is part of the red coalition.
-- @usage yak:Spawn(5) will spawn five aircraft. By default aircraft will spawn at neutral and red airports if the template group is part of the red coaliton.
function RAT:Spawn(naircraft)
-- Make sure that this function is only been called once per RAT object.
@@ -1289,7 +1289,7 @@ end
--- Include all airports which lie in a zone as possible destinations.
-- @param #RAT self
-- @param Core.Zone#ZONE zone Zone in which the destination airports lie. Has to be a MOOSE zone.
-- @param Core.Zone#ZONE zone Zone in which the departure airports lie. Has to be a MOOSE zone.
-- @return #RAT RAT self object.
function RAT:SetDestinationsFromZone(zone)
self:F2(zone)
@@ -1305,7 +1305,7 @@ end
--- Include all airports which lie in a zone as possible destinations.
-- @param #RAT self
-- @param Core.Zone#ZONE zone Zone in which the departure airports lie. Has to be a MOOSE zone.
-- @param Core.Zone#ZONE zone Zone in which the destination airports lie. Has to be a MOOSE zone.
-- @return #RAT RAT self object.
function RAT:SetDeparturesFromZone(zone)
self:F2(zone)
@@ -2049,15 +2049,9 @@ function RAT:_InitAircraft(DCSgroup)
--self.aircraft.descriptors=DCSdesc
-- aircraft dimensions
if DCSdesc.box then
self.aircraft.length=DCSdesc.box.max.x
self.aircraft.height=DCSdesc.box.max.y
self.aircraft.width=DCSdesc.box.max.z
elseif DCStype == "Mirage-F1CE" then
self.aircraft.length=16
self.aircraft.height=5
self.aircraft.width=9
end
self.aircraft.length=DCSdesc.box.max.x
self.aircraft.height=DCSdesc.box.max.y
self.aircraft.width=DCSdesc.box.max.z
self.aircraft.box=math.max(self.aircraft.length,self.aircraft.width)
-- info message
@@ -3492,7 +3486,7 @@ function RAT:Status(message, forID)
local fuel=group:GetFuel()*100.0
local airborne=group:InAir()
local coords=group:GetCoordinate()
local alt=coords.y or 1000
local alt=coords.y
--local vel=group:GetVelocityKMH()
local departure=ratcraft.departure:GetName()
local destination=ratcraft.destination:GetName()
@@ -5443,7 +5437,7 @@ function RAT:_ModifySpawnTemplate(waypoints, livery, spawnplace, departure, take
SpawnTemplate.units[UnitID]["onboard_num"] = string.format("%s%d%02d", self.onboardnum, (self.SpawnIndex-1)%10, (self.onboardnum0-1)+UnitID)
end
-- Modify coalition and country of template.
-- Modify coaltion and country of template.
SpawnTemplate.CoalitionID=self.coalition
if self.country then
SpawnTemplate.CountryID=self.country
@@ -5671,9 +5665,6 @@ function RAT:_ATCClearForLanding(airport, flight)
-- Debug message.
local text1=string.format("ATC %s: Flight %s cleared for landing (flag=%d).", airport, flight, flagvalue)
if string.find(flight,"#") then
flight = string.match(flight,"^(.+)#")
end
local text2=string.format("ATC %s: Flight %s you are cleared for landing.", airport, flight)
BASE:T( RAT.id..text1)
MESSAGE:New(text2, 10):ToAllIf(RAT.ATC.messages)
@@ -5716,9 +5707,6 @@ 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 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)
if string.find(name,"#") then
name = string.match(name,"^(.+)#")
end
local text4=string.format("ATC %s: Flight %s landed. Welcome to %s.", dest, name, dest)
BASE:T(RAT.id..text1)
BASE:T(RAT.id..text2)
+855
View File
@@ -0,0 +1,855 @@
--- **Ops** - (R2.5) - Random Air Traffic.
--
--
--
-- RAT2 creates random air traffic on the map.
--
--
--
-- **Main Features:**
--
-- * It's very random.
--
-- ===
--
-- ### Author: **funkyfranky**
-- @module Functional.Rat2
-- @image Functional_Rat2.png
--- RAT2 class.
-- @type RAT2
-- @field #string ClassName Name of the class.
-- @field #boolean Debug Debug mode. Messages to all about status.
-- @field #string lid Class id string for output to DCS log file.
-- @field #table Qcraft Table of rat crafts.
-- @extends Core.Fsm#FSM
--- Be surprised!
--
-- ===
--
-- ![Banner Image](..\Presentations\RAT2\RAT2_Main.png)
--
-- # The RAT2 Concept
--
--
--
-- @field #RAT2
RAT2 = {
ClassName = "RAT2",
Debug = false,
lid = nil,
Qcraft = {},
}
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Constructor
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Create a new RAT2 class object.
-- @param #RAT2 self
-- @return #RAT2 self.
function RAT2:New()
-- Inherit everthing from FSM class.
local self=BASE:Inherit(self, FSM:New()) -- #RAT2
-- Start State.
self:SetStartState("Stopped")
self.lid="RAT2 | "
-- Add FSM transitions.
-- From State --> Event --> To State
self:AddTransition("Stopped", "Load", "Stopped") -- Load player scores from file.
self:AddTransition("Stopped", "Start", "Running") -- Start RAT2 script.
self:AddTransition("*", "Status", "*") -- Start RAT2 script.
self:AddTransition("*", "Spawned", "*") -- A group was spawned.
return self
end
--- Create a new RAT2 class object.
-- @param #RAT2 self
-- @param #RATAC ratcraft The aircraft to add.
-- @return #RAT2 self.
function RAT2:AddAircraft(ratcraft)
-- Add ratcraft to spawn queue.
table.insert(self.Qcraft, ratcraft)
return self
end
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Status Functions
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Start random air traffic.
-- @param #RAT2 self
-- @param #string From From state.
-- @param #string Event Event.
-- @param #string To To state.
function RAT2:onafterStart(From, Event, To)
self:__Status(-1)
end
--- Check spawn queue and spawn aircraft if necessary.
-- @param #RAT2 self
-- @param #string From From state.
-- @param #string Event Event.
-- @param #string To To state.
function RAT2:onafterStatus(From, Event, To)
self:I(string.format("RAT status %s", self:GetState()))
-- Check queue of aircraft to spawn.
self:_CheckQueueSpawn()
self:__Status(-10)
end
--- Check spawn queue and spawn aircraft if necessary.
-- @param #RAT2 self
function RAT2:_CheckQueueSpawn()
self:I(string.format("Checking flights"))
-- Loop over all ratcraft.
for i,_ratcraft in pairs(self.Qcraft) do
local ratcraft=_ratcraft --Functional.RatCraft#RATCRAFT
-- Get number of alive groups.
local Nalive=ratcraft:_GetAliveGroups()
for _,_flight in pairs(ratcraft.flights) do
local flight=_flight --Ops.FlightGroup#FLIGHTGROUP
self:I(string.format("Checking flight group %s in status %s", flight.groupname, flight:GetState()))
if flight:IsInUtero() or flight:IsArrived() or flight:IsDead() then
self:I(string.format("Try Spawning new flight group %s in status %s", flight.groupname, flight:GetState()))
-- Get departure and parking.
local departure, parking=ratcraft:GetDeparture()
-- Get destination depending on departure.
local destination=ratcraft:GetDestination(departure)
if departure and destination and parking then
self:I(string.format("Spawning new flight group %s in status %s", flight.groupname, flight:GetState()))
-- Try to spawn a ratcraft group.
local group=self:_SpawnRatcraft(ratcraft, flight, departure, destination, parking)
-- Remove queue item and break loop.
if group then
-- We add a little delay
self:__Spawned(0.1, group, flight, ratcraft)
break
end -- if group
end -- if departure
end -- if spawn flight
end -- for flights
end -- for ratcraft
end
--- Check spawn queue and spawn aircraft if necessary.
-- @param #RAT2 self
function RAT2:_CheckArrived()
for _,_ratcraft in pairs(self.Qcraft) do
local ratcraft=_ratcraft --Functional.RatCraft#RATCRAFT
for _,_flight in pairs(ratcraft.flights) do
local flight=_flight --Ops.FlightGroup#FLIGHTGROUP
if flight:IsArrived() then
-- Destroy group and create a remove unit event.
flight.group:Destroy(nil)
end
end
end
end
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- FSM functions
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Function called after a RAT group was spawned.
-- @param #RAT2 self
-- @param #string From From state.
-- @param #string Event Event.
-- @param #string To To state.
-- @param Wrapper.Group#GROUP group The spawned group.
-- @param Ops.FlightGroup#FLIGHTGROUP flight The flight group.
-- @param Functional.RatCraft#RATCRAFT ratcraft The ratcraft object.
function RAT2:onafterSpawned(From, Event, To, group, flight, ratcraft)
group:SmokeGreen()
end
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Spawn functions
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Spawn an aircraft asset (plane or helo) at the airbase associated with the warehouse.
-- @param #RAT2 self
-- @param Functional.RatCraft#RATCRAFT ratcraft Ratcraft to spawn.
-- @param Ops.FlightGroup#FLIGHTGROUP flight Flight group.
-- @param Functional.RatCraft#RATCRAFT.Departure departure Departure.
-- @param Functional.RatCraft#RATCRAFT.Departure destination Destination.
-- @param #table parking Parking data for this group.
-- @return Wrapper.Group#GROUP The spawned group or nil if the group could not be spawned.
function RAT2:_SpawnRatcraft(ratcraft, flight, departure, destination, parking)
-- Prepare the spawn template.
local template=self:_SpawnAssetPrepareTemplate(ratcraft, flight.groupname)
-- Get flight path if the group goes to another warehouse by itself.
template.route.points=self:_GetFlightplan(ratcraft, AIRBASE:FindByName(departure.name), AIRBASE:FindByName(destination.name))
local airbase=AIRBASE:FindByName(departure.name) --self:_GetAirbase(departure)
-- Get airbase ID and category.
local AirbaseID = airbase:GetID()
local AirbaseCategory = airbase:GetAirbaseCategory()
-- Check enough parking spots.
if AirbaseCategory==Airbase.Category.HELIPAD or AirbaseCategory==Airbase.Category.SHIP then
--TODO Figure out what's necessary in this case.
else
if #parking<#template.units then
local text=string.format("ERROR: Not enough parking! Free parking = %d < %d aircraft to be spawned.", #parking, #template.units)
self:_DebugMessage(text)
return nil
end
end
-- Position the units.
for i=1,#template.units do
-- Unit template.
local unit = template.units[i]
if AirbaseCategory == Airbase.Category.HELIPAD or AirbaseCategory == Airbase.Category.SHIP then
-- Helipads we take the position of the airbase location, since the exact location of the spawn point does not make sense.
local coord=airbase:GetCoordinate()
unit.x=coord.x
unit.y=coord.z
unit.alt=coord.y
unit.parking_id = nil
unit.parking = nil
else
local coord=parking[i].Coordinate --Core.Point#COORDINATE
local terminal=parking[i].TerminalID --#number
if self.Debug then
coord:MarkToAll(string.format("Spawnplace unit %s terminal %d.", unit.name, terminal))
end
unit.x=coord.x
unit.y=coord.z
unit.alt=coord.y
unit.parking_id = nil
unit.parking = terminal
end
if destination.parking then
local spot=destination.parking[i] --Wrapper.Airbase#AIRBASE.ParkingSpot
unit.parking_landing=spot.TerminalID
end
if ratcraft.livery==nil and #ratcraft.liveries>0 then
ratcraft.livery=ratcraft.liveries[math.random(#ratcraft.liveries)]
end
-- Set livery.
if ratcraft.livery then
unit.livery_id = ratcraft.livery
end
-- Set skill.
if ratcraft.skill then
unit.skill= ratcraft.skill
end
end
-- And template position.
template.x = template.units[1].x
template.y = template.units[1].y
-- Uncontrolled spawning.
template.uncontrolled=ratcraft.uncontrolled
-- Debug info.
self:T2({airtemplate=template})
-- Spawn group.
local group=_DATABASE:Spawn(template) --Wrapper.Group#GROUP
return group
end
--- Prepare a spawn template for the asset. Deep copy of asset template, adjusting template and unit names, nillifying group and unit ids.
-- @param #RAT2 self
-- @param Functional.RatCraft#RATCRAFT ratcraft Aircraft that will be spawned.
-- @param #string groupname Name for the group to be spawned.
-- @return #table Prepared new spawn template.
function RAT2:_SpawnAssetPrepareTemplate(ratcraft, groupname)
-- Create an own copy of the template!
local template=UTILS.DeepCopy(ratcraft.template)
-- Set unique name.
template.name=groupname
-- Set current(!) coalition and country.
template.CoalitionID=ratcraft.coalition
template.CountryID=ratcraft.country
-- Nillify the group ID.
template.groupId=nil
-- No late activation.
template.lateActivation=false
-- Set and empty route.
template.route = {}
template.route.routeRelativeTOT=true
template.route.points = {}
-- Handle units.
for i=1,#template.units do
-- Unit template.
local unit=template.units[i]
-- Nillify the unit ID.
unit.unitId=nil
-- Set unit name: <alias>-01, <alias>-02, ...
unit.name=string.format("%s-%02d", template.name , i)
end
return template
end
--@param #RCRAFT.Attribute _attribute Generlized attribute of unit.
--- Get the proper terminal type based on generalized attribute of the group.
--@param #RAT2 self
--@param #number _category Airbase category.
--@return Wrapper.Airbase#AIRBASE.TerminalType Terminal type for this group.
function RAT2:_GetTerminal(_attribute, _category)
-- Default terminal is "large".
local _terminal=AIRBASE.TerminalType.OpenBig
if _attribute==RCRAFT.Attribute.FIGHTER then
-- Fighter ==> small.
_terminal=AIRBASE.TerminalType.FighterAircraft
elseif _attribute==RCRAFT.Attribute.BOMBER or _attribute==RCRAFT.Attribute.TRANSPORTPLANE or _attribute==RCRAFT.Attribute.TANKER or _attribute==RCRAFT.Attribute.AWACS then
-- Bigger aircraft.
_terminal=AIRBASE.TerminalType.OpenBig
elseif _attribute==RCRAFT.Attribute.TRANSPORTHELO or _attribute==RCRAFT.Attribute.ATTACKHELO then
-- Helicopter.
_terminal=AIRBASE.TerminalType.HelicopterUsable
else
--_terminal=AIRBASE.TerminalType.OpenMedOrBig
end
-- For ships, we allow medium spots for all fixed wing aircraft. There are smaller tankers and AWACS aircraft that can use a carrier.
if _category==Airbase.Category.SHIP then
if not (_attribute==RCRAFT.Attribute.TRANSPORTHELO or _attribute==RCRAFT.Attribute.ATTACKHELO) then
_terminal=AIRBASE.TerminalType.OpenMedOrBig
end
end
return _terminal
end
--- Seach unoccupied parking spots at the airbase for a list of assets. For each asset group a list of parking spots is returned.
-- During the search also the not yet spawned asset aircraft are considered.
-- If not enough spots for all asset units could be found, the routine returns nil!
-- @param #RAT2 self
-- @param Wrapper.Airbase#AIRBASE airbase The airbase where we search for parking spots.
-- @param Functional.RatCraft#RATCRAFT ratcraft Ratcraft.
-- @return #table Table of coordinates and terminal IDs of free parking spots. Each table entry has the elements .Coordinate and .TerminalID.
function RAT2:_FindParking(airbase, ratcraft)
-- Init default
local scanradius=50
local scanunits=true
local scanstatics=true
local scanscenery=false
local verysafe=false
-- Function calculating the overlap of two (square) objects.
local function _overlap(l1,l2,dist)
local safedist=(l1/2+l2/2)*1.05 -- 5% safety margine added to safe distance!
local safe = (dist > safedist)
self:T3(string.format("l1=%.1f l2=%.1f s=%.1f d=%.1f ==> safe=%s", l1,l2,safedist,dist,tostring(safe)))
return safe
end
-- Get parking spot data table. This contains all free and "non-free" spots.
local parkingdata=airbase:GetParkingSpotsTable()
-- List of obstacles.
local obstacles={}
-- Loop over all parking spots and get the currently present obstacles.
-- How long does this take on very large airbases, i.e. those with hundereds of parking spots? Seems to be okay!
for _,parkingspot in pairs(parkingdata) do
-- Coordinate of the parking spot.
local _spot=parkingspot.Coordinate -- Core.Point#COORDINATE
local _termid=parkingspot.TerminalID
-- Scan a radius of 100 meters around the spot.
local _,_,_,_units,_statics,_sceneries=_spot:ScanObjects(scanradius, scanunits, scanstatics, scanscenery)
-- Check all units.
for _,_unit in pairs(_units) do
local unit=_unit --Wrapper.Unit#UNIT
local _coord=unit:GetCoordinate()
local _size=self:_GetObjectSize(unit:GetDCSObject())
local _name=unit:GetName()
table.insert(obstacles, {coord=_coord, size=_size, name=_name, type="unit"})
end
-- Check all statics.
for _,static in pairs(_statics) do
local _vec3=static:getPoint()
local _coord=COORDINATE:NewFromVec3(_vec3)
local _name=static:getName()
local _size=self:_GetObjectSize(static)
table.insert(obstacles, {coord=_coord, size=_size, name=_name, type="static"})
end
-- Check all scenery.
for _,scenery in pairs(_sceneries) do
local _vec3=scenery:getPoint()
local _coord=COORDINATE:NewFromVec3(_vec3)
local _name=scenery:getTypeName()
local _size=self:_GetObjectSize(scenery)
table.insert(obstacles,{coord=_coord, size=_size, name=_name, type="scenery"})
end
-- TODO check clients. Clients cannot be spawned. So we can loop over them.
end
-- Parking data for all assets.
local parking={}
-- Get terminal type of this asset
local terminaltype=self:_GetTerminal(ratcraft.attribute, airbase:GetAirbaseCategory())
local Nunits=#ratcraft.templategroup:GetUnits()
-- Loop over all units - each one needs a spot.
for i=1,Nunits do
-- Loop over all parking spots.
local gotit=false
for _,_parkingspot in pairs(parkingdata) do
local parkingspot=_parkingspot --Wrapper.Airbase#AIRBASE.ParkingSpot
-- Check correct terminal type for asset. We don't want helos in shelters etc.
if AIRBASE._CheckTerminalType(parkingspot.TerminalType, terminaltype) then
-- Coordinate of the parking spot.
local _spot=parkingspot.Coordinate -- Core.Point#COORDINATE
local _termid=parkingspot.TerminalID
local _toac=parkingspot.TOAC
--env.info(string.format("FF asset=%s (id=%d): needs terminal type=%d, id=%d, #obstacles=%d", _asset.templatename, _asset.uid, terminaltype, _termid, #obstacles))
local free=true
local problem=nil
-- Safe parking using TO_AC from DCS result.
if self.safeparking and _toac then
free=false
self:T("Parking spot %d is occupied by other aircraft taking off or landing.", _termid)
end
-- Loop over all obstacles.
for _,obstacle in pairs(obstacles) do
-- Check if aircraft overlaps with any obstacle.
local dist=_spot:Get2DDistance(obstacle.coord)
local safe=_overlap(ratcraft.size, obstacle.size, dist)
-- Spot is blocked.
if not safe then
--env.info(string.format("FF asset=%s (id=%d): spot id=%d dist=%.1fm is NOT SAFE", _asset.templatename, _asset.uid, _termid, dist))
free=false
problem=obstacle
problem.dist=dist
break
else
--env.info(string.format("FF asset=%s (id=%d): spot id=%d dist=%.1fm is SAFE", _asset.templatename, _asset.uid, _termid, dist))
end
end
-- Check if spot is free
if free then
-- Add parkingspot for this asset unit.
table.insert(parking, parkingspot)
self:T(self.lid..string.format("Parking spot #%d is free for ratcraft unit id=%d!", _termid, i))
-- Add the unit as obstacle so that this spot will not be available for the next unit.
table.insert(obstacles, {coord=_spot, size=ratcraft.size, name=ratcraft.templatename, type="ratcraft"})
-- Break loop over parking spots.
gotit=true
break
else
-- Debug output for occupied spots.
self:T(self.lid..string.format("Parking spot #%d is occupied or not big enough!", _termid))
if self.Debug then
local coord=problem.coord --Core.Point#COORDINATE
local text=string.format("Obstacle blocking spot #%d is %s type %s with size=%.1f m and distance=%.1f m.", _termid, problem.name, problem.type, problem.size, problem.dist)
coord:MarkToAll(string.format(text))
end
end
end -- check terminal type
end -- loop over parking spots
-- No parking spot for at least one unit :(
if not gotit then
self:T(self.lid..string.format("WARNING: No free parking spot for ratcraft unit i=%d", i))
return nil
end
end -- loop over units
return parking
end
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Flightplan functions
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Calculate the maximum height an aircraft can reach for the given parameters.
-- @param #RAT2 self
-- @param #number D Total distance in meters from Departure to holding point at destination.
-- @param #number alphaC Climb angle in rad.
-- @param #number alphaD Descent angle in rad.
-- @param #number Hdep AGL altitude of departure point.
-- @param #number Hdest AGL altitude of destination point.
-- @param #number Deltahhold Relative altitude of holding point above destination.
-- @return #number Maximum height the aircraft can reach.
function RAT2:_GetMaxHeight(D, alphaC, alphaD, Hdep, Hdest, Deltahhold)
local Hhold=Hdest+Deltahhold
local hdest=Hdest-Hdep
local hhold=hdest+Deltahhold
local Dp=math.sqrt(D^2 + hhold^2)
local alphaS=math.atan(hdest/D) -- slope angle
local alphaH=math.atan(hhold/D) -- angle to holding point (could be necative!)
local alphaCp=alphaC-alphaH -- climb angle with slope
local alphaDp=alphaD+alphaH -- descent angle with slope
-- ASA triangle.
local gammap=math.pi-alphaCp-alphaDp
local sCp=Dp*math.sin(alphaDp)/math.sin(gammap)
local sDp=Dp*math.sin(alphaCp)/math.sin(gammap)
-- Max height from departure.
local hmax=sCp*math.sin(alphaC)
return hmax
end
--- Make a flight plan from a departure to a destination airport.
-- @param #RAT2 self
-- @param Functional.RatCraft#RATCRAFT ratcraft Ratcraft object.
-- @param Wrapper.Airbase#AIRBASE departure Departure airbase.
-- @param Wrapper.Airbase#AIRBASE destination Destination airbase.
-- @return #table Table of flightplan waypoints.
-- @return #table Table of flightplan coordinates.
function RAT2:_GetFlightplan(ratcraft, departure, destination)
-- Parameters
local Vmax=ratcraft.speedmax
local Range=ratcraft.range
local category=ratcraft.category
local ceiling=ratcraft.DCSdesc.Hmax
local Vymax=ratcraft.DCSdesc.VyMax
-- Max cruise speed 90% of max speed.
local VxCruiseMax=0.90*Vmax
-- Min cruise speed 70% of max cruise or 600 km/h whichever is lower.
local VxCruiseMin = math.min(VxCruiseMax*0.75, 750)
-- Cruise speed (randomized). Expectation value at midpoint between min and max.
local VxCruise = UTILS.RandomGaussian((VxCruiseMax-VxCruiseMin)/2+VxCruiseMin, (VxCruiseMax-VxCruiseMax)/4, VxCruiseMin, VxCruiseMax)
-- Climb speed 90% ov Vmax but max 720 km/h.
local VxClimb = math.min(Vmax*0.90, 720)
-- Descent speed 60% of Vmax but max 500 km/h.
local VxDescent = math.min(Vmax*0.60, 500)
-- Holding speed is 90% of descent speed.
local VxHolding = VxDescent*0.9
-- Final leg is 90% of holding speed.
local VxFinal = VxHolding*0.9
-- Reasonably civil climb speed Vy=1500 ft/min = 7.6 m/s but max aircraft specific climb rate.
local VyClimb=math.min(7.6, Vymax)
-- Climb angle in rad.
local AlphaClimb=math.rad(4)
-- Descent angle in rad. Moderate 4 degrees.
local AlphaDescent=math.rad(4)
-- Expected cruise level (peak of Gaussian distribution)
local FLcruise_expect=150*RAT.unit.FL2m
if category==Group.Category.HELICOPTER then
FLcruise_expect=1000 -- 1000 m ASL
end
-------------------------
--- DEPARTURE AIRPORT ---
-------------------------
-- Coordinates of departure point.
local Pdeparture=departure:GetCoordinate()
-- Height ASL of departure point.
local H_departure=Pdeparture.y
---------------------------
--- DESTINATION AIRPORT ---
---------------------------
-- Position of destination airport.
local Pdestination=destination:GetCoordinate()
-- Height ASL of destination airport/zone.
local H_destination=Pdestination.y
-----------------------------
--- DESCENT/HOLDING POINT ---
-----------------------------
-- Get a random point between 5 and 10 km away from the destination.
local Rhmin=5000
local Rhmax=10000
-- For helos we set a distance between 500 to 1000 m.
if category==Group.Category.HELICOPTER then
Rhmin=500
Rhmax=1000
end
-- Coordinates of the holding point. y is the land height at that point.
local Pholding=Pdestination:GetRandomCoordinateInRadius(Rhmax, Rhmin)
-- Distance from holding point to final destination (not used).
local d_holding=Pholding:Get2DDistance(Pdestination)
-- AGL height of holding point.
local H_holding=Pholding.y
---------------
--- GENERAL ---
---------------
-- We go directly to the holding point not the destination airport. From there, planes are guided by DCS to final approach.
local heading=Pdeparture:HeadingTo(Pholding)
local d_total=Pdeparture:Get2DDistance(Pholding)
------------------------------
--- Holding Point Altitude ---
------------------------------
-- Holding point altitude. For planes between 1600 and 2400 m AGL. For helos 160 to 240 m AGL.
local h_holding=1200
if category==Group.Category.HELICOPTER then
h_holding=150
end
h_holding=UTILS.Randomize(h_holding, 0.2)
-- Max holding altitude.
local DeltaholdingMax=self:_GetMaxHeight(d_total, AlphaClimb, AlphaDescent, H_departure, H_holding, 0)
if h_holding>DeltaholdingMax then
h_holding=math.abs(DeltaholdingMax)
end
-- This is the height ASL of the holding point we want to fly to.
local Hh_holding=H_holding+h_holding
---------------------------
--- Max Flight Altitude ---
---------------------------
-- Get max flight altitude relative to H_departure.
local h_max=self:_GetMaxHeight(d_total, AlphaClimb, AlphaDescent, H_departure, H_holding, h_holding)
-- Max flight level ASL aircraft can reach for given angles and distance.
local FLmax = h_max+H_departure
--CRUISE
-- Min cruise alt is just above holding point at destination or departure height, whatever is larger.
local FLmin=math.max(H_departure, Hh_holding)
-- Ensure that FLmax not above its service ceiling.
FLmax=math.min(FLmax, ceiling)
-- If the route is very short we set FLmin a bit lower than FLmax.
if FLmin>FLmax then
FLmin=FLmax
end
-- Expected cruise altitude - peak of gaussian distribution.
if FLcruise_expect<FLmin then
FLcruise_expect=FLmin
end
if FLcruise_expect>FLmax then
FLcruise_expect=FLmax
end
-- Set cruise altitude. Selected from Gaussian distribution but limited to FLmin and FLmax.
local FLcruise=UTILS.RandomGaussian(FLcruise_expect, math.abs(FLmax-FLmin)/4, FLmin, FLmax)
-- Climb and descent heights.
local h_climb = FLcruise - H_departure
local h_descent = FLcruise - Hh_holding
-- Get distances.
local d_climb = h_climb/math.tan(AlphaClimb)
local d_descent = h_descent/math.tan(AlphaDescent)
local d_cruise = d_total-d_climb-d_descent
-- Debug.
local text=string.format("Flight plan:\n")
text=text..string.format("Vx max = %.2f km/h\n", Vmax)
text=text..string.format("Vx climb = %.2f km/h\n", VxClimb*3.6)
text=text..string.format("Vx cruise = %.2f km/h\n", VxCruise*3.6)
text=text..string.format("Vx descent = %.2f km/h\n", VxDescent*3.6)
text=text..string.format("Vx holding = %.2f km/h\n", VxHolding*3.6)
text=text..string.format("Vx final = %.2f km/h\n", VxFinal*3.6)
text=text..string.format("Vy max = %.2f m/s\n", Vymax)
text=text..string.format("Vy climb = %.2f m/s\n", VyClimb)
text=text..string.format("Alpha Climb = %.2f Deg\n", math.deg(AlphaClimb))
text=text..string.format("Alpha Descent = %.2f Deg\n", math.deg(AlphaDescent))
text=text..string.format("Dist climb = %.3f km\n", d_climb/1000)
text=text..string.format("Dist cruise = %.3f km\n", d_cruise/1000)
text=text..string.format("Dist descent = %.3f km\n", d_descent/1000)
text=text..string.format("Dist total = %.3f km\n", d_total/1000)
text=text..string.format("h_climb = %.3f km\n", h_climb/1000)
text=text..string.format("h_desc = %.3f km\n", h_descent/1000)
text=text..string.format("h_holding = %.3f km\n", h_holding/1000)
text=text..string.format("h_max = %.3f km\n", h_max/1000)
text=text..string.format("FL min = %.3f km\n", FLmin/1000)
text=text..string.format("FL expect = %.3f km\n", FLcruise_expect/1000)
text=text..string.format("FL cruise * = %.3f km\n", FLcruise/1000)
text=text..string.format("FL max = %.3f km\n", FLmax/1000)
text=text..string.format("Ceiling = %.3f km\n", ceiling/1000)
text=text..string.format("Max range = %.3f km\n", Range/1000)
self:T(self.lid..text)
-- Ensure that cruise distance is positve. Can be slightly negative in special cases. And we don't want to turn back.
if d_cruise<0 then
d_cruise=100
end
------------------------
--- Create Waypoints ---
------------------------
-- Waypoints and coordinates
local wp={}
local c={}
--- Departure/Take-off
c[#c+1]=Pdeparture
wp[#wp+1]=Pdeparture:WaypointAir("RADIO", COORDINATE.WaypointType.TakeOffParking, COORDINATE.WaypointAction.FromParkingArea, VxClimb, true, departure, nil, "Departure")
--- Begin of Cruise
local Pcruise=Pdeparture:Translate(d_climb, heading)
Pcruise.y=FLcruise
c[#c+1]=Pcruise
wp[#wp+1]=Pcruise:WaypointAir("BARO", COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, VxCruise, true, nil, nil, "Cruise")
--- Descent
local Pdescent=Pcruise:Translate(d_cruise, heading)
Pdescent.y=FLcruise
c[#c+1]=Pdescent
wp[#wp+1]=Pdescent:WaypointAir("BARO", COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, VxDescent, true, nil, nil, "Descent")
--- Holding point
Pholding.y=H_holding+h_holding
c[#c+1]=Pholding
wp[#wp+1]=Pholding:WaypointAir("BARO", COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, VxHolding, true, nil, nil, "Holding")
--- Final destination.
c[#c+1]=Pdestination
wp[#wp+1]=Pdestination:WaypointAir("RADIO", COORDINATE.WaypointType.Land, COORDINATE.WaypointAction.Landing, VxFinal, true, destination, nil, "Final Destination")
-- Mark points at waypoints for debugging.
if self.Debug or true then
for i,coord in pairs(c) do
local coord=coord --Core.Point#COORDINATE
local dist=0
if i>1 then
dist=coord:Get2DDistance(c[i-1])
end
coord:MarkToAll(string.format("Waypoint %i, distance = %.2f km",i, dist/1000))
end
end
return wp,c
end
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,596 @@
--- **Functional** - (R2.5) - Random Air Traffic.
--
--
--
-- RATCRAFT creates random air traffic on the map.
--
--
--
-- **Main Features:**
--
-- * It's very random.
--
-- ===
--
-- ### Author: **funkyfranky**
-- @module Functional.RatCraft
-- @image Functional_Rat2.png
--- RATCRAFT
--
-- @type RATCRAFT
-- @field #string ClassName Name of the class.
-- @field #boolean Debugmode Debug mode. Messages to all about status.
-- @field #string lid Class id string for output to DCS log file.
-- @field #string templatename Name of the group template.
-- @field #string alias Alias for spawn prefix. Default template group name.
-- @field #table template Table of the group template.
-- @field Wrapper.Group#GROUP templategroup Template group.
-- @field #number coalition Coalition side.
-- @field #number country Country number.
-- @field #string actype Aircraft type name.
-- @field #number category Category (plane=X, helo=Y).
-- @field #string attribute Generalized attribute.
-- @field #number ceiling Max altitude in meters of the aircraft group.
-- @field #number speedmax Max speed in km/h of the aircraft group.
-- @field #number sizex Size X-axis in meters.
-- @field #number sizez Size Z-axis in meters.
-- @field #number size Max size (X, Z) in meters.
-- @field #table liveries Table of liveries.
-- @field #string livery Current livery.
-- @field #string skill Skill of group.
-- @field #string onboard Onboard number. This should better be on UNIT level!
-- @field #table departures Defined departures.
-- @field #table departure Current departure airbase or zone.
-- @field #table destinations Defined destinations.
-- @field #table destination Current destination.
-- @field #boolean commute If true, commute between to airbases/zones.
-- @field #boolean journey If true, continue journey from the current destination.
-- @field #string takeoff Takeoff type cold, hot, air.
-- @field #string landing Landing type.
-- @field #table flights Table of flight groups.
-- @field #number Nspawn Number of max spawned aircraft groups.
-- @field #number Nunits Number of units in group.
-- @extends Core.Fsm#FSM
RATCRAFT = {
ClassName = "RATCRAFT",
Debugmode = false,
lid = nil,
templatename = nil,
alias = nil,
template = nil,
templategroup = nil,
coalition = nil,
country = nil,
actype = nil,
category = nil,
attribute = nil,
ceiling = nil,
speedmax = nil,
sizex = nil,
sizez = nil,
size = nil,
liveries = {},
livery = nil,
skill = nil,
onboard = nil,
departures = {},
destinations = {},
departure = nil,
destination = nil,
commute = nil,
journey = nil,
takeoff = nil,
landing = nil,
flights = {},
Nspawn = 2,
Nunits = nil,
}
--- Generalized asset attributes. Can be used to request assets with certain general characteristics. See [DCS attributes](https://wiki.hoggitworld.com/view/DCS_enum_attributes) on hoggit.
-- @type RATCRAFT.Attribute
-- @field #string TRANSPORTPLANE Airplane with transport capability. This can be used to transport other assets.
-- @field #string AWACS Airborne Early Warning and Control System.
-- @field #string FIGHTER Fighter, interceptor, ... airplane.
-- @field #string BOMBER Aircraft which can be used for strategic bombing.
-- @field #string TANKER Airplane which can refuel other aircraft.
-- @field #string TRANSPORTHELO Helicopter with transport capability. This can be used to transport other assets.
-- @field #string ATTACKHELO Attack helicopter.
-- @field #string UAV Unpiloted Aerial Vehicle, e.g. drones.
RATCRAFT.Attribute = {
TRANSPORTPLANE="TransportPlane",
AWACS="AWACS",
FIGHTER="Fighter",
BOMBER="Bomber",
TANKER="Tanker",
TRANSPORTHELO="TransportHelo",
ATTACKHELO="AttackHelo",
UAV="UAV",
OTHER="Other",
}
--- Departure/destination type, i.e. airbase or zone.
-- @type RATCRAFT.DeType
-- @field #string AIRBASE Departure/destination is an airbase.
-- @field #string ZONE Departure/destination is a zone.
RATCRAFT.DeType={
AIRBASE="Airbase",
ZONE="Zone",
}
--- Departure/destination parameters.
-- @type RATCRAFT.Departure
-- @field #string name Name of the departure/destination airbase/zone.
-- @field #string type Type of the departure/destination, i.e. an airbase or a zone.
-- @field #table parking Number of parking spot IDs for the aircraft.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO list
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO: helos
-- TODO: despawn when arrived
-- TODO: zones as departures
-- TODO: zones as destinations
-- TODO: monitor if stationary
-- TODO: commute
-- TODO: continue journey
-- TODO: return zone
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Constructor
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Create a new RATCRAFT class object from a template group defined in the mission editor.
-- @param #RATCRAFT self
-- @param #string groupname Name of the **late activated** template group.
-- @param #number nspawn Number of groups to spawn. Default 1.
-- @param #string alias (Optional) Alias for the group name used as spawn name prefix. Default is the group name.
-- @return #RATCRAFT self
function RATCRAFT:New(groupname, nspawn, alias)
-- Inherit everything from FSM class.
local self=BASE:Inherit(self, FSM:New()) --#RATCRAFT
-- Defaults
self.Nspawn=nspawn or 1
self.alias=alias or groupname
-- Start State.
self:SetStartState("Stopped")
-- Add FSM transitions.
-- From State --> Event --> To State
self:AddTransition("Stopped", "Load", "Stopped") -- Load ratcraft from file.
self:AddTransition("Stopped", "Start", "Running") -- Start RAT2 script.
self:AddTransition("Running", "Pause", "Paused") -- Pause spawning RATCRAFT.
self:AddTransition("Paused", "Unpause", "Running") -- UnPause spawning RATCRAFT.
-- Initialize aircraft parameters.
self:_Init(groupname)
self:Start()
return self
end
--- Init aircraft parameters.
-- @param #RATCRAFT self
-- @param #string groupname Name of the template group.
-- @return #RATCRAFT self
function RATCRAFT:_Init(groupname)
self.templatename=groupname
self.templategroup=GROUP:FindByName(groupname)
self.template=self.templategroup:GetTemplate()
self.speedmax=self.templategroup:GetSpeedMax()
self.range=1000000
self.DCSdesc=self.templategroup:GetDCSDesc(1)
self.coalition=self.templategroup:GetCoalition()
self.country=self.templategroup:GetUnit(1):GetCountry()
self.category=self.templategroup:GetUnit(1):GetCategory()
self.Nunits=#self.templategroup:GetUnits()
-- aircraft dimensions
self.sizex=self.DCSdesc.box.max.x
self.sizey=self.DCSdesc.box.max.y
self.sizez=self.DCSdesc.box.max.z
self.size =math.max(self.sizex, self.sizez)
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- User Functions
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Add adeparture airbase for the aircraft.
-- @param #RATCRAFT self
-- @param #string airbasename Departure airbase name.
-- @param #table parking (Optional) Table of parking spot IDs. At least the number of units in the group must be given.
-- @return #RATCRAFT self
function RATCRAFT:AddDepartureAirbase(airbasename, parking)
local departure={} --#RATCRAFT.Departure
local spots=nil
if parking then
if type(parking)=="number" then
parking={parking}
end
-- Convert parking IDs to complete parking data.
spots={}
local airbase=AIRBASE:FindByName(airbasename)
for _,TerminalID in pairs(parking) do
local spot=airbase:GetParkingSpotData(TerminalID)
if spot then
self:I(string.format("Add in parking spot %d", spot.TerminalID))
table.insert(spots, spot)
end
end
end
departure.name=airbasename
departure.type=RATCRAFT.DeType.AIRBASE
departure.parking=spots
table.insert(self.departures, departure)
return self
end
--- Add destination airbase for the aircraft and optionally specific parking spot IDs to be used by this group.
-- @param #RATCRAFT self
-- @param #string airbasename Destination airbase name.
-- @param #table parking (Optional) Table of parking spot IDs. At least the number of units in the group must be given.
-- @return #RATCRAFT self
function RATCRAFT:AddDestinationAirbase(airbasename, parking)
local destination={} --#RATCRAFT.Departure
-- Convert parking IDs to complete parking data.
local spots=nil
if parking then
if type(parking)=="number" then
parking={parking}
end
spots={}
local airbase=AIRBASE:FindByName(airbasename)
for _,TerminalID in pairs(parking) do
local spot=airbase:GetParkingSpotData(TerminalID)
if spot then
table.insert(spots, spot)
end
end
end
destination.name=airbasename
destination.type=RATCRAFT.DeType.AIRBASE
destination.parking=spots
table.insert(self.destinations, destination)
return self
end
--- Add a departure for the aircraft.
-- @param #RATCRAFT self
-- @param Core.Zone#ZONE zone Zone.
-- @return #RATCRAFT self
function RATCRAFT:AddDepartureZone(zone)
local departure={} --#RATCRAFT.Departure
departure.type={}
table.insert(self.departures, zone)
return self
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- FSM Functions
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Add a departure for the aircraft.
-- @param #RATCRAFT self
function RATCRAFT:onafterStart()
-- Create flight groups.
for i=1,self.Nspawn do
-- Group name.
local groupname=string.format("%s-%02d", self.alias, i)
-- New flight group.
local flightgroup=FLIGHTGROUP:New(groupname)
-- Add flight to tabloe.
table.insert(self.flights, flightgroup)
end
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Departure Functions
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Get departure.
-- @param #RATCRAFT self
-- @return #RATCRAFT.Departure
-- @return #table Parking data table.
function RATCRAFT:GetDeparture()
-- TODO: for commute/continue, set departure to current airbase/zone. Get same parking spot.
local departures=UTILS.DeepCopy(self.departures)
-- Try each departure in random order.
for i=1,#departures do
-- Roll dice.
local r=math.random(#departures)
-- Get random departure
local departure=departures[r] --#RATCRAFT.Departure
-- Check if airbase or zone.
if departure.type==RATCRAFT.DeType.AIRBASE then
---
-- Airbase
---
-- Departure airbase.
local airbase=AIRBASE:FindByName(departure.name)
if airbase then
-- Template group.
local group=self.templategroup --Wrapper.Group#GROUP
-- Get number of free parking spots.
--local parking=airbase:FindFreeParkingSpotForAircraft(group)
local parking=self:GetParkingDeparture(departure)
-- Check if parking is sufficient.
if parking and #parking>=self.Nunits then
self:I(string.format("Returning departure %s", departure.name))
return departure, parking
else
self:I(string.format("Removing departure %s", departure.name))
-- Remove from table so it does not get selected again.
table.remove(departures, r)
end
else
self:E("ERROR: Could not find departure airbase!")
end
else
---
-- Zone
---
-- Departure airbase.
local zone=ZONE:New(departure.name)
if zone then
-- TODO: check if in range.
return departure
else
self:E("ERROR: Could not find departure zone!")
end
end
end
end
--- Get parking at departure.
-- @param #RATCRAFT self
-- @param #RATCRAFT.Departure departure The chosen departure.
-- @return #table Parking data table or nil if not enough spots.
function RATCRAFT:GetParkingDeparture(departure)
if departure.type==RATCRAFT.DeType.AIRBASE then
local airbase=AIRBASE:FindByName(departure.name)
if airbase then
local parkingdata=airbase:GetParkingSpotsTable()
if departure.parking then
---
-- User specified parking spots
---
-- Check if free?
local parking={}
for _,_spot in pairs(parkingdata) do
local spot=_spot --Wrapper.Airbase#AIRBASE.ParkingSpot
self:I(string.format("Checking spot %d", spot.TerminalID))
-- Check if spot if free?
if spot.Free then
self:I(string.format("Spot %d is FREE", spot.TerminalID))
-- Check if spot is in user table?
for _,_park in pairs(departure.parking) do
local park=_park --Wrapper.Airbase#AIRBASE.ParkingSpot
if park.TerminalID==spot.TerminalID then
self:I(string.format("Adding spot %d to parking", spot.TerminalID))
table.insert(parking, spot)
end
end
end
end
-- Only return data if sufficient spots available.
if #parking>=self.Nunits then
self:I(string.format("Found valid parking for %d spots", #parking))
return parking
end
else
---
-- Choose parking from what is free
---
local parking={}
for _,_spot in pairs(parkingdata) do
local spot=_spot --Wrapper.Airbase#AIRBASE.ParkingSpot
if spot.Free then
table.insert(parking, spot)
end
if #parking>=self.Nunits then
return parking
end
end
end
end
end
self:I(string.format("Could not find valid parking data"))
return nil
end
--- Get destination.
-- @param #RATCRAFT self
-- @param #RATCRAFT.Departure departure The chosen departure.
-- @return #RATCRAFT.Departure
function RATCRAFT:GetDestination(departure)
if departure==nil then
return nil
end
-- TODO: for commute, switch departure and destination.
-- Create copy of all destinations.
local destinations=UTILS.DeepCopy(self.destinations)
-- Try each destination in random order.
for i=1,#destinations do
-- Roll dice.
local r=math.random(#destinations)
-- Get random departure
local destination=destinations[r] --#RATCRAFT.Departure
-- Check if airbase or zone.
if destination.type==RATCRAFT.DeType.AIRBASE then
---
-- Airbase
---
-- Get airbase.
local airbase=AIRBASE:FindByName(destination.name)
local depart=AIRBASE:FindByName(departure.name)
if airbase then
-- TODO: check
-- coalition, terminal type, distance
-- Distance between departure and destination.
local distance=depart:GetCoordinate():Get2DDistance(airbase:GetCoordinate())
if distance then
self:I(string.format("Returning destination %s", destination.name))
return destination
else
self:I(string.format("Removing destination %s", destination.name))
-- Remove from table so it does not get selected again.
table.remove(destinations, r)
end
else
self:E("ERROR: Could not find airbase!")
end
else
---
-- Zone
---
-- Departure airbase.
local zone=ZONE:New(destination.name)
if zone then
-- TODO: check if in range.
return destination
else
self:E("ERROR: Could not find destination zone!")
end
end
end
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Status Functions
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Get number of alive groups
-- @param #RATCRAFT self
-- @return #number N live.
function RATCRAFT:_GetAliveGroups()
local n=0
for _,_flight in pairs(self.flights) do
local flight=_flight --Ops.FlightGroup#FLIGHTGROUP
if not flight:IsDead() then
n=n+1
end
end
return n
end
@@ -0,0 +1,757 @@
--- **Functional** - (R2.5) - Simple and Persistent Player Scoring.
--
--
-- Score!
--
--
-- ## Main Features:
--
-- * Good stuff.
--
-- ===
--
-- ### Author: **funkyfranky**
-- @module Functional.SimpleScore
-- @image Functional_SimpleScore.png
--- SCORE class.
-- @type SCORE
-- @field #string ClassName Name of the class.
-- @field #boolean Debug Debug mode. Messages to all about status.
-- @field #string lid Class id string for output to DCS log file.
-- @field #table menuadded Table of groups the menu was added for.
-- @field #boolean menudisabled If true, F10 menu for players is disabled.
-- @field #table playerscores Player score table.
-- @extends Core.Fsm#FSM
--- Goooooaaaallllll!
--
-- ===
--
-- ![Banner Image](..\Presentations\SCORE\SCORE_Main.png)
--
-- # The Scoring Concept
--
-- Score
--
-- # Basic Script
--
-- -- Create a new score object.
-- score=SCORE:New()
--
-- -- Start score.
-- SCORE:Start()
--
-- # Training Zones
--
-- Players are only protected if they are inside one of the training zones.
--
-- -- Create a new missile trainer object.
-- SCORE=SCORE:New()
--
-- -- Add training zones.
-- SCORE:AddSafeZone(ZONE:New("Training Zone Alpha")
-- SCORE:AddSafeZone(ZONE:New("Training Zone Bravo")
--
-- -- Start missile trainer.
-- SCORE:Start()
--
--
-- Todo!
--
--
-- @field #SCORE
SCORE = {
ClassName = "SCORE",
Debug = false,
lid = nil,
menuadded = {},
menudisabled = nil,
playerscores = nil,
}
--- Player data table holding all important parameters of each player.
-- @type SCORE.PlayerData
-- @field Wrapper.Unit#UNIT unit Aircraft of the player.
-- @field #string unitname Name of the unit.
-- @field Wrapper.Client#CLIENT client Client object of player.
-- @field #string callsign Callsign of player.
-- @field Wrapper.Group#GROUP group Aircraft group of player.
-- @field #string groupname Name of the the player aircraft group.
-- @field #string name Player name.
-- @field #number coalition Coalition number of player.
-- @field #table hit Table of hit units.
--- Hit unit data.
-- @type SCORE.HitData
-- @field #string unitname Name of the hit unit.
-- @field #string category Category of hit unit.
-- @field #number score Score
-- @field #boolean friendly If true, unit is friendly.
-- @field #boolean destroyed If true, unit was destroyed.
--- Create a new SCORE class object.
-- @param #SCORE self
-- @return #SCORE self.
function SCORE:New()
self.lid="SCORE | "
-- Inherit everthing from FSM class.
local self=BASE:Inherit(self, FSM:New()) -- #SCORE
-- Defaults:
self:SetDefaultMissileDestruction(true)
self:SetDefaultLaunchAlerts(true)
self:SetDefaultLaunchMarks(true)
self:SetExplosionPower()
-- Start State.
self:SetStartState("Stopped")
-- Add FSM transitions.
-- From State --> Event --> To State
self:AddTransition("Stopped", "Start", "Running") -- Start SCORE script.
self:AddTransition("*", "Status", "*") -- Status update.
------------------------
--- Pseudo Functions ---
------------------------
--- Triggers the FSM event "Start". Starts the SCORE. Initializes parameters and starts event handlers.
-- @function [parent=#SCORE] Start
-- @param #SCORE self
--- Triggers the FSM event "Start" after a delay. Starts the SCORE. Initializes parameters and starts event handlers.
-- @function [parent=#SCORE] __Start
-- @param #SCORE self
-- @param #number delay Delay in seconds.
--- Triggers the FSM event "Stop". Stops the SCORE and all its event handlers.
-- @param #SCORE self
--- Triggers the FSM event "Stop" after a delay. Stops the SCORE and all its event handlers.
-- @function [parent=#SCORE] __Stop
-- @param #SCORE self
-- @param #number delay Delay in seconds.
--- Triggers the FSM event "Status".
-- @function [parent=#SCORE] Status
-- @param #SCORE self
--- Triggers the FSM event "Status" after a delay.
-- @function [parent=#SCORE] __Status
-- @param #SCORE self
-- @param #number delay Delay in seconds.
return self
end
--- On after Start event. Starts the missile trainer and adds event handlers.
-- @param #SCORE self
-- @param #string From From state.
-- @param #string Event Event.
-- @param #string To To state.
function SCORE:onafterStart(From, Event, To)
-- Short info.
local text=string.format("Starting SCORE v%s", SCORE.version)
env.info(text)
-- Init player scores table.
self.playerscores={}
-- Event handlers
self:HandleEvent(EVENTS.Dead, self._EventDeadOrCrash)
self:HandleEvent(EVENTS.Crash, self._EventDeadOrCrash)
self:HandleEvent(EVENTS.Hit, self._EventHit)
self:HandleEvent(EVENTS.Birth)
self:HandleEvent(EVENTS.PlayerLeaveUnit)
-- Handle events:
self:HandleEvent(EVENTS.Birth)
self:HandleEvent(EVENTS.Shot)
if self.Debug then
self:TraceClass(self.ClassName)
self:TraceLevel(2)
end
self:__Status(-10)
end
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Event Functions
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- SCORE event handler for event birth.
-- @param #SCORE self
-- @param Core.Event#EVENTDATA EventData
function SCORE:OnEventBirth(EventData)
self:F3({eventbirth = EventData})
-- Nil checks.
if EventData==nil then
self:E(self.lid.."ERROR: EventData=nil in event BIRTH!")
self:E(EventData)
return
end
if EventData.IniUnit==nil then
self:E(self.lid.."ERROR: EventData.IniUnit=nil in event BIRTH!")
self:E(EventData)
return
end
-- Player unit and name.
local _unitName=EventData.IniUnitName
local playerunit, playername=self:_GetPlayerUnitAndName(_unitName)
-- Debug info.
self:T(self.lid.."BIRTH: unit = "..tostring(EventData.IniUnitName))
self:T(self.lid.."BIRTH: group = "..tostring(EventData.IniGroupName))
self:T(self.lid.."BIRTH: player = "..tostring(playername))
-- Check if player entered.
if playerunit and playername then
local _uid=playerunit:GetID()
local _group=playerunit:GetGroup()
local _callsign=playerunit:GetCallsign()
-- Debug output.
local text=string.format("Pilot %s, callsign %s entered unit %s of group %s.", playername, _callsign, _unitName, _group:GetName())
self:T(self.lid..text)
MESSAGE:New(text, 5):ToAllIf(self.Debug)
-- Add F10 radio menu for player.
if not self.menudisabled then
SCHEDULER:New(nil, self._AddF10Commands, {self,_unitName}, 0.1)
end
-- Player data.
local playerData={} --#SCORE.PlayerData
-- Player unit, client and callsign.
playerData.unit = playerunit
playerData.unitname = _unitName
playerData.group = _group
playerData.groupname = _group:GetName()
playerData.name = playername
playerData.callsign = playerData.unit:GetCallsign()
playerData.client = CLIENT:FindByName(_unitName, nil, true)
playerData.coalition = _group:GetCoalition()
playerData.hit = playerData.hit or {}
-- Init player data.
self.players[playername]=playerData
end
end
--- Handles the OnHit event for the scoring.
-- @param #SCORE self
-- @param Core.Event#EVENTDATA Event
function SCORE:_EventOnHit(Event)
self:F( { Event } )
local InitUnit = nil
local InitUNIT = nil
local InitUnitName = ""
local InitGroup = nil
local InitGroupName = ""
local InitPlayerName = nil
local InitCoalition = nil
local InitCategory = nil
local InitType = nil
local InitUnitCoalition = nil
local InitUnitCategory = nil
local InitUnitType = nil
local TargetUnit = nil
local TargetUNIT = nil
local TargetUnitName = ""
local TargetGroup = nil
local TargetGroupName = ""
local TargetPlayerName = nil
local TargetCoalition = nil
local TargetCategory = nil
local TargetType = nil
local TargetUnitCoalition = nil
local TargetUnitCategory = nil
local TargetUnitType = nil
if Event.IniDCSUnit then
InitUnit = Event.IniDCSUnit
InitUNIT = Event.IniUnit
InitUnitName = Event.IniDCSUnitName
InitGroup = Event.IniDCSGroup
InitGroupName = Event.IniDCSGroupName
InitPlayerName = Event.IniPlayerName
InitCoalition = Event.IniCoalition
InitCategory = Event.IniCategory
InitType = Event.IniTypeName
InitUnitCoalition = _SCORINGCoalition[InitCoalition]
InitUnitCategory = _SCORINGCategory[InitCategory]
InitUnitType = InitType
self:T( { InitUnitName, InitGroupName, InitPlayerName, InitCoalition, InitCategory, InitType , InitUnitCoalition, InitUnitCategory, InitUnitType } )
end
if Event.TgtDCSUnit then
TargetUnit = Event.TgtDCSUnit
TargetUNIT = Event.TgtUnit
TargetUnitName = Event.TgtDCSUnitName
TargetGroup = Event.TgtDCSGroup
TargetGroupName = Event.TgtDCSGroupName
TargetPlayerName = Event.TgtPlayerName
TargetCoalition = Event.TgtCoalition
TargetCategory = Event.TgtCategory
TargetType = Event.TgtTypeName
TargetUnitCoalition = _SCORINGCoalition[TargetCoalition]
TargetUnitCategory = _SCORINGCategory[TargetCategory]
TargetUnitType = TargetType
end
-- Current time.
local Tnow=timer.getTime()
if InitPlayerName~=nil then -- It is a player that is hitting something
self:T("Hitting Something")
-- What is he hitting?
if TargetCategory then
-- A target got hit, score it.
-- Player contains the score data from self.Players[InitPlayerName]
local player=self.Players[InitPlayerName] --#SCORE.PlayerData
-- Hit table.
player.hit[TargetUnitName]=player.hit[TargetUnitName] or {}
local hit=player.hit[TargetUnitName] --#SCORE.HitData
hit.score = hit.score or 0
hit.penalty = hit.penalty or 0
hit.timeStamp = hit.timeStamp or 0
hit.unit = hit.unit or TargetUNIT
hit.threatLevel, hit.threatType = hit.unit:GetThreatLevel()
-- Only grant hit scores if there was more than one second between the last hit.
if Tnow-hit.timeStamp>1 then
-- Update timestamp
hit.timeStamp = Tnow
if TargetPlayerName~=nil then
-- It is a player hitting another player ...
hit.otherplayer=true
end
local Score = 0
if InitCoalition then -- A coalition object was hit.
if InitCoalition == TargetCoalition then
------------------
-- Hit Friendly --
------------------
hit.friendly=true
player.penalty = player.penalty-10
hit.penalty=hit.penalty-10
-- Check if target was another player.
if TargetPlayerName~=nil then -- It is a player hitting another player ...
else
end
-- Write penalty to CSV file.
--self:ScoreCSV( InitPlayerName, TargetPlayerName, "HIT_PENALTY", 1, -10, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
else
----------------
-- Hit Enemey --
----------------
hit.friendly=true
player.score=player.score+1
hit.score=hit.score+1
--hit.scoreHit = hit.ScoreHit + 1
-- Check if it was a player.
if TargetPlayerName~=nil then -- It is a player hitting another player ...
else
end
-- Write score to CSV file. Score 1 PT.
end
else -- A scenery object was hit.
end
end
end
end
end
--- Track DEAD or CRASH events for the scoring.
-- @param #SCORING self
-- @param Core.Event#EVENTDATA Event
function SCORING:_EventOnDeadOrCrash( Event )
self:F( { Event } )
local TargetUnit = nil
local TargetGroup = nil
local TargetUnitName = ""
local TargetGroupName = ""
local TargetPlayerName = ""
local TargetCoalition = nil
local TargetCategory = nil
local TargetType = nil
local TargetUnitCoalition = nil
local TargetUnitCategory = nil
local TargetUnitType = nil
if Event.IniDCSUnit then
TargetUnit = Event.IniUnit
TargetUnitName = Event.IniDCSUnitName
TargetGroup = Event.IniDCSGroup
TargetGroupName = Event.IniDCSGroupName
TargetPlayerName = Event.IniPlayerName
TargetCoalition = Event.IniCoalition
TargetCategory = Event.IniCategory
TargetType = Event.IniTypeName
TargetUnitCoalition = _SCORINGCoalition[TargetCoalition]
TargetUnitCategory = _SCORINGCategory[TargetCategory]
TargetUnitType = TargetType
self:T( { TargetUnitName, TargetGroupName, TargetPlayerName, TargetCoalition, TargetCategory, TargetType } )
end
-- Player contains the score and reference data for the player.
for PlayerName, _player in pairs(self.Players) do
local player=_player --#SCORE.PlayerData
if player and player.unit and player.unit:IsAlive() then
self:T( "Something got destroyed" )
-- Some variables
local InitUnitName = Player.UnitName
local InitUnitType = Player.UnitType
local InitCoalition = Player.UnitCoalition
local InitCategory = Player.UnitCategory
local InitUnitCoalition = _SCORINGCoalition[InitCoalition]
local InitUnitCategory = _SCORINGCategory[InitCategory]
self:T( { InitUnitName, InitUnitType, InitUnitCoalition, InitCoalition, InitUnitCategory, InitCategory } )
local Destroyed = false
local hit=player.hit[TargetUnitName] --#SCORE.HitData
-- What is the player destroying?
if hit and hit.timeStamp~=0 then -- Was there a hit for this unit for this player before registered?
local TargetThreatLevel = hit.threatLevel
local TargetThreatType = hit.threatType
Player.Destroy[TargetCategory] = Player.Destroy[TargetCategory] or {}
Player.Destroy[TargetCategory][TargetType] = Player.Destroy[TargetCategory][TargetType] or {}
local destroy={} --#SCORE.DestroyData
-- PlayerDestroy contains the destroy score data per category and target type of the player.
local TargetDestroy = Player.Destroy[TargetCategory][TargetType]
TargetDestroy.Score = TargetDestroy.Score or 0
TargetDestroy.ScoreDestroy = TargetDestroy.ScoreDestroy or 0
TargetDestroy.Penalty = TargetDestroy.Penalty or 0
TargetDestroy.PenaltyDestroy = TargetDestroy.PenaltyDestroy or 0
if TargetCoalition then
if InitCoalition == TargetCoalition then
---
-- Hit Friendly
---
local ThreatLevelTarget = TargetThreatLevel
local ThreatTypeTarget = TargetThreatType
local ThreatLevelPlayer = Player.ThreatLevel / 10 + 1
local ThreatPenalty = math.ceil( ( ThreatLevelTarget / ThreatLevelPlayer ) * self.ScaleDestroyPenalty / 10 )
self:F( { ThreatLevel = ThreatPenalty, ThreatLevelTarget = ThreatLevelTarget, ThreatTypeTarget = ThreatTypeTarget, ThreatLevelPlayer = ThreatLevelPlayer } )
Player.Penalty = Player.Penalty + ThreatPenalty
TargetDestroy.Penalty = TargetDestroy.Penalty + ThreatPenalty
TargetDestroy.PenaltyDestroy = TargetDestroy.PenaltyDestroy + 1
if Player.HitPlayers[TargetPlayerName] then
-- A player destroyed another friendly player.
else
-- A player destroyed another friendly target.
end
-- Write CSV penalty.
Destroyed = true
--self:ScoreCSV( PlayerName, TargetPlayerName, "DESTROY_PENALTY", 1, ThreatPenalty, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
else
---
-- Hit Enemy
---
local ThreatLevelTarget = TargetThreatLevel
local ThreatTypeTarget = TargetThreatType
local ThreatLevelPlayer = Player.ThreatLevel / 10 + 1
local ThreatScore = math.ceil( ( ThreatLevelTarget / ThreatLevelPlayer ) * self.ScaleDestroyScore / 10 )
self:F( { ThreatLevel = ThreatScore, ThreatLevelTarget = ThreatLevelTarget, ThreatTypeTarget = ThreatTypeTarget, ThreatLevelPlayer = ThreatLevelPlayer } )
Player.Score = Player.Score + ThreatScore
TargetDestroy.Score = TargetDestroy.Score + ThreatScore
TargetDestroy.ScoreDestroy = TargetDestroy.ScoreDestroy + 1
if Player.HitPlayers[TargetPlayerName] then
-- A player destroyed another enemy player.
else
-- A player destroyed another enemy target.
end
-- Write CSV.
Destroyed = true
--self:ScoreCSV( PlayerName, TargetPlayerName, "DESTROY_SCORE", 1, ThreatScore, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
local UnitName = TargetUnit:GetName()
-- Scoring for special objects.
local Score = self.ScoringObjects[UnitName]
if Score then
Player.Score = Player.Score + Score
TargetDestroy.Score = TargetDestroy.Score + Score
MESSAGE
:NewType( self.DisplayMessagePrefix .. "Special target '" .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " .. " destroyed! " ..
"Player '" .. PlayerName .. "' receives an extra " .. Score .. " points! Total: " .. Player.Score - Player.Penalty,
MESSAGE.Type.Information
)
:ToAllIf( self:IfMessagesScore() and self:IfMessagesToAll() )
:ToCoalitionIf( InitCoalition, self:IfMessagesScore() and self:IfMessagesToCoalition() )
-- Write CSV file.
self:ScoreCSV( PlayerName, TargetPlayerName, "DESTROY_SCORE", 1, Score, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
Destroyed = true
end
-- Check if there are Zones where the destruction happened.
for ZoneName, ScoreZoneData in pairs(self.ScoringZones) do
self:F( { ScoringZone = ScoreZoneData } )
local ScoreZone = ScoreZoneData.ScoreZone -- Core.Zone#ZONE_BASE
local Score = ScoreZoneData.Score
-- Check if target is in zone.
if ScoreZone:IsVec2InZone( TargetUnit:GetVec2() ) then
Player.Score = Player.Score + Score
TargetDestroy.Score = TargetDestroy.Score + Score
MESSAGE
:NewType( self.DisplayMessagePrefix .. "Target destroyed in zone '" .. ScoreZone:GetName() .. "'." ..
"Player '" .. PlayerName .. "' receives an extra " .. Score .. " points! " ..
"Total: " .. Player.Score - Player.Penalty,
MESSAGE.Type.Information )
:ToAllIf( self:IfMessagesZone() and self:IfMessagesToAll() )
:ToCoalitionIf( InitCoalition, self:IfMessagesZone() and self:IfMessagesToCoalition() )
-- Write CSV.
self:ScoreCSV( PlayerName, TargetPlayerName, "DESTROY_SCORE", 1, Score, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
Destroyed = true
end
end
end
else
---
-- Scenery Destroyed
---
-- Check if there are Zones where the destruction happened.
for ZoneName, ScoreZoneData in pairs(self.ScoringZones) do
local ScoreZone = ScoreZoneData.ScoreZone -- Core.Zone#ZONE_BASE
local Score = ScoreZoneData.Score
if ScoreZone:IsVec2InZone(TargetUnit:GetVec2()) then
Player.Score = Player.Score + Score
TargetDestroy.Score = TargetDestroy.Score + Score
-- Player destroyed scenery in scoring zone.
--Write CSV.
Destroyed = true
--self:ScoreCSV( PlayerName, "", "DESTROY_SCORE", 1, Score, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, "", "Scenery", TargetUnitType )
end
end
end
-- Delete now the hit cache if the target was destroyed.
-- Otherwise points will be granted every time a target gets killed by the players that hit that target.
-- This is only relevant for player to player destroys.
if Destroyed then
Player.Hit[TargetCategory][TargetUnitName].TimeStamp = 0
end
end
end
end
end
--- On before "Save" event. Checks if io and lfs are available.
-- @param #SCORE self
-- @param #string From From state.
-- @param #string Event Event.
-- @param #string To To state.
-- @param #string path (Optional) Path where the file is saved. Default is the DCS root installation folder or your "Saved Games\\DCS" folder if the lfs module is desanitized.
-- @param #string filename (Optional) File name for saving the player grades. Default is "SCORE-<ALIAS>_LSOgrades.csv".
function SCORE:onbeforeSave(From, Event, To, path, filename)
-- Check io module is available.
if not io then
self:E(self.lid.."ERROR: io not desanitized. Can't save player grades.")
return false
end
-- Check default path.
if path==nil and not lfs then
self:E(self.lid.."WARNING: lfs not desanitized. Results will be saved in DCS installation root directory rather than your \"Saved Games/DCS\" folder.")
end
return true
end
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- FSM Functions
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- On after "Save" event. Player data is saved to file.
-- @param #SCORE self
-- @param #string From From state.
-- @param #string Event Event.
-- @param #string To To state.
-- @param #string path Path where the file is saved. If nil, file is saved in the DCS root installtion directory or your "Saved Games" folder if lfs was desanitized.
-- @param #string filename (Optional) File name for saving the player grades. Default is "SCORE-<ALIAS>_LSOgrades.csv".
function SCORE:onafterSave(From, Event, To, path, filename)
--- Function that saves data to file
local function _savefile(filename, data)
local f = io.open(filename, "wb")
if f then
f:write(data)
f:close()
end
end
-- Set path or default.
if lfs then
path=path or lfs.writedir()
end
-- Set file name.
filename=filename or string.format("Score.csv")
-- Set path.
if path~=nil then
filename=path.."\\"..filename
end
-- Header line
local scores="Name,Pass,Points Final,Points Pass,Grade,Details,Wire,Tgroove,Case,Wind,Modex,Airframe,Carrier Type,Carrier Name,Theatre,Mission Time,Mission Date,OS Date\n"
local scores="Name,Player Unit,Player Coalition,Player Category,Score Type,Target Category,Target Name, Target Coalition,Target Player,Target Score,Mission Date, Mission Time, OS Date"
-- Loop over all players.
local n=0
for playername,grades in pairs(self.playerscores) do
-- Loop over player grades table.
for i,_grade in pairs(grades) do
local grade=_grade --#SCORE.LSOgrade
-- Check some stuff that could be nil.
local wire="n/a"
if grade.wire and grade.wire<=4 then
wire=tostring(grade.wire)
end
local Tgroove="n/a"
if grade.Tgroove and grade.Tgroove<=360 and grade.case<3 then
Tgroove=tostring(UTILS.Round(grade.Tgroove, 1))
end
local finalscore="n/a"
if grade.finalscore then
finalscore=tostring(UTILS.Round(grade.finalscore, 1))
end
-- Compile grade line.
scores=scores..string.format("%s,%d,%s,%.1f,%s,%s,%s,%s,%d,%s,%s,%s,%s,%s,%s,%s,%s,%s\n",
playername, i, finalscore, grade.points, grade.grade, grade.details, wire, Tgroove, grade.case,
grade.wind, grade.modex, grade.airframe, grade.carriertype, grade.carriername, grade.theatre, grade.mitime, grade.midate, grade.osdate)
n=n+1
end
end
-- Info
local text=string.format("Saving %d player LSO grades to file %s", n, filename)
self:I(self.lid..text)
-- Save file.
_savefile(filename, scores)
end
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,4 +1,4 @@
--- **Functional** - Make SAM sites execute evasive and defensive behaviour when being fired upon.
--- **Functional** -- Make SAM sites execute evasive and defensive behaviour when being fired upon.
--
-- ===
--
@@ -1,11 +1,9 @@
--- **Functional** - Short Range Air Defense System.
--- **Functional** -- Short Range Air Defense System
--
-- ===
--
-- ## Features:
--
-- * Short Range Air Defense System
-- * Controls a network of short range air/missile defense groups.
-- **SHORAD** - Short Range Air Defense System
-- Controls a network of short range air/missile defense groups.
--
-- ===
--
@@ -85,7 +85,6 @@
-- @field #boolean eventmoose If true, events are handled by MOOSE. If false, events are handled directly by DCS eventhandler. Default true.
-- @field Core.Zone#ZONE BattleZone
-- @field #boolean AutoEngage
-- @field #table waypoints Waypoints of the group as defined in the ME.
-- @extends Core.Fsm#FSM_CONTROLLABLE
--
@@ -266,7 +265,6 @@ SUPPRESSION={
DefaultAlarmState = "Auto",
DefaultROE = "Weapon Free",
eventmoose = true,
waypoints = {},
}
--- Enumerator of possible rules of engagement.
@@ -297,7 +295,7 @@ SUPPRESSION.MenuF10=nil
--- PSEUDOATC version.
-- @field #number version
SUPPRESSION.version="0.9.4"
SUPPRESSION.version="0.9.3"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -311,7 +309,7 @@ SUPPRESSION.version="0.9.4"
--- Creates a new AI_suppression object.
-- @param #SUPPRESSION self
-- @param Wrapper.Group#GROUP group The GROUP object for which suppression should be applied.
-- @return #SUPPRESSION self
-- @return #SUPPRESSION SUPPRESSION object or *nil* if group does not exist or is not a ground group.
function SUPPRESSION:New(group)
-- Inherits from FSM_CONTROLLABLE
@@ -322,7 +320,7 @@ function SUPPRESSION:New(group)
self.lid=string.format("SUPPRESSION %s | ", tostring(group:GetName()))
self:T(self.lid..string.format("SUPPRESSION version %s. Activating suppressive fire for group %s", SUPPRESSION.version, group:GetName()))
else
self:E("SUPPRESSION | Requested group does not exist! (Has to be a MOOSE group)")
self:E(self.lid.."SUPPRESSION | Requested group does not exist! (Has to be a MOOSE group.)")
return nil
end
@@ -1188,16 +1186,6 @@ function SUPPRESSION:onafterFightBack(Controllable, From, Event, To)
-- Set ROE and alarm state back to default.
self:_SetROE()
self:_SetAlarmState()
local group=Controllable --Wrapper.Group#GROUP
local Waypoints = group:GetTemplateRoutePoints()
-- env.info("FF waypoints",showMessageBox)
-- self:I(Waypoints)
group:Route(Waypoints, 5)
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -1263,7 +1251,7 @@ function SUPPRESSION:onafterFallBack(Controllable, From, Event, To, AttackUnit)
self:_SetROE(SUPPRESSION.ROE.Hold)
-- Set alarm state to GREEN and let the unit run away.
self:_SetAlarmState(SUPPRESSION.AlarmState.Auto)
self:_SetAlarmState(SUPPRESSION.AlarmState.Green)
-- Make the group run away.
self:_Run(Coord, self.Speed, self.Formation, self.FallbackWait)
@@ -1549,7 +1537,7 @@ end
-- @param #SUPPRESSION self
-- @param Core.Event#EVENTDATA EventData
function SUPPRESSION:_OnEventHit(EventData)
self:F3(EventData)
self:F(EventData)
local GroupNameSelf=self.Controllable:GetName()
local GroupNameTgt=EventData.TgtGroupName
@@ -1688,15 +1676,15 @@ end
function SUPPRESSION:_Run(fin, speed, formation, wait)
speed=speed or 20
formation=formation or ENUMS.Formation.Vehicle.OffRoad
formation=formation or "Off road"
wait=wait or 30
local group=self.Controllable -- Wrapper.Group#GROUP
local group=self.Controllable -- Wrapper.Controllable#CONTROLLABLE
if group and group:IsAlive() then
-- Clear all tasks.
--group:ClearTasks()
group:ClearTasks()
-- Current coordinates of group.
local ini=group:GetCoordinate()
@@ -1706,18 +1694,57 @@ function SUPPRESSION:_Run(fin, speed, formation, wait)
-- Heading from ini to fin.
local heading=self:_Heading(ini, fin)
-- Number of waypoints.
local nx
if dist <= 50 then
nx=2
elseif dist <= 100 then
nx=3
elseif dist <= 500 then
nx=4
else
nx=5
end
-- Number of intermediate waypoints.
local dx=dist/(nx-1)
-- Waypoint and task arrays.
local wp={}
local tasks={}
-- First waypoint is the current position of the group.
wp[1]=ini:WaypointGround(speed, formation)
tasks[1]=group:TaskFunction("SUPPRESSION._Passing_Waypoint", self, 1, false)
if self.Debug then
local MarkerID=ini:MarkToAll(string.format("Waypoing %d of group %s (initial)", #wp, self.Controllable:GetName()))
end
self:T2(self.lid..string.format("Number of waypoints %d", nx))
for i=1,nx-2 do
local x=dx*i
local coord=ini:Translate(x, heading)
wp[#wp+1]=coord:WaypointGround(speed, formation)
tasks[#tasks+1]=group:TaskFunction("SUPPRESSION._Passing_Waypoint", self, #wp, false)
self:T2(self.lid..string.format("%d x = %4.1f", i, x))
if self.Debug then
local MarkerID=coord:MarkToAll(string.format("Waypoing %d of group %s", #wp, self.Controllable:GetName()))
end
end
self:T2(self.lid..string.format("Total distance: %4.1f", dist))
-- Final waypoint.
wp[#wp+1]=fin:WaypointGround(speed, formation)
if self.Debug then
local MarkerID=fin:MarkToAll(string.format("Waypoing %d of group %s (final)", #wp, self.Controllable:GetName()))
end
-- Task to hold.
local ConditionWait=group:TaskCondition(nil, nil, nil, nil, wait, nil)
local TaskHold = group:TaskHold()
@@ -1726,15 +1753,25 @@ function SUPPRESSION:_Run(fin, speed, formation, wait)
local TaskComboFin = {}
TaskComboFin[#TaskComboFin+1] = group:TaskFunction("SUPPRESSION._Passing_Waypoint", self, #wp, true)
TaskComboFin[#TaskComboFin+1] = group:TaskControlled(TaskHold, ConditionWait)
-- Add final task.
tasks[#tasks+1]=group:TaskCombo(TaskComboFin)
-- Original waypoints of the group.
local Waypoints = group:GetTemplateRoutePoints()
-- Final waypoint.
wp[#wp+1]=fin:WaypointGround(speed, formation, TaskComboFin)
if self.Debug then
local MarkerID=fin:MarkToAll(string.format("Waypoing %d of group %s (final)", #wp, self.Controllable:GetName()))
end
-- New points are added to the default route.
for i,p in ipairs(wp) do
table.insert(Waypoints, i, wp[i])
end
-- Set task for all waypoints.
for i,wp in ipairs(Waypoints) do
group:SetTaskWaypoint(Waypoints[i], tasks[i])
end
-- Submit task and route group along waypoints.
group:Route(wp)
group:Route(Waypoints)
else
self:E(self.lid..string.format("ERROR: Group is not alive!"))
@@ -1753,7 +1790,7 @@ function SUPPRESSION._Passing_Waypoint(group, Fsm, i, final)
local text=string.format("Group %s passing waypoint %d (final=%s)", group:GetName(), i, tostring(final))
MESSAGE:New(text,10):ToAllIf(Fsm.Debug)
if Fsm.Debug then
env.info(Fsm.lid..text)
env.info(self.lid..text)
end
if final then
@@ -1854,7 +1891,7 @@ function SUPPRESSION:_GetLife()
local groupstrength=#units/self.IniGroupStrength*100
self:T2(self.lid..string.format("Group %s _GetLife nunits = %d", self.Controllable:GetName(), #units))
self.T2(self.lid..string.format("Group %s _GetLife nunits = %d", self.Controllable:GetName(), #units))
for _,unit in pairs(units) do
File diff suppressed because it is too large Load Diff
@@ -1,4 +1,4 @@
--- **Functional** - Models the process to zone guarding and capturing.
--- **Functional** -- Models the process to zone guarding and capturing.
--
-- ===
--
@@ -68,9 +68,9 @@ do -- ZONE_CAPTURE_COALITION
--
-- In order to use ZONE_CAPTURE_COALITION, you need to:
--
-- * Create a @{Core.Zone} object from one of the ZONE_ classes.
-- The functional ZONE_ classses are those derived from a ZONE_RADIUS.
-- In order to use a ZONE_POLYGON, hand over the **GROUP name** of a late activated group forming a polygon with it's waypoints.
-- * Create a @{Zone} object from one of the ZONE_ classes.
-- Note that ZONE_POLYGON_ classes are not yet functional.
-- The only functional ZONE_ classses are those derived from a ZONE_RADIUS.
-- * Set the state of the zone. Most of the time, Guarded would be the initial state.
-- * Start the zone capturing **monitoring process**.
-- This will check the presence of friendly and/or enemy units within the zone and will transition the state of the zone when the tactical situation changed.
@@ -363,7 +363,7 @@ do -- ZONE_CAPTURE_COALITION
--- ZONE_CAPTURE_COALITION Constructor.
-- @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 @{Zone} object with the goal to be achieved.
-- @param DCSCoalition.DCSCoalition#coalition 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 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.
@@ -804,7 +804,7 @@ do -- ZONE_CAPTURE_COALITION
return IsEmpty
end
--- Check if zone is "Guarded", i.e. only one (the defending) coalition is present inside the zone.
--- Check if zone is "Guarded", i.e. only one (the defending) coaliton is present inside the zone.
-- @param #ZONE_CAPTURE_COALITION self
-- @return #boolean self:IsAllInZoneOfCoalition( self.Coalition )
function ZONE_CAPTURE_COALITION:IsGuarded()
@@ -826,7 +826,7 @@ do -- ZONE_CAPTURE_COALITION
return IsCaptured
end
--- Check if zone is "Attacked", i.e. another coalition entered the zone.
--- Check if zone is "Attacked", i.e. another coaliton entered the zone.
-- @param #ZONE_CAPTURE_COALITION self
-- @return #boolean self:IsSomeInZoneOfCoalition( self.Coalition )
function ZONE_CAPTURE_COALITION:IsAttacked()
@@ -899,23 +899,24 @@ do -- ZONE_CAPTURE_COALITION
end
self:I(text)
end
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Misc Functions
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Update Mark on F10 map.
-- @param #ZONE_CAPTURE_COALITION self
function ZONE_CAPTURE_COALITION:Mark()
if self.MarkOn then
local Coord = self:GetCoordinate()
local ZoneName = self:GetZoneName()
local State = self:GetState()
-- Remove marks.
if self.MarkRed then
Coord:RemoveMark(self.MarkRed)
@@ -923,21 +924,21 @@ do -- ZONE_CAPTURE_COALITION
if self.MarkBlue then
Coord:RemoveMark(self.MarkBlue)
end
-- Create new marks for each coalition.
-- Create new marks for each coaliton.
if self.Coalition == coalition.side.BLUE then
self.MarkBlue = Coord:MarkToCoalitionBlue( "Coalition: Blue\nGuard Zone: " .. ZoneName .. "\nStatus: " .. State )
self.MarkBlue = Coord:MarkToCoalitionBlue( "Coalition: Blue\nGuard Zone: " .. ZoneName .. "\nStatus: " .. State )
self.MarkRed = Coord:MarkToCoalitionRed( "Coalition: Blue\nCapture Zone: " .. ZoneName .. "\nStatus: " .. State )
elseif self.Coalition == coalition.side.RED then
self.MarkRed = Coord:MarkToCoalitionRed( "Coalition: Red\nGuard Zone: " .. ZoneName .. "\nStatus: " .. State )
self.MarkRed = Coord:MarkToCoalitionRed( "Coalition: Red\nGuard Zone: " .. ZoneName .. "\nStatus: " .. State )
self.MarkBlue = Coord:MarkToCoalitionBlue( "Coalition: Red\nCapture Zone: " .. ZoneName .. "\nStatus: " .. State )
else
self.MarkRed = Coord:MarkToCoalitionRed( "Coalition: Neutral\nCapture Zone: " .. ZoneName .. "\nStatus: " .. State )
self.MarkRed = Coord:MarkToCoalitionRed( "Coalition: Neutral\nCapture Zone: " .. ZoneName .. "\nStatus: " .. State )
self.MarkBlue = Coord:MarkToCoalitionBlue( "Coalition: Neutral\nCapture Zone: " .. ZoneName .. "\nStatus: " .. State )
end
end
end
end
+37 -35
View File
@@ -1,4 +1,4 @@
--- **Functional** - Base class that models processes to achieve goals involving a Zone.
--- **Functional (WIP)** -- Base class that models processes to achieve goals involving a Zone.
--
-- ===
--
@@ -8,7 +8,7 @@
-- ===
--
-- ### Author: **FlightControl**
-- ### Contributions: **funkyfranky**, **Applevangelist**
-- ### Contributions: **funkyfranky**
--
-- ===
--
@@ -26,6 +26,7 @@ do -- Zone
-- @field #boolean SmokeZone If true, smoke zone.
-- @extends Core.Zone#ZONE_RADIUS
--- Models processes that have a Goal with a defined achievement involving a Zone.
-- Derived classes implement the ways how the achievements can be realized.
--
@@ -52,26 +53,21 @@ do -- Zone
SmokeColor = nil,
SmokeZone = nil,
}
--- ZONE_GOAL Constructor.
-- @param #ZONE_GOAL self
-- @param Core.Zone#ZONE_RADIUS 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_RADIUS Zone A @{Zone} object with the goal to be achieved.
-- @return #ZONE_GOAL
function ZONE_GOAL:New( Zone )
local self = BASE:Inherit( self, ZONE_RADIUS:New( Zone:GetName(), Zone:GetVec2(), Zone:GetRadius() ) ) -- #ZONE_GOAL
self:F( { Zone = Zone } )
BASE:I({Zone=Zone})
local self = BASE:Inherit( self, BASE:New())
if type(Zone) == "string" then
self = BASE:Inherit( self, ZONE_POLYGON:NewFromGroupName(Zone) )
else
self = BASE:Inherit( self, ZONE_RADIUS:New( Zone:GetName(), Zone:GetVec2(), Zone:GetRadius() ) ) -- #ZONE_GOAL
self:F( { Zone = Zone } )
end
-- Goal object.
self.Goal = GOAL:New()
self.SmokeTime = nil
-- Set smoke ON.
self:SetSmokeZone(true)
@@ -85,7 +81,7 @@ do -- Zone
-- @function [parent=#ZONE_GOAL] __DestroyedUnit
-- @param #ZONE_GOAL self
-- @param #number delay Delay in seconds.
--- DestroyedUnit Handler OnAfter for ZONE_GOAL
-- @function [parent=#ZONE_GOAL] OnAfterDestroyedUnit
-- @param #ZONE_GOAL self
@@ -97,15 +93,15 @@ do -- Zone
return self
end
--- Get the Zone.
-- @param #ZONE_GOAL self
-- @return #ZONE_GOAL
function ZONE_GOAL:GetZone()
return self
end
--- Get the name of the Zone.
-- @param #ZONE_GOAL self
-- @return #string
@@ -113,6 +109,7 @@ do -- Zone
return self:GetName()
end
--- Activate smoking of zone with the color or the current owner.
-- @param #ZONE_GOAL self
-- @param #boolean switch If *true* or *nil* activate smoke. If *false* or *nil*, no smoke.
@@ -134,10 +131,11 @@ do -- Zone
-- @param DCS#SMOKECOLOR.Color SmokeColor
function ZONE_GOAL:Smoke( SmokeColor )
self:F( { SmokeColor = SmokeColor} )
self.SmokeColor = SmokeColor
end
--- Flare the zone boundary.
-- @param #ZONE_GOAL self
-- @param DCS#SMOKECOLOR.Color FlareColor
@@ -145,6 +143,7 @@ do -- Zone
self:FlareZone( FlareColor, 30)
end
--- When started, check the Smoke and the Zone status.
-- @param #ZONE_GOAL self
function ZONE_GOAL:onafterGuard()
@@ -156,16 +155,17 @@ do -- Zone
end
end
--- Check status Smoke.
-- @param #ZONE_GOAL self
function ZONE_GOAL:StatusSmoke()
self:F({self.SmokeTime, self.SmokeColor})
if self.SmokeZone then
-- Current time.
local CurrentTime = timer.getTime()
-- Restart smoke every 5 min.
if self.SmokeTime == nil or self.SmokeTime + 300 <= CurrentTime then
if self.SmokeColor then
@@ -173,48 +173,50 @@ do -- Zone
self.SmokeTime = CurrentTime
end
end
end
end
--- @param #ZONE_GOAL self
-- @param Core.Event#EVENTDATA EventData Event data table.
function ZONE_GOAL:__Destroyed( EventData )
self:F( { "EventDead", EventData } )
self:F( { EventData.IniUnit } )
if EventData.IniDCSUnit then
local Vec3 = EventData.IniDCSUnit:getPosition().p
self:F( { Vec3 = Vec3 } )
if Vec3 and self:IsVec3InZone(Vec3) then
local PlayerHits = _DATABASE.HITS[EventData.IniUnitName]
if PlayerHits then
for PlayerName, PlayerHit in pairs( PlayerHits.Players or {} ) do
self.Goal:AddPlayerContribution( PlayerName )
self:DestroyedUnit( EventData.IniUnitName, PlayerName )
end
end
end
end
end
--- Activate the event UnitDestroyed to be fired when a unit is destroyed in the zone.
-- @param #ZONE_GOAL self
function ZONE_GOAL:MonitorDestroyedUnits()
self:HandleEvent( EVENTS.Dead, self.__Destroyed )
self:HandleEvent( EVENTS.Crash, self.__Destroyed )
end
end
@@ -1,4 +1,4 @@
--- **Functional** - Base class that models processes to achieve goals involving a Zone and Cargo.
--- **Functional (WIP)** -- Base class that models processes to achieve goals involving a Zone and Cargo.
--
-- ===
--
@@ -55,7 +55,7 @@ do -- ZoneGoal
--- ZONE_GOAL_CARGO Constructor.
-- @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 @{Zone} object with the goal to be achieved.
-- @param DCSCoalition.DCSCoalition#coalition Coalition The initial coalition owning the zone.
-- @return #ZONE_GOAL_CARGO
function ZONE_GOAL_CARGO:New( Zone, Coalition )
@@ -1,16 +1,16 @@
--- **Functional** - Base class that models processes to achieve goals involving a Zone for a Coalition.
--- **Functional (WIP)** -- Base class that models processes to achieve goals involving a Zone for a Coalition.
--
-- ===
--
-- ZONE_GOAL_COALITION models processes that have a Goal with a defined achievement involving a Zone for a Coalition.
--
-- ZONE_GOAL_COALITION models processes that have a Goal with a defined achievement involving a Zone for a Coalition.
-- Derived classes implement the ways how the achievements can be realized.
--
--
-- ===
--
--
-- ### Author: **FlightControl**
--
--
-- ===
--
--
-- @module Functional.ZoneGoalCoalition
-- @image MOOSE.JPG
@@ -24,66 +24,68 @@ do -- ZoneGoal
-- @field #table ObjectCategories Table of object categories that are able to hold a zone. Default is UNITS and STATICS.
-- @extends Functional.ZoneGoal#ZONE_GOAL
--- ZONE_GOAL_COALITION models processes that have a Goal with a defined achievement involving a Zone for a Coalition.
--- ZONE_GOAL_COALITION models processes that have a Goal with a defined achievement involving a Zone for a Coalition.
-- Derived classes implement the ways how the achievements can be realized.
--
--
-- ## 1. ZONE_GOAL_COALITION constructor
--
--
-- * @{#ZONE_GOAL_COALITION.New}(): Creates a new ZONE_GOAL_COALITION object.
--
--
-- ## 2. ZONE_GOAL_COALITION is a finite state machine (FSM).
--
--
-- ### 2.1 ZONE_GOAL_COALITION States
--
--
-- ### 2.2 ZONE_GOAL_COALITION Events
--
--
-- ### 2.3 ZONE_GOAL_COALITION State Machine
--
--
-- @field #ZONE_GOAL_COALITION
ZONE_GOAL_COALITION = {
ClassName = "ZONE_GOAL_COALITION",
Coalition = nil,
PreviousCoalition = nil,
UnitCategories = nil,
ClassName = "ZONE_GOAL_COALITION",
Coalition = nil,
PreviousCoaliton = nil,
UnitCategories = nil,
ObjectCategories = nil,
}
--- @field #table ZONE_GOAL_COALITION.States
ZONE_GOAL_COALITION.States = {}
--- ZONE_GOAL_COALITION Constructor.
-- @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 @{Zone} object with the goal to be achieved.
-- @param DCSCoalition.DCSCoalition#coalition 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}.
-- @return #ZONE_GOAL_COALITION
function ZONE_GOAL_COALITION:New( Zone, Coalition, UnitCategories )
if not Zone then
BASE:E( "ERROR: No Zone specified in ZONE_GOAL_COALITION!" )
BASE:E("ERROR: No Zone specified in ZONE_GOAL_COALITON!")
return nil
end
-- Inherit ZONE_GOAL.
local self = BASE:Inherit( self, ZONE_GOAL:New( Zone ) ) -- #ZONE_GOAL_COALITION
self:F( { Zone = Zone, Coalition = Coalition } )
self:F( { Zone = Zone, Coalition = Coalition } )
-- Set initial owner.
self:SetCoalition( Coalition or coalition.side.NEUTRAL )
self:SetCoalition( Coalition or coalition.side.NEUTRAL)
-- Set default unit and object categories for the zone scan.
self:SetUnitCategories( UnitCategories )
self:SetUnitCategories(UnitCategories)
self:SetObjectCategories()
return self
end
--- Set the owning coalition of the zone.
-- @param #ZONE_GOAL_COALITION self
-- @param DCSCoalition.DCSCoalition#coalition Coalition The coalition ID, e.g. *coalition.side.RED*.
-- @return #ZONE_GOAL_COALITION
function ZONE_GOAL_COALITION:SetCoalition( Coalition )
self.PreviousCoalition = self.Coalition or Coalition
self.PreviousCoalition=self.Coalition or Coalition
self.Coalition = Coalition
return self
end
@@ -93,31 +95,31 @@ do -- ZoneGoal
-- @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
function ZONE_GOAL_COALITION:SetUnitCategories( UnitCategories )
if UnitCategories and type( UnitCategories ) ~= "table" then
UnitCategories = { UnitCategories }
if UnitCategories and type(UnitCategories)~="table" then
UnitCategories={UnitCategories}
end
self.UnitCategories = UnitCategories or { Unit.Category.GROUND_UNIT }
self.UnitCategories=UnitCategories or {Unit.Category.GROUND_UNIT}
return self
end
--- Set the owning coalition of the zone.
-- @param #ZONE_GOAL_COALITION self
-- @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_GOAL_COALITION
function ZONE_GOAL_COALITION:SetObjectCategories( ObjectCategories )
if ObjectCategories and type( ObjectCategories ) ~= "table" then
ObjectCategories = { ObjectCategories }
if ObjectCategories and type(ObjectCategories)~="table" then
ObjectCategories={ObjectCategories}
end
self.ObjectCategories = ObjectCategories or { Object.Category.UNIT, Object.Category.STATIC }
self.ObjectCategories=ObjectCategories or {Object.Category.UNIT, Object.Category.STATIC}
return self
end
end
--- Get the owning coalition of the zone.
-- @param #ZONE_GOAL_COALITION self
-- @return DCSCoalition.DCSCoalition#coalition Coalition.
@@ -125,37 +127,39 @@ do -- ZoneGoal
return self.Coalition
end
--- Get the previous coalition, i.e. the one owning the zone before the current one.
--- Get the previous coaliton, i.e. the one owning the zone before the current one.
-- @param #ZONE_GOAL_COALITION self
-- @return DCSCoalition.DCSCoalition#coalition Coalition.
function ZONE_GOAL_COALITION:GetPreviousCoalition()
return self.PreviousCoalition
end
--- Get the owning coalition name of the zone.
-- @param #ZONE_GOAL_COALITION self
-- @return #string Coalition name.
function ZONE_GOAL_COALITION:GetCoalitionName()
return UTILS.GetCoalitionName( self.Coalition )
return UTILS.GetCoalitionName(self.Coalition)
end
--- Check status Coalition ownership.
-- @param #ZONE_GOAL_COALITION self
-- @return #ZONE_GOAL_COALITION
function ZONE_GOAL_COALITION:StatusZone()
-- Get current state.
local State = self:GetState()
-- Debug text.
local text = string.format( "Zone state=%s, Owner=%s, Scanning...", State, self:GetCoalitionName() )
self:F( text )
local text=string.format("Zone state=%s, Owner=%s, Scanning...", State, self:GetCoalitionName())
self:F(text)
-- Scan zone.
self:Scan( self.ObjectCategories, self.UnitCategories )
return self
end
end
+4 -16
View File
@@ -22,37 +22,25 @@ _DATABASE:_RegisterAirbases()
--- Check if os etc is available.
BASE:I("Checking de-sanitization of os, io and lfs:")
local __na = false
local __na=false
if os then
BASE:I("- os available")
else
BASE:I("- os NOT available! Some functions may not work.")
__na = true
__na=true
end
if io then
BASE:I("- io available")
else
BASE:I("- io NOT available! Some functions may not work.")
__na = true
__na=true
end
if lfs then
BASE:I("- lfs available")
else
BASE:I("- lfs NOT available! Some functions may not work.")
__na = true
__na=true
end
if __na then
BASE:I("Check <DCS install folder>/Scripts/MissionScripting.lua and comment out the lines with sanitizeModule(''). Use at your own risk!)")
end
BASE.ServerName = "Unknown"
if lfs and loadfile then
local serverfile = lfs.writedir() .. 'Config/serverSettings.lua'
if UTILS.FileExists(serverfile) then
loadfile(serverfile)()
if cfg and cfg.name then
BASE.ServerName = cfg.name
end
end
BASE.ServerName = BASE.ServerName or "Unknown"
BASE:I("Server Name: " .. tostring(BASE.ServerName))
end
+25 -4
View File
@@ -5,12 +5,9 @@ __Moose.Include( 'Scripts/Moose/Utilities/Profiler.lua' )
__Moose.Include( 'Scripts/Moose/Utilities/Templates.lua' )
__Moose.Include( 'Scripts/Moose/Utilities/STTS.lua' )
__Moose.Include( 'Scripts/Moose/Utilities/FiFo.lua' )
__Moose.Include( 'Scripts/Moose/Utilities/Socket.lua' )
__Moose.Include( 'Scripts/Moose/Core/Base.lua' )
__Moose.Include( 'Scripts/Moose/Core/Astar.lua' )
__Moose.Include( 'Scripts/Moose/Core/Beacon.lua' )
__Moose.Include( 'Scripts/Moose/Core/Condition.lua' )
__Moose.Include( 'Scripts/Moose/Core/UserFlag.lua' )
__Moose.Include( 'Scripts/Moose/Core/Report.lua' )
__Moose.Include( 'Scripts/Moose/Core/Scheduler.lua' )
@@ -31,6 +28,7 @@ __Moose.Include( 'Scripts/Moose/Core/SpawnStatic.lua' )
__Moose.Include( 'Scripts/Moose/Core/Timer.lua' )
__Moose.Include( 'Scripts/Moose/Core/Goal.lua' )
__Moose.Include( 'Scripts/Moose/Core/Spot.lua' )
__Moose.Include( 'Scripts/Moose/Core/Astar.lua' )
__Moose.Include( 'Scripts/Moose/Core/MarkerOps_Base.lua' )
__Moose.Include( 'Scripts/Moose/Core/TextAndSound.lua' )
@@ -45,6 +43,7 @@ __Moose.Include( 'Scripts/Moose/Wrapper/Static.lua' )
__Moose.Include( 'Scripts/Moose/Wrapper/Airbase.lua' )
__Moose.Include( 'Scripts/Moose/Wrapper/Scenery.lua' )
__Moose.Include( 'Scripts/Moose/Wrapper/Marker.lua' )
__Moose.Include( 'Scripts/Moose/Wrapper/DCSTask.lua' )
__Moose.Include( 'Scripts/Moose/Cargo/Cargo.lua' )
__Moose.Include( 'Scripts/Moose/Cargo/CargoUnit.lua' )
@@ -74,13 +73,35 @@ __Moose.Include( 'Scripts/Moose/Functional/Warehouse.lua' )
__Moose.Include( 'Scripts/Moose/Functional/Fox.lua' )
__Moose.Include( 'Scripts/Moose/Functional/Mantis.lua' )
__Moose.Include( 'Scripts/Moose/Functional/Shorad.lua' )
__Moose.Include( 'Scripts/Moose/Functional/Autolase.lua' )
__Moose.Include( 'Scripts/Moose/Functional/AICSAR.lua' )
__Moose.Include( 'Scripts/Moose/Ops/Airboss.lua' )
__Moose.Include( 'Scripts/Moose/Ops/RecoveryTanker.lua' )
__Moose.Include( 'Scripts/Moose/Ops/RescueHelo.lua' )
__Moose.Include( 'Scripts/Moose/Ops/ATIS.lua' )
__Moose.Include( 'Scripts/Moose/Ops/CTLD.lua' )
__Moose.Include( 'Scripts/Moose/Ops/Auftrag.lua' )
__Moose.Include( 'Scripts/Moose/Ops/Target.lua' )
__Moose.Include( 'Scripts/Moose/Ops/OpsGroup.lua' )
__Moose.Include( 'Scripts/Moose/Ops/FlightGroup.lua' )
__Moose.Include( 'Scripts/Moose/Ops/NavyGroup.lua' )
__Moose.Include( 'Scripts/Moose/Ops/ArmyGroup.lua' )
__Moose.Include( 'Scripts/Moose/Ops/Cohort.lua' )
__Moose.Include( 'Scripts/Moose/Ops/Squadron.lua' )
__Moose.Include( 'Scripts/Moose/Ops/Platoon.lua' )
__Moose.Include( 'Scripts/Moose/Ops/Legion.lua' )
__Moose.Include( 'Scripts/Moose/Ops/AirWing.lua' )
__Moose.Include( 'Scripts/Moose/Ops/Brigade.lua' )
__Moose.Include( 'Scripts/Moose/Ops/Intelligence.lua' )
__Moose.Include( 'Scripts/Moose/Ops/Commander.lua' )
__Moose.Include( 'Scripts/Moose/Ops/OpsTransport.lua' )
__Moose.Include( 'Scripts/Moose/Ops/CSAR.lua' )
__Moose.Include( 'Scripts/Moose/Ops/CTLD.lua' )
__Moose.Include( 'Scripts/Moose/Ops/OpsZone.lua' )
__Moose.Include( 'Scripts/Moose/Ops/Chief.lua' )
__Moose.Include( 'Scripts/Moose/Ops/Flotilla.lua' )
__Moose.Include( 'Scripts/Moose/Ops/Fleet.lua' )
__Moose.Include( 'Scripts/Moose/Ops/Awacs.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_Balancer.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_Air.lua' )
File diff suppressed because it is too large Load Diff

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