Compare commits

..

91 Commits
2.4.0 ... 2.4.5

Author SHA1 Message Date
FlightControl
a22b9e925a Merge branch 'develop' 2018-10-18 20:25:35 +02:00
FlightControl
90e7688cea Optimized the boarding and unboarding of cargo. fixed bug when in defence of APC, cargo would not be loaded. The boarding and unboarding has become much more stable now. 2018-10-18 20:25:21 +02:00
FlightControl
9ecd48f523 Merge branch 'develop' 2018-10-18 20:11:49 +02:00
FlightControl
ce9d1837a7 Optimized the boarding and unboarding of cargo. fixed bug when in defence of APC, cargo would not be loaded. The boarding and unboarding has become much more stable now. 2018-10-18 20:11:31 +02:00
FlightControl
bbf83eca3e Merge branch 'develop' 2018-10-18 18:24:56 +02:00
FlightControl
65c28d6628 Optimized the boarding and unboarding of cargo. fixed bug when in defence of APC, cargo would not be loaded. The boarding and unboarding has become much more stable now. 2018-10-18 18:24:25 +02:00
FlightControl
f0ac7818b3 Optimized the boarding and unboarding of cargo. fixed bug when in defence of APC, cargo would not be loaded. The boarding and unboarding has become much more stable now. 2018-10-18 07:27:50 +02:00
FlightControl
07d666b030 Optimized the boarding and unboarding of cargo. fixed bug when in defence of APC, cargo would not be loaded. The boarding and unboarding has become much more stable now. 2018-10-18 07:27:09 +02:00
Frank
3c1547bd6c Merge pull request #1033 from FlightControl-Master/FF/Develop
Warehouse v0.6.4
2018-10-17 21:59:57 +02:00
Frank
92bf8b59e6 CTR 2018-10-17 21:54:44 +02:00
Frank
4b39312c2c CT 2018-10-17 21:20:30 +02:00
Frank
ea767650ae Merge branch 'develop' into FF/Develop 2018-10-17 21:20:19 +02:00
Frank
e0afd19a94 Warehouse v0.6.4
- Added possibility to auto save assets on mission end.
- Minor bug fixes.
2018-10-17 21:17:45 +02:00
FlightControl
767bb58ac9 Merge branch 'develop' 2018-10-17 19:23:47 +02:00
FlightControl
8a78308dbc Improvements on the pickup. Avoid a template as part of a CarrierSet to be considered as a valid carrier for pickup. And improved the timing of the loading. 2018-10-17 19:21:35 +02:00
funkyfranky
d2db1e56cc WH 2018-10-17 16:00:22 +02:00
Frank
5f8ebbaf6a CCT 2018-10-17 00:28:08 +02:00
Frank
52758b6900 Merge pull request #1031 from FlightControl-Master/FF/Develop
Warehouse v0.6.3
2018-10-17 00:22:19 +02:00
Frank
3bb2405563 Merge branch 'develop' into FF/Develop 2018-10-17 00:17:44 +02:00
Frank
c6403325f5 Warehouse v0.6.3
Persistance of assets.
2018-10-17 00:17:25 +02:00
funkyfranky
e17b5356dd WH 2018-10-16 16:32:35 +02:00
Frank
d87cb41b75 Warehouse v0.6.2
added first version of save/load assets

PseudoATC
fixed bearing info
other bugs reported!
2018-10-15 23:50:40 +02:00
funkyfranky
40154788d6 WH, CT WIP 2018-10-15 16:19:43 +02:00
FlightControl
a8f42d61fa APC defense ... optimized the unloading of infantry when enemies are nearby. Now the infantry is reloading into the APCs when the enemies are eliminated. 2018-10-15 07:20:46 +02:00
Frank
b923f66c56 CT v0.0.6 2018-10-14 22:27:30 +02:00
FlightControl
a0355af13b Fixing a stupid typo with the dead event handler in SET_UNIT.
Addint methods in Point.lua and Utils.lua.
2018-10-14 14:07:42 +02:00
FlightControl
112945b3f6 Fixing a stupid typo with the dead event handler in SET_UNIT. 2018-10-14 14:05:27 +02:00
Frank
09c46595e5 Merge pull request #1030 from FlightControl-Master/FF/Develop
Added wind to AoA
2018-10-13 23:27:12 +02:00
Frank
003b0c875e Added wind ot AoA
COORDINATE
* added GetWindWithTurbulences function

POSITIONABLE
* Included wind in AoA calculation
2018-10-13 23:25:45 +02:00
Frank
ee2668ac65 Merge pull request #1029 from FlightControl-Master/FF/Develop
Aircraft attitude
2018-10-13 19:53:05 +02:00
Frank
f47bf4771f Remove CT 2018-10-13 19:45:26 +02:00
Frank
8551830517 Merge branch 'develop' into FF/Develop 2018-10-13 19:42:30 +02:00
Frank
8b78090a57 CT v0.0.5 2018-10-13 19:42:17 +02:00
FlightControl
d2bdb2a791 Merge branch 'develop' 2018-10-13 07:54:28 +02:00
FlightControl
f8f0114f06 Documentation and exact location of test missions. 2018-10-13 07:54:15 +02:00
FlightControl
8619d48c80 Merge branch 'develop' 2018-10-13 07:49:34 +02:00
FlightControl
4171cc45f5 Fixing a mistake on capture. 2018-10-13 07:49:14 +02:00
FlightControl
5bccd2c6c9 Merge branch 'develop' 2018-10-13 07:34:01 +02:00
FlightControl
a60626468c Implemented the capturing of the airbase. 2018-10-13 07:33:25 +02:00
Frank
f9cb5d5966 CT v0.0.4
Fixed wrong z-position.
Generalized abort parameters.
Added preliminary F10 menu.
2018-10-13 00:37:15 +02:00
FlightControl
cad1c8c462 Merge branch 'develop' 2018-10-12 21:11:32 +02:00
FlightControl
19e2af08e0 increased the altitude of hover. 2018-10-12 21:10:58 +02:00
FlightControl
4386b19b06 Merge branch 'develop' 2018-10-12 20:20:16 +02:00
FlightControl
da90826bd0 Fix height problem in workaround solution. 2018-10-12 20:15:10 +02:00
funkyfranky
33509a49e0 CT v0.0.3 2018-10-12 16:16:39 +02:00
FlightControl
514d9f3eb3 Implemented workaround request to board and unboard cargo from buildings. Now "InAir" means a velocity < 1 m/s and a height < 30 m. Once DCS properly fixes the flag to land on buildings, this workaround can be removed. 2018-10-12 07:17:56 +02:00
FlightControl
690805d7ca Implemented workaround request to board and unboard cargo from buildings. Now "InAir" means a velocity < 1 m/s and a height < 30 m. Once DCS properly fixes the flag to land on buildings, this workaround can be removed. 2018-10-12 07:14:05 +02:00
Frank
eda359e20f CT v0.0.2 2018-10-12 00:11:39 +02:00
Frank
46882ed192 Merge branch 'develop' into FF/Develop 2018-10-11 19:36:57 +02:00
FlightControl
f1f37b6598 Merge branch 'develop' 2018-10-11 19:18:01 +02:00
FlightControl
08c593578f Fixing issues with cargo loading for helos and apcs when the near range was too small... 2018-10-11 19:17:33 +02:00
FlightControl
6625de9005 Some optimizations for group. 2018-10-11 17:44:49 +02:00
funkyfranky
bbd5766688 CT general dist 2018-10-11 16:17:58 +02:00
Frank
ccf2f60068 CT 2018-10-11 00:34:14 +02:00
funkyfranky
fa4abed028 Added AoA function and carrier training WIP 2018-10-10 15:56:34 +02:00
FlightControl
804a356f13 Merge branch 'develop' 2018-10-09 20:13:32 +02:00
FlightControl
f03a2e3657 Revision of core classes documentation. 2018-10-09 19:30:57 +02:00
FlightControl
e6f51af34c Documentation 2018-10-09 09:47:22 +02:00
FlightControl
db85883026 Merge branch 'develop' 2018-10-08 06:43:30 +02:00
FlightControl
a3e29a8d5c Documentation 2018-10-08 06:05:44 +02:00
FlightControl
e5e9bc2ef7 docuemntation 2018-10-08 06:01:49 +02:00
FlightControl
41aee35b5d Documentation 2018-10-08 05:56:14 +02:00
FlightControl
7081a9eff5 ATC ground updates 2018-10-08 05:42:18 +02:00
FlightControl
be839f3a3b Fixing late activated HQs for command centers. 2018-10-08 04:57:53 +02:00
FlightControl
f35b27451f Update CargoGroup.lua 2018-10-07 18:46:19 +02:00
Frank
016e59860f Merge pull request #1022 from FlightControl-Master/FF/Develop
Warehouse v0.6.1
2018-10-07 16:58:28 +02:00
Frank
d9719923c1 Warehouse v0.6.1
- Added spawn zone max distance as optional parameter to SetSpawnZone function.
- Added optional RefCoord parameter to FindNearestWarehouse function.
2018-10-07 16:54:26 +02:00
Frank
15a6c5f6a8 Merge pull request #1021 from FlightControl-Master/FF/Develop
Warehouse v0.6.0
2018-10-07 16:13:45 +02:00
Frank
88d4580f9e Warehouse v0.6.0
- Added user function to find nearest warehouse.
- Fixed bug in GetNumberOfAssets function.
2018-10-07 16:11:34 +02:00
Frank
87d82aa674 Merge pull request #1019 from FlightControl-Master/FF/Develop
Warehouse v0.5.9
2018-10-07 00:21:52 +02:00
Frank
d58c7f8fab Warehouse v0.5.9
* Fixed bug for distance to spawn zone.
* Fixed bug when carriers get killed.
* Added example for supply chains to docs.
* Added option to specify skll and livery when adding assets.
* Added option for specifying assignments when adding assets.
2018-10-07 00:18:32 +02:00
FlightControl
8d30dfacd5 Merge branch 'develop' 2018-10-06 07:56:40 +02:00
Frank
7340b0aad3 Merge pull request #1015 from FlightControl-Master/FF/Develop
Warehouse v0.5.8
2018-10-05 23:11:07 +02:00
Frank
03fd8c93eb Merge branch 'develop' into FF/Develop 2018-10-05 22:45:54 +02:00
Frank
f727aa0a17 Revert "Merge branch 'master' into FF/Develop"
This reverts commit 502c356784, reversing
changes made to 0e7291a912.
2018-10-05 22:44:19 +02:00
Frank
502c356784 Merge branch 'master' into FF/Develop 2018-10-05 22:44:07 +02:00
Frank
0e7291a912 WAREHOUSE v0.5.8
Fixed bug with dist to spawn zone.
2018-10-05 22:43:31 +02:00
funkyfranky
2dc14097b8 SPOT parameters and docu 2018-10-05 15:34:04 +02:00
Frank
9655d60bf8 Merge pull request #1014 from FlightControl-Master/FF/Develop
Warehouse v0.5.7
2018-10-05 01:50:40 +02:00
Frank
cc920682fd Merge branch 'develop' into FF/Develop 2018-10-05 01:47:28 +02:00
Frank
205f69b3ab Warehouse v0.5.7
- Added check if spawn zones are on land
- Removed check that ground units cannot go to ships
- Added check that spawn zone is 5 km from warehouse (needs to be revised).

Coordinate:
- added surface type checks api functions
2018-10-05 01:47:10 +02:00
FlightControl
c4376f081b Pushing a fix for shadowze 2018-10-04 21:37:19 +02:00
FlightControl
1ae062dc6e Fixed in CLEANUP
- Scan initial units within the subscribed airbases.
- Scan if at a birth the unit is within an airbase.
- Scan upon checking if the units are within the airbases.
2018-10-04 21:28:45 +02:00
funkyfranky
ea3bae39cc Warehouse v0.5.6w 2018-10-04 16:28:18 +02:00
FlightControl
0bb62ce43f Merge pull request #1012 from FlightControl-Master/FF/Develop
Warehouse v0.5.6
2018-10-03 21:57:46 +02:00
Frank
a4595090c4 Warehouse v0.5.6
- Neutral warehouses can be captured
- Added example 16 for resupply
2018-10-03 21:41:33 +02:00
FlightControl
9df3f52fd5 Warehouse 2018-10-02 21:42:16 +02:00
FlightControl
6f37ff1831 remove old release notes 2018-10-02 19:37:33 +02:00
funkyfranky
cba7bec477 WH and ARTY 2018-10-02 15:27:46 +02:00
Frank
e990db8070 Merge branch 'develop' into FF/Develop 2018-10-01 22:20:31 +02:00
funkyfranky
f8404f336d Arty v1.0.6 2018-10-01 16:24:13 +02:00
50 changed files with 3206 additions and 1348 deletions

View File

@@ -1,5 +1,6 @@
--- **AI** - (R2.2) - Manages the process of an automatic A2A defense system based on an EWR network targets and coordinating CAP and GCI. --- **AI** - (R2.2) - Manages the process of an automatic A2A defense system based on an EWR network targets and coordinating CAP and GCI.
-- --
-- ===
-- --
-- Features: -- Features:
-- --
@@ -18,6 +19,19 @@
-- * Quickly setup an A2A defense system using @{#AI_A2A_GCICAP}. -- * Quickly setup an A2A defense system using @{#AI_A2A_GCICAP}.
-- * Setup a more advanced defense system using @{#AI_A2A_DISPATCHER}. -- * Setup a more advanced defense system using @{#AI_A2A_DISPATCHER}.
-- --
-- ===
--
-- ## Missions:
--
-- [AID-A2A - AI A2A Dispatching](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching/AID-A2A%20-%20AI%20A2A%20Dispatching)
--
-- ===
--
-- ## YouTube Channel:
--
-- [DCS WORLD - MOOSE - A2A GCICAP - Build an automatic A2A Defense System](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl0S4KMNUUJpaUs6zZHjLKNx)
--
-- ===
-- --
-- # QUICK START GUIDE -- # QUICK START GUIDE
-- --
@@ -183,18 +197,6 @@ do -- AI_A2A_DISPATCHER
-- --
-- === -- ===
-- --
-- # Demo Missions
--
-- ### [AI\_A2A\_DISPATCHER Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/release-2-2-pre/AID%20-%20AI%20Dispatching)
--
-- ===
--
-- # YouTube Channel
--
-- ### [DCS WORLD - MOOSE - A2A GCICAP - Build an automatic A2A Defense System](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl0S4KMNUUJpaUs6zZHjLKNx)
--
-- ===
--
-- ![Banner Image](..\Presentations\AI_A2A_DISPATCHER\Dia3.JPG) -- ![Banner Image](..\Presentations\AI_A2A_DISPATCHER\Dia3.JPG)
-- --
-- It includes automatic spawning of Combat Air Patrol aircraft (CAP) and Ground Controlled Intercept aircraft (GCI) in response to enemy air movements that are detected by a ground based radar network. -- It includes automatic spawning of Combat Air Patrol aircraft (CAP) and Ground Controlled Intercept aircraft (GCI) in response to enemy air movements that are detected by a ground based radar network.
@@ -796,10 +798,17 @@ do -- AI_A2A_DISPATCHER
-- --
-- Use the method @{#AI_A2A_DISPATCHER.SetDisengageRadius}() to modify the default Disengage Radius to another distance setting. -- Use the method @{#AI_A2A_DISPATCHER.SetDisengageRadius}() to modify the default Disengage Radius to another distance setting.
-- --
-- ## 11. Airbase capture:
-- --
-- ## 11. Q & A: -- Different squadrons can be located at one airbase.
-- If the airbase gets captured, that is, when there is an enemy unit near the airbase, and there aren't anymore friendlies at the airbase, the airbase will change coalition ownership.
-- 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.
-- --
-- ### 11.1. Which countries will be selected for each coalition? -- ## 12. Q & A:
--
-- ### 12.1. Which countries will be selected for each coalition?
-- --
-- Which countries are assigned to a coalition influences which units are available to the coalition. -- Which countries are assigned to a coalition influences which units are available to the coalition.
-- For example because the mission calls for a EWR radar on the blue side the Ukraine might be chosen as a blue country -- For example because the mission calls for a EWR radar on the blue side the Ukraine might be chosen as a blue country
@@ -807,7 +816,7 @@ do -- AI_A2A_DISPATCHER
-- Some countries assign different tasking to aircraft, for example Germany assigns the CAP task to F-4E Phantoms but the USA does not. -- Some countries assign different tasking to aircraft, for example Germany assigns the CAP task to F-4E Phantoms but the USA does not.
-- Therefore if F4s are wanted as a coalition's CAP or GCI aircraft Germany will need to be assigned to that coalition. -- Therefore if F4s are wanted as a coalition's CAP or GCI aircraft Germany will need to be assigned to that coalition.
-- --
-- ### 11.2. Country, type, load out, skill and skins for CAP and GCI aircraft? -- ### 12.2. Country, type, load out, skill and skins for CAP and GCI aircraft?
-- --
-- * Note these can be from any countries within the coalition but must be an aircraft with one of the main tasks being "CAP". -- * Note these can be from any countries within the coalition but must be an aircraft with one of the main tasks being "CAP".
-- * Obviously skins which are selected must be available to all players that join the mission otherwise they will see a default skin. -- * Obviously skins which are selected must be available to all players that join the mission otherwise they will see a default skin.
@@ -995,9 +1004,13 @@ do -- AI_A2A_DISPATCHER
self:HandleEvent( EVENTS.Dead, self.OnEventCrashOrDead ) self:HandleEvent( EVENTS.Dead, self.OnEventCrashOrDead )
--self:HandleEvent( EVENTS.RemoveUnit, self.OnEventCrashOrDead ) --self:HandleEvent( EVENTS.RemoveUnit, self.OnEventCrashOrDead )
self:HandleEvent( EVENTS.Land ) self:HandleEvent( EVENTS.Land )
self:HandleEvent( EVENTS.EngineShutdown ) self:HandleEvent( EVENTS.EngineShutdown )
-- Handle the situation where the airbases are captured.
self:HandleEvent( EVENTS.BaseCaptured )
self:SetTacticalDisplay( false ) self:SetTacticalDisplay( false )
self:__Start( 5 ) self:__Start( 5 )
@@ -1005,6 +1018,25 @@ do -- AI_A2A_DISPATCHER
return self return self
end end
--- @param #AI_A2A_DISPATCHER self
-- @param Core.Event#EVENTDATA EventData
function AI_A2A_DISPATCHER:OnEventBaseCaptured( EventData )
local AirbaseName = EventData.PlaceName -- The name of the airbase that was captured.
self:I( "Captured " .. AirbaseName )
-- 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.Resources = -999 -- The base has been captured, and the resources are eliminated. No more spawning.
Squadron.Captured = true
self:I( "Squadron " .. SquadronName .. " captured." )
end
end
end
--- @param #AI_A2A_DISPATCHER self --- @param #AI_A2A_DISPATCHER self
-- @param Core.Event#EVENTDATA EventData -- @param Core.Event#EVENTDATA EventData
function AI_A2A_DISPATCHER:OnEventCrashOrDead( EventData ) function AI_A2A_DISPATCHER:OnEventCrashOrDead( EventData )
@@ -1480,6 +1512,7 @@ do -- AI_A2A_DISPATCHER
DefenderSquadron.Name = SquadronName DefenderSquadron.Name = SquadronName
DefenderSquadron.Airbase = AIRBASE:FindByName( AirbaseName ) DefenderSquadron.Airbase = AIRBASE:FindByName( AirbaseName )
DefenderSquadron.AirbaseName = DefenderSquadron.Airbase:GetName()
if not DefenderSquadron.Airbase then if not DefenderSquadron.Airbase then
error( "Cannot find airbase with name:" .. AirbaseName ) error( "Cannot find airbase with name:" .. AirbaseName )
end end
@@ -1497,6 +1530,7 @@ do -- AI_A2A_DISPATCHER
end end
DefenderSquadron.Resources = Resources DefenderSquadron.Resources = Resources
DefenderSquadron.TemplatePrefixes = TemplatePrefixes DefenderSquadron.TemplatePrefixes = TemplatePrefixes
DefenderSquadron.Captured = false -- Not captured. This flag will be set to true, when the airbase where the squadron is located, is captured.
self:F( { Squadron = {SquadronName, AirbaseName, TemplatePrefixes, Resources } } ) self:F( { Squadron = {SquadronName, AirbaseName, TemplatePrefixes, Resources } } )
@@ -1663,7 +1697,9 @@ do -- AI_A2A_DISPATCHER
local DefenderSquadron = self:GetSquadron( SquadronName ) local DefenderSquadron = self:GetSquadron( SquadronName )
if ( not DefenderSquadron.Resources ) or ( DefenderSquadron.Resources and DefenderSquadron.Resources > 0 ) then if DefenderSquadron.Captured == false then -- We can only spawn new CAP if the base has not been captured.
if ( not DefenderSquadron.Resources ) or ( DefenderSquadron.Resources and DefenderSquadron.Resources > 0 ) then -- And, if there are sufficient resources.
local Cap = DefenderSquadron.Cap local Cap = DefenderSquadron.Cap
if Cap then if Cap then
@@ -1677,6 +1713,7 @@ do -- AI_A2A_DISPATCHER
end end
end end
end end
end
return nil return nil
end end
@@ -1693,12 +1730,15 @@ do -- AI_A2A_DISPATCHER
local DefenderSquadron = self:GetSquadron( SquadronName ) local DefenderSquadron = self:GetSquadron( SquadronName )
if ( not DefenderSquadron.Resources ) or ( DefenderSquadron.Resources and DefenderSquadron.Resources > 0 ) then if DefenderSquadron.Captured == false then -- We can only spawn new CAP if the base has not been captured.
if ( not DefenderSquadron.Resources ) or ( DefenderSquadron.Resources and DefenderSquadron.Resources > 0 ) then -- And, if there are sufficient resources.
local Gci = DefenderSquadron.Gci local Gci = DefenderSquadron.Gci
if Gci then if Gci then
return DefenderSquadron return DefenderSquadron
end end
end end
end
return nil return nil
end end

View File

@@ -213,8 +213,8 @@ function AI_CARGO:onbeforeLoad( Carrier, From, Event, To, PickupZone )
local Boarding = false local Boarding = false
local LoadInterval = 5 local LoadInterval = 2
local LoadDelay = 0 local LoadDelay = 1
local Carrier_List = {} local Carrier_List = {}
local Carrier_Weight = {} local Carrier_Weight = {}
@@ -262,9 +262,10 @@ function AI_CARGO:onbeforeLoad( Carrier, From, Event, To, PickupZone )
Carrier:RouteStop() Carrier:RouteStop()
--Cargo:Ungroup() --Cargo:Ungroup()
Cargo:__Board( -LoadDelay, CarrierUnit ) Cargo:__Board( -LoadDelay, CarrierUnit )
LoadDelay = LoadDelay + Cargo:GetCount() * LoadInterval
self:__Board( LoadDelay, Cargo, CarrierUnit, PickupZone ) self:__Board( LoadDelay, Cargo, CarrierUnit, PickupZone )
LoadDelay = LoadDelay + Cargo:GetCount() * LoadInterval
-- So now this CarrierUnit has Cargo that is being loaded. -- So now this CarrierUnit has Cargo that is being loaded.
-- This will be used further in the logic to follow and to check cargo status. -- This will be used further in the logic to follow and to check cargo status.
self.Carrier_Cargo[Cargo] = CarrierUnit self.Carrier_Cargo[Cargo] = CarrierUnit
@@ -280,6 +281,79 @@ function AI_CARGO:onbeforeLoad( Carrier, From, Event, To, PickupZone )
end end
end
if not Loaded == true then
-- No loading happened, so we need to pickup something else.
self.Relocating = false
end
end
return Boarding
end
--- On before Reload event.
-- @param #AI_CARGO self
-- @param Wrapper.Group#GROUP Carrier
-- @param #string From From state.
-- @param #string Event Event.
-- @param #string To To state.
-- @param Core.Zone#ZONE PickupZone (optional) The zone where the cargo will be picked up. The PickupZone can be nil, if there wasn't any PickupZoneSet provided.
function AI_CARGO:onbeforeReload( Carrier, From, Event, To )
self:F( { Carrier, From, Event, To } )
local Boarding = false
local LoadInterval = 2
local LoadDelay = 1
local Carrier_List = {}
local Carrier_Weight = {}
if Carrier and Carrier:IsAlive() then
for _, CarrierUnit in pairs( Carrier:GetUnits() ) do
local CarrierUnit = CarrierUnit -- Wrapper.Unit#UNIT
Carrier_List[#Carrier_List+1] = CarrierUnit
end
local Carrier_Count = #Carrier_List
local Carrier_Index = 1
local Loaded = false
for Cargo, CarrierUnit in pairs( self.Carrier_Cargo ) do
local Cargo = Cargo -- Cargo.Cargo#CARGO
self:F( { IsUnLoaded = Cargo:IsUnLoaded(), IsDeployed = Cargo:IsDeployed(), Cargo:GetName(), Carrier:GetName() } )
-- Try all Carriers, but start from the one according the Carrier_Index
for Carrier_Loop = 1, #Carrier_List do
local CarrierUnit = Carrier_List[Carrier_Index] -- Wrapper.Unit#UNIT
-- This counters loop through the available Carriers.
Carrier_Index = Carrier_Index + 1
if Carrier_Index > Carrier_Count then
Carrier_Index = 1
end
if Cargo:IsUnLoaded() and not Cargo:IsDeployed() then
Carrier:RouteStop()
Cargo:__Board( -LoadDelay, CarrierUnit )
self:__Board( LoadDelay, Cargo, CarrierUnit )
LoadDelay = LoadDelay + Cargo:GetCount() * LoadInterval
-- So now this CarrierUnit has Cargo that is being loaded.
-- This will be used further in the logic to follow and to check cargo status.
self.Carrier_Cargo[Cargo] = CarrierUnit
Boarding = true
Loaded = true
end
end
end end
@@ -307,7 +381,7 @@ function AI_CARGO:onafterBoard( Carrier, From, Event, To, Cargo, CarrierUnit, Pi
if Carrier and Carrier:IsAlive() then if Carrier and Carrier:IsAlive() then
self:F({ IsLoaded = Cargo:IsLoaded(), Cargo:GetName(), Carrier:GetName() } ) self:F({ IsLoaded = Cargo:IsLoaded(), Cargo:GetName(), Carrier:GetName() } )
if not Cargo:IsLoaded() then if not Cargo:IsLoaded() and not Cargo:IsDestroyed() then
self:__Board( -10, Cargo, CarrierUnit, PickupZone ) self:__Board( -10, Cargo, CarrierUnit, PickupZone )
return return
end end
@@ -368,6 +442,7 @@ function AI_CARGO:onafterPickedUp( Carrier, From, Event, To, PickupZone )
self.Relocating = false self.Relocating = false
if HasCargo then if HasCargo then
self:F( "Transporting" )
self.Transporting = true self.Transporting = true
end end
@@ -383,11 +458,11 @@ end
-- @param #string Event Event. -- @param #string Event Event.
-- @param #string To To state. -- @param #string To To state.
-- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. -- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE.
function AI_CARGO:onafterUnload( Carrier, From, Event, To, DeployZone ) function AI_CARGO:onafterUnload( Carrier, From, Event, To, DeployZone, Defend )
self:F( { Carrier, From, Event, To, DeployZone } ) self:F( { Carrier, From, Event, To, DeployZone, Defend = Defend } )
local UnboardInterval = 10 local UnboardInterval = 5
local UnboardDelay = 10 local UnboardDelay = 5
if Carrier and Carrier:IsAlive() then if Carrier and Carrier:IsAlive() then
for _, CarrierUnit in pairs( Carrier:GetUnits() ) do for _, CarrierUnit in pairs( Carrier:GetUnits() ) do
@@ -398,8 +473,10 @@ function AI_CARGO:onafterUnload( Carrier, From, Event, To, DeployZone )
if Cargo:IsLoaded() then if Cargo:IsLoaded() then
Cargo:__UnBoard( UnboardDelay ) Cargo:__UnBoard( UnboardDelay )
UnboardDelay = UnboardDelay + Cargo:GetCount() * UnboardInterval UnboardDelay = UnboardDelay + Cargo:GetCount() * UnboardInterval
self:__Unboard( UnboardDelay, Cargo, CarrierUnit, DeployZone, Defend )
if not Defend == true then
Cargo:SetDeployed( true ) Cargo:SetDeployed( true )
self:__Unboard( UnboardDelay, Cargo, CarrierUnit, DeployZone ) end
end end
end end
end end
@@ -415,17 +492,17 @@ end
-- @param #string To To state. -- @param #string To To state.
-- @param #string Cargo.Cargo#CARGO Cargo Cargo object. -- @param #string Cargo.Cargo#CARGO Cargo Cargo object.
-- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. -- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE.
function AI_CARGO:onafterUnboard( Carrier, From, Event, To, Cargo, CarrierUnit, DeployZone ) function AI_CARGO:onafterUnboard( Carrier, From, Event, To, Cargo, CarrierUnit, DeployZone, Defend )
self:F( { Carrier, From, Event, To, Cargo:GetName() } ) self:F( { Carrier, From, Event, To, Cargo:GetName(), DeployZone = DeployZone, Defend = Defend } )
if Carrier and Carrier:IsAlive() then if Carrier and Carrier:IsAlive() then
if not Cargo:IsUnLoaded() then if not Cargo:IsUnLoaded() then
self:__Unboard( 10, Cargo, CarrierUnit, DeployZone ) self:__Unboard( 10, Cargo, CarrierUnit, DeployZone, Defend )
return return
end end
end end
self:Unloaded( Cargo, CarrierUnit, DeployZone ) self:Unloaded( Cargo, CarrierUnit, DeployZone, Defend )
end end
@@ -438,8 +515,8 @@ end
-- @param #string Cargo.Cargo#CARGO Cargo Cargo object. -- @param #string Cargo.Cargo#CARGO Cargo Cargo object.
-- @param #boolean Deployed Cargo is deployed. -- @param #boolean Deployed Cargo is deployed.
-- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. -- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE.
function AI_CARGO:onafterUnloaded( Carrier, From, Event, To, Cargo, CarrierUnit, DeployZone ) function AI_CARGO:onafterUnloaded( Carrier, From, Event, To, Cargo, CarrierUnit, DeployZone, Defend )
self:F( { Carrier, From, Event, To, Cargo:GetName(), DeployZone = DeployZone } ) self:F( { Carrier, From, Event, To, Cargo:GetName(), DeployZone = DeployZone, Defend = Defend } )
local AllUnloaded = true local AllUnloaded = true
@@ -465,7 +542,7 @@ function AI_CARGO:onafterUnloaded( Carrier, From, Event, To, Cargo, CarrierUnit,
end end
if AllUnloaded == true then if AllUnloaded == true then
self:__Deployed( 5, DeployZone ) self:__Deployed( 5, DeployZone, Defend )
end end
end end
@@ -477,10 +554,15 @@ end
-- @param #string Event Event. -- @param #string Event Event.
-- @param #string To To state. -- @param #string To To state.
-- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. -- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE.
function AI_CARGO:onafterDeployed( Carrier, From, Event, To, DeployZone ) function AI_CARGO:onafterDeployed( Carrier, From, Event, To, DeployZone, Defend )
self:F( { Carrier, From, Event, To, DeployZone = DeployZone } ) self:F( { Carrier, From, Event, To, DeployZone = DeployZone, Defend = Defend } )
if not Defend == true then
self.Transporting = false self.Transporting = false
else
self:F( "Defending" )
end
end end

View File

@@ -97,6 +97,7 @@ function AI_CARGO_APC:New( APC, CargoSet, CombatRadius )
self:AddTransition( "*", "Follow", "Following" ) self:AddTransition( "*", "Follow", "Following" )
self:AddTransition( "*", "Guard", "Unloaded" ) self:AddTransition( "*", "Guard", "Unloaded" )
self:AddTransition( "*", "Home", "*" ) self:AddTransition( "*", "Home", "*" )
self:AddTransition( "*", "Reload", "Boarding" )
self:AddTransition( "*", "Destroyed", "Destroyed" ) self:AddTransition( "*", "Destroyed", "Destroyed" )
@@ -118,7 +119,6 @@ function AI_CARGO_APC:SetCarrier( CargoCarrier )
self.CargoCarrier:SetState( self.CargoCarrier, "AI_CARGO_APC", self ) self.CargoCarrier:SetState( self.CargoCarrier, "AI_CARGO_APC", self )
CargoCarrier:HandleEvent( EVENTS.Dead ) CargoCarrier:HandleEvent( EVENTS.Dead )
CargoCarrier:HandleEvent( EVENTS.Hit )
function CargoCarrier:OnEventDead( EventData ) function CargoCarrier:OnEventDead( EventData )
self:F({"dead"}) self:F({"dead"})
@@ -133,17 +133,19 @@ function AI_CARGO_APC:SetCarrier( CargoCarrier )
end end
end end
function CargoCarrier:OnEventHit( EventData ) -- CargoCarrier:HandleEvent( EVENTS.Hit )
self:F({"hit"}) --
local AICargoTroops = self:GetState( self, "AI_CARGO_APC" ) -- function CargoCarrier:OnEventHit( EventData )
if AICargoTroops then -- self:F({"hit"})
self:F( { OnHitLoaded = AICargoTroops:Is( "Loaded" ) } ) -- local AICargoTroops = self:GetState( self, "AI_CARGO_APC" )
if AICargoTroops:Is( "Loaded" ) or AICargoTroops:Is( "Boarding" ) then -- if AICargoTroops then
-- There are enemies within combat radius. Unload the CargoCarrier. -- self:F( { OnHitLoaded = AICargoTroops:Is( "Loaded" ) } )
AICargoTroops:Unload( false ) -- if AICargoTroops:Is( "Loaded" ) or AICargoTroops:Is( "Boarding" ) then
end -- -- There are enemies within combat radius. Unload the CargoCarrier.
end -- AICargoTroops:Unload( false )
end -- end
-- end
-- end
self.Zone = ZONE_UNIT:New( self.CargoCarrier:GetName() .. "-Zone", self.CargoCarrier, self.CombatRadius ) self.Zone = ZONE_UNIT:New( self.CargoCarrier:GetName() .. "-Zone", self.CargoCarrier, self.CombatRadius )
self.Coalition = self.CargoCarrier:GetCoalition() self.Coalition = self.CargoCarrier:GetCoalition()
@@ -276,19 +278,20 @@ function AI_CARGO_APC:onafterMonitor( APC, From, Event, To )
if self.CarrierCoordinate then if self.CarrierCoordinate then
if self:IsTransporting() == true then if self:IsTransporting() == true then
local Coordinate = APC:GetCoordinate() local Coordinate = APC:GetCoordinate()
if self:Is( "Unloaded" ) or self:Is( "Loaded" ) then
self.Zone:Scan( { Object.Category.UNIT } ) self.Zone:Scan( { Object.Category.UNIT } )
if self.Zone:IsAllInZoneOfCoalition( self.Coalition ) then if self.Zone:IsAllInZoneOfCoalition( self.Coalition ) then
if self:Is( "Unloaded" ) or self:Is( "Following" ) then if self:Is( "Unloaded" ) then
-- There are no enemies within combat radius. Load the CargoCarrier. -- There are no enemies within combat radius. Reload the CargoCarrier.
self:Load() self:Reload()
end end
else else
if self:Is( "Loaded" ) then if self:Is( "Loaded" ) then
-- There are enemies within combat radius. Unload the CargoCarrier. -- There are enemies within combat radius. Unload the CargoCarrier.
self:__Unload( 1 ) self:__Unload( 1, nil, true ) -- The 2nd parameter is true, which means that the unload is for defending the carrier, not to deploy!
else else
if self:Is( "Unloaded" ) then if self:Is( "Unloaded" ) then
self:Follow() --self:Follow()
end end
self:F( "I am here" .. self:GetCurrentState() ) self:F( "I am here" .. self:GetCurrentState() )
if self:Is( "Following" ) then if self:Is( "Following" ) then
@@ -313,6 +316,7 @@ function AI_CARGO_APC:onafterMonitor( APC, From, Event, To )
end end
end end
end end
end
end end
self.CarrierCoordinate = APC:GetCoordinate() self.CarrierCoordinate = APC:GetCoordinate()
@@ -442,6 +446,45 @@ function AI_CARGO_APC:onafterDeploy( APC, From, Event, To, Coordinate, Speed, He
end end
--- On after Unloaded event.
-- @param #AI_CARGO_APC self
-- @param Wrapper.Group#GROUP Carrier
-- @param #string From From state.
-- @param #string Event Event.
-- @param #string To To state.
-- @param #string Cargo.Cargo#CARGO Cargo Cargo object.
-- @param #boolean Deployed Cargo is deployed.
-- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE.
function AI_CARGO_APC:onafterUnloaded( Carrier, From, Event, To, Cargo, CarrierUnit, DeployZone, Defend )
self:F( { Carrier, From, Event, To, DeployZone = DeployZone, Defend = Defend } )
self:GetParent( self, AI_CARGO_APC ).onafterUnloaded( self, Carrier, From, Event, To, Cargo, CarrierUnit, DeployZone, Defend )
-- If Defend == true then we need to scan for possible enemies within combat zone and engage only ground forces.
if Defend == true then
self.Zone:Scan( { Object.Category.UNIT } )
if not self.Zone:IsAllInZoneOfCoalition( self.Coalition ) then
-- OK, enemies nearby, now find the enemies and attack them.
local AttackUnits = self.Zone:GetScannedUnits() -- #list<DCS#Unit>
local Move = {}
local CargoGroup = Cargo.CargoObject -- Wrapper.Group#GROUP
Move[#Move+1] = CargoGroup:GetCoordinate():WaypointGround( 70, "Custom" )
for UnitId, AttackUnit in pairs( AttackUnits ) do
local MooseUnit = UNIT:Find( AttackUnit )
if MooseUnit:GetCoalition() ~= CargoGroup:GetCoalition() then
Move[#Move+1] = MooseUnit:GetCoordinate():WaypointGround( 70, "Line abreast" )
--MoveTo.Task = CargoGroup:TaskCombo( CargoGroup:TaskAttackUnit( MooseUnit, true ) )
self:F( { MooseUnit = MooseUnit:GetName(), CargoGroup = CargoGroup:GetName() } )
end
end
CargoGroup:RoutePush( Move, 0.1 )
end
end
end
--- On after Deployed event. --- On after Deployed event.
-- @param #AI_CARGO_APC self -- @param #AI_CARGO_APC self
-- @param Wrapper.Group#GROUP Carrier -- @param Wrapper.Group#GROUP Carrier
@@ -449,12 +492,12 @@ end
-- @param #string Event Event. -- @param #string Event Event.
-- @param #string To To state. -- @param #string To To state.
-- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. -- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE.
function AI_CARGO_APC:onafterDeployed( APC, From, Event, To, DeployZone ) function AI_CARGO_APC:onafterDeployed( APC, From, Event, To, DeployZone, Defend )
self:F( { APC, From, Event, To, DeployZone = DeployZone } ) self:F( { APC, From, Event, To, DeployZone = DeployZone, Defend = Defend } )
self:__Guard( 0.1 ) self:__Guard( 0.1 )
self:GetParent( self, AI_CARGO_APC ).onafterDeployed( self, APC, From, Event, To, DeployZone ) self:GetParent( self, AI_CARGO_APC ).onafterDeployed( self, APC, From, Event, To, DeployZone, Defend )
end end

View File

@@ -894,8 +894,12 @@ end
-- @param #AI_CARGO_DISPATCHER self -- @param #AI_CARGO_DISPATCHER self
function AI_CARGO_DISPATCHER:onafterMonitor() function AI_CARGO_DISPATCHER:onafterMonitor()
self:F("Carriers")
self.SetCarrier:Flush()
for CarrierGroupName, Carrier in pairs( self.SetCarrier:GetSet() ) do for CarrierGroupName, Carrier in pairs( self.SetCarrier:GetSet() ) do
local Carrier = Carrier -- Wrapper.Group#GROUP local Carrier = Carrier -- Wrapper.Group#GROUP
if Carrier:IsAlive() == true then
local AI_Cargo = self.AI_Cargo[Carrier] local AI_Cargo = self.AI_Cargo[Carrier]
if not AI_Cargo then if not AI_Cargo then
@@ -1108,7 +1112,7 @@ function AI_CARGO_DISPATCHER:onafterMonitor()
local PickupCargo = nil local PickupCargo = nil
local PickupZone = nil local PickupZone = nil
--self.SetCargo:Flush() self.SetCargo:Flush()
for CargoName, Cargo in UTILS.spairs( self.SetCargo:GetSet(), function( t, a, b ) return t[a]:GetWeight() < t[b]:GetWeight() end ) do for CargoName, Cargo in UTILS.spairs( self.SetCargo:GetSet(), function( t, a, b ) return t[a]:GetWeight() < t[b]:GetWeight() end ) do
local Cargo = Cargo -- Cargo.Cargo#CARGO local Cargo = Cargo -- Cargo.Cargo#CARGO
self:F( { Cargo = Cargo:GetName(), UnLoaded = Cargo:IsUnLoaded(), Deployed = Cargo:IsDeployed(), PickupCargo = self.PickupCargo[Carrier] ~= nil } ) self:F( { Cargo = Cargo:GetName(), UnLoaded = Cargo:IsUnLoaded(), Deployed = Cargo:IsDeployed(), PickupCargo = self.PickupCargo[Carrier] ~= nil } )
@@ -1139,7 +1143,7 @@ function AI_CARGO_DISPATCHER:onafterMonitor()
LargestLoadCapacity = LoadCapacity LargestLoadCapacity = LoadCapacity
end end
end end
-- So if there is aa carrier that has the required load capacity to load the total weight of the cargo, dispatch the carrier. -- So if there is a carrier that has the required load capacity to load the total weight of the cargo, dispatch the carrier.
-- Otherwise break and go to the next carrier. -- Otherwise break and go to the next carrier.
-- This will skip cargo which is too large to be able to be loaded by carriers -- This will skip cargo which is too large to be able to be loaded by carriers
-- and will secure an efficient dispatching scheme. -- and will secure an efficient dispatching scheme.
@@ -1168,6 +1172,7 @@ function AI_CARGO_DISPATCHER:onafterMonitor()
end end
end end
end end
end
self:__Monitor( self.MonitorTimeInterval ) self:__Monitor( self.MonitorTimeInterval )
end end

View File

@@ -872,7 +872,7 @@ do -- CARGO
--self:F( { CargoObjectVec2 = self.CargoObject:GetVec2() } ) --self:F( { CargoObjectVec2 = self.CargoObject:GetVec2() } )
--self:F( { PointVec2 = PointVec2:GetVec2() } ) --self:F( { PointVec2 = PointVec2:GetVec2() } )
local Distance = Coordinate:Get2DDistance( self.CargoObject:GetCoordinate() ) local Distance = Coordinate:Get2DDistance( self.CargoObject:GetCoordinate() )
--self:F( Distance ) --self:F( { Distance = Distance, NearRadius = NearRadius or "nil" } )
if Distance <= NearRadius then if Distance <= NearRadius then
--self:F( { PointVec2 = PointVec2, NearRadius = NearRadius, IsNear = true } ) --self:F( { PointVec2 = PointVec2, NearRadius = NearRadius, IsNear = true } )

View File

@@ -20,9 +20,9 @@
do -- CARGO_GROUP do -- CARGO_GROUP
--- @type CARGO_GROUP --- @type CARGO_GROUP
-- @extends Cargo.Cargo#CARGO_REPORTABLE
-- @field Core.Set#SET_CARGO CargoSet The collection of derived CARGO objects. -- @field Core.Set#SET_CARGO CargoSet The collection of derived CARGO objects.
-- @field #string GroupName The name of the CargoGroup. -- @field #string GroupName The name of the CargoGroup.
-- @extends Cargo.Cargo#CARGO_REPORTABLE
--- Defines a cargo that is represented by a @{Wrapper.Group} object within the simulator. --- Defines a cargo that is represented by a @{Wrapper.Group} object within the simulator.
-- The cargo can be Loaded, UnLoaded, Boarded, UnBoarded to and from Carriers. -- The cargo can be Loaded, UnLoaded, Boarded, UnBoarded to and from Carriers.
@@ -51,7 +51,7 @@ do -- CARGO_GROUP
-- @param #CARGO_GROUP self -- @param #CARGO_GROUP self
-- @param Wrapper.Group#GROUP CargoGroup Group to be transported as cargo. -- @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. -- @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.
-- @param #string Name Some user defined name of the cargo group. -- @param #string Name A user defined name of the cargo group. This name CAN be the same as the group object but can also have a different name. This name MUST be unique!
-- @param #number LoadRadius (optional) Distance in meters until which a cargo is loaded into the carrier. Cargo outside this radius has to be routed by other means to within the radius to be loaded. -- @param #number LoadRadius (optional) Distance in meters until which a cargo is loaded into the carrier. Cargo outside this radius has to be routed by other means to within the radius to be loaded.
-- @param #number NearRadius (optional) Once the units are within this radius of the carrier, they are actually loaded, i.e. disappear from the scene. -- @param #number NearRadius (optional) Once the units are within this radius of the carrier, they are actually loaded, i.e. disappear from the scene.
-- @return #CARGO_GROUP Cargo group object. -- @return #CARGO_GROUP Cargo group object.
@@ -291,29 +291,29 @@ do -- CARGO_GROUP
end end
--- Enter Boarding State. --- After Board Event.
-- @param #CARGO_GROUP self -- @param #CARGO_GROUP self
-- @param #string Event -- @param #string Event
-- @param #string From -- @param #string From
-- @param #string To -- @param #string To
-- @param Wrapper.Unit#UNIT CargoCarrier -- @param Wrapper.Unit#UNIT CargoCarrier
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier. -- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
function CARGO_GROUP:onenterBoarding( From, Event, To, CargoCarrier, NearRadius, ... ) function CARGO_GROUP:onafterBoard( From, Event, To, CargoCarrier, NearRadius, ... )
self:F( { CargoCarrier.UnitName, From, Event, To, NearRadius = NearRadius } ) self:F( { CargoCarrier.UnitName, From, Event, To, NearRadius = NearRadius } )
NearRadius = NearRadius or self.NearRadius NearRadius = NearRadius or self.NearRadius
if From == "UnLoaded" then
-- For each Cargo object within the CARGO_GROUPED, route each object to the CargoLoadPointVec2 -- For each Cargo object within the CARGO_GROUPED, route each object to the CargoLoadPointVec2
self.CargoSet:ForEach( self.CargoSet:ForEach(
function( Cargo, ... ) function( Cargo, ... )
self:F( { "Board Unit", Cargo:GetName( ), Cargo:IsDestroyed(), Cargo.CargoObject:IsAlive() } )
local CargoGroup = Cargo.CargoObject --Wrapper.Group#GROUP
CargoGroup:OptionAlarmStateGreen()
Cargo:__Board( 1, CargoCarrier, NearRadius, ... ) Cargo:__Board( 1, CargoCarrier, NearRadius, ... )
end, ... end, ...
) )
self:__Boarding( 1, CargoCarrier, NearRadius, ... ) self:__Boarding( -1, CargoCarrier, NearRadius, ... )
end
end end
@@ -323,15 +323,17 @@ do -- CARGO_GROUP
-- @param #string From -- @param #string From
-- @param #string To -- @param #string To
-- @param Wrapper.Unit#UNIT CargoCarrier -- @param Wrapper.Unit#UNIT CargoCarrier
function CARGO_GROUP:onenterLoaded( From, Event, To, CargoCarrier, ... ) function CARGO_GROUP:onafterLoad( From, Event, To, CargoCarrier, ... )
--self:F( { From, Event, To, CargoCarrier, ...} ) --self:F( { From, Event, To, CargoCarrier, ...} )
if From == "UnLoaded" then if From == "UnLoaded" then
-- For each Cargo object within the CARGO_GROUP, load each cargo to the CargoCarrier. -- For each Cargo object within the CARGO_GROUP, load each cargo to the CargoCarrier.
for CargoID, Cargo in pairs( self.CargoSet:GetSet() ) do for CargoID, Cargo in pairs( self.CargoSet:GetSet() ) do
if not Cargo:IsDestroyed() then
Cargo:Load( CargoCarrier ) Cargo:Load( CargoCarrier )
end end
end end
end
--self.CargoObject:Destroy() --self.CargoObject:Destroy()
self.CargoCarrier = CargoCarrier self.CargoCarrier = CargoCarrier
@@ -400,7 +402,7 @@ do -- CARGO_GROUP
-- @param #string To -- @param #string To
-- @param Core.Point#POINT_VEC2 ToPointVec2 -- @param Core.Point#POINT_VEC2 ToPointVec2
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier. -- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
function CARGO_GROUP:onenterUnBoarding( From, Event, To, ToPointVec2, NearRadius, ... ) function CARGO_GROUP:onafterUnBoard( From, Event, To, ToPointVec2, NearRadius, ... )
self:F( {From, Event, To, ToPointVec2, NearRadius } ) self:F( {From, Event, To, ToPointVec2, NearRadius } )
NearRadius = NearRadius or 25 NearRadius = NearRadius or 25
@@ -443,7 +445,7 @@ do -- CARGO_GROUP
-- @param #string To -- @param #string To
-- @param Core.Point#POINT_VEC2 ToPointVec2 -- @param Core.Point#POINT_VEC2 ToPointVec2
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier. -- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
function CARGO_GROUP:onleaveUnBoarding( From, Event, To, ToPointVec2, NearRadius, ... ) function CARGO_GROUP:onafterUnBoarding( From, Event, To, ToPointVec2, NearRadius, ... )
--self:F( { From, Event, To, ToPointVec2, NearRadius } ) --self:F( { From, Event, To, ToPointVec2, NearRadius } )
--local NearRadius = NearRadius or 25 --local NearRadius = NearRadius or 25
@@ -464,7 +466,7 @@ do -- CARGO_GROUP
end end
if UnBoarded then if UnBoarded then
return true self:__UnLoad( 1, ToPointVec2, ... )
else else
self:__UnBoarding( 1, ToPointVec2, NearRadius, ... ) self:__UnBoarding( 1, ToPointVec2, NearRadius, ... )
end end
@@ -474,30 +476,13 @@ do -- CARGO_GROUP
end end
--- UnBoard Event.
-- @param #CARGO_GROUP self
-- @param #string Event
-- @param #string From
-- @param #string To
-- @param Core.Point#POINT_VEC2 ToPointVec2
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
function CARGO_GROUP:onafterUnBoarding( From, Event, To, ToPointVec2, NearRadius, ... )
--self:F( { From, Event, To, ToPointVec2, NearRadius } )
--local NearRadius = NearRadius or 25
self:__UnLoad( 1, ToPointVec2, ... )
end
--- Enter UnLoaded State. --- Enter UnLoaded State.
-- @param #CARGO_GROUP self -- @param #CARGO_GROUP self
-- @param #string Event -- @param #string Event
-- @param #string From -- @param #string From
-- @param #string To -- @param #string To
-- @param Core.Point#POINT_VEC2 -- @param Core.Point#POINT_VEC2
function CARGO_GROUP:onenterUnLoaded( From, Event, To, ToPointVec2, ... ) function CARGO_GROUP:onafterUnLoad( From, Event, To, ToPointVec2, ... )
--self:F( { From, Event, To, ToPointVec2 } ) --self:F( { From, Event, To, ToPointVec2 } )
if From == "Loaded" then if From == "Loaded" then
@@ -507,7 +492,7 @@ do -- CARGO_GROUP
function( Cargo ) function( Cargo )
--Cargo:UnLoad( ToPointVec2 ) --Cargo:UnLoad( ToPointVec2 )
local RandomVec2=ToPointVec2:GetRandomPointVec2InRadius(20, 10) local RandomVec2=ToPointVec2:GetRandomPointVec2InRadius(20, 10)
Cargo:UnLoad( RandomVec2 ) Cargo:UnBoard( RandomVec2 )
end end
) )

View File

@@ -231,7 +231,9 @@ do -- CARGO_UNIT
local MaxSpeed = Desc.speedMaxOffRoad local MaxSpeed = Desc.speedMaxOffRoad
local TypeName = Desc.typeName local TypeName = Desc.typeName
self:T( self.CargoInAir ) --self:F({Unit=self.CargoObject:GetName()})
-- A cargo unit can only be boarded if it is not dead
-- Only move the group to the carrier when the cargo is not in the air -- Only move the group to the carrier when the cargo is not in the air
-- (eg. cargo can be on a oil derrick, moving the cargo on the oil derrick will drop the cargo on the sea). -- (eg. cargo can be on a oil derrick, moving the cargo on the oil derrick will drop the cargo on the sea).
@@ -248,7 +250,7 @@ do -- CARGO_UNIT
local Speed = 90 local Speed = 90
local Angle = 180 local Angle = 180
local Distance = 5 local Distance = 0
local CargoCarrierPointVec2 = CargoCarrier:GetPointVec2() local CargoCarrierPointVec2 = CargoCarrier:GetPointVec2()
local CargoCarrierHeading = CargoCarrier:GetHeading() -- Get Heading of object in degrees. local CargoCarrierHeading = CargoCarrier:GetHeading() -- Get Heading of object in degrees.
@@ -272,7 +274,6 @@ do -- CARGO_UNIT
end end
end end
end end
end end
@@ -286,25 +287,28 @@ do -- CARGO_UNIT
function CARGO_UNIT:onafterBoarding( From, Event, To, CargoCarrier, NearRadius, ... ) function CARGO_UNIT:onafterBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
self:F( { From, Event, To, CargoCarrier:GetName(), NearRadius = NearRadius } ) self:F( { From, Event, To, CargoCarrier:GetName(), NearRadius = NearRadius } )
self:F( { IsAlive=self.CargoObject:IsAlive() } )
if CargoCarrier and CargoCarrier:IsAlive() and self.CargoObject and self.CargoObject:IsAlive() then if CargoCarrier and CargoCarrier:IsAlive() then -- and self.CargoObject and self.CargoObject:IsAlive() then
if (CargoCarrier:IsAir() and not CargoCarrier:InAir()) or true then if (CargoCarrier:IsAir() and not CargoCarrier:InAir()) or true then
local NearRadius = NearRadius or CargoCarrier:GetBoundingRadius( NearRadius ) + 5 local NearRadius = NearRadius or CargoCarrier:GetBoundingRadius( NearRadius ) + 5
if self:IsNear( CargoCarrier:GetPointVec2(), NearRadius ) then if self:IsNear( CargoCarrier:GetPointVec2(), NearRadius ) then
self:__Load( 1, CargoCarrier, ... ) self:__Load( -1, CargoCarrier, ... )
else else
if self:IsNear( CargoCarrier:GetPointVec2(), 20 ) then if self:IsNear( CargoCarrier:GetPointVec2(), 20 ) then
self:__Boarding( -1, CargoCarrier, NearRadius, ... ) self:__Boarding( -1, CargoCarrier, NearRadius, ... )
self.RunCount = self.RunCount + 1 self.RunCount = self.RunCount + 1
else else
self:__Boarding( -5, CargoCarrier, NearRadius, ... ) self:__Boarding( -2, CargoCarrier, NearRadius, ... )
self.RunCount = self.RunCount + 5 self.RunCount = self.RunCount + 2
end end
if self.RunCount >= 40 then if self.RunCount >= 40 then
self.RunCount = 0 self.RunCount = 0
local Speed = 90 local Speed = 90
local Angle = 180 local Angle = 180
local Distance = 5 local Distance = 0
--self:F({Unit=self.CargoObject:GetName()})
local CargoCarrierPointVec2 = CargoCarrier:GetPointVec2() local CargoCarrierPointVec2 = CargoCarrier:GetPointVec2()
local CargoCarrierHeading = CargoCarrier:GetHeading() -- Get Heading of object in degrees. local CargoCarrierHeading = CargoCarrier:GetHeading() -- Get Heading of object in degrees.
@@ -337,26 +341,6 @@ do -- CARGO_UNIT
end end
--- Enter Boarding State.
-- @param #CARGO_UNIT self
-- @param #string Event
-- @param #string From
-- @param #string To
-- @param Wrapper.Unit#UNIT CargoCarrier
-- @param #number NearRadius Default 25 m.
function CARGO_UNIT:onenterBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
--self:F( { From, Event, To, CargoCarrier.UnitName, NearRadius } )
local Speed = 90
local Angle = 180
local Distance = 5
if From == "UnLoaded" or From == "Boarding" then
end
end
--- Loaded State. --- Loaded State.
-- @param #CARGO_UNIT self -- @param #CARGO_UNIT self
-- @param #string Event -- @param #string Event
@@ -368,10 +352,11 @@ do -- CARGO_UNIT
self.CargoCarrier = CargoCarrier self.CargoCarrier = CargoCarrier
-- Only destroy the CargoObject is if there is a CargoObject (packages don't have CargoObjects). --self:F({Unit=self.CargoObject:GetName()})
-- Only destroy the CargoObject if there is a CargoObject (packages don't have CargoObjects).
if self.CargoObject then if self.CargoObject then
self:T("Destroying") self.CargoObject:Destroy( false )
self.CargoObject:Destroy()
--self.CargoObject:ReSpawnAt( COORDINATE:NewFromVec2( {x=0,y=0} ), 0 ) --self.CargoObject:ReSpawnAt( COORDINATE:NewFromVec2( {x=0,y=0} ), 0 )
end end
end end

View File

@@ -1,4 +1,22 @@
--- **Core** -- BASE forms **the basis of the MOOSE framework**. Each class within the MOOSE framework derives from BASE. --- **Core** - The base class within the framework.
--
-- ===
--
-- ## Features:
--
-- * The construction and inheritance of MOOSE classes.
-- * The class naming and numbering system.
-- * The class hierarchy search system.
-- * The tracing of information or objects during mission execution for debuggin purposes.
-- * The subscription to DCS events for event handling in MOOSE objects.
-- * Object inspection.
--
-- ===
--
-- All classes within the MOOSE framework are derived from the BASE class.
-- Note: The BASE class is an abstract class and is not meant to be used directly.
--
-- ===
-- --
-- ### Author: **FlightControl** -- ### Author: **FlightControl**
-- ### Contributions: -- ### Contributions:
@@ -23,24 +41,14 @@ local _ClassID = 0
-- @field ClassID The ID number of the class. -- @field ClassID The ID number of the class.
-- @field ClassNameAndID The name of the class concatenated with the ID number of the class. -- @field ClassNameAndID The name of the class concatenated with the ID number of the class.
--- All classes within the MOOSE framework are derived from the BASE class. --- BASE class
-- --
-- BASE provides facilities for : -- # 1. BASE constructor.
--
-- * The construction and inheritance of MOOSE classes.
-- * The class naming and numbering system.
-- * The class hierarchy search system.
-- * The tracing of information or objects during mission execution for debuggin purposes.
-- * The subscription to DCS events for event handling in MOOSE objects.
--
-- Note: The BASE class is an abstract class and is not meant to be used directly.
--
-- ## 1.1) BASE constructor
-- --
-- Any class derived from BASE, will use the @{Core.Base#BASE.New} constructor embedded in the @{Core.Base#BASE.Inherit} method. -- Any class derived from BASE, will use the @{Core.Base#BASE.New} constructor embedded in the @{Core.Base#BASE.Inherit} method.
-- See an example at the @{Core.Base#BASE.New} method how this is done. -- See an example at the @{Core.Base#BASE.New} method how this is done.
-- --
-- ## 1.2) Trace information for debugging -- # 2. Trace information for debugging.
-- --
-- The BASE class contains trace methods to trace progress within a mission execution of a certain object. -- The BASE class contains trace methods to trace progress within a mission execution of a certain object.
-- These trace methods are inherited by each MOOSE class interiting BASE, soeach object created from derived class from BASE can use the tracing methods to trace its execution. -- These trace methods are inherited by each MOOSE class interiting BASE, soeach object created from derived class from BASE can use the tracing methods to trace its execution.
@@ -71,7 +79,7 @@ local _ClassID = 0
-- --
-- Below a more detailed explanation of the different method types for tracing. -- Below a more detailed explanation of the different method types for tracing.
-- --
-- ### 1.2.1) Tracing methods categories -- ## 2.1. Tracing methods categories.
-- --
-- There are basically 3 types of tracing methods available: -- There are basically 3 types of tracing methods available:
-- --
@@ -79,7 +87,7 @@ local _ClassID = 0
-- * @{#BASE.T}: Used to trace further logic within a function giving optional variables or parameters. A T is indicated at column 44 in the DCS.log file. -- * @{#BASE.T}: Used to trace further logic within a function giving optional variables or parameters. A T is indicated at column 44 in the DCS.log file.
-- * @{#BASE.E}: Used to always trace information giving optional variables or parameters. An E is indicated at column 44 in the DCS.log file. -- * @{#BASE.E}: Used to always trace information giving optional variables or parameters. An E is indicated at column 44 in the DCS.log file.
-- --
-- ### 1.2.2) Tracing levels -- ## 2.2 Tracing levels.
-- --
-- There are 3 tracing levels within MOOSE. -- There are 3 tracing levels within MOOSE.
-- These tracing levels were defined to avoid bulks of tracing to be generated by lots of objects. -- These tracing levels were defined to avoid bulks of tracing to be generated by lots of objects.
@@ -91,7 +99,7 @@ local _ClassID = 0
-- * @{#BASE.T2}: Trace further logic within a function giving optional variables or parameters with tracing level 2. -- * @{#BASE.T2}: Trace further logic within a function giving optional variables or parameters with tracing level 2.
-- * @{#BASE.T3}: Trace further logic within a function giving optional variables or parameters with tracing level 3. -- * @{#BASE.T3}: Trace further logic within a function giving optional variables or parameters with tracing level 3.
-- --
-- ### 1.2.3) Trace activation. -- ## 2.3. Trace activation.
-- --
-- Tracing can be activated in several ways: -- Tracing can be activated in several ways:
-- --
@@ -101,16 +109,17 @@ local _ClassID = 0
-- * Activate only the tracing of a certain method of a certain class through the @{#BASE.TraceClassMethod}() method. -- * Activate only the tracing of a certain method of a certain class through the @{#BASE.TraceClassMethod}() method.
-- * Activate only the tracing of a certain level through the @{#BASE.TraceLevel}() method. -- * Activate only the tracing of a certain level through the @{#BASE.TraceLevel}() method.
-- --
-- ### 1.2.4) Check if tracing is on. -- ## 2.4. Check if tracing is on.
-- --
-- The method @{#BASE.IsTrace}() will validate if tracing is activated or not. -- The method @{#BASE.IsTrace}() will validate if tracing is activated or not.
-- --
-- ## 1.3 DCS simulator Event Handling --
-- # 3. DCS simulator Event Handling.
-- --
-- The BASE class provides methods to catch DCS Events. These are events that are triggered from within the DCS simulator, -- The BASE class provides methods to catch DCS Events. These are events that are triggered from within the DCS simulator,
-- and handled through lua scripting. MOOSE provides an encapsulation to handle these events more efficiently. -- and handled through lua scripting. MOOSE provides an encapsulation to handle these events more efficiently.
-- --
-- ### 1.3.1 Subscribe / Unsubscribe to DCS Events -- ## 3.1. Subscribe / Unsubscribe to DCS Events.
-- --
-- At first, the mission designer will need to **Subscribe** to a specific DCS event for the class. -- At first, the mission designer will need to **Subscribe** to a specific DCS event for the class.
-- So, when the DCS event occurs, the class will be notified of that event. -- So, when the DCS event occurs, the class will be notified of that event.
@@ -119,7 +128,7 @@ local _ClassID = 0
-- * @{#BASE.HandleEvent}(): Subscribe to a DCS Event. -- * @{#BASE.HandleEvent}(): Subscribe to a DCS Event.
-- * @{#BASE.UnHandleEvent}(): Unsubscribe from a DCS Event. -- * @{#BASE.UnHandleEvent}(): Unsubscribe from a DCS Event.
-- --
-- ### 1.3.2 Event Handling of DCS Events -- ## 3.2. Event Handling of DCS Events.
-- --
-- Once the class is subscribed to the event, an **Event Handling** method on the object or class needs to be written that will be called -- Once the class is subscribed to the event, an **Event Handling** method on the object or class needs to be written that will be called
-- when the DCS event occurs. The Event Handling method receives an @{Core.Event#EVENTDATA} structure, which contains a lot of information -- when the DCS event occurs. The Event Handling method receives an @{Core.Event#EVENTDATA} structure, which contains a lot of information
@@ -154,7 +163,7 @@ local _ClassID = 0
-- --
-- See the @{Event} module for more information about event handling. -- See the @{Event} module for more information about event handling.
-- --
-- ## 1.4) Class identification methods -- # 4. Class identification methods.
-- --
-- BASE provides methods to get more information of each object: -- BASE provides methods to get more information of each object:
-- --
@@ -162,7 +171,7 @@ local _ClassID = 0
-- * @{#BASE.GetClassName}(): Gets the name of the object, which is the name of the class the object was instantiated from. -- * @{#BASE.GetClassName}(): Gets the name of the object, which is the name of the class the object was instantiated from.
-- * @{#BASE.GetClassNameAndID}(): Gets the name and ID of the object. -- * @{#BASE.GetClassNameAndID}(): Gets the name and ID of the object.
-- --
-- ## 1.5) All objects derived from BASE can have "States" -- # 5. All objects derived from BASE can have "States".
-- --
-- A mechanism is in place in MOOSE, that allows to let the objects administer **states**. -- A mechanism is in place in MOOSE, that allows to let the objects administer **states**.
-- States are essentially properties of objects, which are identified by a **Key** and a **Value**. -- States are essentially properties of objects, which are identified by a **Key** and a **Value**.
@@ -177,7 +186,7 @@ local _ClassID = 0
-- Thus, if the state is to be set for the same object as the object for which the method is used, then provide the same -- Thus, if the state is to be set for the same object as the object for which the method is used, then provide the same
-- object name to the method. -- object name to the method.
-- --
-- ## 1.10) Inheritance -- # 6. Inheritance.
-- --
-- The following methods are available to implement inheritance -- The following methods are available to implement inheritance
-- --
@@ -186,8 +195,7 @@ local _ClassID = 0
-- --
-- === -- ===
-- --
-- @field #BASE BASE -- @field #BASE
--
BASE = { BASE = {
ClassName = "BASE", ClassName = "BASE",
ClassID = 0, ClassID = 0,

View File

@@ -1,4 +1,25 @@
--- **Core** -- DATABASE manages the database of mission objects. --- **Core** - Manages several databases containing templates, mission objects, and mission information.
--
-- ===
--
-- ## Features:
--
-- * During mission startup, scan the mission environment, and create / instantiate intelligently the different objects as defined within the mission.
-- * Manage database of DCS Group templates (as modelled using the mission editor).
-- - Group templates.
-- - Unit templates.
-- - Statics templates.
-- * Manage database of @{Wrapper.Group#GROUP} objects alive in the mission.
-- * Manage database of @{Wrapper.Unit#UNIT} objects alive in the mission.
-- * Manage database of @{Wrapper.Static#STATIC} objects alive in the mission.
-- * Manage database of players.
-- * Manage database of client slots defined using the mission editor.
-- * Manage database of airbases on the map, and from FARPs and ships as defined using the mission editor.
-- * Manage database of countries.
-- * Manage database of zone names.
-- * Manage database of hits to units and statics.
-- * Manage database of destroys of units and statics.
-- * Manage database of @{Core.Zone#ZONE_BASE} objects.
-- --
-- === -- ===
-- --

View File

@@ -1,8 +1,15 @@
--- **Core** -- EVENT models DCS **event dispatching** using a **publish-subscribe** model. --- **Core** - Models DCS event dispatching using a publish-subscribe model.
-- --
-- === -- ===
-- --
-- # 1) Event Handling Overview -- ## Features:
--
-- * Capture DCS events and dispatch them to the subscribed objects.
-- * Generate DCS events to the subscribed objects from within the code.
--
-- ===
--
-- # Event Handling Overview
-- --
-- ![Objects](..\Presentations\EVENT\Dia2.JPG) -- ![Objects](..\Presentations\EVENT\Dia2.JPG)
-- --
@@ -14,7 +21,7 @@
-- Objects can subscribe to different events. The Event dispatcher will publish the received DCS events to the subscribed MOOSE objects, in a specified order. -- Objects can subscribe to different events. The Event dispatcher will publish the received DCS events to the subscribed MOOSE objects, in a specified order.
-- In this way, the subscribed MOOSE objects are kept in sync with your evolving running mission. -- In this way, the subscribed MOOSE objects are kept in sync with your evolving running mission.
-- --
-- ## 1.1) Event Dispatching -- ## 1. Event Dispatching
-- --
-- ![Objects](..\Presentations\EVENT\Dia4.JPG) -- ![Objects](..\Presentations\EVENT\Dia4.JPG)
-- --
@@ -41,7 +48,7 @@
-- --
-- But for some DCS events, the publishing order is reversed. This is due to the fact that objects need to be **erased** instead of added. -- But for some DCS events, the publishing order is reversed. This is due to the fact that objects need to be **erased** instead of added.
-- --
-- ## 1.2) Event Handling -- # 2. Event Handling
-- --
-- ![Objects](..\Presentations\EVENT\Dia8.JPG) -- ![Objects](..\Presentations\EVENT\Dia8.JPG)
-- --
@@ -53,7 +60,7 @@
-- The BASE class provides methods to catch DCS Events. These are events that are triggered from within the DCS simulator, -- The BASE class provides methods to catch DCS Events. These are events that are triggered from within the DCS simulator,
-- and handled through lua scripting. MOOSE provides an encapsulation to handle these events more efficiently. -- and handled through lua scripting. MOOSE provides an encapsulation to handle these events more efficiently.
-- --
-- ### 1.2.1 Subscribe / Unsubscribe to DCS Events -- ## 2.1. Subscribe to / Unsubscribe from DCS Events.
-- --
-- At first, the mission designer will need to **Subscribe** to a specific DCS event for the class. -- At first, the mission designer will need to **Subscribe** to a specific DCS event for the class.
-- So, when the DCS event occurs, the class will be notified of that event. -- So, when the DCS event occurs, the class will be notified of that event.
@@ -69,7 +76,7 @@
-- So if a UNIT within the mission has the subscribed event for that object, -- So if a UNIT within the mission has the subscribed event for that object,
-- then the object event handler will receive the event for that UNIT! -- then the object event handler will receive the event for that UNIT!
-- --
-- ### 1.3.2 Event Handling of DCS Events -- ## 2.2 Event Handling of DCS Events
-- --
-- Once the class is subscribed to the event, an **Event Handling** method on the object or class needs to be written that will be called -- Once the class is subscribed to the event, an **Event Handling** method on the object or class needs to be written that will be called
-- when the DCS event occurs. The Event Handling method receives an @{Core.Event#EVENTDATA} structure, which contains a lot of information -- when the DCS event occurs. The Event Handling method receives an @{Core.Event#EVENTDATA} structure, which contains a lot of information
@@ -100,19 +107,19 @@
-- self:SmokeBlue() -- self:SmokeBlue()
-- end -- end
-- --
-- ### 1.3.3 Event Handling methods that are automatically called upon subscribed DCS events -- ## 2.3 Event Handling methods that are automatically called upon subscribed DCS events.
-- --
-- ![Objects](..\Presentations\EVENT\Dia10.JPG) -- ![Objects](..\Presentations\EVENT\Dia10.JPG)
-- --
-- The following list outlines which EVENTS item in the structure corresponds to which Event Handling method. -- The following list outlines which EVENTS item in the structure corresponds to which Event Handling method.
-- Always ensure that your event handling methods align with the events being subscribed to, or nothing will be executed. -- Always ensure that your event handling methods align with the events being subscribed to, or nothing will be executed.
-- --
-- # 2) EVENTS type -- # 3. EVENTS type
-- --
-- The EVENTS structure contains names for all the different DCS events that objects can subscribe to using the -- The EVENTS structure contains names for all the different DCS events that objects can subscribe to using the
-- @{Core.Base#BASE.HandleEvent}() method. -- @{Core.Base#BASE.HandleEvent}() method.
-- --
-- # 3) EVENTDATA type -- # 4. EVENTDATA type
-- --
-- The @{Core.Event#EVENTDATA} structure contains all the fields that are populated with event information before -- The @{Core.Event#EVENTDATA} structure contains all the fields that are populated with event information before
-- an Event Handler method is being called by the event dispatcher. -- an Event Handler method is being called by the event dispatcher.
@@ -166,11 +173,12 @@
-- @image Core_Event.JPG -- @image Core_Event.JPG
--- The EVENT structure --- @type EVENT
--
-- @type EVENT
-- @field #EVENT.Events Events -- @field #EVENT.Events Events
-- @extends Core.Base#BASE -- @extends Core.Base#BASE
--- The EVENT class
-- @field #EVENT
EVENT = { EVENT = {
ClassName = "EVENT", ClassName = "EVENT",
ClassID = 0, ClassID = 0,

View File

@@ -1,5 +1,18 @@
--- **Core** -- The **FSM** (**F**inite **S**tate **M**achine) class and derived **FSM\_** classes --- **Core** - FSM (Finite State Machine) are objects that model and control long lasting business processes and workflow.
-- are design patterns allowing efficient (long-lasting) processes and workflows. --
-- ===
--
-- ## Features:
--
-- * Provide a base class to model your own state machines.
-- * Trigger events synchronously.
-- * Trigger events asynchronously.
-- * Handle events before or after the event was triggered.
-- * Handle state transitions as a result of event before and after the state change.
-- * For internal moose purposes, further state machines have been designed:
-- - to handle controllables (groups and units).
-- - to handle tasks.
-- - to handle processes.
-- --
-- === -- ===
-- --

View File

@@ -1,8 +1,16 @@
--- **Core (WIP)** -- Base class to allow the modeling of processes to achieve Goals. --- **Core** - Models the process to achieve goal(s).
-- --
-- === -- ===
-- --
-- GOAL models processes that have an objective with a defined achievement. Derived classes implement the ways how the achievements can be realized. -- ## 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.
-- --
-- === -- ===
-- --
@@ -13,6 +21,7 @@
-- @module Core.Goal -- @module Core.Goal
-- @image Core_Goal.JPG -- @image Core_Goal.JPG
do -- Goal do -- Goal
--- @type GOAL --- @type GOAL
@@ -21,21 +30,43 @@ do -- Goal
--- Models processes that have an objective with a defined achievement. Derived classes implement the ways how the achievements can be realized. --- Models processes that have an objective with a defined achievement. Derived classes implement the ways how the achievements can be realized.
-- --
-- ## 1. GOAL constructor -- # 1. GOAL constructor
-- --
-- * @{#GOAL.New}(): Creates a new GOAL object. -- * @{#GOAL.New}(): Creates a new GOAL object.
-- --
-- ## 2. GOAL is a finite state machine (FSM). -- # 2. GOAL is a finite state machine (FSM).
-- --
-- ### 2.1 GOAL States -- ## 2.1. GOAL States
-- --
-- * **Pending**: The goal object is in progress. -- * **Pending**: The goal object is in progress.
-- * **Achieved**: The goal objective is Achieved. -- * **Achieved**: The goal objective is Achieved.
-- --
-- ### 2.2 GOAL Events -- ## 2.2. GOAL Events
-- --
-- * **Achieved**: Set the goal objective to Achieved. -- * **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}(),
-- 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 -- @field #GOAL
GOAL = { GOAL = {
ClassName = "GOAL", ClassName = "GOAL",

View File

@@ -1,7 +1,27 @@
--- **Core** -- MENU_ classes model the definition of **hierarchical menu structures** and **commands for players** within a mission. --- **Core** - Manage hierarchical menu structures and commands for players within a mission.
-- --
-- === -- ===
-- --
-- ### Features:
--
-- * Setup mission sub menus.
-- * Setup mission command menus.
-- * Setup coalition sub menus.
-- * Setup coalition command menus.
-- * Setup group sub menus.
-- * Setup group command menus.
-- * Manage menu creation intelligently, avoid double menu creation.
-- * Only create or delete menus when required, and keep existing menus persistent.
-- * Update menu structures.
-- * Refresh menu structures intelligently, based on a time stamp of updates.
-- - Delete obscolete menus.
-- - Create new one where required.
-- - Don't touch the existing ones.
-- * Provide a variable amount of parameters to menus.
-- * Update the parameters and the receiving methods, without updating the menu within DCS!
-- * Provide a great performance boost in menu management.
-- * Provide a great tool to manage menus in your code.
--
-- DCS Menus can be managed using the MENU classes. -- DCS Menus can be managed using the MENU classes.
-- The advantage of using MENU classes is that it hides the complexity of dealing with menu management in more advanced scanerios where you need to -- The advantage of using MENU classes is that it hides the complexity of dealing with menu management in more advanced scanerios where you need to
-- set menus and later remove them, and later set them again. You'll find while using use normal DCS scripting functions, that setting and removing -- set menus and later remove them, and later set them again. You'll find while using use normal DCS scripting functions, that setting and removing
@@ -92,7 +112,7 @@ end
--- ---
-- @param Wrapper.Group#GROUP Group -- @param Wrapper.Group#GROUP Group
function MENU_INDEX:PrepareGroup( Group ) function MENU_INDEX:PrepareGroup( Group )
if Group and Group:IsAlive() then if Group and Group:IsAlive() ~= nil then -- something was changed here!
local GroupName = Group:GetName() local GroupName = Group:GetName()
self.Group[GroupName] = self.Group[GroupName] or {} self.Group[GroupName] = self.Group[GroupName] or {}
self.Group[GroupName].Menus = self.Group[GroupName].Menus or {} self.Group[GroupName].Menus = self.Group[GroupName].Menus or {}
@@ -146,6 +166,7 @@ end
function MENU_INDEX:SetGroupMenu( Group, Path, Menu ) function MENU_INDEX:SetGroupMenu( Group, Path, Menu )
local MenuGroupName = Group:GetName() local MenuGroupName = Group:GetName()
Group:F({MenuGroupName=MenuGroupName,Path=Path})
self.Group[MenuGroupName].Menus[Path] = Menu self.Group[MenuGroupName].Menus[Path] = Menu
end end

View File

@@ -1,4 +1,15 @@
--- **Core** -- MESSAGE class takes are of the **real-time notifications** and **messages to players** during a simulation. --- **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.
-- * Send message to all players.
-- * Send messages to a coalition.
-- * Send messages to a specific group.
-- --
-- === -- ===
-- --

View File

@@ -1,6 +1,6 @@
--- **Core** -- Defines an **extensive API** to **manage 3D points** in the DCS World 3D simulation space. --- **Core** - Defines an extensive API to manage 3D points in the DCS World 3D simulation space.
-- --
-- **Features:** -- ## Features:
-- --
-- * Provides a COORDINATE class, which allows to manage points in 3D space and perform various operations on it. -- * Provides a COORDINATE class, which allows to manage points in 3D space and perform various operations on it.
-- * Provides a POINT\_VEC2 class, which is derived from COORDINATE, and allows to manage points in 3D space, but from a Lat/Lon and Altitude perspective. -- * Provides a POINT\_VEC2 class, which is derived from COORDINATE, and allows to manage points in 3D space, but from a Lat/Lon and Altitude perspective.
@@ -768,6 +768,24 @@ do -- COORDINATE
return direction, strength return direction, strength
end end
--- Returns the wind direction (from) and strength.
-- @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 Direction the wind is blowing from in degrees.
function COORDINATE:GetWindWithTurbulenceVec3(height)
-- AGL height if
local landheight=self:GetLandHeight()+0.1 -- we at 0.1 meters to be sure to be above ground since wind is zero below ground level.
-- Point at which the wind is evaluated.
local point={x=self.x, y=math.max(height or self.y, landheight), z=self.z}
-- Get wind velocity vector including turbulences.
local vec3 = atmosphere.getWindWithTurbulence(point)
return vec3
end
--- Returns a text documenting the wind direction (from) and strength according the measurement system @{Settings}. --- Returns a text documenting the wind direction (from) and strength according the measurement system @{Settings}.
-- The text will reflect the wind like this: -- The text will reflect the wind like this:
@@ -1383,9 +1401,53 @@ do -- COORDINATE
return surface return surface
end end
--- Checks if the surface type is on land.
-- @param #COORDINATE self
-- @return #boolean If true, the surface type at the coordinate is land.
function COORDINATE:IsSurfaceTypeLand()
return self:GetSurfaceType()==land.SurfaceType.LAND
end
--- Checks if the surface type is road.
-- @param #COORDINATE self
-- @return #boolean If true, the surface type at the coordinate is land.
function COORDINATE:IsSurfaceTypeLand()
return self:GetSurfaceType()==land.SurfaceType.LAND
end
--- Checks if the surface type is road.
-- @param #COORDINATE self
-- @return #boolean If true, the surface type at the coordinate is a road.
function COORDINATE:IsSurfaceTypeRoad()
return self:GetSurfaceType()==land.SurfaceType.ROAD
end
--- Checks if the surface type is runway.
-- @param #COORDINATE self
-- @return #boolean If true, the surface type at the coordinate is a runway or taxi way.
function COORDINATE:IsSurfaceTypeRunway()
return self:GetSurfaceType()==land.SurfaceType.RUNWAY
end
--- Checks if the surface type is shallow water.
-- @param #COORDINATE self
-- @return #boolean If true, the surface type at the coordinate is a shallow water.
function COORDINATE:IsSurfaceTypeShallowWater()
return self:GetSurfaceType()==land.SurfaceType.SHALLOW_WATER
end
--- Checks if the surface type is water.
-- @param #COORDINATE self
-- @return #boolean If true, the surface type at the coordinate is a deep water.
function COORDINATE:IsSurfaceTypeWater()
return self:GetSurfaceType()==land.SurfaceType.WATER
end
--- Creates an explosion at the point of a certain intensity. --- Creates an explosion at the point of a certain intensity.
-- @param #COORDINATE self -- @param #COORDINATE self
-- @param #number ExplosionIntensity -- @param #number ExplosionIntensity Intensity of the explosion in kg TNT.
function COORDINATE:Explosion( ExplosionIntensity ) function COORDINATE:Explosion( ExplosionIntensity )
self:F2( { ExplosionIntensity } ) self:F2( { ExplosionIntensity } )
trigger.action.explosion( self:GetVec3(), ExplosionIntensity ) trigger.action.explosion( self:GetVec3(), ExplosionIntensity )
@@ -1723,7 +1785,8 @@ do -- COORDINATE
--- Return a BR string from a COORDINATE to the COORDINATE. --- Return a BR string from a COORDINATE to the COORDINATE.
-- @param #COORDINATE self -- @param #COORDINATE self
-- @param #COORDINATE TargetCoordinate The target COORDINATE. -- @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.
-- @return #string The BR text. -- @return #string The BR text.
function COORDINATE:ToStringBR( FromCoordinate, Settings ) function COORDINATE:ToStringBR( FromCoordinate, Settings )
local DirectionVec3 = FromCoordinate:GetDirectionVec3( self ) local DirectionVec3 = FromCoordinate:GetDirectionVec3( self )
@@ -1734,7 +1797,8 @@ do -- COORDINATE
--- Return a BRAA string from a COORDINATE to the COORDINATE. --- Return a BRAA string from a COORDINATE to the COORDINATE.
-- @param #COORDINATE self -- @param #COORDINATE self
-- @param #COORDINATE TargetCoordinate The target COORDINATE. -- @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.
-- @return #string The BR text. -- @return #string The BR text.
function COORDINATE:ToStringBRA( FromCoordinate, Settings ) function COORDINATE:ToStringBRA( FromCoordinate, Settings )
local DirectionVec3 = FromCoordinate:GetDirectionVec3( self ) local DirectionVec3 = FromCoordinate:GetDirectionVec3( self )
@@ -1747,6 +1811,7 @@ do -- COORDINATE
--- Return a BULLS string out of the BULLS of the coalition to the COORDINATE. --- Return a BULLS string out of the BULLS of the coalition to the COORDINATE.
-- @param #COORDINATE self -- @param #COORDINATE self
-- @param DCS#coalition.side Coalition The coalition. -- @param DCS#coalition.side Coalition The coalition.
-- @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 BR text. -- @return #string The BR text.
function COORDINATE:ToStringBULLS( Coalition, Settings ) function COORDINATE:ToStringBULLS( Coalition, Settings )
local BullsCoordinate = COORDINATE:NewFromVec3( coalition.getMainRefPoint( Coalition ) ) local BullsCoordinate = COORDINATE:NewFromVec3( coalition.getMainRefPoint( Coalition ) )
@@ -1786,7 +1851,7 @@ do -- COORDINATE
--- Provides a Lat Lon string in Degree Minute Second format. --- Provides a Lat Lon string in Degree Minute Second format.
-- @param #COORDINATE self -- @param #COORDINATE self
-- @param Core.Settings#SETTINGS Settings (optional) Settings -- @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 LL DMS Text -- @return #string The LL DMS Text
function COORDINATE:ToStringLLDMS( Settings ) function COORDINATE:ToStringLLDMS( Settings )
@@ -1797,7 +1862,7 @@ do -- COORDINATE
--- Provides a Lat Lon string in Degree Decimal Minute format. --- Provides a Lat Lon string in Degree Decimal Minute format.
-- @param #COORDINATE self -- @param #COORDINATE self
-- @param Core.Settings#SETTINGS Settings (optional) Settings -- @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 LL DDM Text -- @return #string The LL DDM Text
function COORDINATE:ToStringLLDDM( Settings ) function COORDINATE:ToStringLLDDM( Settings )
@@ -1808,7 +1873,7 @@ do -- COORDINATE
--- Provides a MGRS string --- Provides a MGRS string
-- @param #COORDINATE self -- @param #COORDINATE self
-- @param Core.Settings#SETTINGS Settings (optional) Settings -- @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 -- @return #string The MGRS Text
function COORDINATE:ToStringMGRS( Settings ) --R2.1 Fixes issue #424. function COORDINATE:ToStringMGRS( Settings ) --R2.1 Fixes issue #424.
@@ -1822,10 +1887,12 @@ do -- COORDINATE
-- * Uses default settings in COORDINATE. -- * Uses default settings in COORDINATE.
-- * Can be overridden if for a GROUP containing x clients, a menu was selected to override the default. -- * Can be overridden if for a GROUP containing x clients, a menu was selected to override the default.
-- @param #COORDINATE self -- @param #COORDINATE self
-- @param #COORDINATE ReferenceCoord The refrence coordinate.
-- @param #string ReferenceName The refrence name.
-- @param Wrapper.Controllable#CONTROLLABLE Controllable -- @param Wrapper.Controllable#CONTROLLABLE Controllable
-- @param Core.Settings#SETTINGS Settings -- @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 coordinate Text in the configured coordinate system. -- @return #string The coordinate Text in the configured coordinate system.
function COORDINATE:ToStringFromRP( ReferenceCoord, ReferenceName, Controllable, Settings ) -- R2.2 function COORDINATE:ToStringFromRP( ReferenceCoord, ReferenceName, Controllable, Settings )
self:F2( { ReferenceCoord = ReferenceCoord, ReferenceName = ReferenceName } ) self:F2( { ReferenceCoord = ReferenceCoord, ReferenceName = ReferenceName } )
@@ -1852,9 +1919,9 @@ do -- COORDINATE
--- Provides a coordinate string of the point, based on the A2G coordinate format system. --- Provides a coordinate string of the point, based on the A2G coordinate format system.
-- @param #COORDINATE self -- @param #COORDINATE self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable -- @param Wrapper.Controllable#CONTROLLABLE Controllable
-- @param Core.Settings#SETTINGS Settings -- @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 coordinate Text in the configured coordinate system. -- @return #string The coordinate Text in the configured coordinate system.
function COORDINATE:ToStringA2G( Controllable, Settings ) -- R2.2 function COORDINATE:ToStringA2G( Controllable, Settings )
self:F2( { Controllable = Controllable and Controllable:GetName() } ) self:F2( { Controllable = Controllable and Controllable:GetName() } )
@@ -1887,7 +1954,7 @@ do -- COORDINATE
--- Provides a coordinate string of the point, based on the A2A coordinate format system. --- Provides a coordinate string of the point, based on the A2A coordinate format system.
-- @param #COORDINATE self -- @param #COORDINATE self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable -- @param Wrapper.Controllable#CONTROLLABLE Controllable
-- @param Core.Settings#SETTINGS Settings -- @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 coordinate Text in the configured coordinate system. -- @return #string The coordinate Text in the configured coordinate system.
function COORDINATE:ToStringA2A( Controllable, Settings ) -- R2.2 function COORDINATE:ToStringA2A( Controllable, Settings ) -- R2.2
@@ -1926,7 +1993,7 @@ do -- COORDINATE
-- * Can be overridden if for a GROUP containing x clients, a menu was selected to override the default. -- * Can be overridden if for a GROUP containing x clients, a menu was selected to override the default.
-- @param #COORDINATE self -- @param #COORDINATE self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable -- @param Wrapper.Controllable#CONTROLLABLE Controllable
-- @param Core.Settings#SETTINGS Settings -- @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 Tasking.Task#TASK Task The task for which coordinates need to be calculated. -- @param Tasking.Task#TASK Task The task for which coordinates need to be calculated.
-- @return #string The coordinate Text in the configured coordinate system. -- @return #string The coordinate Text in the configured coordinate system.
function COORDINATE:ToString( Controllable, Settings, Task ) function COORDINATE:ToString( Controllable, Settings, Task )
@@ -1979,7 +2046,7 @@ do -- COORDINATE
-- * Can be overridden if for a GROUP containing x clients, a menu was selected to override the default. -- * Can be overridden if for a GROUP containing x clients, a menu was selected to override the default.
-- @param #COORDINATE self -- @param #COORDINATE self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable -- @param Wrapper.Controllable#CONTROLLABLE Controllable
-- @param Core.Settings#SETTINGS Settings -- @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. -- @return #string The pressure text in the configured measurement system.
function COORDINATE:ToStringPressure( Controllable, Settings ) -- R2.3 function COORDINATE:ToStringPressure( Controllable, Settings ) -- R2.3
@@ -1995,9 +2062,9 @@ do -- COORDINATE
-- * Can be overridden if for a GROUP containing x clients, a menu was selected to override the default. -- * Can be overridden if for a GROUP containing x clients, a menu was selected to override the default.
-- @param #COORDINATE self -- @param #COORDINATE self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable -- @param Wrapper.Controllable#CONTROLLABLE Controllable
-- @param Core.Settings#SETTINGS Settings -- @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 wind text in the configured measurement system. -- @return #string The wind text in the configured measurement system.
function COORDINATE:ToStringWind( Controllable, Settings ) -- R2.3 function COORDINATE:ToStringWind( Controllable, Settings )
self:F2( { Controllable = Controllable and Controllable:GetName() } ) self:F2( { Controllable = Controllable and Controllable:GetName() } )
@@ -2011,9 +2078,9 @@ do -- COORDINATE
-- * Can be overridden if for a GROUP containing x clients, a menu was selected to override the default. -- * Can be overridden if for a GROUP containing x clients, a menu was selected to override the default.
-- @param #COORDINATE self -- @param #COORDINATE self
-- @param Wrapper.Controllable#CONTROLLABLE Controllable -- @param Wrapper.Controllable#CONTROLLABLE Controllable
-- @param Core.Settings#SETTINGS Settings -- @param Core.Settings#SETTINGS
-- @return #string The temperature text in the configured measurement system. -- @return #string The temperature text in the configured measurement system.
function COORDINATE:ToStringTemperature( Controllable, Settings ) -- R2.3 function COORDINATE:ToStringTemperature( Controllable, Settings )
self:F2( { Controllable = Controllable and Controllable:GetName() } ) self:F2( { Controllable = Controllable and Controllable:GetName() } )

View File

@@ -1,7 +1,12 @@
--- **Core** -- The RADIO Module is responsible for everything that is related to radio transmission and you can hear in DCS, be it TACAN beacons, Radio transmissions... --- **Core** - Is responsible for everything that is related to radio transmission and you can hear in DCS, be it TACAN beacons, Radio transmissions.
-- --
-- === -- ===
-- --
-- ## Features:
--
-- * Provide radio functionality to broadcast radio transmissions.
-- * Provide beacon functionality to assist pilots.
--
-- The Radio contains 2 classes : RADIO and BEACON -- The Radio contains 2 classes : RADIO and BEACON
-- --
-- What are radio communications in DCS ? -- What are radio communications in DCS ?

View File

@@ -1,20 +1,26 @@
--- **Core** -- **REPORT** class provides a handy means to create messages and reports. --- **Core** - Provides a handy means to create messages and reports.
-- --
-- === -- ===
-- --
-- ### Authors: -- ## Features:
-- --
-- * FlightControl : Design & Programming -- * Create text blocks that are formatted.
-- * Create automatic indents.
-- * Variate the delimiters between reporting lines.
-- --
-- ### Contributions: -- ===
--
-- ### Authors: FlightControl : Design & Programming
-- --
-- @module Core.Report -- @module Core.Report
-- @image Core_Report.JPG -- @image Core_Report.JPG
--- The REPORT class --- @type REPORT
-- @type REPORT
-- @extends Core.Base#BASE -- @extends Core.Base#BASE
--- Provides a handy means to create messages and reports.
-- @field #REPORT
REPORT = { REPORT = {
ClassName = "REPORT", ClassName = "REPORT",
Title = "", Title = "",

View File

@@ -1,9 +1,10 @@
--- **Core** -- SCHEDULER prepares and handles the **execution of functions over scheduled time (intervals)**. --- **Core** - Prepares and handles the execution of functions over scheduled time (intervals).
-- --
-- === -- ===
-- --
-- SCHEDULER manages the **scheduling of functions**: -- ## Features:
-- --
-- * Schedule functions over time,
-- * optionally in an optional specified time interval, -- * optionally in an optional specified time interval,
-- * optionally **repeating** with a specified time repeat interval, -- * optionally **repeating** with a specified time repeat interval,
-- * optionally **randomizing** with a specified time interval randomization factor, -- * optionally **randomizing** with a specified time interval randomization factor,

View File

@@ -1,22 +1,35 @@
--- **Core** -- SET_ classes define **collections** of objects to perform **bulk actions** and logically **group** objects. --- **Core** - Define collections of objects to perform bulk actions and logically group objects.
-- --
-- === -- ===
-- --
-- SET_ classes group objects of the same type into a collection, which is either: -- ## Features:
-- --
-- * Manually managed using the **:Add...()** or **:Remove...()** methods. The initial SET can be filtered with the **@{#SET_BASE.FilterOnce}()** method -- * Dynamically maintain collections of objects.
-- * Manually modify the collection, by adding or removing objects.
-- * Collections of different types.
-- * Validate the presence of objects in the collection.
-- * Perform bulk actions on collection.
--
-- ===
--
-- Group objects or data of the same type into a collection, which is either:
--
-- * Manually managed using the **:Add...()** or **:Remove...()** methods. The initial SET can be filtered with the **@{#SET_BASE.FilterOnce}()** method.
-- * Dynamically updated when new objects are created or objects are destroyed using the **@{#SET_BASE.FilterStart}()** method. -- * Dynamically updated when new objects are created or objects are destroyed using the **@{#SET_BASE.FilterStart}()** method.
-- --
-- Various types of SET_ classes are available: -- Various types of SET_ classes are available:
-- --
-- * @{#SET_UNIT}: Defines a colleciton of @{Wrapper.Unit}s filtered by filter criteria.
-- * @{#SET_GROUP}: Defines a collection of @{Wrapper.Group}s filtered by filter criteria. -- * @{#SET_GROUP}: Defines a collection of @{Wrapper.Group}s filtered by filter criteria.
-- * @{#SET_UNIT}: Defines a colleciton of @{Wrapper.Unit}s filtered by filter criteria.
-- * @{#SET_STATIC}: Defines a collection of @{Wrapper.Static}s filtered by filter criteria.
-- * @{#SET_CLIENT}: Defines a collection of @{Client}s filterd by filter criteria. -- * @{#SET_CLIENT}: Defines a collection of @{Client}s filterd by filter criteria.
-- * @{#SET_AIRBASE}: Defines a collection of @{Wrapper.Airbase}s filtered by filter criteria. -- * @{#SET_AIRBASE}: Defines a collection of @{Wrapper.Airbase}s filtered by filter criteria.
-- * @{#SET_CARGO}: Defines a collection of @{Cargo.Cargo}s filtered by filter criteria.
-- * @{#SET_ZONE}: Defines a collection of @{Core.Zone}s filtered by filter criteria.
-- --
-- These classes are derived from @{#SET_BASE}, which contains the main methods to manage SETs. -- These classes are derived from @{#SET_BASE}, which contains the main methods to manage the collections.
-- --
-- A multitude of other methods are available in SET_ classes that allow to: -- A multitude of other methods are available in the individual set classes that allow to:
-- --
-- * Validate the presence of objects in the SET. -- * Validate the presence of objects in the SET.
-- * Trigger events when objects in the SET change a zone presence. -- * Trigger events when objects in the SET change a zone presence.
@@ -1895,7 +1908,7 @@ do -- SET_UNIT
if _DATABASE then if _DATABASE then
self:_FilterStart() self:_FilterStart()
self:HandleEvent( EVENTS.Birth, self._EventOnBirth ) self:HandleEvent( EVENTS.Birth, self._EventOnBirth )
self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrashOr ) self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash )
self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash ) self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash )
self:HandleEvent( EVENTS.RemoveUnit, self._EventOnDeadOrCrash ) self:HandleEvent( EVENTS.RemoveUnit, self._EventOnDeadOrCrash )
end end
@@ -2431,7 +2444,12 @@ do -- SET_UNIT
-- @return #SET_UNIT self -- @return #SET_UNIT self
function SET_UNIT:IsIncludeObject( MUnit ) function SET_UNIT:IsIncludeObject( MUnit )
self:F2( MUnit ) self:F2( MUnit )
local MUnitInclude = true
local MUnitInclude = false
if MUnit:IsAlive() ~= nil then
MUnitInclude = true
if self.Filter.Active ~= nil then if self.Filter.Active ~= nil then
local MUnitActive = false local MUnitActive = false
@@ -2518,6 +2536,7 @@ do -- SET_UNIT
end end
MUnitInclude = MUnitInclude and MUnitSEAD MUnitInclude = MUnitInclude and MUnitSEAD
end end
end
self:T2( MUnitInclude ) self:T2( MUnitInclude )
return MUnitInclude return MUnitInclude

View File

@@ -1,4 +1,16 @@
--- **Core** -- Manages various settings for MOOSE classes. --- **Core** - Manages various settings for running missions, consumed by moose classes and provides a menu system for players to tweak settings in running missions.
--
-- ===
--
-- ## Features:
--
-- * Provide a settings menu system to the players.
-- * Provide a player settings menu and an overall mission settings menu.
-- * Mission settings provide default settings, while player settings override mission settings.
-- * Provide a menu to select between different coordinate formats for A2G coordinates.
-- * Provide a menu to select between different coordinate formats for A2A coordinates.
-- * Provide a menu to select between different message time duration options.
-- * Provide a menu to select between different metric systems.
-- --
-- === -- ===
-- --

View File

@@ -1,8 +1,32 @@
--- **Core** --Spawn dynamically new GROUPs of UNITs in your missions. --- **Core** - Spawn dynamically new groups of units in running missions.
-- --
-- === -- ===
-- --
-- The documentation of the SPAWN class can be found further in this document. -- ## Features:
--
-- * Spawn new groups in running missions.
-- * Schedule spawning of new groups.
-- * Put limits on the amount of groups that can be spawned, and the amount of units that can be alive at the same time.
-- * Randomize the spawning location between different zones.
-- * Randomize the intial positions within the zones.
-- * Spawn in array formation.
-- * Spawn uncontrolled (for planes or helos only).
-- * Clean up inactive helicopters that "crashed".
-- * Place a hook to capture a spawn event, and tailor with customer code.
-- * Spawn late activated.
-- * Spawn with or without an initial delay.
-- * Respawn after landing, on the runway or at the ramp after engine shutdown.
-- * Spawn with custom heading.
-- * Spawn with different skills.
-- * Spawn with different liveries.
-- * Spawn with an inner and outer radius to set the initial position.
-- * Spawn with a randomize route.
-- * Spawn with a randomized template.
-- * Spawn with a randomized start points on a route.
-- * Spawn with an alternative name.
-- * Spawn and keep the unit names.
-- * Spawn with a different coalition and country.
-- * Enquiry methods to check on spawn status.
-- --
-- === -- ===
-- --

View File

@@ -1,8 +1,14 @@
--- **Core** -- Spawn dynamically new STATICs in your missions. --- **Core** - Spawn new statics in your running missions.
-- --
-- === -- ===
-- --
-- SPAWNSTATIC spawns static structures in your missions dynamically. See below the SPAWNSTATIC class documentation. -- ## Features:
--
-- * Spawn new statics from a static already defined using the mission editor.
-- * Spawn new statics from a given template.
-- * Spawn new statics from a given type.
-- * Spawn with a custom heading and location.
-- * Spawn within a zone.
-- --
-- === -- ===
-- --

View File

@@ -1,11 +1,12 @@
--- **Core** -- Management of SPOT logistics, that can be transported from and to transportation carriers. --- **Core** - Management of spotting logistics, that can be activated and deactivated upon command.
-- --
-- === -- ===
-- --
-- SPOT implements the DCS Spot class functionality, but adds additional luxury to be able to: -- SPOT implements the DCS Spot class functionality, but adds additional luxury to be able to:
-- --
-- * Spot for a defined duration. -- * Spot for a defined duration.
-- * wiggle the spot at the target. -- * Updates of laer spot position every 0.2 seconds for moving targets.
-- * Wiggle the spot at the target.
-- * Provide a @{Wrapper.Unit} as a target, instead of a point. -- * Provide a @{Wrapper.Unit} as a target, instead of a point.
-- * Implement a status machine, LaseOn, LaseOff. -- * Implement a status machine, LaseOn, LaseOff.
-- --
@@ -49,7 +50,8 @@ do
--- Implements the target spotting or marking functionality, but adds additional luxury to be able to: --- Implements the target spotting or marking functionality, but adds additional luxury to be able to:
-- --
-- * Mark targets for a defined duration. -- * Mark targets for a defined duration.
-- * wiggle the spot at the target. -- * Updates of laer spot position every 0.2 seconds for moving targets.
-- * Wiggle the spot at the target.
-- * Provide a @{Wrapper.Unit} as a target, instead of a point. -- * Provide a @{Wrapper.Unit} as a target, instead of a point.
-- * Implement a status machine, LaseOn, LaseOff. -- * Implement a status machine, LaseOn, LaseOff.
-- --
@@ -85,9 +87,7 @@ do
--- SPOT Constructor. --- SPOT Constructor.
-- @param #SPOT self -- @param #SPOT self
-- @param Wrapper.Unit#UNIT Recce -- @param Wrapper.Unit#UNIT Recce Unit that is lasing
-- @param #number LaserCode
-- @param #number Duration
-- @return #SPOT -- @return #SPOT
function SPOT:New( Recce ) function SPOT:New( Recce )
@@ -115,12 +115,17 @@ do
--- LaseOn Trigger for SPOT --- LaseOn Trigger for SPOT
-- @function [parent=#SPOT] LaseOn -- @function [parent=#SPOT] LaseOn
-- @param #SPOT self -- @param #SPOT self
-- @param Wrapper.Positionable#POSITIONABLE Target
-- @param #number LaserCode Laser code.
-- @param #number Duration Duration of lasing in seconds.
--- LaseOn Asynchronous Trigger for SPOT --- LaseOn Asynchronous Trigger for SPOT
-- @function [parent=#SPOT] __LaseOn -- @function [parent=#SPOT] __LaseOn
-- @param #SPOT self -- @param #SPOT self
-- @param #number Delay -- @param #number Delay
-- @param Wrapper.Positionable#POSITIONABLE Target
-- @param #number LaserCode Laser code.
-- @param #number Duration Duration of lasing in seconds.
self:AddTransition( "On", "Lasing", "On" ) self:AddTransition( "On", "Lasing", "On" )
@@ -193,9 +198,9 @@ do
-- @param From -- @param From
-- @param Event -- @param Event
-- @param To -- @param To
-- @param Wrapper.Positionable#POSITIONABLE Target -- @param Wrapper.Positionable#POSITIONABLE Target Unit that is being lased.
-- @param #number LaserCode -- @param #number LaserCode Laser code.
-- @param #number Duration -- @param #number Duration Duration of lasing in seconds.
function SPOT:onafterLaseOn( From, Event, To, Target, LaserCode, Duration ) function SPOT:onafterLaseOn( From, Event, To, Target, LaserCode, Duration )
self:F( { "LaseOn", Target, LaserCode, Duration } ) self:F( { "LaseOn", Target, LaserCode, Duration } )

View File

@@ -1,8 +1,10 @@
--- **Core (WIP)** -- Manage user flags. --- **Core** - Manage user flags to interact with the mission editor trigger system and server side scripts.
-- --
-- === -- ===
-- --
-- Management of DCS User Flags. -- ## Features:
--
-- * Set or get DCS user flags within running missions.
-- --
-- === -- ===
-- --
@@ -22,7 +24,7 @@ do -- UserFlag
--- Management of DCS User Flags. --- Management of DCS User Flags.
-- --
-- ## USERFLAG constructor -- # 1. USERFLAG constructor
-- --
-- * @{#USERFLAG.New}(): Creates a new USERFLAG object. -- * @{#USERFLAG.New}(): Creates a new USERFLAG object.
-- --
@@ -55,8 +57,6 @@ do -- UserFlag
-- --
function USERFLAG:Set( Number ) --R2.3 function USERFLAG:Set( Number ) --R2.3
self:F( { Number = Number } )
trigger.action.setUserFlag( self.UserFlagName, Number ) trigger.action.setUserFlag( self.UserFlagName, Number )
return self return self

View File

@@ -1,4 +1,10 @@
--- **Core (WIP)** -- Manage user sound. --- **Core** - Manage user sound.
--
-- ===
--
-- ## Features:
--
-- * Play sounds wihtin running missions.
-- --
-- === -- ===
-- --

View File

@@ -1,4 +1,12 @@
--- **Core** -- VELOCITY models a speed, which can be expressed in various formats according the Settings. --- **Core** - Models a velocity or speed, which can be expressed in various formats according the settings.
--
-- ===
--
-- ## Features:
--
-- * Convert velocity in various metric systems.
-- * Set the velocity.
-- * Create a text in a specific format of a velocity.
-- --
-- === -- ===
-- --

View File

@@ -1,7 +1,24 @@
--- **Core** -- ZONE classes define **zones** within your mission of **various forms**, with **various capabilities**. --- **Core** - Define zones within your mission of various forms, with various capabilities.
-- --
-- === -- ===
-- --
-- ## Features:
--
-- * Create radius zones.
-- * Create trigger zones.
-- * Create polygon zones.
-- * Create moving zones around a unit.
-- * Create moving zones around a group.
-- * Provide the zone behaviour. Some zones are static, while others are moveable.
-- * Enquiry if a coordinate is within a zone.
-- * Smoke zones.
-- * Set a zone probability to control zone selection.
-- * Get zone coordinates.
-- * Get zone properties.
-- * Get zone bounding box.
-- * Set/get zone name.
--
--
-- There are essentially two core functions that zones accomodate: -- There are essentially two core functions that zones accomodate:
-- --
-- * Test if an object is within the zone boundaries. -- * Test if an object is within the zone boundaries.

View File

@@ -1,8 +1,18 @@
--- **Functional** -- The ATC\_GROUND classes monitor airbase traffic and regulate speed while taxiing. --- **Functional** -- Monitor airbase traffic and regulate speed while taxiing.
-- --
-- === -- ===
-- --
-- ![Banner Image](..\Presentations\ATC_GROUND\Dia1.JPG) -- ## Features:
--
-- * Monitor speed of the airplanes of players during taxi.
-- * Communicate ATC ground operations.
-- * Kick speeding players during taxi.
--
-- ===
--
-- ## Missions:
--
-- [ABP - Airbase Police](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/ABP%20-%20Airbase%20Police)
-- --
-- === -- ===
-- --

View File

@@ -1,4 +1,4 @@
--- **Functional** - (R2.4) Control artillery units. --- **Functional** - Control artillery units.
-- --
-- === -- ===
-- --
@@ -21,15 +21,7 @@
-- --
-- ==== -- ====
-- --
-- # Demo Missions -- ## [MOOSE YouTube Channel](https://www.youtube.com/channel/UCjrA9j5LQoWsG4SpS8i79Qg)
--
-- ### [MOOSE - ALL Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS)
--
-- ====
--
-- # YouTube Channel
--
-- ### [MOOSE YouTube Channel](https://www.youtube.com/channel/UCjrA9j5LQoWsG4SpS8i79Qg)
-- --
-- === -- ===
-- --
@@ -597,8 +589,15 @@ ARTY={
autorelocateonroad=false, autorelocateonroad=false,
} }
--- Weapong type ID. http://wiki.hoggit.us/view/DCS_enum_weapon_flag --- Weapong type ID. See [here](http://wiki.hoggit.us/view/DCS_enum_weapon_flag).
-- @list WeaponType -- @type ARTY.WeaponType
-- @field #number Auto Automatic selection of weapon type.
-- @field #number Cannon Cannons using conventional shells.
-- @field #number Rockets Unguided rockets.
-- @field #number CruiseMissile Cruise missiles.
-- @field #number TacticalNukes Tactical nuclear shells (simulated).
-- @field #number IlluminationShells Illumination shells (simulated).
-- @field #number SmokeShells Smoke shells (simulated).
ARTY.WeaponType={ ARTY.WeaponType={
Auto=1073741822, Auto=1073741822,
Cannon=805306368, Cannon=805306368,
@@ -610,7 +609,7 @@ ARTY.WeaponType={
} }
--- Database of common artillery unit properties. --- Database of common artillery unit properties.
-- @list db -- @type ARTY.db
ARTY.db={ ARTY.db={
["2B11 mortar"] = { -- type "2B11 mortar" ["2B11 mortar"] = { -- type "2B11 mortar"
minrange = 500, -- correct? minrange = 500, -- correct?
@@ -675,7 +674,7 @@ ARTY.id="ARTY | "
--- Arty script version. --- Arty script version.
-- @field #string version -- @field #string version
ARTY.version="1.0.5" ARTY.version="1.0.6"
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -1189,7 +1188,14 @@ function ARTY:AssignTargetCoord(coord, prio, radius, nshells, maxengage, time, w
end end
-- Time in seconds. -- Time in seconds.
local _time=self:_ClockToSeconds(time) local _time
if type(time)=="string" then
_time=self:_ClockToSeconds(time)
elseif type(time)=="number" then
_time=timer.getAbsTime()+time
else
_time=timer.getAbsTime()
end
-- Prepare target array. -- Prepare target array.
local _target={name=_name, coord=coord, radius=radius, nshells=nshells, engaged=0, underfire=false, prio=prio, maxengage=maxengage, time=_time, weapontype=weapontype} local _target={name=_name, coord=coord, radius=radius, nshells=nshells, engaged=0, underfire=false, prio=prio, maxengage=maxengage, time=_time, weapontype=weapontype}
@@ -1240,9 +1246,6 @@ function ARTY:AssignMoveCoord(coord, time, speed, onroad, cancel, name, unique)
return nil return nil
end end
-- Default is current time if no time was specified.
time=time or self:_SecondsToClock(timer.getAbsTime())
-- Set speed. -- Set speed.
if speed then if speed then
-- Make sure, given speed is less than max physiaclly possible speed of group. -- Make sure, given speed is less than max physiaclly possible speed of group.
@@ -1264,7 +1267,14 @@ function ARTY:AssignMoveCoord(coord, time, speed, onroad, cancel, name, unique)
end end
-- Time in seconds. -- Time in seconds.
local _time=self:_ClockToSeconds(time) local _time
if type(time)=="string" then
_time=self:_ClockToSeconds(time)
elseif type(time)=="number" then
_time=timer.getAbsTime()+time
else
_time=timer.getAbsTime()
end
-- Prepare move array. -- Prepare move array.
local _move={name=_name, coord=coord, time=_time, speed=speed, onroad=onroad, cancel=cancel} local _move={name=_name, coord=coord, time=_time, speed=speed, onroad=onroad, cancel=cancel}

View File

@@ -1,23 +1,22 @@
--- **Functional** -- The CLEANUP_AIRBASE class keeps an area clean of crashing or colliding airplanes. It also prevents airplanes from firing within this area. --- **Functional** -- Keep airbases clean of crashing or colliding airplanes, and kill missiles when being fired at airbases.
-- --
-- === -- ===
-- --
-- ### Author: **FlightControl** -- ## Features:
-- ### Contributions: --
--
-- * Try to keep the airbase clean and operational.
-- * Prevent airplanes from crashing.
-- * Clean up obstructing airplanes from the runway that are standing still for a period of time.
-- * Prevent airplanes firing missiles within the airbase zone.
-- --
-- === -- ===
-- --
-- @module Functional.CleanUp -- ## Missions:
-- @image CleanUp_Airbases.JPG --
-- [CLA - CleanUp Airbase](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/CLA%20-%20CleanUp%20Airbase)
--- @type CLEANUP_AIRBASE.__ Methods which are not intended for mission designers, but which are used interally by the moose designer :-) --
-- @field #map<#string,Wrapper.Airbase#AIRBASE> Airbases Map of Airbases. -- ===
-- @extends Core.Base#BASE
--- @type CLEANUP_AIRBASE
-- @extends #CLEANUP_AIRBASE.__
--- Keeps airbases clean, and tries to guarantee continuous airbase operations, even under combat.
-- --
-- Specific airbases need to be provided that need to be guarded. Each airbase registered, will be guarded within a zone of 8 km around the airbase. -- Specific airbases need to be provided that need to be guarded. Each airbase registered, will be guarded within a zone of 8 km around the airbase.
-- Any unit that fires a missile, or shoots within the zone of an airbase, will be monitored by CLEANUP_AIRBASE. -- Any unit that fires a missile, or shoots within the zone of an airbase, will be monitored by CLEANUP_AIRBASE.
@@ -43,7 +42,26 @@
-- --
-- By following the above guidelines, you can add airbase cleanup with acceptable CPU overhead. -- By following the above guidelines, you can add airbase cleanup with acceptable CPU overhead.
-- --
-- ## 1. CLEANUP_AIRBASE Constructor -- ===
--
-- ### Author: **FlightControl**
-- ### Contributions:
--
-- ===
--
-- @module Functional.CleanUp
-- @image CleanUp_Airbases.JPG
--- @type CLEANUP_AIRBASE.__ Methods which are not intended for mission designers, but which are used interally by the moose designer :-)
-- @field #map<#string,Wrapper.Airbase#AIRBASE> Airbases Map of Airbases.
-- @extends Core.Base#BASE
--- @type CLEANUP_AIRBASE
-- @extends #CLEANUP_AIRBASE.__
--- Keeps airbases clean, and tries to guarantee continuous airbase operations, even under combat.
--
-- # 1. CLEANUP_AIRBASE Constructor
-- --
-- Creates the main object which is preventing the airbase to get polluted with debris on the runway, which halts the airbase. -- Creates the main object which is preventing the airbase to get polluted with debris on the runway, which halts the airbase.
-- --
@@ -54,12 +72,12 @@
-- CleanUpTbilisi = CLEANUP_AIRBASE:New( AIRBASE.Caucasus.Tbilisi ) -- CleanUpTbilisi = CLEANUP_AIRBASE:New( AIRBASE.Caucasus.Tbilisi )
-- CleanUpKutaisi = CLEANUP_AIRBASE:New( AIRBASE.Caucasus.Kutaisi ) -- CleanUpKutaisi = CLEANUP_AIRBASE:New( AIRBASE.Caucasus.Kutaisi )
-- --
-- ## 2. Add or Remove airbases -- # 2. Add or Remove airbases
-- --
-- The method @{#CLEANUP_AIRBASE.AddAirbase}() to add an airbase to the cleanup validation process. -- The method @{#CLEANUP_AIRBASE.AddAirbase}() to add an airbase to the cleanup validation process.
-- The method @{#CLEANUP_AIRBASE.RemoveAirbase}() removes an airbase from the cleanup validation process. -- The method @{#CLEANUP_AIRBASE.RemoveAirbase}() removes an airbase from the cleanup validation process.
-- --
-- ## 3. Clean missiles and bombs within the airbase zone. -- # 3. Clean missiles and bombs within the airbase zone.
-- --
-- When missiles or bombs hit the runway, the airbase operations stop. -- When missiles or bombs hit the runway, the airbase operations stop.
-- Use the method @{#CLEANUP_AIRBASE.SetCleanMissiles}() to control the cleaning of missiles, which will prevent airbases to stop. -- Use the method @{#CLEANUP_AIRBASE.SetCleanMissiles}() to control the cleaning of missiles, which will prevent airbases to stop.
@@ -113,6 +131,20 @@ function CLEANUP_AIRBASE:New( AirbaseNames )
self:HandleEvent( EVENTS.Dead, self.__.OnEventCrash ) self:HandleEvent( EVENTS.Dead, self.__.OnEventCrash )
self:HandleEvent( EVENTS.Crash, self.__.OnEventCrash ) self:HandleEvent( EVENTS.Crash, self.__.OnEventCrash )
for UnitName, Unit in pairs( _DATABASE.UNITS ) do
local Unit = Unit -- Wrapper.Unit#UNIT
if Unit:IsAlive() ~= nil then
if self:IsInAirbase( Unit:GetVec2() ) then
self:F( { UnitName = UnitName } )
self.CleanUpList[UnitName] = {}
self.CleanUpList[UnitName].CleanUpUnit = Unit
self.CleanUpList[UnitName].CleanUpGroup = Unit:GetGroup()
self.CleanUpList[UnitName].CleanUpGroupName = Unit:GetGroup():GetName()
self.CleanUpList[UnitName].CleanUpUnitName = Unit:GetName()
end
end
end
return self return self
end end
@@ -213,11 +245,15 @@ end
function CLEANUP_AIRBASE.__:OnEventBirth( EventData ) function CLEANUP_AIRBASE.__:OnEventBirth( EventData )
self:F( { EventData } ) self:F( { EventData } )
if EventData.IniUnit:IsAlive() ~= nil then
if self:IsInAirbase( EventData.IniUnit:GetVec2() ) then
self.CleanUpList[EventData.IniDCSUnitName] = {} self.CleanUpList[EventData.IniDCSUnitName] = {}
self.CleanUpList[EventData.IniDCSUnitName].CleanUpUnit = EventData.IniUnit self.CleanUpList[EventData.IniDCSUnitName].CleanUpUnit = EventData.IniUnit
self.CleanUpList[EventData.IniDCSUnitName].CleanUpGroup = EventData.IniGroup self.CleanUpList[EventData.IniDCSUnitName].CleanUpGroup = EventData.IniGroup
self.CleanUpList[EventData.IniDCSUnitName].CleanUpGroupName = EventData.IniDCSGroupName self.CleanUpList[EventData.IniDCSUnitName].CleanUpGroupName = EventData.IniDCSGroupName
self.CleanUpList[EventData.IniDCSUnitName].CleanUpUnitName = EventData.IniDCSUnitName self.CleanUpList[EventData.IniDCSUnitName].CleanUpUnitName = EventData.IniDCSUnitName
end
end
end end
@@ -350,6 +386,8 @@ function CLEANUP_AIRBASE.__:CleanUpSchedule()
if CleanUpUnit:IsAlive() ~= nil then if CleanUpUnit:IsAlive() ~= nil then
if self:IsInAirbase( CleanUpUnit:GetVec2() ) then
if _DATABASE:GetStatusGroup( CleanUpGroupName ) ~= "ReSpawn" then if _DATABASE:GetStatusGroup( CleanUpGroupName ) ~= "ReSpawn" then
local CleanUpCoordinate = CleanUpUnit:GetCoordinate() local CleanUpCoordinate = CleanUpUnit:GetCoordinate()
@@ -373,7 +411,7 @@ function CLEANUP_AIRBASE.__:CleanUpSchedule()
end end
end end
-- Clean Units which are waiting for a very long time in the CleanUpZone. -- Clean Units which are waiting for a very long time in the CleanUpZone.
if CleanUpUnit then if CleanUpUnit and not CleanUpUnit:GetPlayerName() then
local CleanUpUnitVelocity = CleanUpUnit:GetVelocityKMH() local CleanUpUnitVelocity = CleanUpUnit:GetVelocityKMH()
if CleanUpUnitVelocity < 1 then if CleanUpUnitVelocity < 1 then
if CleanUpListData.CleanUpMoved then if CleanUpListData.CleanUpMoved then
@@ -387,7 +425,10 @@ function CLEANUP_AIRBASE.__:CleanUpSchedule()
CleanUpListData.CleanUpMoved = true CleanUpListData.CleanUpMoved = true
end end
end end
else
-- not anymore in an airbase zone, remove from cleanup list.
self.CleanUpList[CleanUpUnitName] = nil
end
else else
-- Do nothing ... -- Do nothing ...
self.CleanUpList[CleanUpUnitName] = nil self.CleanUpList[CleanUpUnitName] = nil

View File

@@ -2,41 +2,24 @@
-- --
-- === -- ===
-- --
-- Orchestrate the designation of potential targets executed by a Recce group, -- ## Features:
-- and communicates these to a dedicated attacking group of players,
-- so that following a dynamically generated menu system,
-- each detected set of potential targets can be lased or smoked...
-- --
-- Targets can be: -- * Faciliate the communication of detected targets to players.
-- -- * Designate targets using lasers, through a menu system.
-- * **Lased** for a period of time. -- * Designate targets using smoking, through a menu system.
-- * **Smoked**. Artillery or airplanes with Illuminatino ordonance need to be present. (WIP, but early demo ready.) -- * Designate targets using illumination, through a menu system.
-- * **Illuminated** through an illumination bomb. Artillery or airplanes with Illuminatino ordonance need to be present. (WIP, but early demo ready. -- * Auto lase targets.
-- * Refresh detection upon specified time intervals.
-- * Prioritization on threat levels.
-- * Reporting system of threats.
-- --
-- === -- ===
-- --
-- # **AUTHORS and CONTRIBUTIONS** -- ## Missions:
-- --
-- ### Contributions: -- [DES - Designation](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/DES%20-%20Designation)
-- --
-- * [**Ciribob**](https://forums.eagle.ru/member.php?u=112175): Showing the way how to lase targets + how laser codes work!!! Explained the autolase script. -- ===
-- * [**EasyEB**](https://forums.eagle.ru/member.php?u=112055): Ideas and Beta Testing
-- * [**Wingthor**](https://forums.eagle.ru/member.php?u=123698): Beta Testing
--
--
-- ### Authors:
--
-- * **FlightControl**: Design & Programming
--
-- @module Functional.Designate
-- @image Designation.JPG
do -- DESIGNATE
--- @type DESIGNATE
-- @extends Core.Fsm#FSM_PROCESS
--- Manage the designation of detected targets.
-- --
-- Targets detected by recce will be communicated to a group of attacking players. -- Targets detected by recce will be communicated to a group of attacking players.
-- A menu system is made available that allows to: -- A menu system is made available that allows to:
@@ -61,7 +44,7 @@ do -- DESIGNATE
-- * A **Player** is an active CLIENT object containing a human player. -- * A **Player** is an active CLIENT object containing a human player.
-- * A **Designate Menu** is the menu that is dynamically created during the designation process for each _AttackGroup_. -- * A **Designate Menu** is the menu that is dynamically created during the designation process for each _AttackGroup_.
-- --
-- ## 0. Player Manual -- # Player Manual
-- --
-- ![Banner Image](..\Presentations\DESIGNATE\Dia3.JPG) -- ![Banner Image](..\Presentations\DESIGNATE\Dia3.JPG)
-- --
@@ -88,7 +71,7 @@ do -- DESIGNATE
-- This will ensure that the detection process won't be interrupted and that targets can be designated. -- This will ensure that the detection process won't be interrupted and that targets can be designated.
-- However, you don't have to, so to simulate a more real-word situation or simulation, **Recce can also be destroyed**! -- However, you don't have to, so to simulate a more real-word situation or simulation, **Recce can also be destroyed**!
-- --
-- ### 0.1. Player View (Observer) -- ## 1. Player View (Observer)
-- --
-- ![Banner Image](..\Presentations\DESIGNATE\Dia4.JPG) -- ![Banner Image](..\Presentations\DESIGNATE\Dia4.JPG)
-- --
@@ -101,7 +84,7 @@ do -- DESIGNATE
-- that can be put in **scope** of the DesignateObject. -- that can be put in **scope** of the DesignateObject.
-- We call this the **MaximumDesignations** term. -- We call this the **MaximumDesignations** term.
-- --
-- ### 0.2. Designate Menu -- ## 2. Designate Menu
-- --
-- ![Banner Image](..\Presentations\DESIGNATE\Dia5.JPG) -- ![Banner Image](..\Presentations\DESIGNATE\Dia5.JPG)
-- --
@@ -135,7 +118,7 @@ do -- DESIGNATE
-- * Smoke Targets using a specific smoke color. -- * Smoke Targets using a specific smoke color.
-- * Illuminate areas. -- * Illuminate areas.
-- --
-- ### 0.3. Lasing Targets -- ## 3. Lasing Targets
-- --
-- ![Banner Image](..\Presentations\DESIGNATE\Dia7.JPG) -- ![Banner Image](..\Presentations\DESIGNATE\Dia7.JPG)
-- --
@@ -159,7 +142,7 @@ do -- DESIGNATE
-- --
-- In this way, DESIGNATE assists players to designate ground targets for a coordinated attack! -- In this way, DESIGNATE assists players to designate ground targets for a coordinated attack!
-- --
-- ### 0.4. Illuminating Targets -- ## 4. Illuminating Targets
-- --
-- ![Banner Image](..\Presentations\DESIGNATE\Dia9.JPG) -- ![Banner Image](..\Presentations\DESIGNATE\Dia9.JPG)
-- --
@@ -168,7 +151,7 @@ do -- DESIGNATE
-- Illumination bombs can be fired in while lasing targets. -- Illumination bombs can be fired in while lasing targets.
-- When illumination bombs are fired, it will take about 2 minutes until a sequent bomb run can be requested using the menus. -- When illumination bombs are fired, it will take about 2 minutes until a sequent bomb run can be requested using the menus.
-- --
-- ### 0.5. Smoking Targets -- ## 5. Smoking Targets
-- --
-- ![Banner Image](..\Presentations\DESIGNATE\Dia10.JPG) -- ![Banner Image](..\Presentations\DESIGNATE\Dia10.JPG)
-- --
@@ -180,19 +163,44 @@ do -- DESIGNATE
-- --
-- Have FUN! -- Have FUN!
-- --
-- ## 1. DESIGNATE constructor -- ===
--
-- ### Contributions:
--
-- * [**Ciribob**](https://forums.eagle.ru/member.php?u=112175): Showing the way how to lase targets + how laser codes work!!! Explained the autolase script.
-- * [**EasyEB**](https://forums.eagle.ru/member.php?u=112055): Ideas and Beta Testing
-- * [**Wingthor**](https://forums.eagle.ru/member.php?u=123698): Beta Testing
--
-- ### Authors:
--
-- * **FlightControl**: Design & Programming
--
-- ===
--
-- @module Functional.Designate
-- @image Designation.JPG
do -- DESIGNATE
--- @type DESIGNATE
-- @extends Core.Fsm#FSM_PROCESS
--- Manage the designation of detected targets.
--
--
-- # 1. DESIGNATE constructor
-- --
-- * @{#DESIGNATE.New}(): Creates a new DESIGNATE object. -- * @{#DESIGNATE.New}(): Creates a new DESIGNATE object.
-- --
-- ## 2. DESIGNATE is a FSM -- # 2. DESIGNATE is a FSM
-- --
-- Designate is a finite state machine, which allows for controlled transitions of states. -- Designate is a finite state machine, which allows for controlled transitions of states.
-- --
-- ### 2.1 DESIGNATE States -- ## 2.1 DESIGNATE States
-- --
-- * **Designating** ( Group ): The designation process. -- * **Designating** ( Group ): The designation process.
-- --
-- ### 2.2 DESIGNATE Events -- ## 2.2 DESIGNATE Events
-- --
-- * **@{#DESIGNATE.Detect}**: Detect targets. -- * **@{#DESIGNATE.Detect}**: Detect targets.
-- * **@{#DESIGNATE.LaseOn}**: Lase the targets with the specified Index. -- * **@{#DESIGNATE.LaseOn}**: Lase the targets with the specified Index.
@@ -200,7 +208,7 @@ do -- DESIGNATE
-- * **@{#DESIGNATE.Smoke}**: Smoke the targets with the specified Index. -- * **@{#DESIGNATE.Smoke}**: Smoke the targets with the specified Index.
-- * **@{#DESIGNATE.Status}**: Report designation status. -- * **@{#DESIGNATE.Status}**: Report designation status.
-- --
-- ## 3. Maximum Designations -- # 3. Maximum Designations
-- --
-- In order to prevent an overflow of designations due to many Detected Targets, there is a -- 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. -- Maximum Designations scope that is set in the DesignationObject.
@@ -208,9 +216,9 @@ do -- DESIGNATE
-- The method @{#DESIGNATE.SetMaximumDesignations}() will put a limit on the amount of designations 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. -- 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 -- # 4. Laser codes
-- --
-- ### 4.1. Set possible laser codes -- ## 4.1. Set possible laser codes
-- --
-- An array of laser codes can be provided, that will be used by the DESIGNATE when lasing. -- An array of laser codes can be provided, that will be used by the DESIGNATE when lasing.
-- The laser code is communicated by the Recce when it is lasing a larget. -- The laser code is communicated by the Recce when it is lasing a larget.
@@ -228,11 +236,11 @@ do -- DESIGNATE
-- --
-- The above sets a collection of possible laser codes that can be assigned. **Note the { } notation!** -- The above sets a collection of possible laser codes that can be assigned. **Note the { } notation!**
-- --
-- ### 4.2. Auto generate laser codes -- ## 4.2. Auto generate laser codes
-- --
-- Use the method @{#DESIGNATE.GenerateLaserCodes}() to generate all possible laser codes. Logic implemented and advised by Ciribob! -- Use the method @{#DESIGNATE.GenerateLaserCodes}() to generate all possible laser codes. Logic implemented and advised by Ciribob!
-- --
-- ### 4.3. Add specific lase codes to the lase menu -- ## 4.3. Add specific lase codes to the lase menu
-- --
-- Certain plane types can only drop laser guided ordonnance when targets are lased with specific laser codes. -- Certain plane types can only drop laser guided ordonnance when targets are lased with specific laser codes.
-- The SU-25T needs targets to be lased using laser code 1113. -- The SU-25T needs targets to be lased using laser code 1113.
@@ -241,7 +249,7 @@ do -- DESIGNATE
-- The method @{#DESIGNATE.AddMenuLaserCode}() to allow a player to lase a target using a specific laser code. -- The method @{#DESIGNATE.AddMenuLaserCode}() to allow a player to lase a target using a specific laser code.
-- Remove such a lase menu option using @{#DESIGNATE.RemoveMenuLaserCode}(). -- Remove such a lase menu option using @{#DESIGNATE.RemoveMenuLaserCode}().
-- --
-- ## 5. Autolase to automatically lase detected targets. -- # 5. Autolase to automatically lase detected targets.
-- --
-- DetectionItems can be auto lased once detected by Recces. As such, there is almost no action required from the Players using the Designate Menu. -- DetectionItems can be auto lased once detected by Recces. As such, there is almost no action required from the Players using the Designate Menu.
-- The **auto lase** function can be activated through the Designation Menu. -- The **auto lase** function can be activated through the Designation Menu.
@@ -252,7 +260,7 @@ do -- DESIGNATE
-- --
-- Activate the auto lasing. -- Activate the auto lasing.
-- --
-- ## 6. Target prioritization on threat level -- # 6. Target prioritization on threat level
-- --
-- Targets can be detected of different types in one DetectionItem. Depending on the type of the Target, a different threat level applies in an Air to Ground combat context. -- Targets can be detected of different types in one DetectionItem. Depending on the type of the Target, a different threat level applies in an Air to Ground combat context.
-- SAMs are of a higher threat than normal tanks. So, if the Target type was recognized, the Recces will select those targets that form the biggest threat first, -- SAMs are of a higher threat than normal tanks. So, if the Target type was recognized, the Recces will select those targets that form the biggest threat first,
@@ -265,12 +273,12 @@ do -- DESIGNATE
-- --
-- The example will activate the threat level prioritization for this the Designate object. Threats will be marked based on the threat level of the Target. -- The example will activate the threat level prioritization for this the Designate object. Threats will be marked based on the threat level of the Target.
-- --
-- ## 6. Designate Menu Location for a Mission -- # 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. -- 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 @{Mission} object for the designate function. -- Use the method @{#DESIGNATE.SetMission}() to set the @{Mission} object for the designate function.
-- --
-- ## 7. Status Report -- # 8. Status Report
-- --
-- A status report is available that displays the current Targets detected, grouped per DetectionItem, and a list of which Targets are currently being marked. -- A status report is available that displays the current Targets detected, grouped per DetectionItem, and a list of which Targets are currently being marked.
-- --

View File

@@ -2,18 +2,25 @@
-- --
-- === -- ===
-- --
-- ## Features:
--
-- * Detection of targets by recce units.
-- * Group detected targets per unit, type or area (zone).
-- * Keep persistency of detected targets, if when detection is lost.
-- * Provide an indication of detected targets.
-- * Report detected targets.
-- * Refresh detection upon specified time intervals.
--
-- ===
--
-- ## Missions:
--
-- [DET - Detection](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/DET%20-%20Detection)
--
-- ===
--
-- Facilitate the detection of enemy units within the battle zone executed by FACs (Forward Air Controllers) or RECCEs (Reconnassance Units). -- Facilitate the detection of enemy units within the battle zone executed by FACs (Forward Air Controllers) or RECCEs (Reconnassance Units).
-- DETECTION uses the in-built detection capabilities of DCS World, but adds new functionalities. -- It uses the in-built detection capabilities of DCS World, but adds new functionalities.
--
-- Find the DETECTION classes documentation further in this document in the globals section.
--
-- ===
--
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/DET%20-%20Detection)
--
-- ===
--
-- ### [YouTube Playlist](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl3Cf5jpI6BS0sBOVWK__tji)
-- --
-- === -- ===
-- --
@@ -25,13 +32,11 @@
-- --
-- * FlightControl : Analysis, Design, Programming, Testing -- * FlightControl : Analysis, Design, Programming, Testing
-- --
-- ===
--
-- @module Functional.Detection -- @module Functional.Detection
-- @image Detection.JPG -- @image Detection.JPG
----BASE:TraceClass("DETECTION_BASE")
----BASE:TraceClass("DETECTION_AREAS")
----BASE:TraceClass("DETECTION_UNITS")
----BASE:TraceClass("DETECTION_TYPES")
do -- DETECTION_BASE do -- DETECTION_BASE

View File

@@ -2,6 +2,27 @@
-- --
-- === -- ===
-- --
-- ## Features:
--
-- * Escort navigation commands.
-- * Escort hold at position commands.
-- * Escorts reporting detected targets.
-- * Escorts scanning targets in advance.
-- * Escorts attacking specific targets.
-- * Request assistance from other groups for attack.
-- * Manage rule of engagement of escorts.
-- * Manage the allowed evasion techniques of escorts.
-- * Make escort to execute a defined mission or path.
-- * Escort tactical situation reporting.
--
-- ===
--
-- ## Missions:
--
-- [ESC - Escorting](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/ESC%20-%20Escorting)
--
-- ===
--
-- Allows you to interact with escorting AI on your flight and take the lead. -- Allows you to interact with escorting AI on your flight and take the lead.
-- --
-- Each escorting group can be commanded with a whole set of radio commands (radio menu in your flight, and then F10). -- Each escorting group can be commanded with a whole set of radio commands (radio menu in your flight, and then F10).
@@ -77,47 +98,18 @@
-- Escort groups can have their own mission. This menu item will allow the escort group to resume their Mission from a given waypoint. -- Escort groups can have their own mission. This menu item will allow the escort group to resume their Mission from a given waypoint.
-- Note that this is really fantastic, as you now have the dynamic of taking control of the escort groups, and allowing them to resume their path or mission. -- Note that this is really fantastic, as you now have the dynamic of taking control of the escort groups, and allowing them to resume their path or mission.
-- --
-- # ESCORT construction methods. -- ===
--
-- Create a new SPAWN object with the @{#ESCORT.New} method:
--
-- * @{#ESCORT.New}: Creates a new ESCORT object from a @{Wrapper.Group#GROUP} for a @{Wrapper.Client#CLIENT}, with an optional briefing text.
--
-- # ESCORT initialization methods.
--
-- The following menus are created within the RADIO MENU (F10) of an active unit hosted by a player:
--
-- * @{#ESCORT.MenuFollowAt}: Creates a menu to make the escort follow the client.
-- * @{#ESCORT.MenuHoldAtEscortPosition}: Creates a menu to hold the escort at its current position.
-- * @{#ESCORT.MenuHoldAtLeaderPosition}: Creates a menu to hold the escort at the client position.
-- * @{#ESCORT.MenuScanForTargets}: Creates a menu so that the escort scans targets.
-- * @{#ESCORT.MenuFlare}: Creates a menu to disperse flares.
-- * @{#ESCORT.MenuSmoke}: Creates a menu to disparse smoke.
-- * @{#ESCORT.MenuReportTargets}: Creates a menu so that the escort reports targets.
-- * @{#ESCORT.MenuReportPosition}: Creates a menu so that the escort reports its current position from bullseye.
-- * @{#ESCORT.MenuAssistedAttack: Creates a menu so that the escort supportes assisted attack from other escorts with the client.
-- * @{#ESCORT.MenuROE: Creates a menu structure to set the rules of engagement of the escort.
-- * @{#ESCORT.MenuEvasion: Creates a menu structure to set the evasion techniques when the escort is under threat.
-- * @{#ESCORT.MenuResumeMission}: Creates a menu structure so that the escort can resume from a waypoint.
--
--
-- @usage
-- -- Declare a new EscortPlanes object as follows:
--
-- -- First find the GROUP object and the CLIENT object.
-- local EscortClient = CLIENT:FindByName( "Unit Name" ) -- The Unit Name is the name of the unit flagged with the skill Client in the mission editor.
-- local EscortGroup = GROUP:FindByName( "Group Name" ) -- The Group Name is the name of the group that will escort the Escort Client.
--
-- -- Now use these 2 objects to construct the new EscortPlanes object.
-- EscortPlanes = ESCORT:New( EscortClient, EscortGroup, "Desert", "Welcome to the mission. You are escorted by a plane with code name 'Desert', which can be instructed through the F10 radio menu." )
-- --
-- ### Authors: **FlightControl**
-- --
-- ===
-- --
-- @module Functional.Escort -- @module Functional.Escort
-- @image Escorting.JPG -- @image Escorting.JPG
--- ESCORT class
-- @type ESCORT
--- @type ESCORT
-- @extends Core.Base#BASE -- @extends Core.Base#BASE
-- @field Wrapper.Client#CLIENT EscortClient -- @field Wrapper.Client#CLIENT EscortClient
-- @field Wrapper.Group#GROUP EscortGroup -- @field Wrapper.Group#GROUP EscortGroup
@@ -129,6 +121,26 @@
-- @Field DCS#AI.Option.Air.val.ROE OptionROE Which ROE is set to the EscortGroup. -- @Field DCS#AI.Option.Air.val.ROE OptionROE Which ROE is set to the EscortGroup.
-- @field DCS#AI.Option.Air.val.REACTION_ON_THREAT OptionReactionOnThreat Which REACTION_ON_THREAT is set to the EscortGroup. -- @field DCS#AI.Option.Air.val.REACTION_ON_THREAT OptionReactionOnThreat Which REACTION_ON_THREAT is set to the EscortGroup.
-- @field FunctionalMENU_GROUPDETECTION_BASE Detection -- @field FunctionalMENU_GROUPDETECTION_BASE Detection
--- ESCORT class
--
-- # ESCORT construction methods.
--
-- Create a new SPAWN object with the @{#ESCORT.New} method:
--
-- * @{#ESCORT.New}: Creates a new ESCORT object from a @{Wrapper.Group#GROUP} for a @{Wrapper.Client#CLIENT}, with an optional briefing text.
--
-- @usage
-- -- Declare a new EscortPlanes object as follows:
--
-- -- First find the GROUP object and the CLIENT object.
-- local EscortClient = CLIENT:FindByName( "Unit Name" ) -- The Unit Name is the name of the unit flagged with the skill Client in the mission editor.
-- local EscortGroup = GROUP:FindByName( "Group Name" ) -- The Group Name is the name of the group that will escort the Escort Client.
--
-- -- Now use these 2 objects to construct the new EscortPlanes object.
-- EscortPlanes = ESCORT:New( EscortClient, EscortGroup, "Desert", "Welcome to the mission. You are escorted by a plane with code name 'Desert', which can be instructed through the F10 radio menu." )
--
-- @field #ESCORT
ESCORT = { ESCORT = {
ClassName = "ESCORT", ClassName = "ESCORT",
EscortName = nil, -- The Escort Name EscortName = nil, -- The Escort Name

View File

@@ -1,10 +1,8 @@
--- **Functional** -- MISSILETRAINER helps you to train missile avoidance. --- **Functional** -- Train missile defence and deflection.
-- --
-- === -- ===
-- --
-- The @{#MISSILETRAINER} class uses the DCS world messaging system to be alerted of any missiles fired, and when a missile would hit your aircraft, -- ## Features:
-- the class will destroy the missile within a certain range, to avoid damage to your aircraft.
-- It suports the following functionality:
-- --
-- * Track the missiles fired at you and other players, providing bearing and range information of the missiles towards the airplanes. -- * Track the missiles fired at you and other players, providing bearing and range information of the missiles towards the airplanes.
-- * Provide alerts of missile launches, including detailed information of the units launching, including bearing, range <20> -- * Provide alerts of missile launches, including detailed information of the units launching, including bearing, range <20>
@@ -12,7 +10,18 @@
-- * Provide alerts when the missile self destructs. -- * Provide alerts when the missile self destructs.
-- * Enable / Disable and Configure the Missile Trainer using the various menu options. -- * Enable / Disable and Configure the Missile Trainer using the various menu options.
-- --
-- When running a mission where MISSILETRAINER is used, the following radio menu structure ( 'Radio Menu' -> 'Other (F10)' -> 'MissileTrainer' ) options are available for the players: -- ===
--
-- ## Missions:
--
-- [MIT - Missile Trainer](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/MIT%20-%20Missile%20Trainer)
--
-- ===
--
-- Uses the MOOSE messaging system to be alerted of any missiles fired, and when a missile would hit your aircraft,
-- the class will destroy the missile within a certain range, to avoid damage to your aircraft.
--
-- When running a mission where the missile trainer is used, the following radio menu structure ( 'Radio Menu' -> 'Other (F10)' -> 'MissileTrainer' ) options are available for the players:
-- --
-- * **Messages**: Menu to configure all messages. -- * **Messages**: Menu to configure all messages.
-- * **Messages On**: Show all messages. -- * **Messages On**: Show all messages.
@@ -42,17 +51,40 @@
-- * **150 meter**: Destroys the missile when the distance to the aircraft is below or equal to 150 meter. -- * **150 meter**: Destroys the missile when the distance to the aircraft is below or equal to 150 meter.
-- * **200 meter**: Destroys the missile when the distance to the aircraft is below or equal to 200 meter. -- * **200 meter**: Destroys the missile when the distance to the aircraft is below or equal to 200 meter.
-- --
-- ===
--
-- ### Authors: **FlightControl**
--
-- ### Contributions:
--
-- * **Stuka (Danny)**: Who you can search on the Eagle Dynamics Forums. Working together with Danny has resulted in the MISSILETRAINER class.
-- Danny has shared his ideas and together we made a design.
-- Together with the **476 virtual team**, we tested the MISSILETRAINER class, and got much positive feedback!
-- * **132nd Squadron**: Testing and optimizing the logic.
--
-- ===
--
-- @module Functional.MissileTrainer
-- @image Missile_Trainer.JPG
--- @type MISSILETRAINER
-- @field Core.Set#SET_CLIENT DBClients
-- @extends Core.Base#BASE
---
--
-- # Constructor:
-- --
-- 1.1) MISSILETRAINER construction methods:
-- -----------------------------------------
-- Create a new MISSILETRAINER object with the @{#MISSILETRAINER.New} method: -- Create a new MISSILETRAINER object with the @{#MISSILETRAINER.New} method:
-- --
-- * @{#MISSILETRAINER.New}: Creates a new MISSILETRAINER object taking the maximum distance to your aircraft to evaluate when a missile needs to be destroyed. -- * @{#MISSILETRAINER.New}: Creates a new MISSILETRAINER object taking the maximum distance to your aircraft to evaluate when a missile needs to be destroyed.
-- --
-- MISSILETRAINER will collect each unit declared in the mission with a skill level "Client" and "Player", and will monitor the missiles shot at those. -- MISSILETRAINER will collect each unit declared in the mission with a skill level "Client" and "Player", and will monitor the missiles shot at those.
-- --
-- 1.2) MISSILETRAINER initialization methods: -- # Initialization:
-- ------------------------------------------- --
-- A MISSILETRAINER object will behave differently based on the usage of initialization methods: -- A MISSILETRAINER object will behave differently based on the usage of initialization methods:
-- --
-- * @{#MISSILETRAINER.InitMessagesOnOff}: Sets by default the display of any message to be ON or OFF. -- * @{#MISSILETRAINER.InitMessagesOnOff}: Sets by default the display of any message to be ON or OFF.
@@ -66,23 +98,7 @@
-- * @{#MISSILETRAINER.InitBearingOnOff}: Sets by default the display of bearing information of missiles ON of OFF. -- * @{#MISSILETRAINER.InitBearingOnOff}: Sets by default the display of bearing information of missiles ON of OFF.
-- * @{#MISSILETRAINER.InitMenusOnOff}: Allows to configure the options through the radio menu. -- * @{#MISSILETRAINER.InitMenusOnOff}: Allows to configure the options through the radio menu.
-- --
-- === -- @field #MISSILETRAINER
--
-- CREDITS
-- ===
-- **Stuka (Danny)** Who you can search on the Eagle Dynamics Forums.
-- Working together with Danny has resulted in the MISSILETRAINER class.
-- Danny has shared his ideas and together we made a design.
-- Together with the **476 virtual team**, we tested the MISSILETRAINER class, and got much positive feedback!
--
-- @module Functional.MissileTrainer
-- @image Missile_Trainer.JPG
--- The MISSILETRAINER class
-- @type MISSILETRAINER
-- @field Core.Set#SET_CLIENT DBClients
-- @extends Core.Base#BASE
MISSILETRAINER = { MISSILETRAINER = {
ClassName = "MISSILETRAINER", ClassName = "MISSILETRAINER",
TrackingMissiles = {}, TrackingMissiles = {},

View File

@@ -1,4 +1,4 @@
--- **Functional** -- Limit the MOVEMENT of simulaneous moving ground vehicles. --- **Functional** -- Limit the movement of simulaneous moving ground vehicles.
-- --
-- === -- ===
-- --
@@ -10,9 +10,11 @@
-- @module Functional.Movement -- @module Functional.Movement
-- @image MOOSE.JPG -- @image MOOSE.JPG
--- the MOVEMENT class --- @type MOVEMENT
-- @type MOVEMENT
-- @extends Core.Base#BASE -- @extends Core.Base#BASE
---
--@field #MOVEMENT
MOVEMENT = { MOVEMENT = {
ClassName = "MOVEMENT", ClassName = "MOVEMENT",
} }

View File

@@ -1,4 +1,4 @@
--- **Functional** - (R2.4) Rudimentary ATC. --- **Functional** - Rudimentary ATC.
-- --
-- ![Banner Image](..\Presentations\PSEUDOATC\PSEUDOATC_Main.jpg) -- ![Banner Image](..\Presentations\PSEUDOATC\PSEUDOATC_Main.jpg)
-- --
@@ -8,7 +8,7 @@
-- --
-- In particular, a menu entry "Pseudo ATC" is created in the "F10 Other..." radiomenu. -- In particular, a menu entry "Pseudo ATC" is created in the "F10 Other..." radiomenu.
-- --
-- ## Features -- ## Features:
-- --
-- * Weather report at nearby airbases and mission waypoints. -- * Weather report at nearby airbases and mission waypoints.
-- * Report absolute bearing and range to nearest airports and mission waypoints. -- * Report absolute bearing and range to nearest airports and mission waypoints.
@@ -20,12 +20,6 @@
-- --
-- ==== -- ====
-- --
-- # Demo Missions
--
-- ### [MOOSE - ALL Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS)
--
-- ====
--
-- # YouTube Channel -- # YouTube Channel
-- --
-- ### [MOOSE YouTube Channel](https://www.youtube.com/channel/UCjrA9j5LQoWsG4SpS8i79Qg) -- ### [MOOSE YouTube Channel](https://www.youtube.com/channel/UCjrA9j5LQoWsG4SpS8i79Qg)
@@ -104,7 +98,7 @@ PSEUDOATC.id="PseudoATC | "
--- PSEUDOATC version. --- PSEUDOATC version.
-- @field #number version -- @field #number version
PSEUDOATC.version="0.9.0" PSEUDOATC.version="0.9.1"
----------------------------------------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------------------------------------------------
@@ -749,9 +743,9 @@ function PSEUDOATC:ReportBR(id, position, location)
local coord=unit:GetCoordinate() local coord=unit:GetCoordinate()
-- Direction vector from current position (coord) to target (position). -- Direction vector from current position (coord) to target (position).
local pos=coord:Translate(30,90) local angle=coord:HeadingTo(position)
local vec3=coord:GetDirectionVec3(pos)
local angle=coord:GetAngleDegrees(vec3) -- Range from current to
local range=coord:Get2DDistance(position) local range=coord:Get2DDistance(position)
-- Bearing string. -- Bearing string.

View File

@@ -1,14 +1,12 @@
--- **Functional** - (R2.2) - Create random airtraffic in your missions. --- **Functional** - Create random airtraffic in your missions.
-- --
-- === -- ===
-- --
-- The aim of the RAT class is to fill the empty DCS world with randomized air traffic and bring more life to your airports. -- The aim of the RAT class is to fill the empty DCS world with randomized air traffic and bring more life to your airports.
--
-- In particular, it is designed to spawn AI air units at random airports. These units will be assigned a random flight path to another random airport on the map. -- In particular, it is designed to spawn AI air units at random airports. These units will be assigned a random flight path to another random airport on the map.
--
-- Even the mission designer will not know where aircraft will be spawned and which route they follow. -- Even the mission designer will not know where aircraft will be spawned and which route they follow.
-- --
-- ## Features -- ## Features:
-- --
-- * Very simple interface. Just one unit and two lines of Lua code needed to fill your map. -- * Very simple interface. Just one unit and two lines of Lua code needed to fill your map.
-- * High degree of randomization. Aircraft will spawn at random airports, have random routes and random destinations. -- * High degree of randomization. Aircraft will spawn at random airports, have random routes and random destinations.
@@ -22,7 +20,7 @@
-- * All of the above can be customized by the user if necessary. -- * All of the above can be customized by the user if necessary.
-- * All current (Caucasus, Nevada, Normandy, Persian Gulf) and future maps are supported. -- * All current (Caucasus, Nevada, Normandy, Persian Gulf) and future maps are supported.
-- --
-- The RAT class creates an entry in the F10 radio menu which allows to -- The RAT class creates an entry in the F10 radio menu which allows to:
-- --
-- * Create new groups on-the-fly, i.e. at run time within the mission, -- * Create new groups on-the-fly, i.e. at run time within the mission,
-- * Destroy specific groups (e.g. if they get stuck or damaged and block a runway), -- * Destroy specific groups (e.g. if they get stuck or damaged and block a runway),
@@ -35,10 +33,9 @@
-- --
-- === -- ===
-- --
-- # Demo Missions -- ## Missions:
-- --
-- ### [MOOSE - ALL Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS) -- ### [RAT - Random Air Traffic](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/RAT%20-%20Random%20Air%20Traffic)
-- ### [MOOSE - RAT Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/RAT%20-%20Random%20Air%20Traffic)
-- --
-- === -- ===
-- --

View File

@@ -1,4 +1,4 @@
--- **Functional** - (R2.3) - Range Practice. --- **Functional** - Range Practice.
-- --
-- === -- ===
-- --
@@ -9,7 +9,7 @@
-- --
-- [476th - Air Weapons Range Objects mod](http://www.476vfightergroup.com/downloads.php?do=file&id=287) is highly recommended for this class. -- [476th - Air Weapons Range Objects mod](http://www.476vfightergroup.com/downloads.php?do=file&id=287) is highly recommended for this class.
-- --
-- ## Features -- ## Features:
-- --
-- * Impact points of bombs, rockets and missils are recorded and distance to closest range target is measured and reported to the player. -- * Impact points of bombs, rockets and missils are recorded and distance to closest range target is measured and reported to the player.
-- * Number of hits on strafing passes are counted and reported. Also the percentage of hits w.r.t fired shots is evaluated. -- * Number of hits on strafing passes are counted and reported. Also the percentage of hits w.r.t fired shots is evaluated.
@@ -25,14 +25,6 @@
-- --
-- === -- ===
-- --
-- # Demo Missions
--
-- ### [MOOSE - ALL Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS)
--
-- ===
--
-- # YouTube Channel
--
-- ### [MOOSE YouTube Channel](https://www.youtube.com/channel/UCjrA9j5LQoWsG4SpS8i79Qg) -- ### [MOOSE YouTube Channel](https://www.youtube.com/channel/UCjrA9j5LQoWsG4SpS8i79Qg)
-- ### [MOOSE - On the Range - Demonstration Video](https://www.youtube.com/watch?v=kIXcxNB9_3M) -- ### [MOOSE - On the Range - Demonstration Video](https://www.youtube.com/watch?v=kIXcxNB9_3M)
-- --

View File

@@ -1,4 +1,25 @@
--- **Functional** -- (R2.0) - Administer the scoring of player achievements, and create a CSV file logging the scoring events for use at team or squadron websites. --- **Functional** - Administer the scoring of player achievements, and create a CSV file logging the scoring events for use at team or squadron websites.
--
-- ===
--
-- ## Features:
--
-- * Set the scoring scales based on threat level.
-- * Positive scores and negative scores.
-- * A contribution model to score achievements.
-- * Score goals.
-- * Score specific achievements.
-- * Score the hits and destroys of units.
-- * Score the hits and destroys of statics.
-- * Score the hits and destroys of scenery.
-- * Log scores into a CSV file.
-- * Connect to a remote server using JSON and IP.
--
-- ===
--
-- ## Missions:
--
-- [SCO - Scoring](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SCO%20-%20Scoring)
-- --
-- === -- ===
-- --
@@ -52,9 +73,34 @@
-- Use the radio menu F10 to consult the scores while running the mission. -- Use the radio menu F10 to consult the scores while running the mission.
-- Scores can be reported for your user, or an overall score can be reported of all players currently active in the mission. -- Scores can be reported for your user, or an overall score can be reported of all players currently active in the mission.
-- --
-- # 1) @{Functional.Scoring#SCORING} class, extends @{Core.Base#BASE} -- ===
-- --
-- ## 1.1) Set the destroy score or penalty scale -- ### Authors: **FlightControl**
--
-- ### Contributions:
--
-- * **Wingthor (TAW)**: Testing & Advice.
-- * **Dutch-Baron (TAW)**: Testing & Advice.
-- * **[Whisper](http://forums.eagle.ru/member.php?u=3829): Testing and Advice.
--
-- ===
--
-- @module Functional.Scoring
-- @image Scoring.JPG
--- @type SCORING
-- @field Players A collection of the current players that have joined the game.
-- @extends Core.Base#BASE
--- SCORING class
--
-- # Constructor:
--
-- local Scoring = SCORING:New( "Scoring File" )
--
--
-- # Set the destroy score or penalty scale:
-- --
-- Score scales can be set for scores granted when enemies or friendlies are destroyed. -- Score scales can be set for scores granted when enemies or friendlies are destroyed.
-- Use the method @{#SCORING.SetScaleDestroyScore}() to set the scale of enemy destroys (positive destroys). -- Use the method @{#SCORING.SetScaleDestroyScore}() to set the scale of enemy destroys (positive destroys).
@@ -67,7 +113,7 @@
-- The above sets the scale for valid scores to 10. So scores will be given in a scale from 0 to 10. -- The above sets the scale for valid scores to 10. So scores will be given in a scale from 0 to 10.
-- The penalties will be given in a scale from 0 to 40. -- The penalties will be given in a scale from 0 to 40.
-- --
-- ## 1.2) Define special targets that will give extra scores. -- # Define special targets that will give extra scores:
-- --
-- Special targets can be set that will give extra scores to the players when these are destroyed. -- Special targets can be set that will give extra scores to the players when these are destroyed.
-- Use the methods @{#SCORING.AddUnitScore}() and @{#SCORING.RemoveUnitScore}() to specify a special additional score for a specific @{Wrapper.Unit}s. -- Use the methods @{#SCORING.AddUnitScore}() and @{#SCORING.RemoveUnitScore}() to specify a special additional score for a specific @{Wrapper.Unit}s.
@@ -84,7 +130,7 @@
-- --
-- Scoring:RemoveUnitScore( UNIT:FindByName( "Unit #001" ) ) -- Scoring:RemoveUnitScore( UNIT:FindByName( "Unit #001" ) )
-- --
-- ## 1.3) Define destruction zones that will give extra scores. -- # Define destruction zones that will give extra scores:
-- --
-- Define zones of destruction. Any object destroyed within the zone of the given category will give extra points. -- Define zones of destruction. Any object destroyed within the zone of the given category will give extra points.
-- Use the method @{#SCORING.AddZoneScore}() to add a @{Zone} for additional scoring. -- Use the method @{#SCORING.AddZoneScore}() to add a @{Zone} for additional scoring.
@@ -94,12 +140,12 @@
-- The other implementation could be to designate a scenery target (a building) in the mission editor surrounded by a @{Zone}, -- The other implementation could be to designate a scenery target (a building) in the mission editor surrounded by a @{Zone},
-- just large enough around that building. -- just large enough around that building.
-- --
-- ## 1.4) Add extra Goal scores upon an event or a condition. -- # Add extra Goal scores upon an event or a condition:
-- --
-- A mission has goals and achievements. The scoring system provides an API to set additional scores when a goal or achievement event happens. -- A mission has goals and achievements. The scoring system provides an API to set additional scores when a goal or achievement event happens.
-- Use the method @{#SCORING.AddGoalScore}() to add a score for a Player at any time in your mission. -- Use the method @{#SCORING.AddGoalScore}() to add a score for a Player at any time in your mission.
-- --
-- ## 1.5) (Decommissioned) Configure fratricide level. -- # (Decommissioned) Configure fratricide level.
-- --
-- **This functionality is decomissioned until the DCS bug concerning Unit:destroy() not being functional in multi player for player units has been fixed by ED**. -- **This functionality is decomissioned until the DCS bug concerning Unit:destroy() not being functional in multi player for player units has been fixed by ED**.
-- --
@@ -107,13 +153,13 @@
-- Use the method @{#SCORING.SetFratricide}() to define the level when a player gets kicked. -- Use the method @{#SCORING.SetFratricide}() to define the level when a player gets kicked.
-- By default, the fratricide level is the default penalty mutiplier * 2 for the penalty score. -- By default, the fratricide level is the default penalty mutiplier * 2 for the penalty score.
-- --
-- ## 1.6) Penalty score when a player changes the coalition. -- # Penalty score when a player changes the coalition.
-- --
-- When a player changes the coalition, he can receive a penalty score. -- When a player changes the coalition, he can receive a penalty score.
-- Use the method @{#SCORING.SetCoalitionChangePenalty}() to define the penalty when a player changes coalition. -- Use the method @{#SCORING.SetCoalitionChangePenalty}() to define the penalty when a player changes coalition.
-- By default, the penalty for changing coalition is the default penalty scale. -- By default, the penalty for changing coalition is the default penalty scale.
-- --
-- ## 1.8) Define output CSV files. -- # Define output CSV files.
-- --
-- The CSV file is given the name of the string given in the @{#SCORING.New}{} constructor, followed by the .csv extension. -- The CSV file is given the name of the string given in the @{#SCORING.New}{} constructor, followed by the .csv extension.
-- The file is incrementally saved in the **<User>\\Saved Games\\DCS\\Logs** folder, and has a time stamp indicating each mission run. -- The file is incrementally saved in the **<User>\\Saved Games\\DCS\\Logs** folder, and has a time stamp indicating each mission run.
@@ -150,7 +196,7 @@
-- The MOOSE designer cannot take any responsibility of any damage inflicted as a result of the de-sanitization. -- The MOOSE designer cannot take any responsibility of any damage inflicted as a result of the de-sanitization.
-- That being said, I hope that the SCORING class provides you with a great add-on to score your squad mates achievements. -- That being said, I hope that the SCORING class provides you with a great add-on to score your squad mates achievements.
-- --
-- ## 1.9) Configure messages. -- # Configure messages.
-- --
-- When players hit or destroy targets, messages are sent. -- When players hit or destroy targets, messages are sent.
-- Various methods exist to configure: -- Various methods exist to configure:
@@ -158,7 +204,7 @@
-- * Which messages are sent upon the event. -- * Which messages are sent upon the event.
-- * Which audience receives the message. -- * Which audience receives the message.
-- --
-- ### 1.9.1) Configure the messages sent upon the event. -- ## Configure the messages sent upon the event.
-- --
-- Use the following methods to configure when to send messages. By default, all messages are sent. -- Use the following methods to configure when to send messages. By default, all messages are sent.
-- --
@@ -167,49 +213,16 @@
-- * @{#SCORING.SetMessagesAddon}(): Configure to send messages for additional score, after a target has been destroyed. -- * @{#SCORING.SetMessagesAddon}(): Configure to send messages for additional score, after a target has been destroyed.
-- * @{#SCORING.SetMessagesZone}(): Configure to send messages for additional score, after a target has been destroyed within a given zone. -- * @{#SCORING.SetMessagesZone}(): Configure to send messages for additional score, after a target has been destroyed within a given zone.
-- --
-- ### 1.9.2) Configure the audience of the messages. -- ## Configure the audience of the messages.
-- --
-- Use the following methods to configure the audience of the messages. By default, the messages are sent to all players in the mission. -- Use the following methods to configure the audience of the messages. By default, the messages are sent to all players in the mission.
-- --
-- * @{#SCORING.SetMessagesToAll}(): Configure to send messages to all players. -- * @{#SCORING.SetMessagesToAll}(): Configure to send messages to all players.
-- * @{#SCORING.SetMessagesToCoalition}(): Configure to send messages to only those players within the same coalition as the player. -- * @{#SCORING.SetMessagesToCoalition}(): Configure to send messages to only those players within the same coalition as the player.
-- --
--
-- === -- ===
-- --
-- # **API CHANGE HISTORY** -- @field #SCORING
--
-- The underlying change log documents the API changes. Please read this carefully. The following notation is used:
--
-- * **Added** parts are expressed in bold type face.
-- * _Removed_ parts are expressed in italic type face.
--
-- Hereby the change log:
--
-- 2017-02-26: Initial class and API.
--
-- ===
--
-- # **AUTHORS and CONTRIBUTIONS**
--
-- ### Contributions:
--
-- * **Wingthor (TAW)**: Testing & Advice.
-- * **Dutch-Baron (TAW)**: Testing & Advice.
-- * **[Whisper](http://forums.eagle.ru/member.php?u=3829): Testing and Advice.
--
-- ### Authors:
--
-- * **FlightControl**: Concept, Design & Programming.
--
-- @module Functional.Scoring
-- @image Scoring.JPG
--- The Scoring class
-- @type SCORING
-- @field Players A collection of the current players that have joined the game.
-- @extends Core.Base#BASE
SCORING = { SCORING = {
ClassName = "SCORING", ClassName = "SCORING",
ClassID = 0, ClassID = 0,
@@ -236,8 +249,10 @@ local _SCORINGCategory =
-- @param #string GameName The name of the game. This name is also logged in the CSV score file. -- @param #string GameName The name of the game. This name is also logged in the CSV score file.
-- @return #SCORING self -- @return #SCORING self
-- @usage -- @usage
--
-- -- Define a new scoring object for the mission Gori Valley. -- -- Define a new scoring object for the mission Gori Valley.
-- ScoringObject = SCORING:New( "Gori Valley" ) -- ScoringObject = SCORING:New( "Gori Valley" )
--
function SCORING:New( GameName ) function SCORING:New( GameName )
-- Inherits from BASE -- Inherits from BASE

View File

@@ -1,13 +1,41 @@
--- **Functional** -- Provides defensive behaviour to a set of SAM sites within a running Mission. --- **Functional** -- Make SAM sites execute evasive and defensive behaviour when being fired upon.
--
-- ===
--
-- ## Features:
--
-- * When SAM sites are being fired upon, the SAMs will take evasive action will reposition themselves when possible.
-- * When SAM sites are being fired upon, the SAMs will take defensive action by shutting down their radars.
--
-- ===
--
-- ## Missions:
--
-- [SEV - SEAD Evasion](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SEV%20-%20SEAD%20Evasion)
--
-- ===
--
-- ### Authors: **FlightControl**
-- --
-- === -- ===
-- --
-- @module Functional.Sead -- @module Functional.Sead
-- @image SEAD.JPG -- @image SEAD.JPG
--- The SEAD class --- @type SEAD
-- @type SEAD
-- @extends Core.Base#BASE -- @extends Core.Base#BASE
--- Make SAM sites execute evasive and defensive behaviour when being fired upon.
--
-- This class is very easy to use. Just setup a SEAD object by using @{#SEAD.New}() and SAMs will evade and take defensive action when being fired upon.
--
-- # Constructor:
--
-- Use the @{#SEAD.New}() constructor to create a new SEAD object.
--
-- SEAD_RU_SAM_Defenses = SEAD:New( { 'RU SA-6 Kub', 'RU SA-6 Defenses', 'RU MI-26 Troops', 'RU Attack Gori' } )
--
-- @field #SEAD
SEAD = { SEAD = {
ClassName = "SEAD", ClassName = "SEAD",
TargetSkill = { TargetSkill = {

View File

@@ -1,7 +1,18 @@
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --- **Functional** - Suppress fire of ground units when they get hit.
--- **Functional** - (R2.4) Suppress fire of ground units when they get hit.
-- --
-- ==== -- ===
--
-- ## Features:
--
-- * Hold fire of attacked units when being fired upon.
--
-- ===
--
-- ## Missions:
--
-- ## [MOOSE - ALL Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS)
--
-- ===
-- --
-- When ground units get hit by (suppressive) enemy fire, they will not be able to shoot back for a certain amount of time. -- When ground units get hit by (suppressive) enemy fire, they will not be able to shoot back for a certain amount of time.
-- --
@@ -12,12 +23,6 @@
-- --
-- ==== -- ====
-- --
-- # Demo Missions
--
-- ### [MOOSE - ALL Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS)
--
-- ====
--
-- # YouTube Channel -- # YouTube Channel
-- --
-- ### [MOOSE YouTube Channel](https://www.youtube.com/channel/UCjrA9j5LQoWsG4SpS8i79Qg) -- ### [MOOSE YouTube Channel](https://www.youtube.com/channel/UCjrA9j5LQoWsG4SpS8i79Qg)
@@ -28,7 +33,8 @@
-- --
-- ### Contributions: [FlightControl](https://forums.eagle.ru/member.php?u=89536) -- ### Contributions: [FlightControl](https://forums.eagle.ru/member.php?u=89536)
-- --
-- ==== -- ===
--
-- @module Functional.Suppression -- @module Functional.Suppression
-- @image Suppression.JPG -- @image Suppression.JPG

File diff suppressed because it is too large Load Diff

View File

@@ -1,14 +1,40 @@
--- **Functional** -- (R2.3) Models the process to zone guarding and capturing. --- **Functional** -- Models the process to zone guarding and capturing.
-- --
-- === -- ===
-- --
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/CAZ - Capture Zones) -- ## Features:
-- --
-- - CAZ-000 - Capture Zone: Demonstrates the basic concept of capturing a zone. -- * Models the possible state transitions between the Guarded, Attacked, Empty and Captured states.
-- * A zone has an owning coalition, that means that at a specific point in time, a zone can be owned by the red or blue coalition.
-- * Provide event handlers to tailor the actions when a zone changes coalition or state.
-- --
-- === -- ===
-- --
-- ### [YouTube Playlist](https://www.youtube.com/watch?v=0m6K6Yxa-os&list=PL7ZUrU4zZUl0qqJsfa8DPvZWDY-OyDumE) -- ## Missions:
--
-- [CAZ - Capture Zones](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/CAZ%20-%20Capture%20Zones)
--
-- ===
--
-- # Player Experience
--
-- ![States](..\Presentations\ZONE_CAPTURE_COALITION\Dia3.JPG)
--
-- The above models the possible state transitions between the **Guarded**, **Attacked**, **Empty** and **Captured** states.
-- A zone has an __owning coalition__, that means that at a specific point in time, a zone can be owned by the red or blue coalition.
--
-- The Zone can be in the state **Guarded** by the __owning coalition__, which is the coalition that initially occupies the zone with units of its coalition.
-- Once units of an other coalition are entering the Zone, the state will change to **Attacked**. As long as these units remain in the zone, the state keeps set to Attacked.
-- When all units are destroyed in the Zone, the state will change to **Empty**, which expresses that the Zone is empty, and can be captured.
-- When units of the other coalition are in the Zone, and no other units of the owning coalition is in the Zone, the Zone is captured, and its state will change to **Captured**.
--
-- The zone needs to be monitored regularly for the presence of units to interprete the correct state transition required.
-- This monitoring process MUST be started using the @{#ZONE_CAPTURE_COALITION.Start}() method.
-- Otherwise no monitoring will be active and the zone will stay in the current state forever.
--
-- ===
--
-- ## [YouTube Playlist](https://www.youtube.com/watch?v=0m6K6Yxa-os&list=PL7ZUrU4zZUl0qqJsfa8DPvZWDY-OyDumE)
-- --
-- === -- ===
-- --
@@ -29,65 +55,76 @@ do -- ZONE_CAPTURE_COALITION
--- Models the process to capture a Zone for a Coalition, which is guarded by another Coalition. --- Models the process to capture a Zone for a Coalition, which is guarded by another Coalition.
-- This is a powerful concept that allows to create very dynamic missions based on the different state transitions of various zones. -- This is a powerful concept that allows to create very dynamic missions based on the different state transitions of various zones.
-- --
-- --- -- ===
-- --
-- ![Banner Image](..\Presentations\ZONE_CAPTURE_COALITION\Dia1.JPG) -- In order to use ZONE_CAPTURE_COALITION, you need to:
-- --
-- --- -- * Create a @{Zone} object from one of the ZONE_ classes.
-- -- Note that ZONE_POLYGON_ classes are not yet functional.
-- # 0. Player Experience -- 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.
-- ![States](..\Presentations\ZONE_CAPTURE_COALITION\Dia3.JPG) -- * 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.
-- The above models the possible state transitions between the **Guarded**, **Attacked**, **Empty** and **Captured** states. -- The frequency of the monitoring must not be real-time, a 30 second interval to execute the checks is sufficient.
-- A zone has an __owning coalition__, that means that at a specific point in time, a zone can be owned by the red or blue coalition.
--
-- The Zone can be in the state **Guarded** by the __owning coalition__, which is the coalition that initially occupies the zone with units of its coalition.
-- Once units of an other coalition are entering the Zone, the state will change to **Attacked**. As long as these units remain in the zone, the state keeps set to Attacked.
-- When all units are destroyed in the Zone, the state will change to **Empty**, which expresses that the Zone is empty, and can be captured.
-- When units of the other coalition are in the Zone, and no other units of the owning coalition is in the Zone, the Zone is captured, and its state will change to **Captured**.
--
-- The zone needs to be monitored regularly for the presence of units to interprete the correct state transition required.
-- This monitoring process MUST be started using the @{#ZONE_CAPTURE_COALITION.Start}() method.
-- Otherwise no monitoring will be active and the zone will stay in the current state forever.
-- See further in chapter 3.3 for more information about this.
--
-- ## 1. ZONE\_CAPTURE\_COALITION constructor
--
-- * @{#ZONE_CAPTURE_COALITION.New}(): Creates a new ZONE\_CAPTURE\_COALITION object.
--
-- In order to use ZONE\_CAPTURE\_COALITION, you need to:
--
-- - 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.
-- --
-- ![New](..\Presentations\ZONE_CAPTURE_COALITION\Dia5.JPG) -- ![New](..\Presentations\ZONE_CAPTURE_COALITION\Dia5.JPG)
-- --
-- Ensure that during the life cycle of the ZONE\_CAPTURE\_COALITION object, the object keeps alive. -- ### Important:
-- It is best to declare the object globally within your script.
-- --
-- ## 2. ZONE\_CAPTURE\_COALITION is a finite state machine (FSM). -- You must start the monitoring process within your code, or there won't be any state transition checks executed.
-- See further the start/stop monitoring process.
--
-- ### Important:
--
-- Ensure that the object containing the ZONE_CAPTURE_COALITION object is persistent.
-- Otherwise the garbage collector of lua will remove the object and the monitoring process will stop.
-- This will result in your object to be destroyed (removed) from internal memory and there won't be any zone state transitions anymore detected!
-- So use the `local` keyword in lua with thought! Most of the time, you can declare your object gobally.
--
--
--
-- # Example:
--
-- -- Define a new ZONE object, which is based on the trigger zone `CaptureZone`, which is defined within the mission editor.
-- CaptureZone = ZONE:New( "CaptureZone" )
--
-- -- Here we create a new ZONE_CAPTURE_COALITION object, using the :New constructor.
-- ZoneCaptureCoalition = ZONE_CAPTURE_COALITION:New( CaptureZone, coalition.side.RED )
--
-- -- Set the zone to Guarding state.
-- ZoneCaptureCoalition:__Guard( 1 )
--
-- -- Start the zone monitoring process in 30 seconds and check every 30 seconds.
-- ZoneCaptureCoalition:Start( 30, 30 )
--
--
-- # Constructor:
--
-- Use the @{#ZONE_CAPTURE_COALITION.New}() constructor to create a new ZONE_CAPTURE_COALITION object.
--
-- # ZONE_CAPTURE_COALITION is a finite state machine (FSM).
-- --
-- ![States](..\Presentations\ZONE_CAPTURE_COALITION\Dia4.JPG) -- ![States](..\Presentations\ZONE_CAPTURE_COALITION\Dia4.JPG)
-- --
-- ### 2.1 ZONE\_CAPTURE\_COALITION States -- ## ZONE_CAPTURE_COALITION States
-- --
-- * **Captured**: The Zone has been captured by an other coalition. -- * **Captured**: The Zone has been captured by an other coalition.
-- * **Attacked**: The Zone is currently intruded by an other coalition. There are units of the owning coalition and an other coalition in the Zone. -- * **Attacked**: The Zone is currently intruded by an other coalition. There are units of the owning coalition and an other coalition in the Zone.
-- * **Guarded**: The Zone is guarded by the owning coalition. There is no other unit of an other coalition in the Zone. -- * **Guarded**: The Zone is guarded by the owning coalition. There is no other unit of an other coalition in the Zone.
-- * **Empty**: The Zone is empty. There is not valid unit in the Zone. -- * **Empty**: The Zone is empty. There is not valid unit in the Zone.
-- --
-- ### 2.2 ZONE\_CAPTURE\_COALITION Events -- ## 2.2 ZONE_CAPTURE_COALITION Events
-- --
-- * **Capture**: The Zone has been captured by an other coalition. -- * **Capture**: The Zone has been captured by an other coalition.
-- * **Attack**: The Zone is currently intruded by an other coalition. There are units of the owning coalition and an other coalition in the Zone. -- * **Attack**: The Zone is currently intruded by an other coalition. There are units of the owning coalition and an other coalition in the Zone.
-- * **Guard**: The Zone is guarded by the owning coalition. There is no other unit of an other coalition in the Zone. -- * **Guard**: The Zone is guarded by the owning coalition. There is no other unit of an other coalition in the Zone.
-- * **Empty**: The Zone is empty. There is not valid unit in the Zone. -- * **Empty**: The Zone is empty. There is not valid unit in the Zone.
-- --
-- ## 3. "Script It" -- # "Script It"
-- --
-- ZONE\_CAPTURE\_COALITION allows to take action on the various state transitions and add your custom code and logic. -- ZONE_CAPTURE_COALITION allows to take action on the various state transitions and add your custom code and logic.
-- --
-- ### 3.1. Take action using state- and event handlers. -- ## Take action using state- and event handlers.
-- --
-- ![States](..\Presentations\ZONE_CAPTURE_COALITION\Dia6.JPG) -- ![States](..\Presentations\ZONE_CAPTURE_COALITION\Dia6.JPG)
-- --
@@ -104,8 +141,6 @@ do -- ZONE_CAPTURE_COALITION
-- - On Before the event is triggered. Return false to cancel the transition. -- - On Before the event is triggered. Return false to cancel the transition.
-- - On After the event is triggered. -- - On After the event is triggered.
-- --
--
--
-- ![States](..\Presentations\ZONE_CAPTURE_COALITION\Dia7.JPG) -- ![States](..\Presentations\ZONE_CAPTURE_COALITION\Dia7.JPG)
-- --
-- Each handler can receive optionally 3 parameters: -- Each handler can receive optionally 3 parameters:
@@ -126,7 +161,7 @@ do -- ZONE_CAPTURE_COALITION
-- --
-- This code checks that when the __Guarded__ state has been reached, that if the **From** state was __Empty__, then display a message. -- This code checks that when the __Guarded__ state has been reached, that if the **From** state was __Empty__, then display a message.
-- --
-- ### 3.2. Example Event Handler. -- ## Example Event Handler.
-- --
-- --- @param Functional.ZoneCaptureCoalition#ZONE_CAPTURE_COALITION self -- --- @param Functional.ZoneCaptureCoalition#ZONE_CAPTURE_COALITION self
-- function ZoneCaptureCoalition:OnEnterGuarded( From, Event, To ) -- function ZoneCaptureCoalition:OnEnterGuarded( From, Event, To )
@@ -145,7 +180,7 @@ do -- ZONE_CAPTURE_COALITION
-- end -- end
-- end -- end
-- --
-- ### 3.3. Stop and Start the zone monitoring process. -- ## Stop and Start the zone monitoring process.
-- --
-- At regular intervals, the state of the zone needs to be monitored. -- At regular intervals, the state of the zone needs to be monitored.
-- The zone needs to be scanned for the presence of units within the zone boundaries. -- The zone needs to be scanned for the presence of units within the zone boundaries.
@@ -157,8 +192,8 @@ do -- ZONE_CAPTURE_COALITION
-- --
-- Therefore, the mission designer is given 2 methods that allow to take control of the CPU utilization efficiency: -- Therefore, the mission designer is given 2 methods that allow to take control of the CPU utilization efficiency:
-- --
-- - @{#ZONE_CAPTURE_COALITION.Start()}(): This starts the monitoring process. -- * @{#ZONE_CAPTURE_COALITION.Start}(): This starts the monitoring process.
-- - @{#ZONE_CAPTURE_COALITION.Stop()}(): This stops the monitoring process. -- * @{#ZONE_CAPTURE_COALITION.Stop}(): This stops the monitoring process.
-- --
-- ### IMPORTANT -- ### IMPORTANT
-- --
@@ -166,9 +201,9 @@ do -- ZONE_CAPTURE_COALITION
-- The monitoring process is NOT started by default!!!** -- The monitoring process is NOT started by default!!!**
-- --
-- --
-- ## 4. Full Example -- # Full Example
-- --
-- The following annotated code shows a real example of how ZONE\_CAPTURE\_COALITION can be applied. -- The following annotated code shows a real example of how ZONE_CAPTURE_COALITION can be applied.
-- --
-- The concept is simple. -- The concept is simple.
-- --
@@ -329,7 +364,7 @@ do -- ZONE_CAPTURE_COALITION
do do
--- Captured State Handler OnLeave for ZONE\_CAPTURE\_COALITION --- Captured State Handler OnLeave for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnLeaveCaptured -- @function [parent=#ZONE_CAPTURE_COALITION] OnLeaveCaptured
-- @param #ZONE_CAPTURE_COALITION self -- @param #ZONE_CAPTURE_COALITION self
-- @param #string From -- @param #string From
@@ -337,7 +372,7 @@ do -- ZONE_CAPTURE_COALITION
-- @param #string To -- @param #string To
-- @return #boolean -- @return #boolean
--- Captured State Handler OnEnter for ZONE\_CAPTURE\_COALITION --- Captured State Handler OnEnter for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnEnterCaptured -- @function [parent=#ZONE_CAPTURE_COALITION] OnEnterCaptured
-- @param #ZONE_CAPTURE_COALITION self -- @param #ZONE_CAPTURE_COALITION self
-- @param #string From -- @param #string From
@@ -349,7 +384,7 @@ do -- ZONE_CAPTURE_COALITION
do do
--- Attacked State Handler OnLeave for ZONE\_CAPTURE\_COALITION --- Attacked State Handler OnLeave for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnLeaveAttacked -- @function [parent=#ZONE_CAPTURE_COALITION] OnLeaveAttacked
-- @param #ZONE_CAPTURE_COALITION self -- @param #ZONE_CAPTURE_COALITION self
-- @param #string From -- @param #string From
@@ -357,7 +392,7 @@ do -- ZONE_CAPTURE_COALITION
-- @param #string To -- @param #string To
-- @return #boolean -- @return #boolean
--- Attacked State Handler OnEnter for ZONE\_CAPTURE\_COALITION --- Attacked State Handler OnEnter for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnEnterAttacked -- @function [parent=#ZONE_CAPTURE_COALITION] OnEnterAttacked
-- @param #ZONE_CAPTURE_COALITION self -- @param #ZONE_CAPTURE_COALITION self
-- @param #string From -- @param #string From
@@ -368,7 +403,7 @@ do -- ZONE_CAPTURE_COALITION
do do
--- Guarded State Handler OnLeave for ZONE\_CAPTURE\_COALITION --- Guarded State Handler OnLeave for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnLeaveGuarded -- @function [parent=#ZONE_CAPTURE_COALITION] OnLeaveGuarded
-- @param #ZONE_CAPTURE_COALITION self -- @param #ZONE_CAPTURE_COALITION self
-- @param #string From -- @param #string From
@@ -376,7 +411,7 @@ do -- ZONE_CAPTURE_COALITION
-- @param #string To -- @param #string To
-- @return #boolean -- @return #boolean
--- Guarded State Handler OnEnter for ZONE\_CAPTURE\_COALITION --- Guarded State Handler OnEnter for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnEnterGuarded -- @function [parent=#ZONE_CAPTURE_COALITION] OnEnterGuarded
-- @param #ZONE_CAPTURE_COALITION self -- @param #ZONE_CAPTURE_COALITION self
-- @param #string From -- @param #string From
@@ -388,7 +423,7 @@ do -- ZONE_CAPTURE_COALITION
do do
--- Empty State Handler OnLeave for ZONE\_CAPTURE\_COALITION --- Empty State Handler OnLeave for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnLeaveEmpty -- @function [parent=#ZONE_CAPTURE_COALITION] OnLeaveEmpty
-- @param #ZONE_CAPTURE_COALITION self -- @param #ZONE_CAPTURE_COALITION self
-- @param #string From -- @param #string From
@@ -396,7 +431,7 @@ do -- ZONE_CAPTURE_COALITION
-- @param #string To -- @param #string To
-- @return #boolean -- @return #boolean
--- Empty State Handler OnEnter for ZONE\_CAPTURE\_COALITION --- Empty State Handler OnEnter for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnEnterEmpty -- @function [parent=#ZONE_CAPTURE_COALITION] OnEnterEmpty
-- @param #ZONE_CAPTURE_COALITION self -- @param #ZONE_CAPTURE_COALITION self
-- @param #string From -- @param #string From
@@ -407,7 +442,7 @@ do -- ZONE_CAPTURE_COALITION
self:AddTransition( "*", "Guard", "Guarded" ) self:AddTransition( "*", "Guard", "Guarded" )
--- Guard Handler OnBefore for ZONE\_CAPTURE\_COALITION --- Guard Handler OnBefore for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnBeforeGuard -- @function [parent=#ZONE_CAPTURE_COALITION] OnBeforeGuard
-- @param #ZONE_CAPTURE_COALITION self -- @param #ZONE_CAPTURE_COALITION self
-- @param #string From -- @param #string From
@@ -415,25 +450,25 @@ do -- ZONE_CAPTURE_COALITION
-- @param #string To -- @param #string To
-- @return #boolean -- @return #boolean
--- Guard Handler OnAfter for ZONE\_CAPTURE\_COALITION --- Guard Handler OnAfter for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnAfterGuard -- @function [parent=#ZONE_CAPTURE_COALITION] OnAfterGuard
-- @param #ZONE_CAPTURE_COALITION self -- @param #ZONE_CAPTURE_COALITION self
-- @param #string From -- @param #string From
-- @param #string Event -- @param #string Event
-- @param #string To -- @param #string To
--- Guard Trigger for ZONE\_CAPTURE\_COALITION --- Guard Trigger for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] Guard -- @function [parent=#ZONE_CAPTURE_COALITION] Guard
-- @param #ZONE_CAPTURE_COALITION self -- @param #ZONE_CAPTURE_COALITION self
--- Guard Asynchronous Trigger for ZONE\_CAPTURE\_COALITION --- Guard Asynchronous Trigger for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] __Guard -- @function [parent=#ZONE_CAPTURE_COALITION] __Guard
-- @param #ZONE_CAPTURE_COALITION self -- @param #ZONE_CAPTURE_COALITION self
-- @param #number Delay -- @param #number Delay
self:AddTransition( "*", "Empty", "Empty" ) self:AddTransition( "*", "Empty", "Empty" )
--- Empty Handler OnBefore for ZONE\_CAPTURE\_COALITION --- Empty Handler OnBefore for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnBeforeEmpty -- @function [parent=#ZONE_CAPTURE_COALITION] OnBeforeEmpty
-- @param #ZONE_CAPTURE_COALITION self -- @param #ZONE_CAPTURE_COALITION self
-- @param #string From -- @param #string From
@@ -441,18 +476,18 @@ do -- ZONE_CAPTURE_COALITION
-- @param #string To -- @param #string To
-- @return #boolean -- @return #boolean
--- Empty Handler OnAfter for ZONE\_CAPTURE\_COALITION --- Empty Handler OnAfter for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnAfterEmpty -- @function [parent=#ZONE_CAPTURE_COALITION] OnAfterEmpty
-- @param #ZONE_CAPTURE_COALITION self -- @param #ZONE_CAPTURE_COALITION self
-- @param #string From -- @param #string From
-- @param #string Event -- @param #string Event
-- @param #string To -- @param #string To
--- Empty Trigger for ZONE\_CAPTURE\_COALITION --- Empty Trigger for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] Empty -- @function [parent=#ZONE_CAPTURE_COALITION] Empty
-- @param #ZONE_CAPTURE_COALITION self -- @param #ZONE_CAPTURE_COALITION self
--- Empty Asynchronous Trigger for ZONE\_CAPTURE\_COALITION --- Empty Asynchronous Trigger for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] __Empty -- @function [parent=#ZONE_CAPTURE_COALITION] __Empty
-- @param #ZONE_CAPTURE_COALITION self -- @param #ZONE_CAPTURE_COALITION self
-- @param #number Delay -- @param #number Delay
@@ -460,7 +495,7 @@ do -- ZONE_CAPTURE_COALITION
self:AddTransition( { "Guarded", "Empty" }, "Attack", "Attacked" ) self:AddTransition( { "Guarded", "Empty" }, "Attack", "Attacked" )
--- Attack Handler OnBefore for ZONE\_CAPTURE\_COALITION --- Attack Handler OnBefore for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnBeforeAttack -- @function [parent=#ZONE_CAPTURE_COALITION] OnBeforeAttack
-- @param #ZONE_CAPTURE_COALITION self -- @param #ZONE_CAPTURE_COALITION self
-- @param #string From -- @param #string From
@@ -468,25 +503,25 @@ do -- ZONE_CAPTURE_COALITION
-- @param #string To -- @param #string To
-- @return #boolean -- @return #boolean
--- Attack Handler OnAfter for ZONE\_CAPTURE\_COALITION --- Attack Handler OnAfter for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnAfterAttack -- @function [parent=#ZONE_CAPTURE_COALITION] OnAfterAttack
-- @param #ZONE_CAPTURE_COALITION self -- @param #ZONE_CAPTURE_COALITION self
-- @param #string From -- @param #string From
-- @param #string Event -- @param #string Event
-- @param #string To -- @param #string To
--- Attack Trigger for ZONE\_CAPTURE\_COALITION --- Attack Trigger for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] Attack -- @function [parent=#ZONE_CAPTURE_COALITION] Attack
-- @param #ZONE_CAPTURE_COALITION self -- @param #ZONE_CAPTURE_COALITION self
--- Attack Asynchronous Trigger for ZONE\_CAPTURE\_COALITION --- Attack Asynchronous Trigger for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] __Attack -- @function [parent=#ZONE_CAPTURE_COALITION] __Attack
-- @param #ZONE_CAPTURE_COALITION self -- @param #ZONE_CAPTURE_COALITION self
-- @param #number Delay -- @param #number Delay
self:AddTransition( { "Guarded", "Attacked", "Empty" }, "Capture", "Captured" ) self:AddTransition( { "Guarded", "Attacked", "Empty" }, "Capture", "Captured" )
--- Capture Handler OnBefore for ZONE\_CAPTURE\_COALITION --- Capture Handler OnBefore for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnBeforeCapture -- @function [parent=#ZONE_CAPTURE_COALITION] OnBeforeCapture
-- @param #ZONE_CAPTURE_COALITION self -- @param #ZONE_CAPTURE_COALITION self
-- @param #string From -- @param #string From
@@ -494,18 +529,18 @@ do -- ZONE_CAPTURE_COALITION
-- @param #string To -- @param #string To
-- @return #boolean -- @return #boolean
--- Capture Handler OnAfter for ZONE\_CAPTURE\_COALITION --- Capture Handler OnAfter for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] OnAfterCapture -- @function [parent=#ZONE_CAPTURE_COALITION] OnAfterCapture
-- @param #ZONE_CAPTURE_COALITION self -- @param #ZONE_CAPTURE_COALITION self
-- @param #string From -- @param #string From
-- @param #string Event -- @param #string Event
-- @param #string To -- @param #string To
--- Capture Trigger for ZONE\_CAPTURE\_COALITION --- Capture Trigger for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] Capture -- @function [parent=#ZONE_CAPTURE_COALITION] Capture
-- @param #ZONE_CAPTURE_COALITION self -- @param #ZONE_CAPTURE_COALITION self
--- Capture Asynchronous Trigger for ZONE\_CAPTURE\_COALITION --- Capture Asynchronous Trigger for ZONE_CAPTURE_COALITION
-- @function [parent=#ZONE_CAPTURE_COALITION] __Capture -- @function [parent=#ZONE_CAPTURE_COALITION] __Capture
-- @param #ZONE_CAPTURE_COALITION self -- @param #ZONE_CAPTURE_COALITION self
-- @param #number Delay -- @param #number Delay

View File

@@ -687,9 +687,9 @@ function COMMANDCENTER:ReportMissionsPlayers( ReportGroup )
Report:Add( "Players active in all missions." ) Report:Add( "Players active in all missions." )
for MissionID, Mission in pairs( self.Missions ) do for MissionID, MissionData in pairs( self.Missions ) do
local Mission = Mission -- Tasking.Mission#MISSION local Mission = MissionData -- Tasking.Mission#MISSION
Report:Add( " - " .. Mission:ReportPlayers() ) Report:Add( " - " .. Mission:ReportPlayersPerTask(ReportGroup) )
end end
self:MessageToGroup( Report:Text(), ReportGroup ) self:MessageToGroup( Report:Text(), ReportGroup )

View File

@@ -657,5 +657,26 @@ function UTILS.Randomize(value, fac, lower, upper)
return r return r
end end
--- Calculate the [dot product](https://en.wikipedia.org/wiki/Dot_product) of two vectors. The result is a number.
-- @param DCS#Vec3 a Vector in 3D with x, y, z components.
-- @param DCS#Vec3 b Vector in 3D with x, y, z components.
-- @return #number Scalar product of the two vectors a*b.
function UTILS.VecDot(a, b)
return a.x*b.x + a.y*b.y + a.z*b.z
end
--- Calculate the [euclidean norm](https://en.wikipedia.org/wiki/Euclidean_distance) (length) of a 3D vector.
-- @param DCS#Vec3 a Vector in 3D with x, y, z components.
-- @return #number Norm of the vector.
function UTILS.VecNorm(a)
return math.sqrt(UTILS.VecDot(a, a))
end
--- Calculate the [cross product](https://en.wikipedia.org/wiki/Cross_product) of two 3D vectors. The result is a 3D vector.
-- @param DCS#Vec3 a Vector in 3D with x, y, z components.
-- @param DCS#Vec3 b Vector in 3D with x, y, z components.
-- @return DCS#Vec3 Vector
function UTILS.VecCross(a, b)
return {x=a.y*b.z - a.z*b.y, y=a.z*b.x - a.x*b.z, z=a.x*b.y - a.y*b.x}
end

View File

@@ -334,7 +334,7 @@ end
--- Find a AIRBASE in the _DATABASE using the name of an existing DCS Airbase. --- Find a AIRBASE in the _DATABASE using the name of an existing DCS Airbase.
-- @param #AIRBASE self -- @param #AIRBASE self
-- @param #string AirbaseName The Airbase Name. -- @param #string AirbaseName The Airbase Name.
-- @return Wrapper.Airbase#AIRBASE self -- @return #AIRBASE self
function AIRBASE:FindByName( AirbaseName ) function AIRBASE:FindByName( AirbaseName )
local AirbaseFound = _DATABASE:FindAirbase( AirbaseName ) local AirbaseFound = _DATABASE:FindAirbase( AirbaseName )

View File

@@ -623,10 +623,8 @@ end
-- @return #CONTROLLABLE self -- @return #CONTROLLABLE self
function CONTROLLABLE:StartUncontrolled(delay) function CONTROLLABLE:StartUncontrolled(delay)
if delay and delay>0 then if delay and delay>0 then
env.info(string.format("FF %s delayed start after %d seconds", self:GetName(), delay))
SCHEDULER:New(nil, CONTROLLABLE.StartUncontrolled, {self}, delay) SCHEDULER:New(nil, CONTROLLABLE.StartUncontrolled, {self}, delay)
else else
env.info(string.format("FF %s instant start", self:GetName()))
self:SetCommand({id='Start', params={}}) self:SetCommand({id='Start', params={}})
end end
return self return self
@@ -1079,10 +1077,10 @@ end
-- The unit / controllable will follow lead unit of another controllable, wingmens of both controllables will continue following their leaders. -- The unit / controllable will follow lead unit of another controllable, wingmens of both controllables will continue following their leaders.
-- The unit / controllable will also protect that controllable from threats of specified types. -- The unit / controllable will also protect that controllable from threats of specified types.
-- @param #CONTROLLABLE self -- @param #CONTROLLABLE self
-- @param Wrapper.Controllable#CONTROLLABLE EscortControllable The controllable to be escorted. -- @param Wrapper.Controllable#CONTROLLABLE FollowControllable The controllable to be escorted.
-- @param DCS#Vec3 Vec3 Position of the unit / lead unit of the controllable relative lead unit of another controllable in frame reference oriented by course of lead unit of another controllable. If another controllable is on land the unit / controllable will orbit around. -- @param DCS#Vec3 Vec3 Position of the unit / lead unit of the controllable relative lead unit of another controllable in frame reference oriented by course of lead unit of another controllable. If another controllable is on land the unit / controllable will orbit around.
-- @param #number LastWaypointIndex Detach waypoint of another controllable. Once reached the unit / controllable Follow task is finished. -- @param #number LastWaypointIndex Detach waypoint of another controllable. Once reached the unit / controllable Follow task is finished.
-- @param #number EngagementDistanceMax Maximal distance from escorted controllable to threat. If the threat is already engaged by escort escort will disengage if the distance becomes greater than 1.5 * engagementDistMax. -- @param #number EngagementDistance Maximal distance from escorted controllable to threat. If the threat is already engaged by escort escort will disengage if the distance becomes greater than 1.5 * engagementDistMax.
-- @param DCS#AttributeNameArray TargetTypes Array of AttributeName that is contains threat categories allowed to engage. -- @param DCS#AttributeNameArray TargetTypes Array of AttributeName that is contains threat categories allowed to engage.
-- @return DCS#Task The DCS task structure. -- @return DCS#Task The DCS task structure.
function CONTROLLABLE:TaskEscort( FollowControllable, Vec3, LastWaypointIndex, EngagementDistance, TargetTypes ) function CONTROLLABLE:TaskEscort( FollowControllable, Vec3, LastWaypointIndex, EngagementDistance, TargetTypes )
@@ -1105,6 +1103,8 @@ function CONTROLLABLE:TaskEscort( FollowControllable, Vec3, LastWaypointIndex, E
LastWaypointIndexFlag = true LastWaypointIndexFlag = true
end end
TargetTypes=TargetTypes or {}
local DCSTask local DCSTask
DCSTask = { id = 'Escort', DCSTask = { id = 'Escort',
params = { params = {
@@ -1975,6 +1975,24 @@ do -- Route methods
return nil return nil
end end
--- Make the controllable to push follow a given route.
-- @param #CONTROLLABLE self
-- @param #table Route A table of Route Points.
-- @param #number DelaySeconds (Optional) Wait for the specified seconds before executing the Route. Default is one second.
-- @return #CONTROLLABLE The CONTROLLABLE.
function CONTROLLABLE:RoutePush( Route, DelaySeconds )
self:F2( Route )
local DCSControllable = self:GetDCSObject()
if DCSControllable then
local RouteTask = self:TaskRoute( Route ) -- Create a RouteTask, that will route the CONTROLLABLE to the Route.
self:PushTask( RouteTask, DelaySeconds or 1 ) -- Execute the RouteTask after the specified seconds (default is 1).
return self
end
return nil
end
--- Stops the movement of the vehicle on the route. --- Stops the movement of the vehicle on the route.
-- @param #CONTROLLABLE self -- @param #CONTROLLABLE self

View File

@@ -2,7 +2,9 @@
-- --
-- === -- ===
-- --
-- The @{#GROUP} class is a wrapper class to handle the DCS Group objects: -- The @{#GROUP} class is a wrapper class to handle the DCS Group objects.
--
-- ## Features:
-- --
-- * Support all DCS Group APIs. -- * Support all DCS Group APIs.
-- * Enhance with Group specific APIs not in the DCS Group API set. -- * Enhance with Group specific APIs not in the DCS Group API set.
@@ -11,7 +13,16 @@
-- --
-- **IMPORTANT: ONE SHOULD NEVER SANATIZE these GROUP OBJECT REFERENCES! (make the GROUP object references nil).** -- **IMPORTANT: ONE SHOULD NEVER SANATIZE these GROUP OBJECT REFERENCES! (make the GROUP object references nil).**
-- --
-- See the detailed documentation on the GROUP class. -- ===
--
-- For each DCS Group object alive within a running mission, a GROUP wrapper object (instance) will be created within the _@{DATABASE} object.
-- This is done at the beginning of the mission (when the mission starts), and dynamically when new DCS Group objects are spawned (using the @{SPAWN} class).
--
-- The GROUP class does not contain a :New() method, rather it provides :Find() methods to retrieve the object reference
-- using the DCS Group or the DCS GroupName.
--
-- The GROUP methods will reference the DCS Group object by name when it is needed during API execution.
-- If the DCS Group object does not exist or is nil, the GROUP methods will return nil and may log an exception in the DCS.log file.
-- --
-- === -- ===
-- --
@@ -34,24 +45,76 @@
--- Wrapper class of the DCS world Group object. --- Wrapper class of the DCS world Group object.
-- --
-- For each DCS Group object alive within a running mission, a GROUP wrapper object (instance) will be created within the _@{DATABASE} object.
-- This is done at the beginning of the mission (when the mission starts), and dynamically when new DCS Group objects are spawned (using the @{SPAWN} class).
--
-- The GROUP class does not contain a :New() method, rather it provides :Find() methods to retrieve the object reference
-- using the DCS Group or the DCS GroupName.
--
-- Another thing to know is that GROUP objects do not "contain" the DCS Group object.
-- The GROUP methods will reference the DCS Group object by name when it is needed during API execution.
-- If the DCS Group object does not exist or is nil, the GROUP methods will return nil and log an exception in the DCS.log file.
--
-- The GROUP class provides the following functions to retrieve quickly the relevant GROUP instance: -- The GROUP class provides the following functions to retrieve quickly the relevant GROUP instance:
-- --
-- * @{#GROUP.Find}(): Find a GROUP instance from the _DATABASE object using a DCS Group object. -- * @{#GROUP.Find}(): Find a GROUP instance from the _DATABASE object using a DCS Group object.
-- * @{#GROUP.FindByName}(): Find a GROUP instance from the _DATABASE object using a DCS Group name. -- * @{#GROUP.FindByName}(): Find a GROUP instance from the _DATABASE object using a DCS Group name.
-- --
-- ## GROUP task methods -- # 1. Tasking of groups
--
-- A GROUP is derived from the wrapper class CONTROLLABLE (@{Wrapper.Controllable#CONTROLLABLE}).
-- See the @{Wrapper.Controllable} task methods section for a description of the task methods.
--
-- But here is an example how a group can be assigned a task.
--
-- This test demonstrates the use(s) of the SwitchWayPoint method of the GROUP class.
--
-- First we look up the objects. We create a GROUP object `HeliGroup`, using the @{#GROUP:FindByName}() method, looking up the `"Helicopter"` group object.
-- Same for the `"AttackGroup"`.
--
-- local HeliGroup = GROUP:FindByName( "Helicopter" )
-- local AttackGroup = GROUP:FindByName( "AttackGroup" )
--
-- Now we retrieve the @{Wrapper.Unit#UNIT} objects of the `AttackGroup` object, using the method `:GetUnits()`.
--
-- local AttackUnits = AttackGroup:GetUnits()
--
-- Tasks are actually text strings that we build using methods of GROUP.
-- So first, we declare an list of `Tasks`.
--
-- local Tasks = {}
--
-- Now we loop over the `AttackUnits` using a for loop.
-- We retrieve the `AttackUnit` using the `AttackGroup:GetUnit()` method.
-- Each `AttackUnit` found, will be attacked by `HeliGroup`, using the method `HeliGroup:TaskAttackUnit()`.
-- This method returns a string containing a command line to execute the task to the `HeliGroup`.
-- The code will assign the task string command to the next element in the `Task` list, using `Tasks[#Tasks+1]`.
-- This little code will take the count of `Task` using `#` operator, and will add `1` to the count.
-- This result will be the index of the `Task` element.
--
-- for i = 1, #AttackUnits do
-- local AttackUnit = AttackGroup:GetUnit( i )
-- Tasks[#Tasks+1] = HeliGroup:TaskAttackUnit( AttackUnit )
-- end
--
-- Once these tasks have been executed, a function `_Resume` will be called ...
--
-- Tasks[#Tasks+1] = HeliGroup:TaskFunction( "_Resume", { "''" } )
--
-- --- @param Wrapper.Group#GROUP HeliGroup
-- function _Resume( HeliGroup )
-- env.info( '_Resume' )
--
-- HeliGroup:MessageToAll( "Resuming",10,"Info")
-- end
--
-- Now here is where the task gets assigned!
-- Using `HeliGroup:PushTask`, the task is pushed onto the task queue of the group `HeliGroup`.
-- Since `Tasks` is an array of tasks, we use the `HeliGroup:TaskCombo` method to execute the tasks.
-- The `HeliGroup:PushTask` method can receive a delay parameter in seconds.
-- In the example, `30` is given as a delay.
--
--
-- HeliGroup:PushTask(
-- HeliGroup:TaskCombo(
-- Tasks
-- ), 30
-- )
--
-- That's it!
-- But again, please refer to the @{Wrapper.Controllable} task methods section for a description of the different task methods that are available.
--
-- --
-- A GROUP is a @{Wrapper.Controllable}. See the @{Wrapper.Controllable} task methods section for a description of the task methods.
-- --
-- ### Obtain the mission from group templates -- ### Obtain the mission from group templates
-- --

View File

@@ -121,6 +121,80 @@ function POSITIONABLE:Destroy( GenerateEvent )
return nil return nil
end end
--- Returns a pos3 table of the objects current position and orientation in 3D space. X, Y, Z values are unit vectors defining the objects orientation.
-- Coordinates are dependent on the position of the maps origin.
-- @param Wrapper.Positionable#POSITIONABLE self
-- @return DCS#Position Table consisting of the point and orientation tables.
function POSITIONABLE:GetPosition()
self:F2( self.PositionableName )
local DCSPositionable = self:GetDCSObject()
if DCSPositionable then
local PositionablePosition = DCSPositionable:getPosition()
self:T3( PositionablePosition )
return PositionablePosition
end
BASE:E( { "Cannot GetPositionVec3", Positionable = self, Alive = self:IsAlive() } )
return nil
end
--- Returns a {@DCS#Vec3} table of the objects current orientation in 3D space. X, Y, Z values are unit vectors defining the objects orientation.
-- X is the orientation parallel to the movement of the object, Z perpendicular and Y vertical orientation.
-- @param Wrapper.Positionable#POSITIONABLE self
-- @return DCS#Vec3 X orientation, i.e. parallel to the direction of movement.
-- @return DCS#Vec3 Y orientation, i.e. vertical.
-- @return DCS#Vec3 Z orientation, i.e. perpendicular to the direction of movement.
function POSITIONABLE:GetOrientation()
local position=self:GetPosition()
if position then
return position.x, position.y, position.z
else
BASE:E( { "Cannot GetOrientation", Positionable = self, Alive = self:IsAlive() } )
return nil, nil, nil
end
end
--- Returns a {@DCS#Vec3} table of the objects current X orientation in 3D space, i.e. along the direction of movement.
-- @param Wrapper.Positionable#POSITIONABLE self
-- @return DCS#Vec3 X orientation, i.e. parallel to the direction of movement.
function POSITIONABLE:GetOrientationX()
local position=self:GetPosition()
if position then
return position.x
else
BASE:E( { "Cannot GetOrientationX", Positionable = self, Alive = self:IsAlive() } )
return nil
end
end
--- Returns a {@DCS#Vec3} table of the objects current Y orientation in 3D space, i.e. vertical orientation.
-- @param Wrapper.Positionable#POSITIONABLE self
-- @return DCS#Vec3 Y orientation, i.e. vertical.
function POSITIONABLE:GetOrientationY()
local position=self:GetPosition()
if position then
return position.y
else
BASE:E( { "Cannot GetOrientationY", Positionable = self, Alive = self:IsAlive() } )
return nil
end
end
--- Returns a {@DCS#Vec3} table of the objects current Z orientation in 3D space, i.e. perpendicular to direction of movement.
-- @param Wrapper.Positionable#POSITIONABLE self
-- @return DCS#Vec3 Z orientation, i.e. perpendicular to movement.
function POSITIONABLE:GetOrientationZ()
local position=self:GetPosition()
if position then
return position.z
else
BASE:E( { "Cannot GetOrientationZ", Positionable = self, Alive = self:IsAlive() } )
return nil
end
end
--- Returns the @{DCS#Position3} position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission. --- Returns the @{DCS#Position3} position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission.
-- @param Wrapper.Positionable#POSITIONABLE self -- @param Wrapper.Positionable#POSITIONABLE self
-- @return DCS#Position The 3D position vectors of the POSITIONABLE. -- @return DCS#Position The 3D position vectors of the POSITIONABLE.
@@ -582,6 +656,153 @@ function POSITIONABLE:GetVelocityMPS()
return 0 return 0
end end
--- Returns the Angle of Attack of a positionable.
-- @param Wrapper.Positionable#POSITIONABLE self
-- @return #number Angle of attack in degrees.
function POSITIONABLE:GetAoA()
-- Get position of the unit.
local unitpos = self:GetPosition()
if unitpos then
-- Get velocity vector of the unit.
local unitvel = self:GetVelocityVec3()
if unitvel and UTILS.VecNorm(unitvel)~=0 then
-- Get wind vector including turbulences.
local wind=self:GetCoordinate():GetWindWithTurbulenceVec3()
-- Include wind vector.
unitvel.x=unitvel.x-wind.x
unitvel.y=unitvel.y-wind.y
unitvel.z=unitvel.z-wind.z
-- Unit velocity transformed into aircraft axes directions.
local AxialVel = {}
-- Transform velocity components in direction of aircraft axes.
AxialVel.x = UTILS.VecDot(unitpos.x, unitvel)
AxialVel.y = UTILS.VecDot(unitpos.y, unitvel)
AxialVel.z = UTILS.VecDot(unitpos.z, unitvel)
-- AoA is angle between unitpos.x and the x and y velocities.
local AoA = math.acos(UTILS.VecDot({x = 1, y = 0, z = 0}, {x = AxialVel.x, y = AxialVel.y, z = 0})/UTILS.VecNorm({x = AxialVel.x, y = AxialVel.y, z = 0}))
--Set correct direction:
if AxialVel.y > 0 then
AoA = -AoA
end
-- Return AoA value in degrees.
return math.deg(AoA)
end
end
return nil
end
--- Returns the unit's climb or descent angle.
-- @param Wrapper.Positionable#POSITIONABLE self
-- @return #number Climb or descent angle in degrees.
function POSITIONABLE:GetClimbAnge()
-- Get position of the unit.
local unitpos = self:GetPosition()
if unitpos then
-- Get velocity vector of the unit.
local unitvel = self:GetVelocityVec3()
if unitvel and UTILS.VecNorm(unitvel)~=0 then
return math.asin(unitvel.y/UTILS.VecNorm(unitvel))
end
end
end
--- Returns the pitch angle of a unit.
-- @param Wrapper.Positionable#POSITIONABLE self
-- @return #number Pitch ange in degrees.
function POSITIONABLE:GetPitch()
-- Get position of the unit.
local unitpos = self:GetPosition()
if unitpos then
return math.deg(math.asin(unitpos.x.y))
end
return nil
end
--- Returns the roll angle of a unit.
-- @param Wrapper.Positionable#POSITIONABLE self
-- @return #number Pitch ange in degrees.
function POSITIONABLE:GetRoll()
-- Get position of the unit.
local unitpos = self:GetPosition()
if unitpos then
--first, make a vector that is perpendicular to y and unitpos.x with cross product
local cp = UTILS.VecCross(unitpos.x, {x = 0, y = 1, z = 0})
--now, get dot product of of this cross product with unitpos.z
local dp = UTILS.VecDot(cp, unitpos.z)
--now get the magnitude of the roll (magnitude of the angle between two vectors is acos(vec1.vec2/|vec1||vec2|)
local Roll = math.acos(dp/(UTILS.VecNorm(cp)*UTILS.VecNorm(unitpos.z)))
--now, have to get sign of roll.
-- by convention, making right roll positive
-- to get sign of roll, use the y component of unitpos.z. For right roll, y component is negative.
if unitpos.z.y > 0 then -- left roll, flip the sign of the roll
Roll = -Roll
end
return math.deg(Roll)
end
end
--- Returns the yaw angle of a unit.
-- @param Wrapper.Positionable#POSITIONABLE self
-- @return #number Yaw ange in degrees.
function POSITIONABLE:GetYaw()
local unitpos = self:GetPosition()
if unitpos then
-- get unit velocity
local unitvel = self:GetVelocityVec3()
if unitvel and UTILS.VecNorm(unitvel) ~= 0 then --must have non-zero velocity!
local AxialVel = {} --unit velocity transformed into aircraft axes directions
--transform velocity components in direction of aircraft axes.
AxialVel.x = UTILS.VecDot(unitpos.x, unitvel)
AxialVel.y = UTILS.VecDot(unitpos.y, unitvel)
AxialVel.z = UTILS.VecDot(unitpos.z, unitvel)
--Yaw is the angle between unitpos.x and the x and z velocities
--define right yaw as positive
local Yaw = math.acos(UTILS.VecDot({x = 1, y = 0, z = 0}, {x = AxialVel.x, y = 0, z = AxialVel.z})/UTILS.VecNorm({x = AxialVel.x, y = 0, z = AxialVel.z}))
--now set correct direction:
if AxialVel.z > 0 then
Yaw = -Yaw
end
return Yaw
end
end
end
--- Returns the message text with the callsign embedded (if there is one). --- Returns the message text with the callsign embedded (if there is one).
-- @param #POSITIONABLE self -- @param #POSITIONABLE self

View File

@@ -896,16 +896,35 @@ function UNIT:IsShip()
end end
--- Returns true if the UNIT is in the air. --- Returns true if the UNIT is in the air.
-- @param Wrapper.Positionable#UNIT self -- @param #UNIT self
-- @return #boolean true if in the air. -- @return #boolean true if in the air.
-- @return #nil The UNIT is not existing or alive. -- @return #nil The UNIT is not existing or alive.
function UNIT:InAir() function UNIT:InAir()
self:F2( self.UnitName ) self:F2( self.UnitName )
local DCSUnit = self:GetDCSObject() local DCSUnit = self:GetDCSObject() --DCS#Unit
if DCSUnit then if DCSUnit then
local UnitInAir = DCSUnit:inAir() -- Implementation of workaround. The original code is below.
-- This to simulate the landing on buildings.
local UnitInAir = true
local UnitCategory = DCSUnit:getDesc().category
if UnitCategory == Unit.Category.HELICOPTER then
local VelocityVec3 = DCSUnit:getVelocity()
local Velocity = ( VelocityVec3.x ^ 2 + VelocityVec3.y ^ 2 + VelocityVec3.z ^ 2 ) ^ 0.5 -- in meters / sec
local Coordinate = DCSUnit:getPoint()
local LandHeight = land.getHeight( { x = Coordinate.x, y = Coordinate.z } )
local Height = Coordinate.y - LandHeight
if Velocity < 1 and Height <= 60 then
UnitInAir = false
end
else
UnitInAir = DCSUnit:inAir()
end
self:T3( UnitInAir ) self:T3( UnitInAir )
return UnitInAir return UnitInAir
end end