Compare commits

..

95 Commits

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

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

#MANTIS
* Added SAM type "SHORAD" as designator

#SCORING
* fix for non local problem

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

**POSITIONABLE**
- Added `Explosion`
2023-04-22 14:02:18 +02:00
Applevangelist
240307ef94 #CTLD
* Docu changes
2023-04-20 08:23:03 +02:00
Applevangelist
90c74bd82c #SET
- Minus one log entry
2023-04-20 08:06:43 +02:00
Thomas
9414096de7 Added active ZONE filtering (#1935)
for groups, units, clients entering/leaving zones to be used with `FilterStart()`
2023-04-19 09:51:53 +02:00
Applevangelist
07c3be9d6a Fixes for getPlayername() errors 2023-04-18 10:24:56 +02:00
Applevangelist
9869dbd95a #CTLD
* Include current group structure in load/save functions
2023-04-16 16:10:46 +02:00
Frank
49b702106a Update Weapon.lua
- Decreased min possible time step to 0.00001 seconds
2023-04-16 12:29:57 +02:00
Applevangelist
8eb09beb96 Merge remote-tracking branch 'origin/master' 2023-04-15 16:19:46 +02:00
Applevangelist
b402a99a25 #CTLD
* Small fix allowing minus signs in template names for repairs
2023-04-15 16:19:35 +02:00
Applevangelist
ad8938cd74 #CTLD
* Small fix allowing minus signs in template names for repairs
2023-04-15 16:17:01 +02:00
Applevangelist
ee409c45a0 #CTLD
* Allow save/loadback with precise(r) coordinates for vehicles and troops.
2023-04-13 15:51:21 +02:00
Applevangelist
9d5da3388d smaller docu item 2023-04-13 15:28:41 +02:00
Applevangelist
9e138aa149 #DATABASE
* Small fix for CLIENT:FindByName()
2023-04-04 10:33:04 +02:00
Applevangelist
cf94c4d043 #NET
* Fix for ucid can be nil
2023-04-03 12:15:29 +02:00
38 changed files with 5098 additions and 1060 deletions

View File

@@ -1688,6 +1688,20 @@ do -- AI_A2A_DISPATCHER
return DefenderSquadron
end
--- Get a resource count from a specific squadron
-- @param #AI_A2A_DISPATCHER self
-- @param #string Squadron Name of the squadron.
-- @return #number Number of airframes available or nil if the squadron does not exist
function AI_A2A_DISPATCHER:QuerySquadron(Squadron)
local Squadron = self:GetSquadron(Squadron)
if Squadron.ResourceCount then
self:T2(string.format("%s = %s",Squadron.Name,Squadron.ResourceCount))
return Squadron.ResourceCount
end
self:F({Squadron = Squadron.Name,SquadronResourceCount = Squadron.ResourceCount})
return nil
end
--- [DEPRECATED - Might create problems launching planes] Set the Squadron visible before startup of the dispatcher.
-- All planes will be spawned as uncontrolled on the parking spot.
-- They will lock the parking spot.

View File

@@ -1,4 +1,4 @@
--- **AI** - Create an automated A2G defense system based on a detection network of reconnaissance vehicles and air units, coordinating SEAD, BAI and CAS operations.
--- **AI** - Create an automated A2G defense system with reconnaissance units, coordinating SEAD, BAI and CAS operations.
--
-- ===
--
@@ -951,7 +951,7 @@ do -- AI_A2G_DISPATCHER
AI_A2G_DISPATCHER.DefenseQueue = {}
--- Defense approach types.
-- @type #AI_A2G_DISPATCHER.DefenseApproach
-- @type AI_A2G_DISPATCHER.DefenseApproach
AI_A2G_DISPATCHER.DefenseApproach = {
Random = 1,
Distance = 2,
@@ -1806,6 +1806,19 @@ do -- AI_A2G_DISPATCHER
return DefenderSquadron
end
--- Get a resource count from a specific squadron
-- @param #AI_A2G_DISPATCHER self
-- @param #string Squadron Name of the squadron.
-- @return #number Number of airframes available or nil if the squadron does not exist
function AI_A2G_DISPATCHER:QuerySquadron(Squadron)
local Squadron = self:GetSquadron(Squadron)
if Squadron.ResourceCount then
self:T2(string.format("%s = %s",Squadron.Name,Squadron.ResourceCount))
return Squadron.ResourceCount
end
self:F({Squadron = Squadron.Name,SquadronResourceCount = Squadron.ResourceCount})
return nil
end
--- Set the Squadron visible before startup of the dispatcher.
-- All planes will be spawned as uncontrolled on the parking spot.
@@ -1839,7 +1852,7 @@ do -- AI_A2G_DISPATCHER
--- Check if the Squadron is visible before startup of the dispatcher.
-- @param #AI_A2G_DISPATCHER self
-- @param #string SquadronName The squadron name.
-- @return #bool true if visible.
-- @return #boolean true if visible.
-- @usage
--
-- -- Set the Squadron visible before startup of dispatcher.

View File

@@ -947,7 +947,7 @@ do -- AI_AIR_DISPATCHER
AI_AIR_DISPATCHER.DefenseQueue = {}
--- Defense approach types
-- @type #AI_AIR_DISPATCHER.DefenseApproach
-- @type AI_AIR_DISPATCHER.DefenseApproach
AI_AIR_DISPATCHER.DefenseApproach = {
Random = 1,
Distance = 2,
@@ -1852,7 +1852,7 @@ do -- AI_AIR_DISPATCHER
--- Check if the Squadron is visible before startup of the dispatcher.
-- @param #AI_AIR_DISPATCHER self
-- @param #string SquadronName The squadron name.
-- @return #bool true if visible.
-- @return #boolean true if visible.
-- @usage
--
-- -- Set the Squadron visible before startup of dispatcher.

View File

@@ -147,8 +147,8 @@
-- @image Escorting.JPG
--- @type AI_ESCORT
---
-- @type AI_ESCORT
-- @extends AI.AI_Formation#AI_FORMATION
@@ -168,10 +168,13 @@
--
-- -- First find the GROUP object and the CLIENT object.
-- local EscortUnit = CLIENT:FindByName( "Unit Name" ) -- The Unit Name is the name of the unit flagged with the skill Client in the mission editor.
-- local EscortGroup = GROUP:FindByName( "Group Name" ) -- The Group Name is the name of the group that will escort the Escort Client.
-- local EscortGroup = SET_GROUP:New():FilterPrefixes("Escort"):FilterOnce() -- The the group name of the escorts contains "Escort".
--
-- -- Now use these 2 objects to construct the new EscortPlanes object.
-- EscortPlanes = AI_ESCORT:New( EscortUnit, EscortGroup, "Desert", "Welcome to the mission. You are escorted by a plane with code name 'Desert', which can be instructed through the F10 radio menu." )
-- EscortPlanes:MenusAirplanes() -- create menus for airplanes
-- EscortPlanes:__Start(2)
--
--
-- @field #AI_ESCORT
AI_ESCORT = {
@@ -189,7 +192,7 @@ AI_ESCORT = {
TaskPoints = {}
}
--- @field Functional.Detection#DETECTION_AREAS
-- @field Functional.Detection#DETECTION_AREAS
AI_ESCORT.Detection = nil
--- MENUPARAM type
@@ -211,10 +214,14 @@ AI_ESCORT.Detection = nil
--
-- -- First find the GROUP object and the CLIENT object.
-- local EscortUnit = CLIENT:FindByName( "Unit Name" ) -- The Unit Name is the name of the unit flagged with the skill Client in the mission editor.
-- local EscortGroup = GROUP:FindByName( "Group Name" ) -- The Group Name is the name of the group that will escort the Escort Client.
-- local EscortGroup = SET_GROUP:New():FilterPrefixes("Escort"):FilterOnce() -- The the group name of the escorts contains "Escort".
--
-- -- Now use these 2 objects to construct the new EscortPlanes object.
-- EscortPlanes = AI_ESCORT:New( EscortUnit, EscortGroup, "Desert", "Welcome to the mission. You are escorted by a plane with code name 'Desert', which can be instructed through the F10 radio menu." )
-- EscortPlanes:MenusAirplanes() -- create menus for airplanes
-- EscortPlanes:__Start(2)
--
--
function AI_ESCORT:New( EscortUnit, EscortGroupSet, EscortName, EscortBriefing )
local self = BASE:Inherit( self, AI_FORMATION:New( EscortUnit, EscortGroupSet, EscortName, EscortBriefing ) ) -- #AI_ESCORT
@@ -231,6 +238,13 @@ function AI_ESCORT:New( EscortUnit, EscortGroupSet, EscortName, EscortBriefing )
self.EscortBriefing = EscortBriefing
self.Menu = {}
self.Menu.HoldAtEscortPosition = self.Menu.HoldAtEscortPosition or {}
self.Menu.HoldAtLeaderPosition = self.Menu.HoldAtLeaderPosition or {}
self.Menu.Flare = self.Menu.Flare or {}
self.Menu.Smoke = self.Menu.Smoke or {}
self.Menu.Targets = self.Menu.Targets or {}
self.Menu.ROE = self.Menu.ROE or {}
self.Menu.ROT = self.Menu.ROT or {}
-- if not EscortBriefing then
-- EscortGroup:MessageToClient( EscortGroup:GetCategoryName() .. " '" .. EscortName .. "' (" .. EscortGroup:GetCallsign() .. ") reporting! " ..
@@ -250,7 +264,7 @@ function AI_ESCORT:New( EscortUnit, EscortGroupSet, EscortName, EscortBriefing )
EscortGroupSet:ForEachGroup(
--- @param Core.Group#GROUP EscortGroup
-- @param Core.Group#GROUP EscortGroup
function( EscortGroup )
-- Set EscortGroup known at EscortUnit.
if not self.PlayerUnit._EscortGroups then
@@ -325,14 +339,14 @@ function AI_ESCORT:_InitEscortRoute( EscortGroup )
end
--- @param #AI_ESCORT self
-- @param #AI_ESCORT self
-- @param Core.Set#SET_GROUP EscortGroupSet
function AI_ESCORT:onafterStart( EscortGroupSet )
self:F()
EscortGroupSet:ForEachGroup(
--- @param Core.Group#GROUP EscortGroup
-- @param Core.Group#GROUP EscortGroup
function( EscortGroup )
EscortGroup:WayPointInitialize()
@@ -370,7 +384,7 @@ function AI_ESCORT:onafterStart( EscortGroupSet )
self:_InitFlightMenus()
self.EscortGroupSet:ForSomeGroupAlive(
--- @param Core.Group#GROUP EscortGroup
-- @param Core.Group#GROUP EscortGroup
function( EscortGroup )
self:_InitEscortMenus( EscortGroup )
@@ -378,7 +392,7 @@ function AI_ESCORT:onafterStart( EscortGroupSet )
self:SetFlightModeFormation( EscortGroup )
--- @param #AI_ESCORT self
-- @param #AI_ESCORT self
-- @param Core.Event#EVENTDATA EventData
function EscortGroup:OnEventDeadOrCrash( EventData )
self:F( { "EventDead", EventData } )
@@ -394,14 +408,14 @@ function AI_ESCORT:onafterStart( EscortGroupSet )
end
--- @param #AI_ESCORT self
-- @param #AI_ESCORT self
-- @param Core.Set#SET_GROUP EscortGroupSet
function AI_ESCORT:onafterStop( EscortGroupSet )
self:F()
EscortGroupSet:ForEachGroup(
--- @param Core.Group#GROUP EscortGroup
-- @param Core.Group#GROUP EscortGroup
function( EscortGroup )
EscortGroup:WayPointInitialize()
@@ -443,9 +457,9 @@ end
-- @param #AI_ESCORT self
-- @param #number XStart The start position on the X-axis in meters for the first group.
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group.
-- @param #number YStart The start position on the Y-axis in meters for the first group.
-- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group.
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group.
-- @param #number ZStart The start position on the Z-axis in meters for the first group.
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
-- @param #number ZLevels The amount of levels on the Z-axis.
-- @return #AI_ESCORT
@@ -493,9 +507,9 @@ end
-- @param #AI_ESCORT self
-- @param #number XStart The start position on the X-axis in meters for the first group.
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group.
-- @param #number YStart The start position on the Y-axis in meters for the first group.
-- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group.
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group.
-- @param #number ZStart The start position on the Z-axis in meters for the first group.
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
-- @param #number ZLevels The amount of levels on the Z-axis.
-- @return #AI_ESCORT
@@ -550,7 +564,7 @@ function AI_ESCORT:SetFlightMenuFormation( Formation )
local MenuFlightFormationID = MENU_GROUP_COMMAND:New( self.PlayerGroup, Formation, FlightMenuFormation,
function ( self, Formation, ... )
self.EscortGroupSet:ForSomeGroupAlive(
--- @param Core.Group#GROUP EscortGroup
-- @param Core.Group#GROUP EscortGroup
function( EscortGroup, self, Formation, Arguments )
if EscortGroup:IsAir() then
self:E({FormationID=FormationID})
@@ -580,7 +594,7 @@ end
-- @param #AI_ESCORT self
-- @param #number XStart The start position on the X-axis in meters for the first group.
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group.
-- @param #number YStart The start position on the Y-axis in meters for the first group.
-- @return #AI_ESCORT
function AI_ESCORT:MenuFormationTrail( XStart, XSpace, YStart )
@@ -594,7 +608,7 @@ end
-- @param #AI_ESCORT self
-- @param #number XStart The start position on the X-axis in meters for the first group.
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group.
-- @param #number YStart The start position on the Y-axis in meters for the first group.
-- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group.
-- @return #AI_ESCORT
function AI_ESCORT:MenuFormationStack( XStart, XSpace, YStart, YSpace )
@@ -609,8 +623,8 @@ end
-- This menu will appear under **Formation**.
-- @param #AI_ESCORT self
-- @param #number XStart The start position on the X-axis in meters for the first group.
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group.
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group.
-- @param #number YStart The start position on the Y-axis in meters for the first group.
-- @param #number ZStart The start position on the Z-axis in meters for the first group.
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
-- @return #AI_ESCORT
function AI_ESCORT:MenuFormationLeftLine( XStart, YStart, ZStart, ZSpace )
@@ -625,8 +639,8 @@ end
-- This menu will appear under **Formation**.
-- @param #AI_ESCORT self
-- @param #number XStart The start position on the X-axis in meters for the first group.
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group.
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group.
-- @param #number YStart The start position on the Y-axis in meters for the first group.
-- @param #number ZStart The start position on the Z-axis in meters for the first group.
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
-- @return #AI_ESCORT
function AI_ESCORT:MenuFormationRightLine( XStart, YStart, ZStart, ZSpace )
@@ -642,8 +656,8 @@ end
-- @param #AI_ESCORT self
-- @param #number XStart The start position on the X-axis in meters for the first group.
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group.
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group.
-- @param #number YStart The start position on the Y-axis in meters for the first group.
-- @param #number ZStart The start position on the Z-axis in meters for the first group.
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
-- @return #AI_ESCORT
function AI_ESCORT:MenuFormationLeftWing( XStart, XSpace, YStart, ZStart, ZSpace )
@@ -659,8 +673,8 @@ end
-- @param #AI_ESCORT self
-- @param #number XStart The start position on the X-axis in meters for the first group.
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group.
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group.
-- @param #number YStart The start position on the Y-axis in meters for the first group.
-- @param #number ZStart The start position on the Z-axis in meters for the first group.
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
-- @return #AI_ESCORT
function AI_ESCORT:MenuFormationRightWing( XStart, XSpace, YStart, ZStart, ZSpace )
@@ -676,9 +690,9 @@ end
-- @param #AI_ESCORT self
-- @param #number XStart The start position on the X-axis in meters for the first group.
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group.
-- @param #number YStart The start position on the Y-axis in meters for the first group.
-- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group.
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group.
-- @param #number ZStart The start position on the Z-axis in meters for the first group.
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
-- @return #AI_ESCORT
function AI_ESCORT:MenuFormationCenterWing( XStart, XSpace, YStart, YSpace, ZStart, ZSpace )
@@ -694,9 +708,9 @@ end
-- @param #AI_ESCORT self
-- @param #number XStart The start position on the X-axis in meters for the first group.
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group.
-- @param #number YStart The start position on the Y-axis in meters for the first group.
-- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group.
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group.
-- @param #number ZStart The start position on the Z-axis in meters for the first group.
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
-- @return #AI_ESCORT
function AI_ESCORT:MenuFormationVic( XStart, XSpace, YStart, YSpace, ZStart, ZSpace )
@@ -712,9 +726,9 @@ end
-- @param #AI_ESCORT self
-- @param #number XStart The start position on the X-axis in meters for the first group.
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group.
-- @param #number YStart The start position on the Y-axis in meters for the first group.
-- @param #number YSpace The space between groups on the Y-axis in meters for each sequent group.
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group.
-- @param #number ZStart The start position on the Z-axis in meters for the first group.
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
-- @param #number ZLevels The amount of levels on the Z-axis.
-- @return #AI_ESCORT
@@ -764,7 +778,7 @@ end
function AI_ESCORT:SetFlightMenuHoldAtEscortPosition()
for _, MenuHoldAtEscortPosition in pairs( self.Menu.HoldAtEscortPosition ) do
for _, MenuHoldAtEscortPosition in pairs( self.Menu.HoldAtEscortPosition or {} ) do
local FlightMenuReportNavigation = MENU_GROUP:New( self.PlayerGroup, "Navigation", self.FlightMenu )
local FlightMenuHoldPosition = MENU_GROUP_COMMAND
@@ -785,7 +799,7 @@ end
function AI_ESCORT:SetEscortMenuHoldAtEscortPosition( EscortGroup )
for _, HoldAtEscortPosition in pairs( self.Menu.HoldAtEscortPosition ) do
for _, HoldAtEscortPosition in pairs( self.Menu.HoldAtEscortPosition or {}) do
if EscortGroup:IsAir() then
local EscortGroupName = EscortGroup:GetName()
local EscortMenuReportNavigation = MENU_GROUP:New( self.PlayerGroup, "Navigation", EscortGroup.EscortMenu )
@@ -853,7 +867,7 @@ end
function AI_ESCORT:SetFlightMenuHoldAtLeaderPosition()
for _, MenuHoldAtLeaderPosition in pairs( self.Menu.HoldAtLeaderPosition ) do
for _, MenuHoldAtLeaderPosition in pairs( self.Menu.HoldAtLeaderPosition or {}) do
local FlightMenuReportNavigation = MENU_GROUP:New( self.PlayerGroup, "Navigation", self.FlightMenu )
local FlightMenuHoldAtLeaderPosition = MENU_GROUP_COMMAND
@@ -874,7 +888,7 @@ end
function AI_ESCORT:SetEscortMenuHoldAtLeaderPosition( EscortGroup )
for _, HoldAtLeaderPosition in pairs( self.Menu.HoldAtLeaderPosition ) do
for _, HoldAtLeaderPosition in pairs( self.Menu.HoldAtLeaderPosition or {}) do
if EscortGroup:IsAir() then
local EscortGroupName = EscortGroup:GetName()
@@ -999,7 +1013,7 @@ end
function AI_ESCORT:SetFlightMenuFlare()
for _, MenuFlare in pairs( self.Menu.Flare) do
for _, MenuFlare in pairs( self.Menu.Flare or {}) do
local FlightMenuReportNavigation = MENU_GROUP:New( self.PlayerGroup, "Navigation", self.FlightMenu )
local FlightMenuFlare = MENU_GROUP:New( self.PlayerGroup, MenuFlare.MenuText, FlightMenuReportNavigation )
@@ -1014,7 +1028,7 @@ end
function AI_ESCORT:SetEscortMenuFlare( EscortGroup )
for _, MenuFlare in pairs( self.Menu.Flare) do
for _, MenuFlare in pairs( self.Menu.Flare or {}) do
if EscortGroup:IsAir() then
local EscortGroupName = EscortGroup:GetName()
@@ -1059,7 +1073,7 @@ end
function AI_ESCORT:SetFlightMenuSmoke()
for _, MenuSmoke in pairs( self.Menu.Smoke) do
for _, MenuSmoke in pairs( self.Menu.Smoke or {}) do
local FlightMenuReportNavigation = MENU_GROUP:New( self.PlayerGroup, "Navigation", self.FlightMenu )
local FlightMenuSmoke = MENU_GROUP:New( self.PlayerGroup, MenuSmoke.MenuText, FlightMenuReportNavigation )
@@ -1076,7 +1090,7 @@ end
function AI_ESCORT:SetEscortMenuSmoke( EscortGroup )
for _, MenuSmoke in pairs( self.Menu.Smoke) do
for _, MenuSmoke in pairs( self.Menu.Smoke or {}) do
if EscortGroup:IsAir() then
local EscortGroupName = EscortGroup:GetName()
@@ -1169,7 +1183,7 @@ function AI_ESCORT:SetFlightMenuTargets()
local FlightMenuAttackNearbyAir = MENU_GROUP_COMMAND:New( self.PlayerGroup, "Attack nearest airborne targets", self.FlightMenuAttack, AI_ESCORT._FlightAttackNearestTarget, self, self.__Enum.ReportType.Air ):SetTag( "Attack" )
local FlightMenuAttackNearbyGround = MENU_GROUP_COMMAND:New( self.PlayerGroup, "Attack nearest ground targets", self.FlightMenuAttack, AI_ESCORT._FlightAttackNearestTarget, self, self.__Enum.ReportType.Ground ):SetTag( "Attack" )
for _, MenuTargets in pairs( self.Menu.Targets) do
for _, MenuTargets in pairs( self.Menu.Targets or {}) do
MenuTargets.FlightReportTargetsScheduler = SCHEDULER:New( self, self._FlightReportTargetsScheduler, {}, MenuTargets.Interval, MenuTargets.Interval )
end
@@ -1179,7 +1193,7 @@ end
function AI_ESCORT:SetEscortMenuTargets( EscortGroup )
for _, MenuTargets in pairs( self.Menu.Targets) do
for _, MenuTargets in pairs( self.Menu.Targets or {} or {}) do
if EscortGroup:IsAir() then
local EscortGroupName = EscortGroup:GetName()
--local EscortMenuReportTargets = MENU_GROUP:New( self.PlayerGroup, "Report targets", EscortGroup.EscortMenu )
@@ -1231,7 +1245,7 @@ function AI_ESCORT:MenuAssistedAttack()
self:F()
self.EscortGroupSet:ForSomeGroupAlive(
--- @param Core.Group#GROUP EscortGroup
-- @param Core.Group#GROUP EscortGroup
function( EscortGroup )
if not EscortGroup:IsAir() then
-- Request assistance from other escorts.
@@ -1246,7 +1260,7 @@ end
function AI_ESCORT:SetFlightMenuROE()
for _, MenuROE in pairs( self.Menu.ROE) do
for _, MenuROE in pairs( self.Menu.ROE or {}) do
local FlightMenuROE = MENU_GROUP:New( self.PlayerGroup, "Rule Of Engagement", self.FlightMenu )
local FlightMenuROEHoldFire = MENU_GROUP_COMMAND:New( self.PlayerGroup, "Hold fire", FlightMenuROE, AI_ESCORT._FlightROEHoldFire, self, "Holding weapons!" )
@@ -1261,7 +1275,7 @@ end
function AI_ESCORT:SetEscortMenuROE( EscortGroup )
for _, MenuROE in pairs( self.Menu.ROE) do
for _, MenuROE in pairs( self.Menu.ROE or {}) do
if EscortGroup:IsAir() then
local EscortGroupName = EscortGroup:GetName()
@@ -1302,7 +1316,7 @@ end
function AI_ESCORT:SetFlightMenuROT()
for _, MenuROT in pairs( self.Menu.ROT) do
for _, MenuROT in pairs( self.Menu.ROT or {}) do
local FlightMenuROT = MENU_GROUP:New( self.PlayerGroup, "Reaction On Threat", self.FlightMenu )
local FlightMenuROTNoReaction = MENU_GROUP_COMMAND:New( self.PlayerGroup, "Fight until death", FlightMenuROT, AI_ESCORT._FlightROTNoReaction, self, "Fighting until death!" )
@@ -1317,7 +1331,7 @@ end
function AI_ESCORT:SetEscortMenuROT( EscortGroup )
for _, MenuROT in pairs( self.Menu.ROT) do
for _, MenuROT in pairs( self.Menu.ROT or {}) do
if EscortGroup:IsAir() then
local EscortGroupName = EscortGroup:GetName()
@@ -1375,7 +1389,7 @@ function AI_ESCORT:SetEscortMenuResumeMission( EscortGroup )
end
--- @param #AI_ESCORT self
-- @param #AI_ESCORT self
-- @param Wrapper.Group#GROUP OrbitGroup
-- @param Wrapper.Group#GROUP EscortGroup
-- @param #number OrbitHeight
@@ -1419,7 +1433,7 @@ function AI_ESCORT:_HoldPosition( OrbitGroup, EscortGroup, OrbitHeight, OrbitSec
end
--- @param #AI_ESCORT self
-- @param #AI_ESCORT self
-- @param Wrapper.Group#GROUP OrbitGroup
-- @param #number OrbitHeight
-- @param #number OrbitSeconds
@@ -1428,7 +1442,7 @@ function AI_ESCORT:_FlightHoldPosition( OrbitGroup, OrbitHeight, OrbitSeconds )
local EscortUnit = self.PlayerUnit
self.EscortGroupSet:ForEachGroupAlive(
--- @param Core.Group#GROUP EscortGroup
-- @param Core.Group#GROUP EscortGroup
function( EscortGroup, OrbitGroup )
if EscortGroup:IsAir() then
if OrbitGroup == nil then
@@ -1456,7 +1470,7 @@ end
function AI_ESCORT:_FlightJoinUp()
self.EscortGroupSet:ForEachGroupAlive(
--- @param Core.Group#GROUP EscortGroup
-- @param Core.Group#GROUP EscortGroup
function( EscortGroup )
if EscortGroup:IsAir() then
self:_JoinUp( EscortGroup )
@@ -1471,7 +1485,7 @@ end
-- @param #AI_ESCORT self
-- @param #number XStart The start position on the X-axis in meters for the first group.
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group.
-- @param #number YStart The start position on the Y-axis in meters for the first group.
-- @return #AI_ESCORT
function AI_ESCORT:_EscortFormationTrail( EscortGroup, XStart, XSpace, YStart )
@@ -1483,7 +1497,7 @@ end
function AI_ESCORT:_FlightFormationTrail( XStart, XSpace, YStart )
self.EscortGroupSet:ForEachGroupAlive(
--- @param Core.Group#GROUP EscortGroup
-- @param Core.Group#GROUP EscortGroup
function( EscortGroup )
if EscortGroup:IsAir() then
self:_EscortFormationTrail( EscortGroup, XStart, XSpace, YStart )
@@ -1510,7 +1524,7 @@ end
function AI_ESCORT:_FlightFormationStack( XStart, XSpace, YStart, YSpace )
self.EscortGroupSet:ForEachGroupAlive(
--- @param Core.Group#GROUP EscortGroup
-- @param Core.Group#GROUP EscortGroup
function( EscortGroup )
if EscortGroup:IsAir() then
self:_EscortFormationStack( EscortGroup, XStart, XSpace, YStart, YSpace )
@@ -1533,7 +1547,7 @@ end
function AI_ESCORT:_FlightFlare( Color, Message )
self.EscortGroupSet:ForEachGroupAlive(
--- @param Core.Group#GROUP EscortGroup
-- @param Core.Group#GROUP EscortGroup
function( EscortGroup )
if EscortGroup:IsAir() then
self:_Flare( EscortGroup, Color, Message )
@@ -1556,7 +1570,7 @@ end
function AI_ESCORT:_FlightSmoke( Color, Message )
self.EscortGroupSet:ForEachGroupAlive(
--- @param Core.Group#GROUP EscortGroup
-- @param Core.Group#GROUP EscortGroup
function( EscortGroup )
if EscortGroup:IsAir() then
self:_Smoke( EscortGroup, Color, Message )
@@ -1587,7 +1601,7 @@ end
function AI_ESCORT:_FlightSwitchReportNearbyTargets( ReportTargets )
self.EscortGroupSet:ForEachGroupAlive(
--- @param Core.Group#GROUP EscortGroup
-- @param Core.Group#GROUP EscortGroup
function( EscortGroup )
if EscortGroup:IsAir() then
self:_EscortSwitchReportNearbyTargets( EscortGroup, ReportTargets )
@@ -1679,7 +1693,7 @@ function AI_ESCORT:_ScanTargets( ScanDuration )
end
--- @param Wrapper.Group#GROUP EscortGroup
-- @param Wrapper.Group#GROUP EscortGroup
-- @param #AI_ESCORT self
function AI_ESCORT.___Resume( EscortGroup, self )
@@ -1701,7 +1715,7 @@ function AI_ESCORT.___Resume( EscortGroup, self )
end
--- @param #AI_ESCORT self
-- @param #AI_ESCORT self
-- @param Wrapper.Group#GROUP EscortGroup
-- @param #number WayPoint
function AI_ESCORT:_ResumeMission( EscortGroup, WayPoint )
@@ -1723,7 +1737,7 @@ function AI_ESCORT:_ResumeMission( EscortGroup, WayPoint )
end
--- @param #AI_ESCORT self
-- @param #AI_ESCORT self
-- @param Wrapper.Group#GROUP EscortGroup The escort group that will attack the detected item.
-- @param Functional.Detection#DETECTION_BASE.DetectedItem DetectedItem
function AI_ESCORT:_AttackTarget( EscortGroup, DetectedItem )
@@ -1743,7 +1757,7 @@ function AI_ESCORT:_AttackTarget( EscortGroup, DetectedItem )
local AttackUnitTasks = {}
DetectedSet:ForEachUnit(
--- @param Wrapper.Unit#UNIT DetectedUnit
-- @param Wrapper.Unit#UNIT DetectedUnit
function( DetectedUnit, Tasks )
if DetectedUnit:IsAlive() then
AttackUnitTasks[#AttackUnitTasks+1] = EscortGroup:TaskAttackUnit( DetectedUnit )
@@ -1767,7 +1781,7 @@ function AI_ESCORT:_AttackTarget( EscortGroup, DetectedItem )
local Tasks = {}
DetectedSet:ForEachUnit(
--- @param Wrapper.Unit#UNIT DetectedUnit
-- @param Wrapper.Unit#UNIT DetectedUnit
function( DetectedUnit, Tasks )
if DetectedUnit:IsAlive() then
Tasks[#Tasks+1] = EscortGroup:TaskFireAtPoint( DetectedUnit:GetVec2(), 50 )
@@ -1795,7 +1809,7 @@ end
function AI_ESCORT:_FlightAttackTarget( DetectedItem )
self.EscortGroupSet:ForEachGroupAlive(
--- @param Core.Group#GROUP EscortGroup
-- @param Core.Group#GROUP EscortGroup
function( EscortGroup, DetectedItem )
if EscortGroup:IsAir() then
self:_AttackTarget( EscortGroup, DetectedItem )
@@ -1842,7 +1856,7 @@ end
---
--- @param #AI_ESCORT self
-- @param #AI_ESCORT self
-- @param Wrapper.Group#GROUP EscortGroup The escort group that will attack the detected item.
-- @param Functional.Detection#DETECTION_BASE.DetectedItem DetectedItem
function AI_ESCORT:_AssistTarget( EscortGroup, DetectedItem )
@@ -1854,7 +1868,7 @@ function AI_ESCORT:_AssistTarget( EscortGroup, DetectedItem )
local Tasks = {}
DetectedSet:ForEachUnit(
--- @param Wrapper.Unit#UNIT DetectedUnit
-- @param Wrapper.Unit#UNIT DetectedUnit
function( DetectedUnit, Tasks )
if DetectedUnit:IsAlive() then
Tasks[#Tasks+1] = EscortGroup:TaskFireAtPoint( DetectedUnit:GetVec2(), 50 )
@@ -1881,7 +1895,7 @@ end
function AI_ESCORT:_FlightROEHoldFire( EscortROEMessage )
self.EscortGroupSet:ForEachGroupAlive(
--- @param Wrapper.Group#GROUP EscortGroup
-- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup )
self:_ROE( EscortGroup, EscortGroup.OptionROEHoldFire, EscortROEMessage )
end
@@ -1890,7 +1904,7 @@ end
function AI_ESCORT:_FlightROEOpenFire( EscortROEMessage )
self.EscortGroupSet:ForEachGroupAlive(
--- @param Wrapper.Group#GROUP EscortGroup
-- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup )
self:_ROE( EscortGroup, EscortGroup.OptionROEOpenFire, EscortROEMessage )
end
@@ -1899,7 +1913,7 @@ end
function AI_ESCORT:_FlightROEReturnFire( EscortROEMessage )
self.EscortGroupSet:ForEachGroupAlive(
--- @param Wrapper.Group#GROUP EscortGroup
-- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup )
self:_ROE( EscortGroup, EscortGroup.OptionROEReturnFire, EscortROEMessage )
end
@@ -1908,7 +1922,7 @@ end
function AI_ESCORT:_FlightROEWeaponFree( EscortROEMessage )
self.EscortGroupSet:ForEachGroupAlive(
--- @param Wrapper.Group#GROUP EscortGroup
-- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup )
self:_ROE( EscortGroup, EscortGroup.OptionROEWeaponFree, EscortROEMessage )
end
@@ -1924,7 +1938,7 @@ end
function AI_ESCORT:_FlightROTNoReaction( EscortROTMessage )
self.EscortGroupSet:ForEachGroupAlive(
--- @param Wrapper.Group#GROUP EscortGroup
-- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup )
self:_ROT( EscortGroup, EscortGroup.OptionROTNoReaction, EscortROTMessage )
end
@@ -1933,7 +1947,7 @@ end
function AI_ESCORT:_FlightROTPassiveDefense( EscortROTMessage )
self.EscortGroupSet:ForEachGroupAlive(
--- @param Wrapper.Group#GROUP EscortGroup
-- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup )
self:_ROT( EscortGroup, EscortGroup.OptionROTPassiveDefense, EscortROTMessage )
end
@@ -1942,7 +1956,7 @@ end
function AI_ESCORT:_FlightROTEvadeFire( EscortROTMessage )
self.EscortGroupSet:ForEachGroupAlive(
--- @param Wrapper.Group#GROUP EscortGroup
-- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup )
self:_ROT( EscortGroup, EscortGroup.OptionROTEvadeFire, EscortROTMessage )
end
@@ -1951,7 +1965,7 @@ end
function AI_ESCORT:_FlightROTVertical( EscortROTMessage )
self.EscortGroupSet:ForEachGroupAlive(
--- @param Wrapper.Group#GROUP EscortGroup
-- @param Wrapper.Group#GROUP EscortGroup
function( EscortGroup )
self:_ROT( EscortGroup, EscortGroup.OptionROTVertical, EscortROTMessage )
end
@@ -2178,5 +2192,3 @@ function AI_ESCORT:_FlightReportTargetsScheduler()
return false
end

View File

@@ -32,10 +32,12 @@
-- @image Core_Database.JPG
--- @type DATABASE
--- DATABASE class.
-- @type DATABASE
-- @field #string ClassName Name of the class.
-- @field #table Templates Templates: Units, Groups, Statics, ClientsByName, ClientsByID.
-- @field #table CLIENTS Clients.
-- @field #table STORAGES DCS warehouse storages.
-- @extends Core.Base#BASE
--- Contains collections of wrapper objects defined within MOOSE that reflect objects within the simulator.
@@ -50,6 +52,7 @@
-- * PLAYERSJOINED
-- * PLAYERS
-- * CARGOS
-- * STORAGES (DCS warehouses)
--
-- On top, for internal MOOSE administration purposes, the DATABASE administers the Unit and Group TEMPLATES as defined within the Mission Editor.
--
@@ -88,7 +91,9 @@ DATABASE = {
WAREHOUSES = {},
FLIGHTGROUPS = {},
FLIGHTCONTROLS = {},
OPSZONES = {},
PATHLINES = {},
STORAGES = {},
}
local _DATABASECoalition =
@@ -245,6 +250,38 @@ function DATABASE:FindAirbase( AirbaseName )
end
--- Adds a STORAGE (DCS warehouse wrapper) based on the Airbase Name to the DATABASE.
-- @param #DATABASE self
-- @param #string AirbaseName The name of the airbase.
-- @return Wrapper.Storage#STORAGE Storage object.
function DATABASE:AddStorage( AirbaseName )
if not self.STORAGES[AirbaseName] then
self.STORAGES[AirbaseName] = STORAGE:New( AirbaseName )
end
return self.STORAGES[AirbaseName]
end
--- Deletes a STORAGE from the DATABASE based on the name of the associated airbase.
-- @param #DATABASE self
-- @param #string AirbaseName The name of the airbase.
function DATABASE:DeleteStorage( AirbaseName )
self.STORAGES[AirbaseName] = nil
end
--- Finds an STORAGE based on the name of the associated airbase.
-- @param #DATABASE self
-- @param #string AirbaseName Name of the airbase.
-- @return Wrapper.Storage#STORAGE The found STORAGE.
function DATABASE:FindStorage( AirbaseName )
local storage = self.STORAGES[AirbaseName]
return storage
end
do -- Zones and Pathlines
--- Finds a @{Core.Zone} based on the zone name.
@@ -580,6 +617,46 @@ do -- Zone_Goal
end
end -- Zone_Goal
do -- OpsZone
--- Finds a @{Ops.OpsZone#OPSZONE} based on the zone name.
-- @param #DATABASE self
-- @param #string ZoneName The name of the zone.
-- @return Ops.OpsZone#OPSZONE The found OPSZONE.
function DATABASE:FindOpsZone( ZoneName )
local ZoneFound = self.OPSZONES[ZoneName]
return ZoneFound
end
--- Adds a @{Ops.OpsZone#OPSZONE} based on the zone name in the DATABASE.
-- @param #DATABASE self
-- @param Ops.OpsZone#OPSZONE OpsZone The zone.
function DATABASE:AddOpsZone( OpsZone )
if OpsZone then
local ZoneName=OpsZone:GetName()
if not self.OPSZONES[ZoneName] then
self.OPSZONES[ZoneName] = OpsZone
end
end
end
--- Deletes a @{Ops.OpsZone#OPSZONE} from the DATABASE based on the zone name.
-- @param #DATABASE self
-- @param #string ZoneName The name of the zone.
function DATABASE:DeleteOpsZone( ZoneName )
self.OPSZONES[ZoneName] = nil
end
end -- OpsZone
do -- cargo
--- Adds a Cargo based on the Cargo Name in the DATABASE.
@@ -1083,7 +1160,7 @@ end
-- @param #string AirbaseName Name of the airbase.
-- @return #number Category.
function DATABASE:GetCategoryFromAirbase( AirbaseName )
return self.AIRBASES[AirbaseName]:GetCategory()
return self.AIRBASES[AirbaseName]:GetAirbaseCategory()
end
@@ -1599,10 +1676,10 @@ end
-- @param #DATABASE self
-- @param #function IteratorFunction The function that will be called object in the database. The function needs to accept a CLIENT parameter.
-- @return #DATABASE self
function DATABASE:ForEachClient( IteratorFunction, ... )
function DATABASE:ForEachClient( IteratorFunction, FinalizeFunction, ... )
self:F2( arg )
self:ForEach( IteratorFunction, arg, self.CLIENTS )
self:ForEach( IteratorFunction, FinalizeFunction, arg, self.CLIENTS )
return self
end
@@ -1611,10 +1688,10 @@ end
-- @param #DATABASE self
-- @param #function IteratorFunction The function that will be called for each object in the database. The function needs to accept a CLIENT parameter.
-- @return #DATABASE self
function DATABASE:ForEachCargo( IteratorFunction, ... )
function DATABASE:ForEachCargo( IteratorFunction, FinalizeFunction, ... )
self:F2( arg )
self:ForEach( IteratorFunction, arg, self.CARGOS )
self:ForEach( IteratorFunction, FinalizeFunction, arg, self.CARGOS )
return self
end

View File

@@ -1224,7 +1224,7 @@ function EVENT:onEvent( Event )
if Event.TgtObjectCategory == Object.Category.STATIC then
-- get base data
Event.TgtDCSUnit = Event.target
if Event.target:isExist() and Event.id ~= 33 and not Event.TgtObjectCategory == Object.Category.COORDINATE then -- leave out ejected seat object
if Event.target:isExist() and Event.id ~= 33 then -- leave out ejected seat object
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
Event.TgtUnitName = Event.TgtDCSUnitName
Event.TgtUnit = STATIC:FindByName( Event.TgtDCSUnitName, false )

View File

@@ -540,7 +540,7 @@ do -- COORDINATE
local gotscenery=false
local function EvaluateZone(ZoneObject)
BASE:T({ZoneObject})
if ZoneObject then
-- Get category of scanned object.
@@ -604,6 +604,46 @@ do -- COORDINATE
return set
end
--- Scan/find STATICS within a certain radius around the coordinate using the world.searchObjects() DCS API function.
-- @param #COORDINATE self
-- @param #number radius (Optional) Scan radius in meters. Default 100 m.
-- @return Core.Set#SET_UNIT Set of units.
function COORDINATE:ScanStatics(radius)
local _,_,_,_,statics=self:ScanObjects(radius, false, true, false)
local set=SET_STATIC:New()
for _,stat in pairs(statics) do
set:AddStatic(STATIC:Find(stat))
end
return set
end
--- Find the closest static to the COORDINATE within a certain radius.
-- @param #COORDINATE self
-- @param #number radius Scan radius in meters. Default 100 m.
-- @return Wrapper.Static#STATIC The closest static or #nil if no unit is inside the given radius.
function COORDINATE:FindClosestStatic(radius)
local units=self:ScanStatics(radius)
local umin=nil --Wrapper.Unit#UNIT
local dmin=math.huge
for _,_unit in pairs(units.Set) do
local unit=_unit --Wrapper.Static#STATIC
local coordinate=unit:GetCoordinate()
local d=self:Get2DDistance(coordinate)
if d<dmin then
dmin=d
umin=unit
end
end
return umin
end
--- Find the closest unit to the COORDINATE within a certain radius.
-- @param #COORDINATE self
-- @param #number radius Scan radius in meters. Default 100 m.
@@ -2349,7 +2389,6 @@ do -- COORDINATE
end
--- Creates a free form shape on the F10 map. The first point is the current COORDINATE. The remaining points need to be specified.
-- **NOTE**: A free form polygon must have **at least three points** in total and currently only **up to 15 points** in total are supported.
-- @param #COORDINATE self
-- @param #table Coordinates Table of coordinates of the remaining points of the shape.
-- @param #number Coalition Coalition: All=-1, Neutral=0, Red=1, Blue=2. Default -1=All.
@@ -2423,9 +2462,30 @@ do -- COORDINATE
vecs[11], vecs[12], vecs[13], vecs[14], vecs[15],
Color, FillColor, LineType, ReadOnly, Text or "")
else
self:E("ERROR: Currently a free form polygon can only have 15 points in total!")
-- Unfortunately, unpack(vecs) does not work! So no idea how to generalize this :(
trigger.action.markupToAll(7, Coalition, MarkID, unpack(vecs), Color, FillColor, LineType, ReadOnly, Text or "")
--trigger.action.markupToAll(7, Coalition, MarkID, unpack(vecs), Color, FillColor, LineType, ReadOnly, Text or "")
-- Write command as string and execute that. Idea by Grimes https://forum.dcs.world/topic/324201-mark-to-all-function/#comment-5273793
local s=string.format("trigger.action.markupToAll(7, %d, %d,", Coalition, MarkID)
for _,vec in pairs(vecs) do
s=s..string.format("%s,", UTILS._OneLineSerialize(vec))
end
s=s..string.format("%s, %s, %s, %s", UTILS._OneLineSerialize(Color), UTILS._OneLineSerialize(FillColor), tostring(LineType), tostring(ReadOnly))
if Text and Text~="" then
s=s..string.format(", \"%s\"", Text)
end
s=s..")"
-- Execute string command
local success=UTILS.DoString(s)
if not success then
self:E("ERROR: Could not draw polygon")
env.info(s)
end
end
return MarkID
@@ -2905,7 +2965,12 @@ do -- COORDINATE
alttext = "very low"
end
local track = UTILS.BearingToCardinal(bearing) or "North"
-- corrected Track to be direction of travel of bogey (self in this case)
local track = "Maneuver"
if self.Heading then
track = UTILS.BearingToCardinal(self.Heading) or "North"
end
if rangeNM > 3 then
if SSML then -- google says "oh" instead of zero, be aware
@@ -3284,6 +3349,51 @@ do -- COORDINATE
return self:GetTemperatureText( nil, Settings )
end
--- Function to check if a coordinate is in a steep (>8% elevation) area of the map
-- @param #COORDINATE self
-- @param #number Radius (Optional) Radius to check around the coordinate, defaults to 50m (100m diameter)
-- @param #number Minelevation (Optional) Elevation from which on a area is defined as steep, defaults to 8% (8m height gain across 100 meters)
-- @return #boolen IsSteep If true, area is steep
-- @return #number MaxElevation Elevation in meters measured over 100m
function COORDINATE:IsInSteepArea(Radius,Minelevation)
local steep = false
local elev = Minelevation or 8
local bdelta = 0
local h0 = self:GetLandHeight()
local radius = Radius or 50
local diam = radius * 2
for i=0,150,30 do
local polar = math.fmod(i+180,360)
local c1 = self:Translate(radius,i,false,false)
local c2 = self:Translate(radius,polar,false,false)
local h1 = c1:GetLandHeight()
local h2 = c2:GetLandHeight()
local d1 = math.abs(h1-h2)
local d2 = math.abs(h0-h1)
local d3 = math.abs(h0-h2)
local dm = d1 > d2 and d1 or d2
local dm1 = dm > d3 and dm or d3
bdelta = dm1 > bdelta and dm1 or bdelta
self:T(string.format("d1=%d, d2=%d, d3=%d, max delta=%d",d1,d2,d3,bdelta))
end
local steepness = bdelta / (radius / 100)
if steepness >= elev then steep = true end
return steep, math.floor(steepness)
end
--- Function to check if a coordinate is in a flat (<8% elevation) area of the map
-- @param #COORDINATE self
-- @param #number Radius (Optional) Radius to check around the coordinate, defaults to 50m (100m diameter)
-- @param #number Minelevation (Optional) Elevation from which on a area is defined as steep, defaults to 8% (8m height gain across 100 meters)
-- @return #boolen IsFlat If true, area is flat
-- @return #number MaxElevation Elevation in meters measured over 100m
function COORDINATE:IsInFlatArea(Radius,Minelevation)
local steep, elev = self:IsInSteepArea(Radius,Minelevation)
local flat = not steep
return flat, elev
end
end
do -- POINT_VEC3

View File

@@ -47,7 +47,8 @@
do -- SET_BASE
--- @type SET_BASE
---
-- @type SET_BASE
-- @field #table Filter Table of filters.
-- @field #table Set Table of objects.
-- @field #table Index Table of indices.
@@ -242,7 +243,7 @@ do -- SET_BASE
function SET_BASE:Add( ObjectName, Object )
-- Debug info.
self:T( { ObjectName = ObjectName, Object = Object } )
self:T2( { ObjectName = ObjectName, Object = Object } )
-- Ensure that the existing element is removed from the Set before a new one is inserted to the Set
if self.Set[ObjectName] then
@@ -257,6 +258,8 @@ do -- SET_BASE
-- Trigger Added event.
self:Added( ObjectName, Object )
return self
end
--- Adds a @{Core.Base#BASE} object in the @{Core.Set#SET_BASE}, using the Object Name as the index.
@@ -578,8 +581,8 @@ do -- SET_BASE
end
----- Private method that registers all alive players in the mission.
---- @param #SET_BASE self
---- @return #SET_BASE self
-- @param #SET_BASE self
-- @return #SET_BASE self
-- function SET_BASE:_RegisterPlayers()
--
-- local CoalitionsData = { AlivePlayersRed = coalition.getPlayers( coalition.side.RED ), AlivePlayersBlue = coalition.getPlayers( coalition.side.BLUE ) }
@@ -796,8 +799,8 @@ do -- SET_BASE
----- Iterate the SET_BASE and call an iterator function for each **alive** unit, providing the Unit and optional parameters.
---- @param #SET_BASE self
---- @param #function IteratorFunction The function that will be called when there is an alive unit in the SET_BASE. The function needs to accept a UNIT parameter.
-- @param #SET_BASE self
-- @param #function IteratorFunction The function that will be called when there is an alive unit in the SET_BASE. The function needs to accept a UNIT parameter.
---- @return #SET_BASE self
-- function SET_BASE:ForEachDCSUnitAlive( IteratorFunction, ... )
-- self:F3( arg )
@@ -808,8 +811,8 @@ do -- SET_BASE
-- end
--
----- Iterate the SET_BASE and call an iterator function for each **alive** player, providing the Unit of the player and optional parameters.
---- @param #SET_BASE self
---- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_BASE. The function needs to accept a UNIT parameter.
-- @param #SET_BASE self
-- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_BASE. The function needs to accept a UNIT parameter.
---- @return #SET_BASE self
-- function SET_BASE:ForEachPlayer( IteratorFunction, ... )
-- self:F3( arg )
@@ -821,8 +824,8 @@ do -- SET_BASE
--
--
----- Iterate the SET_BASE and call an iterator function for each client, providing the Client to the function and optional parameters.
---- @param #SET_BASE self
---- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_BASE. The function needs to accept a CLIENT parameter.
-- @param #SET_BASE self
-- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_BASE. The function needs to accept a CLIENT parameter.
---- @return #SET_BASE self
-- function SET_BASE:ForEachClient( IteratorFunction, ... )
-- self:F3( arg )
@@ -901,9 +904,14 @@ do -- SET_BASE
end
do -- SET_GROUP
do
--- @type SET_GROUP #SET_GROUP
-- SET_GROUP
---
-- @type SET_GROUP #SET_GROUP
-- @field Core.Timer#TIMER ZoneTimer
-- @field #number ZoneTimerInterval
-- @extends Core.Set#SET_BASE
--- Mission designers can use the @{Core.Set#SET_GROUP} class to build sets of groups belonging to certain:
@@ -1344,6 +1352,25 @@ do -- SET_GROUP
return self
end
--- [Internal] Private function for use of continous zone filter
-- @param #SET_GROUP self
-- @return #SET_GROUP self
function SET_GROUP:_ContinousZoneFilter()
local Database = _DATABASE.GROUPS
for ObjectName, Object in pairs( Database ) do
if self:IsIncludeObject( Object ) and self:IsNotInSet(Object) then
self:Add( ObjectName, Object )
elseif (not self:IsIncludeObject( Object )) and self:IsInSet(Object) then
self:Remove(ObjectName)
end
end
return self
end
--- Builds a set of groups that are only active.
-- Only the groups that are active will be included within the set.
-- @param #SET_GROUP self
@@ -1381,11 +1408,47 @@ do -- SET_GROUP
self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash )
self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash )
self:HandleEvent( EVENTS.RemoveUnit, self._EventOnDeadOrCrash )
if self.Filter.Zones then
self.ZoneTimer = TIMER:New(self._ContinousZoneFilter,self)
local timing = self.ZoneTimerInterval or 30
self.ZoneTimer:Start(timing,timing)
end
end
return self
end
--- Set filter timer interval for FilterZones if using active filtering with FilterStart().
-- @param #SET_GROUP self
-- @param #number Seconds Seconds between check intervals, defaults to 30. **Caution** - do not be too agressive with timing! Groups are usually not moving fast enough
-- to warrant a check of below 10 seconds.
-- @return #SET_GROUP self
function SET_GROUP:FilterZoneTimer(Seconds)
self.ZoneTimerInterval = Seconds or 30
return self
end
--- Stops the filtering.
-- @param #SET_GROUP self
-- @return #SET_GROUP self
function SET_GROUP:FilterStop()
if _DATABASE then
self:UnHandleEvent(EVENTS.Birth)
self:UnHandleEvent(EVENTS.Dead)
self:UnHandleEvent(EVENTS.Crash)
self:UnHandleEvent(EVENTS.RemoveUnit)
if self.Filter.Zones and self.ZoneTimer and self.ZoneTimer:IsRunning() then
self.ZoneTimer:Stop()
end
end
return self
end
--- Handles the OnDead or OnCrash event for alive groups set.
-- Note: The GROUP object in the SET_GROUP collection will only be removed if the last unit is destroyed of the GROUP.
-- @param #SET_GROUP self
@@ -1511,7 +1574,7 @@ do -- SET_GROUP
self:F2( arg )
self:ForEach( IteratorFunction, arg, self:GetSet(),
--- @param Core.Zone#ZONE_BASE ZoneObject
-- @param Core.Zone#ZONE_BASE ZoneObject
-- @param Wrapper.Group#GROUP GroupObject
function( ZoneObject, GroupObject )
if GroupObject:IsCompletelyInZone( ZoneObject ) then
@@ -1533,7 +1596,7 @@ do -- SET_GROUP
self:F2( arg )
self:ForEach( IteratorFunction, arg, self:GetSet(),
--- @param Core.Zone#ZONE_BASE ZoneObject
-- @param Core.Zone#ZONE_BASE ZoneObject
-- @param Wrapper.Group#GROUP GroupObject
function( ZoneObject, GroupObject )
if GroupObject:IsPartlyInZone( ZoneObject ) then
@@ -1555,7 +1618,7 @@ do -- SET_GROUP
self:F2( arg )
self:ForEach( IteratorFunction, arg, self:GetSet(),
--- @param Core.Zone#ZONE_BASE ZoneObject
-- @param Core.Zone#ZONE_BASE ZoneObject
-- @param Wrapper.Group#GROUP GroupObject
function( ZoneObject, GroupObject )
if GroupObject:IsNotInZone( ZoneObject ) then
@@ -1602,7 +1665,7 @@ do -- SET_GROUP
self:F2( arg )
self:ForEach( IteratorFunction, arg, self:GetSet(),
--- @param Core.Zone#ZONE_BASE ZoneObject
-- @param Core.Zone#ZONE_BASE ZoneObject
-- @param Wrapper.Group#GROUP GroupObject
function( ZoneObject, GroupObject )
if GroupObject:IsAnyInZone( ZoneObject ) then
@@ -1800,8 +1863,8 @@ do -- SET_GROUP
end
----- Iterate the SET_GROUP and call an iterator function for each **alive** player, providing the Group of the player and optional parameters.
---- @param #SET_GROUP self
---- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_GROUP. The function needs to accept a GROUP parameter.
-- @param #SET_GROUP self
-- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_GROUP. The function needs to accept a GROUP parameter.
---- @return #SET_GROUP self
-- function SET_GROUP:ForEachPlayer( IteratorFunction, ... )
-- self:F2( arg )
@@ -1813,8 +1876,8 @@ do -- SET_GROUP
--
--
----- Iterate the SET_GROUP and call an iterator function for each client, providing the Client to the function and optional parameters.
---- @param #SET_GROUP self
---- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_GROUP. The function needs to accept a CLIENT parameter.
-- @param #SET_GROUP self
-- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_GROUP. The function needs to accept a CLIENT parameter.
---- @return #SET_GROUP self
-- function SET_GROUP:ForEachClient( IteratorFunction, ... )
-- self:F2( arg )
@@ -1888,7 +1951,7 @@ do -- SET_GROUP
if self.Filter.Zones then
local MGroupZone = false
for ZoneName, Zone in pairs( self.Filter.Zones ) do
self:T3( "Zone:", ZoneName )
--self:T( "Zone:", ZoneName )
if MGroup:IsInZone(Zone) then
MGroupZone = true
end
@@ -1955,7 +2018,10 @@ end
do -- SET_UNIT
--- @type SET_UNIT
---
-- @type SET_UNIT
-- @field Core.Timer#TIMER ZoneTimer
-- @field #number ZoneTimerInterval
-- @extends Core.Set#SET_BASE
--- Mission designers can use the SET_UNIT class to build sets of units belonging to certain:
@@ -2348,6 +2414,55 @@ do -- SET_UNIT
return CountU
end
--- [Internal] Private function for use of continous zone filter
-- @param #SET_UNIT self
-- @return #SET_UNIT self
function SET_UNIT:_ContinousZoneFilter()
local Database = _DATABASE.UNITS
for ObjectName, Object in pairs( Database ) do
if self:IsIncludeObject( Object ) and self:IsNotInSet(Object) then
self:Add( ObjectName, Object )
elseif (not self:IsIncludeObject( Object )) and self:IsInSet(Object) then
self:Remove(ObjectName)
end
end
return self
end
--- Set filter timer interval for FilterZones if using active filtering with FilterStart().
-- @param #SET_UNIT self
-- @param #number Seconds Seconds between check intervals, defaults to 30. **Caution** - do not be too agressive with timing! Groups are usually not moving fast enough
-- to warrant a check of below 10 seconds.
-- @return #SET_UNIT self
function SET_UNIT:FilterZoneTimer(Seconds)
self.ZoneTimerInterval = Seconds or 30
return self
end
--- Stops the filtering.
-- @param #SET_UNIT self
-- @return #SET_UNIT self
function SET_UNIT:FilterStop()
if _DATABASE then
self:UnHandleEvent(EVENTS.Birth)
self:UnHandleEvent(EVENTS.Dead)
self:UnHandleEvent(EVENTS.Crash)
self:UnHandleEvent(EVENTS.RemoveUnit)
if self.Filter.Zones and self.ZoneTimer and self.ZoneTimer:IsRunning() then
self.ZoneTimer:Stop()
end
end
return self
end
--- Starts the filtering.
-- @param #SET_UNIT self
-- @return #SET_UNIT self
@@ -2359,6 +2474,11 @@ do -- SET_UNIT
self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash )
self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash )
self:HandleEvent( EVENTS.RemoveUnit, self._EventOnDeadOrCrash )
if self.Filter.Zones then
self.ZoneTimer = TIMER:New(self._ContinousZoneFilter,self)
local timing = self.ZoneTimerInterval or 30
self.ZoneTimer:Start(timing,timing)
end
end
return self
@@ -2559,7 +2679,7 @@ do -- SET_UNIT
self:F2( arg )
self:ForEach( IteratorFunction, arg, self:GetSet(),
--- @param Core.Zone#ZONE_BASE ZoneObject
-- @param Core.Zone#ZONE_BASE ZoneObject
-- @param Wrapper.Unit#UNIT UnitObject
function( ZoneObject, UnitObject )
if UnitObject:IsInZone( ZoneObject ) then
@@ -2581,7 +2701,7 @@ do -- SET_UNIT
self:F2( arg )
self:ForEach( IteratorFunction, arg, self:GetSet(),
--- @param Core.Zone#ZONE_BASE ZoneObject
-- @param Core.Zone#ZONE_BASE ZoneObject
-- @param Wrapper.Unit#UNIT UnitObject
function( ZoneObject, UnitObject )
if UnitObject:IsNotInZone( ZoneObject ) then
@@ -2898,8 +3018,8 @@ do -- SET_UNIT
----- Iterate the SET_UNIT and call an iterator function for each **alive** player, providing the Unit of the player and optional parameters.
---- @param #SET_UNIT self
---- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_UNIT. The function needs to accept a UNIT parameter.
-- @param #SET_UNIT self
-- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_UNIT. The function needs to accept a UNIT parameter.
---- @return #SET_UNIT self
-- function SET_UNIT:ForEachPlayer( IteratorFunction, ... )
-- self:F2( arg )
@@ -2911,8 +3031,8 @@ do -- SET_UNIT
--
--
----- Iterate the SET_UNIT and call an iterator function for each client, providing the Client to the function and optional parameters.
---- @param #SET_UNIT self
---- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_UNIT. The function needs to accept a CLIENT parameter.
-- @param #SET_UNIT self
-- @param #function IteratorFunction The function that will be called when there is an alive player in the SET_UNIT. The function needs to accept a CLIENT parameter.
---- @return #SET_UNIT self
-- function SET_UNIT:ForEachClient( IteratorFunction, ... )
-- self:F2( arg )
@@ -2927,7 +3047,7 @@ do -- SET_UNIT
-- @param Wrapper.Unit#UNIT MUnit
-- @return #SET_UNIT self
function SET_UNIT:IsIncludeObject( MUnit )
self:F2( MUnit )
self:F2( {MUnit} )
local MUnitInclude = false
@@ -3079,7 +3199,8 @@ end
do -- SET_STATIC
--- @type SET_STATIC
---
-- @type SET_STATIC
-- @extends Core.Set#SET_BASE
--- Mission designers can use the SET_STATIC class to build sets of Statics belonging to certain:
@@ -3499,7 +3620,7 @@ do -- SET_STATIC
self:F2( arg )
self:ForEach( IteratorFunction, arg, self:GetSet(),
--- @param Core.Zone#ZONE_BASE ZoneObject
-- @param Core.Zone#ZONE_BASE ZoneObject
-- @param Wrapper.Static#STATIC StaticObject
function( ZoneObject, StaticObject )
if StaticObject:IsInZone( ZoneObject ) then
@@ -3521,7 +3642,7 @@ do -- SET_STATIC
self:F2( arg )
self:ForEach( IteratorFunction, arg, self:GetSet(),
--- @param Core.Zone#ZONE_BASE ZoneObject
-- @param Core.Zone#ZONE_BASE ZoneObject
-- @param Wrapper.Static#STATIC StaticObject
function( ZoneObject, StaticObject )
if StaticObject:IsNotInZone( ZoneObject ) then
@@ -3833,7 +3954,10 @@ end
do -- SET_CLIENT
--- @type SET_CLIENT
---
-- @type SET_CLIENT
-- @field Core.Timer#TIMER ZoneTimer
-- @field #number ZoneTimerInterval
-- @extends Core.Set#SET_BASE
--- Mission designers can use the @{Core.Set#SET_CLIENT} class to build sets of units belonging to certain:
@@ -3893,8 +4017,8 @@ do -- SET_CLIENT
Countries = nil,
ClientPrefixes = nil,
Zones = nil,
Playernames = nil,
Callsigns = nil,
Playernames = nil,
Callsigns = nil,
},
FilterMeta = {
Coalitions = {
@@ -3944,7 +4068,7 @@ do -- SET_CLIENT
--- Remove CLIENT(s) from SET_CLIENT.
-- @param Core.Set#SET_CLIENT self
-- @param Wrapper.Client#CLIENT RemoveClientNames A single name or an array of CLIENT names.
-- @param Wrapper.Client#CLIENT RemoveClientNames A single object or an array of CLIENT objects.
-- @return self
function SET_CLIENT:RemoveClientsByName( RemoveClientNames )
@@ -4141,6 +4265,54 @@ do -- SET_CLIENT
return self
end
--- [Internal] Private function for use of continous zone filter
-- @param #SET_CLIENT self
-- @return #SET_CLIENT self
function SET_CLIENT:_ContinousZoneFilter()
local Database = _DATABASE.CLIENTS
for ObjectName, Object in pairs( Database ) do
if self:IsIncludeObject( Object ) and self:IsNotInSet(Object) then
self:Add( ObjectName, Object )
elseif (not self:IsIncludeObject( Object )) and self:IsInSet(Object) then
self:Remove(ObjectName)
end
end
return self
end
--- Set filter timer interval for FilterZones if using active filtering with FilterStart().
-- @param #SET_CLIENT self
-- @param #number Seconds Seconds between check intervals, defaults to 30. **Caution** - do not be too agressive with timing! Groups are usually not moving fast enough
-- to warrant a check of below 10 seconds.
-- @return #SET_CLIENT self
function SET_CLIENT:FilterZoneTimer(Seconds)
self.ZoneTimerInterval = Seconds or 30
return self
end
--- Stops the filtering.
-- @param #SET_CLIENT self
-- @return #SET_CLIENT self
function SET_CLIENT:FilterStop()
if _DATABASE then
self:UnHandleEvent(EVENTS.Birth)
self:UnHandleEvent(EVENTS.Dead)
self:UnHandleEvent(EVENTS.Crash)
if self.Filter.Zones and self.ZoneTimer and self.ZoneTimer:IsRunning() then
self.ZoneTimer:Stop()
end
end
return self
end
--- Starts the filtering.
-- @param #SET_CLIENT self
-- @return #SET_CLIENT self
@@ -4151,6 +4323,11 @@ do -- SET_CLIENT
self:HandleEvent( EVENTS.Birth, self._EventOnBirth )
self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash )
self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash )
if self.Filter.Zones then
self.ZoneTimer = TIMER:New(self._ContinousZoneFilter,self)
local timing = self.ZoneTimerInterval or 30
self.ZoneTimer:Start(timing,timing)
end
end
return self
@@ -4201,7 +4378,7 @@ do -- SET_CLIENT
self:F2( arg )
self:ForEach( IteratorFunction, arg, self:GetSet(),
--- @param Core.Zone#ZONE_BASE ZoneObject
-- @param Core.Zone#ZONE_BASE ZoneObject
-- @param Wrapper.Client#CLIENT ClientObject
function( ZoneObject, ClientObject )
if ClientObject:IsInZone( ZoneObject ) then
@@ -4223,7 +4400,7 @@ do -- SET_CLIENT
self:F2( arg )
self:ForEach( IteratorFunction, arg, self:GetSet(),
--- @param Core.Zone#ZONE_BASE ZoneObject
-- @param Core.Zone#ZONE_BASE ZoneObject
-- @param Wrapper.Client#CLIENT ClientObject
function( ZoneObject, ClientObject )
if ClientObject:IsNotInZone( ZoneObject ) then
@@ -4291,7 +4468,7 @@ do -- SET_CLIENT
if self.Filter.Active == false or (self.Filter.Active == true and MClient:IsActive() == true and MClient:IsAlive() == true) then
MClientActive = true
end
--self:I( { "Evaluated Active", MClientActive } )
--self:T( { "Evaluated Active", MClientActive } )
MClientInclude = MClientInclude and MClientActive
end
@@ -4358,45 +4535,45 @@ do -- SET_CLIENT
MClientInclude = MClientInclude and MClientPrefix
end
if self.Filter.Zones then
local MClientZone = false
for ZoneName, Zone in pairs( self.Filter.Zones ) do
self:T3( "Zone:", ZoneName )
local unit = MClient:GetClientGroupUnit()
if unit and unit:IsInZone(Zone) then
MClientZone = true
end
end
MClientInclude = MClientInclude and MClientZone
end
if self.Filter.Zones then
local MClientZone = false
for ZoneName, Zone in pairs( self.Filter.Zones ) do
self:T3( "Zone:", ZoneName )
local unit = MClient:GetClientGroupUnit()
if unit and unit:IsInZone(Zone) then
MClientZone = true
end
end
MClientInclude = MClientInclude and MClientZone
end
if self.Filter.Playernames then
local MClientPlayername = false
local playername = MClient:GetPlayerName() or "Unknown"
--self:I(playername)
for _,_Playername in pairs(self.Filter.Playernames) do
if playername and string.find(playername,_Playername) then
MClientPlayername = true
end
end
self:T( { "Evaluated Playername", MClientPlayername } )
MClientInclude = MClientInclude and MClientPlayername
end
if self.Filter.Playernames then
local MClientPlayername = false
local playername = MClient:GetPlayerName() or "Unknown"
--self:T(playername)
for _,_Playername in pairs(self.Filter.Playernames) do
if playername and string.find(playername,_Playername) then
MClientPlayername = true
end
end
self:T( { "Evaluated Playername", MClientPlayername } )
MClientInclude = MClientInclude and MClientPlayername
end
if self.Filter.Callsigns then
local MClientCallsigns = false
local callsign = MClient:GetCallsign()
--self:I(callsign)
for _,_Callsign in pairs(self.Filter.Callsigns) do
if callsign and string.find(callsign,_Callsign) then
MClientCallsigns = true
end
end
self:T( { "Evaluated Callsign", MClientCallsigns } )
MClientInclude = MClientInclude and MClientCallsigns
end
if self.Filter.Callsigns then
local MClientCallsigns = false
local callsign = MClient:GetCallsign()
--self:T(callsign)
for _,_Callsign in pairs(self.Filter.Callsigns) do
if callsign and string.find(callsign,_Callsign) then
MClientCallsigns = true
end
end
self:T( { "Evaluated Callsign", MClientCallsigns } )
MClientInclude = MClientInclude and MClientCallsigns
end
end
end
self:T2( MClientInclude )
return MClientInclude
end
@@ -4405,7 +4582,8 @@ end
do -- SET_PLAYER
--- @type SET_PLAYER
---
-- @type SET_PLAYER
-- @extends Core.Set#SET_BASE
--- Mission designers can use the @{Core.Set#SET_PLAYER} class to build sets of units belonging to alive players:
@@ -4700,7 +4878,7 @@ do -- SET_PLAYER
self:F2( arg )
self:ForEach( IteratorFunction, arg, self:GetSet(),
--- @param Core.Zone#ZONE_BASE ZoneObject
-- @param Core.Zone#ZONE_BASE ZoneObject
-- @param Wrapper.Client#CLIENT ClientObject
function( ZoneObject, ClientObject )
if ClientObject:IsInZone( ZoneObject ) then
@@ -4722,7 +4900,7 @@ do -- SET_PLAYER
self:F2( arg )
self:ForEach( IteratorFunction, arg, self:GetSet(),
--- @param Core.Zone#ZONE_BASE ZoneObject
-- @param Core.Zone#ZONE_BASE ZoneObject
-- @param Wrapper.Client#CLIENT ClientObject
function( ZoneObject, ClientObject )
if ClientObject:IsNotInZone( ZoneObject ) then
@@ -4831,7 +5009,8 @@ end
do -- SET_AIRBASE
--- @type SET_AIRBASE
---
-- @type SET_AIRBASE
-- @extends Core.Set#SET_BASE
--- Mission designers can use the @{Core.Set#SET_AIRBASE} class to build sets of airbases optionally belonging to certain:
@@ -5174,7 +5353,8 @@ end
do -- SET_CARGO
--- @type SET_CARGO
---
-- @type SET_CARGO
-- @extends Core.Set#SET_BASE
--- Mission designers can use the @{Core.Set#SET_CARGO} class to build sets of cargos optionally belonging to certain:
@@ -5600,7 +5780,8 @@ end
do -- SET_ZONE
--- @type SET_ZONE
---
-- @type SET_ZONE
-- @extends Core.Set#SET_BASE
--- Mission designers can use the @{Core.Set#SET_ZONE} class to build sets of zones of various types.
@@ -5968,7 +6149,8 @@ end
do -- SET_ZONE_GOAL
--- @type SET_ZONE_GOAL
---
-- @type SET_ZONE_GOAL
-- @extends Core.Set#SET_BASE
--- Mission designers can use the @{Core.Set#SET_ZONE_GOAL} class to build sets of zones of various types.
@@ -6279,7 +6461,8 @@ end
do -- SET_OPSZONE
--- @type SET_OPSZONE
---
-- @type SET_OPSZONE
-- @extends Core.Set#SET_BASE
--- Mission designers can use the @{Core.Set#SET_OPSZONE} class to build sets of zones of various types.
@@ -6736,7 +6919,8 @@ end
do -- SET_OPSGROUP
--- @type SET_OPSGROUP
---
-- @type SET_OPSGROUP
-- @extends Core.Set#SET_BASE
--- Mission designers can use the @{Core.Set#SET_OPSGROUP} class to build sets of OPS groups belonging to certain:
@@ -7403,6 +7587,7 @@ do -- SET_SCENERY
Scenerys = {},
Filter = {
SceneryPrefixes = nil,
SceneryRoles = nil,
Zones = nil,
},
}
@@ -7425,7 +7610,7 @@ do -- SET_SCENERY
if ZoneSet then
for _,_zone in pairs(ZoneSet.Set) do
self:T("Zone type handed: "..tostring(_zone.ClassName))
self:T("Zone type handed: "..tostring(_zone.ClassName))
table.insert(zonenames,_zone:GetName())
end
self:AddSceneryByName(zonenames)
@@ -7449,7 +7634,7 @@ do -- SET_SCENERY
--- Add SCENERY(s) to SET_SCENERY.
-- @param #SET_SCENERY self
-- @param #string AddScenery A single SCENERY.
-- @param Wrapper.Scenery#SCENERY AddScenery A single SCENERY object.
-- @return #SET_SCENERY self
function SET_SCENERY:AddScenery( AddScenery )
self:F2( AddScenery:GetName() )
@@ -7519,6 +7704,7 @@ do -- SET_SCENERY
end
for _,Zone in pairs( zones ) do
local zonename = Zone:GetName()
self:T(zonename)
self.Filter.Zones[zonename] = Zone
end
return self
@@ -7537,11 +7723,30 @@ do -- SET_SCENERY
Prefixes = { Prefixes }
end
for PrefixID, Prefix in pairs( Prefixes ) do
--self:T(Prefix)
self.Filter.SceneryPrefixes[Prefix] = Prefix
end
return self
end
--- Builds a set of SCENERYs that **contain** an exact match of the "ROLE" property.
-- @param #SET_SCENERY self
-- @param #string Role The string pattern(s) that needs to exactly match the scenery "ROLE" property from the ME quad-zone properties. Can also be passed as a `#table` of strings.
-- @return #SET_SCENERY self
function SET_SCENERY:FilterRoles( Role )
if not self.Filter.SceneryRoles then
self.Filter.SceneryRoles = {}
end
if type( Role ) ~= "table" then
Role = { Role }
end
for PrefixID, Prefix in pairs( Role ) do
--self:T(Prefix)
self.Filter.SceneryRoles[Prefix] = Prefix
end
return self
end
--- Iterate the SET_SCENERY and count how many SCENERYSs are alive.
-- @param #SET_SCENERY self
-- @return #number The number of SCENERYSs alive.
@@ -7629,12 +7834,121 @@ do -- SET_SCENERY
end
---
--- [Internal] Determine if an object is to be included in the SET
-- @param #SET_SCENERY self
-- @param Wrapper.Scenery#SCENERY MScenery
-- @return #SET_SCENERY self
function SET_SCENERY:IsIncludeObject( MScenery )
self:F2( MScenery )
return true
self:T( MScenery.SceneryName )
local MSceneryInclude = true
if MScenery then
local MSceneryName = MScenery:GetName()
-- Filter Prefixes
if self.Filter.Prefixes then
local MSceneryPrefix = false
for ZonePrefixId, ZonePrefix in pairs( self.Filter.Prefixes ) do
self:T( { "Prefix:", string.find( MSceneryName, ZonePrefix, 1 ), ZonePrefix } )
if string.find( MSceneryName, ZonePrefix, 1 ) then
MSceneryPrefix = true
end
end
self:T( { "Evaluated Prefix", MSceneryPrefix } )
MSceneryInclude = MSceneryInclude and MSceneryPrefix
end
if self.Filter.Zones then
local MSceneryZone = false
for ZoneName, Zone in pairs( self.Filter.Zones ) do
--self:T( "Zone:", ZoneName )
local coord = MScenery:GetCoordinate()
if coord and Zone:IsCoordinateInZone(coord) then
MSceneryZone = true
end
self:T( { "Evaluated Zone", MSceneryZone } )
end
MSceneryInclude = MSceneryInclude and MSceneryZone
end
-- Filter Roles
if self.Filter.SceneryRoles then
local MSceneryRole = false
local Role = MScenery:GetProperty("ROLE") or "none"
for ZoneRoleId, ZoneRole in pairs( self.Filter.SceneryRoles ) do
self:T( { "Role:", ZoneRole, Role } )
if ZoneRole == Role then
MSceneryRole = true
end
end
self:T( { "Evaluated Role ", MSceneryRole } )
MSceneryInclude = MSceneryInclude and MSceneryRole
end
end
self:T2( MSceneryInclude )
return MSceneryInclude
end
--- Filters for the defined collection.
-- @param #SET_SCENERY self
-- @return #SET_SCENERY self
function SET_SCENERY:FilterOnce()
for ObjectName, Object in pairs( self:GetSet() ) do
self:T(ObjectName)
if self:IsIncludeObject( Object ) then
self:Add( ObjectName, Object )
else
self:Remove(ObjectName, true)
end
end
return self --FilteredSet
end
--- Count overall initial (Life0) lifepoints of the SET objects.
-- @param #SET_SCENERY self
-- @return #number LIfe0Points
function SET_SCENERY:GetLife0()
local life0 = 0
self:ForEachScenery(
function(obj)
local Obj = obj -- Wrapper.Scenery#SCENERY
life0 = life0 + Obj:GetLife0()
end
)
return life0
end
--- Count overall current lifepoints of the SET objects.
-- @param #SET_SCENERY self
-- @return #number LifePoints
function SET_SCENERY:GetLife()
local life = 0
self:ForEachScenery(
function(obj)
local Obj = obj -- Wrapper.Scenery#SCENERY
life = life + Obj:GetLife()
end
)
return life
end
--- Calculate current relative lifepoints of the SET objects, i.e. Life divided by Life0 as percentage value, eg 75 meaning 75% alive.
-- **CAVEAT**: Some objects change their life value or "hitpoints" **after** the first hit. Hence we will adjust the Life0 value to 120%
-- of the last life value if life exceeds life0 ata any point.
-- Thus will will get a smooth percentage decrease, if you use this e.g. as success criteria for a bombing task.
-- @param #SET_SCENERY self
-- @return #number LifePoints
function SET_SCENERY:GetRelativeLife()
local life = self:GetLife()
local life0 = self:GetLife0()
self:T2(string.format("Set Lifepoints: %d life0 | %d life",life0,life))
local rlife = math.floor((life / life0) * 100)
return rlife
end
end

View File

@@ -163,6 +163,16 @@
--
-- * @{#SPAWN.InitArray}(): Make groups visible before they are actually activated, and order these groups like a battalion in an array.
--
-- ### Group initial position - if wanted different from template position, for use with e.g. @{#SPAWN.SpawnScheduled}().
--
-- * @{#SPAWN.InitPositionCoordinate}(): Set initial position of group via a COORDINATE.
-- * @{#SPAWN.InitPositionVec2}(): Set initial position of group via a VEC2.
--
-- ### Set the positions of a group's units to absolute positions, or relative positions to unit No. 1
--
-- * @{#SPAWN.InitSetUnitRelativePositions}(): Spawn the UNITs of this group with individual relative positions to unit #1 and individual headings.
-- * @{#SPAWN.InitSetUnitAbsolutePositions}(): Spawn the UNITs of this group with individual absolute positions and individual headings.
--
-- ### Position randomization
--
-- * @{#SPAWN.InitRandomizePosition}(): Randomizes the position of @{Wrapper.Group}s that are spawned within a **radius band**, given an Outer and Inner radius, from the point that the spawn happens.
@@ -268,7 +278,7 @@ SPAWN = {
-- @type SPAWN.Takeoff
-- @extends Wrapper.Group#GROUP.Takeoff
--- @field #SPAWN.Takeoff Takeoff
-- @field #SPAWN.Takeoff Takeoff
SPAWN.Takeoff = {
Air = 1,
Runway = 2,
@@ -276,7 +286,7 @@ SPAWN.Takeoff = {
Cold = 4,
}
--- @type SPAWN.SpawnZoneTable
-- @type SPAWN.SpawnZoneTable
-- @list <Core.Zone#ZONE_BASE> SpawnZone
--- Creates the main object to spawn a @{Wrapper.Group} defined in the DCS ME.
@@ -335,7 +345,7 @@ end
-- @param #SPAWN self
-- @param #string SpawnTemplatePrefix is the name of the Group in the ME that defines the Template.
-- @param #string SpawnAliasPrefix is the name that will be given to the Group at runtime.
-- @return #SPAWN
-- @return #SPAWN self
-- @usage
-- -- NATO helicopters engaging in the battle field.
-- Spawn_BE_KA50 = SPAWN:NewWithAlias( 'BE KA-50@RAMP-Ground Defense', 'Helicopter Attacking a City' )
@@ -385,32 +395,129 @@ function SPAWN:NewWithAlias( SpawnTemplatePrefix, SpawnAliasPrefix )
return self
end
--- Creates a new SPAWN instance to create new groups based on the provided template.
--- Creates a new SPAWN instance to create new groups based on the provided template. This will also register the template for future use.
-- @param #SPAWN self
-- @param #table SpawnTemplate is the Template of the Group. This must be a valid Group Template structure!
-- @param #string SpawnTemplatePrefix is the name of the Group that will be given at each spawn.
-- @param #string SpawnAliasPrefix is the name that will be given to the Group at runtime.
-- @return #SPAWN
-- @usage
-- -- Create a new SPAWN object based on a Group Template defined from scratch.
-- Spawn_BE_KA50 = SPAWN:NewWithAlias( 'BE KA-50@RAMP-Ground Defense', 'Helicopter Attacking a City' )
-- @param #table SpawnTemplate is the Template of the Group. This must be a valid Group Template structure - see [Hoggit Wiki](https://wiki.hoggitworld.com/view/DCS_func_addGroup)!
-- @param #string SpawnTemplatePrefix [Mandatory] is the name of the template and the prefix of the GROUP on spawn. The name in the template **will** be overwritten!
-- @param #string SpawnAliasPrefix [Optional] is the prefix that will be given to the GROUP on spawn.
-- @param #boolean NoMooseNamingPostfix [Optional] If true, skip the Moose naming additions (like groupname#001-01) - **but** you need to ensure yourself no duplicate group names exist!
-- @return #SPAWN self
-- @usage
-- -- Spawn a P51 Mustang from scratch
-- local ttemp =
-- {
-- ["modulation"] = 0,
-- ["tasks"] =
-- {
-- }, -- end of ["tasks"]
-- ["task"] = "Reconnaissance",
-- ["uncontrolled"] = false,
-- ["route"] =
-- {
-- ["points"] =
-- {
-- [1] =
-- {
-- ["alt"] = 2000,
-- ["action"] = "Turning Point",
-- ["alt_type"] = "BARO",
-- ["speed"] = 125,
-- ["task"] =
-- {
-- ["id"] = "ComboTask",
-- ["params"] =
-- {
-- ["tasks"] =
-- {
-- }, -- end of ["tasks"]
-- }, -- end of ["params"]
-- }, -- end of ["task"]
-- ["type"] = "Turning Point",
-- ["ETA"] = 0,
-- ["ETA_locked"] = true,
-- ["y"] = 666285.71428571,
-- ["x"] = -312000,
-- ["formation_template"] = "",
-- ["speed_locked"] = true,
-- }, -- end of [1]
-- }, -- end of ["points"]
-- }, -- end of ["route"]
-- ["groupId"] = 1,
-- ["hidden"] = false,
-- ["units"] =
-- {
-- [1] =
-- {
-- ["alt"] = 2000,
-- ["alt_type"] = "BARO",
-- ["livery_id"] = "USAF 364th FS",
-- ["skill"] = "High",
-- ["speed"] = 125,
-- ["type"] = "TF-51D",
-- ["unitId"] = 1,
-- ["psi"] = 0,
-- ["y"] = 666285.71428571,
-- ["x"] = -312000,
-- ["name"] = "P51-1-1",
-- ["payload"] =
-- {
-- ["pylons"] =
-- {
-- }, -- end of ["pylons"]
-- ["fuel"] = 340.68,
-- ["flare"] = 0,
-- ["chaff"] = 0,
-- ["gun"] = 100,
-- }, -- end of ["payload"]
-- ["heading"] = 0,
-- ["callsign"] =
-- {
-- [1] = 1,
-- [2] = 1,
-- ["name"] = "Enfield11",
-- [3] = 1,
-- }, -- end of ["callsign"]
-- ["onboard_num"] = "010",
-- }, -- end of [1]
-- }, -- end of ["units"]
-- ["y"] = 666285.71428571,
-- ["x"] = -312000,
-- ["name"] = "P51",
-- ["communication"] = true,
-- ["start_time"] = 0,
-- ["frequency"] = 124,
-- }
--
-- -- Create a new CSAR_Spawn object based on a normal Group Template to spawn a soldier.
-- local CSAR_Spawn = SPAWN:NewWithFromTemplate( Template, "CSAR", "Pilot" )
--
function SPAWN:NewFromTemplate( SpawnTemplate, SpawnTemplatePrefix, SpawnAliasPrefix )
local self = BASE:Inherit( self, BASE:New() )
self:F( { SpawnTemplate, SpawnTemplatePrefix, SpawnAliasPrefix } )
if SpawnAliasPrefix == nil or SpawnAliasPrefix == "" then
BASE:I( "ERROR: in function NewFromTemplate, required parameter SpawnAliasPrefix is not set" )
-- local mustang = SPAWN:NewFromTemplate(ttemp,"P51D")
-- -- you MUST set the next three:
-- mustang:InitCountry(country.id.FRANCE)
-- mustang:InitCategory(Group.Category.AIRPLANE)
-- mustang:InitCoalition(coalition.side.BLUE)
-- mustang:OnSpawnGroup(
-- function(grp)
-- MESSAGE:New("Group Spawned: "..grp:GetName(),15,"SPAWN"):ToAll()
-- end
-- )
-- mustang:Spawn()
--
function SPAWN:NewFromTemplate( SpawnTemplate, SpawnTemplatePrefix, SpawnAliasPrefix, NoMooseNamingPostfix )
local self = BASE:Inherit( self, BASE:New() )
self:F( { SpawnTemplate, SpawnTemplatePrefix, SpawnAliasPrefix } )
--if SpawnAliasPrefix == nil or SpawnAliasPrefix == "" then
--BASE:I( "ERROR: in function NewFromTemplate, required parameter SpawnAliasPrefix is not set" )
--return nil
--end
if SpawnTemplatePrefix == nil or SpawnTemplatePrefix == "" then
BASE:I( "ERROR: in function NewFromTemplate, required parameter SpawnTemplatePrefix is not set" )
return nil
end
if SpawnTemplate then
self.SpawnTemplate = SpawnTemplate -- Contains the template structure for a Group Spawn from the Mission Editor. Note that this group must have lateActivation always on!!!
self.SpawnTemplatePrefix = SpawnTemplatePrefix
self.SpawnAliasPrefix = SpawnAliasPrefix
self.SpawnAliasPrefix = SpawnAliasPrefix or SpawnTemplatePrefix
self.SpawnTemplate.name = SpawnTemplatePrefix
self.SpawnIndex = 0
self.SpawnCount = 0 -- The internal counter of the amount of spawning the has happened since SpawnStart.
self.AliveUnits = 0 -- Contains the counter how many units are currently alive
@@ -435,6 +542,10 @@ function SPAWN:NewFromTemplate( SpawnTemplate, SpawnTemplatePrefix, SpawnAliasPr
self.SpawnInitModex = nil
self.SpawnInitAirbase = nil
self.TweakedTemplate = true -- Check if the user is using self made template.
self.MooseNameing = true
if NoMooseNamingPostfix == true then
self.MooseNameing = false
end
self.SpawnGroups = {} -- Array containing the descriptions of each Group to be Spawned.
else
@@ -946,7 +1057,7 @@ end
--- This method provides the functionality to randomize the spawning of the Groups at a given list of zones of different types.
-- @param #SPAWN self
-- @param #table SpawnZoneTable A table with @{Core.Zone} objects. If this table is given, then each spawn will be executed within the given list of @{Core.Zone}s objects.
-- @return #SPAWN
-- @return #SPAWN self
-- @usage
--
-- -- Create a zone table of the 2 zones.
@@ -976,6 +1087,31 @@ function SPAWN:InitRandomizeZones( SpawnZoneTable )
return self
end
--- This method sets a spawn position for the group that is different from the location of the template.
-- @param #SPAWN self
-- @param Core.Point#COORDINATE Coordinate The position to spawn from
-- @return #SPAWN self
function SPAWN:InitPositionCoordinate(Coordinate)
self:T( { self.SpawnTemplatePrefix, Coordinate:GetVec2()} )
self:InitPositionVec2(Coordinate:GetVec2())
return self
end
--- This method sets a spawn position for the group that is different from the location of the template.
-- @param #SPAWN self
-- @param DCS#Vec2 Vec2 The position to spawn from
-- @return #SPAWN self
function SPAWN:InitPositionVec2(Vec2)
self:T( { self.SpawnTemplatePrefix, Vec2} )
self.SpawnInitPosition = Vec2
self.SpawnFromNewPosition = true
self:I("MaxGroups:"..self.SpawnMaxGroups)
for SpawnGroupID = 1, self.SpawnMaxGroups do
self:_SetInitialPosition( SpawnGroupID )
end
return self
end
--- For planes and helicopters, when these groups go home and land on their home airbases and FARPs, they normally would taxi to the parking spot, shut-down their engines and wait forever until the Group is removed by the runtime environment.
-- This method is used to re-spawn automatically (so no extra call is needed anymore) the same group after it has landed.
-- This will enable a spawned group to be re-spawned after it lands, until it is destroyed...
@@ -1276,6 +1412,11 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
if self:_GetSpawnIndex( SpawnIndex ) then
if self.SpawnFromNewPosition then
self:_SetInitialPosition( SpawnIndex )
end
if self.SpawnGroups[self.SpawnIndex].Visible then
self.SpawnGroups[self.SpawnIndex].Group:Activate()
else
@@ -1513,7 +1654,7 @@ end
-- @param #number SpawnTime The time interval defined in seconds between each new spawn of new groups.
-- @param #number SpawnTimeVariation The variation to be applied on the defined time interval between each new spawn.
-- The variation is a number between 0 and 1, representing the % of variation to be applied on the time interval.
-- @param #boolen WithDelay Do not spawn the **first** group immediately, but delay the spawn as per the calculation below.
-- @param #boolean WithDelay Do not spawn the **first** group immediately, but delay the spawn as per the calculation below.
-- Effectively the same as @{InitDelayOn}().
-- @return #SPAWN self
-- @usage
@@ -3027,6 +3168,10 @@ function SPAWN:_GetTemplate( SpawnTemplatePrefix )
local SpawnTemplate = nil
if _DATABASE.Templates.Groups[SpawnTemplatePrefix] == nil then
error( 'No Template exists for SpawnTemplatePrefix = ' .. SpawnTemplatePrefix )
end
local Template = _DATABASE.Templates.Groups[SpawnTemplatePrefix].Template
self:F( { Template = Template } )
@@ -3060,6 +3205,11 @@ function SPAWN:_Prepare( SpawnTemplatePrefix, SpawnIndex ) -- R2.2
if self.TweakedTemplate ~= nil and self.TweakedTemplate == true then
BASE:I( "WARNING: You are using a tweaked template." )
SpawnTemplate = self.SpawnTemplate
if self.MooseNameing == true then
SpawnTemplate.name = self:SpawnGroupName( SpawnIndex )
else
SpawnTemplate.name = self:SpawnGroupName()
end
else
SpawnTemplate = self:_GetTemplate( SpawnTemplatePrefix )
SpawnTemplate.name = self:SpawnGroupName( SpawnIndex )
@@ -3190,6 +3340,57 @@ function SPAWN:_RandomizeTemplate( SpawnIndex )
return self
end
--- Private method that sets the DCS#Vec2 where the Group will be spawned.
-- @param #SPAWN self
-- @param #number SpawnIndex
-- @return #SPAWN self
function SPAWN:_SetInitialPosition( SpawnIndex )
self:T( { self.SpawnTemplatePrefix, SpawnIndex, self.SpawnRandomizeZones } )
if self.SpawnFromNewPosition then
self:T( "Preparing Spawn at Vec2 ", self.SpawnInitPosition )
local SpawnVec2 = self.SpawnInitPosition
self:T( { SpawnVec2 = SpawnVec2 } )
local SpawnTemplate = self.SpawnGroups[SpawnIndex].SpawnTemplate
SpawnTemplate.route = SpawnTemplate.route or {}
SpawnTemplate.route.points = SpawnTemplate.route.points or {}
SpawnTemplate.route.points[1] = SpawnTemplate.route.points[1] or {}
SpawnTemplate.route.points[1].x = SpawnTemplate.route.points[1].x or 0
SpawnTemplate.route.points[1].y = SpawnTemplate.route.points[1].y or 0
self:T( { Route = SpawnTemplate.route } )
for UnitID = 1, #SpawnTemplate.units do
local UnitTemplate = SpawnTemplate.units[UnitID]
self:T( 'Before Translation SpawnTemplate.units[' .. UnitID .. '].x = ' .. UnitTemplate.x .. ', SpawnTemplate.units[' .. UnitID .. '].y = ' .. UnitTemplate.y )
local SX = UnitTemplate.x
local SY = UnitTemplate.y
local BX = SpawnTemplate.route.points[1].x
local BY = SpawnTemplate.route.points[1].y
local TX = SpawnVec2.x + (SX - BX)
local TY = SpawnVec2.y + (SY - BY)
UnitTemplate.x = TX
UnitTemplate.y = TY
-- TODO: Manage altitude based on landheight...
-- SpawnTemplate.units[UnitID].alt = SpawnVec2:
self:T( 'After Translation SpawnTemplate.units[' .. UnitID .. '].x = ' .. UnitTemplate.x .. ', SpawnTemplate.units[' .. UnitID .. '].y = ' .. UnitTemplate.y )
end
SpawnTemplate.route.points[1].x = SpawnVec2.x
SpawnTemplate.route.points[1].y = SpawnVec2.y
SpawnTemplate.x = SpawnVec2.x
SpawnTemplate.y = SpawnVec2.y
end
return self
end
--- Private method that randomizes the @{Core.Zone}s where the Group will be spawned.
-- @param #SPAWN self
-- @param #number SpawnIndex
@@ -3309,7 +3510,7 @@ end
-- TODO Need to delete this... _DATABASE does this now ...
--- @param #SPAWN self
-- @param #SPAWN self
-- @param Core.Event#EVENTDATA EventData
function SPAWN:_OnBirth( EventData )
self:F( self.SpawnTemplatePrefix )
@@ -3329,7 +3530,7 @@ function SPAWN:_OnBirth( EventData )
end
--- @param #SPAWN self
-- @param #SPAWN self
-- @param Core.Event#EVENTDATA EventData
function SPAWN:_OnDeadOrCrash( EventData )
self:F( self.SpawnTemplatePrefix )

View File

@@ -33,7 +33,8 @@
do
--- @type SPOT
---
-- @type SPOT
-- @extends Core.Fsm#FSM
@@ -228,7 +229,8 @@ do
-- @param #number LaserCode Laser code.
-- @param #number Duration Duration of lasing in seconds.
function SPOT:onafterLaseOn( From, Event, To, Target, LaserCode, Duration )
self:F( { "LaseOn", Target, LaserCode, Duration } )
self:T({From, Event, To})
self:T2( { "LaseOn", Target, LaserCode, Duration } )
local function StopLase( self )
self:LaseOff()
@@ -256,6 +258,8 @@ do
self:HandleEvent( EVENTS.Dead )
self:__Lasing( -1 )
return self
end
@@ -268,7 +272,7 @@ do
-- @param #number LaserCode Laser code.
-- @param #number Duration Duration of lasing in seconds.
function SPOT:onafterLaseOnCoordinate(From, Event, To, Coordinate, LaserCode, Duration)
self:F( { "LaseOnCoordinate", Coordinate, LaserCode, Duration } )
self:T2( { "LaseOnCoordinate", Coordinate, LaserCode, Duration } )
local function StopLase( self )
self:LaseOff()
@@ -290,12 +294,14 @@ do
end
self:__Lasing(-1)
return self
end
--- @param #SPOT self
---
-- @param #SPOT self
-- @param Core.Event#EVENTDATA EventData
function SPOT:OnEventDead(EventData)
self:F( { Dead = EventData.IniDCSUnitName, Target = self.Target } )
self:T2( { Dead = EventData.IniDCSUnitName, Target = self.Target } )
if self.Target then
if EventData.IniDCSUnitName == self.TargetName then
self:F( {"Target dead ", self.TargetName } )
@@ -309,42 +315,51 @@ do
self:LaseOff()
end
end
return self
end
--- @param #SPOT self
---
-- @param #SPOT self
-- @param From
-- @param Event
-- @param To
function SPOT:onafterLasing( From, Event, To )
self:T({From, Event, To})
if self.Target and self.Target:IsAlive() then
self.SpotIR:setPoint( self.Target:GetPointVec3():AddY(1):AddY(math.random(-100,100)/100):AddX(math.random(-100,100)/100):GetVec3() )
self.SpotLaser:setPoint( self.Target:GetPointVec3():AddY(1):GetVec3() )
self:__Lasing( -0.2 )
elseif self.TargetCoord then
if self.Lasing then
if self.Target and self.Target:IsAlive() then
-- Wiggle the IR spot a bit.
local irvec3={x=self.TargetCoord.x+math.random(-100,100)/100, y=self.TargetCoord.y+math.random(-100,100)/100, z=self.TargetCoord.z} --#DCS.Vec3
local lsvec3={x=self.TargetCoord.x, y=self.TargetCoord.y, z=self.TargetCoord.z} --#DCS.Vec3
self.SpotIR:setPoint( self.Target:GetPointVec3():AddY(1):AddY(math.random(-100,100)/100):AddX(math.random(-100,100)/100):GetVec3() )
self.SpotLaser:setPoint( self.Target:GetPointVec3():AddY(1):GetVec3() )
self.SpotIR:setPoint(irvec3)
self.SpotLaser:setPoint(lsvec3)
self:__Lasing(0.2)
elseif self.TargetCoord then
self:__Lasing(-0.25)
else
self:F( { "Target is not alive", self.Target:IsAlive() } )
-- Wiggle the IR spot a bit.
local irvec3={x=self.TargetCoord.x+math.random(-100,100)/100, y=self.TargetCoord.y+math.random(-100,100)/100, z=self.TargetCoord.z} --#DCS.Vec3
local lsvec3={x=self.TargetCoord.x, y=self.TargetCoord.y, z=self.TargetCoord.z} --#DCS.Vec3
self.SpotIR:setPoint(irvec3)
self.SpotLaser:setPoint(lsvec3)
self:__Lasing(0.2)
else
self:F( { "Target is not alive", self.Target:IsAlive() } )
end
end
return self
end
--- @param #SPOT self
---
-- @param #SPOT self
-- @param From
-- @param Event
-- @param To
-- @return #SPOT
function SPOT:onafterLaseOff( From, Event, To )
self:T({From, Event, To})
self:F( {"Stopped lasing for ", self.Target and self.Target:GetName() or "coord", SpotIR = self.SportIR, SpotLaser = self.SpotLaser } )
self:T2( {"Stopped lasing for ", self.Target and self.Target:GetName() or "coord", SpotIR = self.SportIR, SpotLaser = self.SpotLaser } )
self.Lasing = false

View File

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

View File

@@ -1001,6 +1001,24 @@ function ZONE_RADIUS:Scan( ObjectCategories, UnitCategories )
end
--- Remove junk inside the zone using the `world.removeJunk` function.
-- @param #ZONE_RADIUS self
-- @return #number Number of deleted objects.
function ZONE_RADIUS:RemoveJunk()
local radius=self.Radius
local vec3=self:GetVec3()
local volS = {
id = world.VolumeType.SPHERE,
params = {point = vec3, radius = radius}
}
local n=world.removeJunk(volS)
return n
end
--- Count the number of different coalitions inside the zone.
-- @param #ZONE_RADIUS self
-- @return #table Table of DCS units and DCS statics inside the zone.
@@ -2141,6 +2159,35 @@ function ZONE_POLYGON_BASE:GetZoneQuad(ZoneName, DoNotRegisterZone)
return zone
end
--- Remove junk inside the zone. Due to DCS limitations, this works only for rectangular zones. So we get the smallest rectangular zone encompassing all points points of the polygon zone.
-- @param #ZONE_POLYGON_BASE self
-- @param #number Height Height of the box in meters. Default 1000.
-- @return #number Number of removed objects.
function ZONE_POLYGON_BASE:RemoveJunk(Height)
Height=Height or 1000
local vec2SW, vec2NE=self:GetBoundingVec2()
local vec3SW={x=vec2SW.x, y=-Height, z=vec2SW.y} --DCS#Vec3
local vec3NE={x=vec2NE.x, y= Height, z=vec2NE.y} --DCS#Vec3
--local coord1=COORDINATE:NewFromVec3(vec3SW):MarkToAll("SW")
--local coord1=COORDINATE:NewFromVec3(vec3NE):MarkToAll("NE")
local volume = {
id = world.VolumeType.BOX,
params = {
min=vec3SW,
max=vec3SW
}
}
local n=world.removeJunk(volume)
return n
end
--- Smokes the zone boundaries in a color.
-- @param #ZONE_POLYGON_BASE self
-- @param Utilities.Utils#SMOKECOLOR SmokeColor The smoke color.

View File

@@ -794,10 +794,111 @@ do -- Airbase
-- @param self
-- @return #Airbase.Desc
--- Returns the warehouse object associated with the airbase object. Can then be used to call the warehouse class functions to modify the contents of the warehouse.
-- @function [parent=#Airbase] getWarehouse
-- @param self
-- @return #Warehouse The DCS warehouse object of this airbase.
--- Enables or disables the airbase and FARP auto capture game mechanic where ownership of a base can change based on the presence of ground forces or the
-- default setting assigned in the editor.
-- @function [parent=#Airbase] autoCapture
-- @param self
-- @param #boolean setting `true` : enables autoCapture behavior, `false` : disables autoCapture behavior
--- Returns the current autoCapture setting for the passed base.
-- @function [parent=#Airbase] autoCaptureIsOn
-- @param self
-- @return #boolean `true` if autoCapture behavior is enabled and `false` otherwise.
--- Changes the passed airbase object's coalition to the set value. Must be used with Airbase.autoCapture to disable auto capturing of the base,
-- otherwise the base can revert back to a different coalition depending on the situation and built in game capture rules.
-- @function [parent=#Airbase] setCoalition
-- @param self
-- @param #number coa The new owner coalition: 0=neutra, 1=red, 2=blue.
--- Returns the wsType of every object that exists in DCS. A wsType is a table consisting of 4 entries indexed numerically.
-- It can be used to broadly categorize object types. The table can be broken down as: {mainCategory, subCat1, subCat2, index}
-- @function [parent=#Airbase] getResourceMap
-- @param self
-- @return #table wsType of every object that exists in DCS.
Airbase = {} --#Airbase
end -- Airbase
do -- Warehouse
--- [DCS Class Warehouse](https://wiki.hoggitworld.com/view/DCS_Class_Warehouse)
-- The warehouse class gives control over warehouses that exist in airbase objects. These warehouses can limit the aircraft, munitions, and fuel available to coalition aircraft.
-- @type Warehouse
--- Adds the passed amount of a given item to the warehouse.
-- itemName is the typeName associated with the item: "weapons.missiles.AIM_54C_Mk47"
-- A wsType table can also be used, however the last digit with wsTypes has been known to change. {4, 4, 7, 322}
-- @function [parent=#Warehouse] addItem
-- @param self
-- @param #string itemName Name of the item.
-- @param #number count Number of items to add.
--- Returns the number of the passed type of item currently in a warehouse object.
-- @function [parent=#Warehouse] getItemCount
-- @param self
-- @param #string itemName Name of the item.
--- Sets the passed amount of a given item to the warehouse.
-- @function [parent=#Warehouse] setItem
-- @param self
-- @param #string itemName Name of the item.
-- @param #number count Number of items to add.
--- Removes the amount of the passed item from the warehouse.
-- @function [parent=#Warehouse] removeItem
-- @param self
-- @param #string itemName Name of the item.
-- @param #number count Number of items to be removed.
--- Adds the passed amount of a liquid fuel into the warehouse inventory.
-- @function [parent=#Warehouse] addLiquid
-- @param self
-- @param #number liquidType Type of liquid to add: 0=jetfuel, 1=aviation gasoline, 2=MW50, 3=Diesel.
-- @param #number count Amount of liquid to add.
--- Returns the amount of the passed liquid type within a given warehouse.
-- @function [parent=#Warehouse] getLiquidAmount
-- @param self
-- @param #number liquidType Type of liquid to add: 0=jetfuel, 1=aviation gasoline, 2=MW50, 3=Diesel.
-- @return #number Amount of liquid.
--- Sets the passed amount of a liquid fuel into the warehouse inventory.
-- @function [parent=#Warehouse] setLiquidAmount
-- @param self
-- @param #number liquidType Type of liquid to add: 0=jetfuel, 1=aviation gasoline, 2=MW50, 3=Diesel.
-- @param #number count Amount of liquid.
--- Removes the set amount of liquid from the inventory in a warehouse.
-- @function [parent=#Warehouse] setLiquidAmount
-- @param self
-- @param #number liquidType Type of liquid to add: 0=jetfuel, 1=aviation gasoline, 2=MW50, 3=Diesel.
-- @param #number count Amount of liquid.
--- Returns the airbase object associated with the warehouse object.
-- @function [parent=#Warehouse] getOwner
-- @param self
-- @return #Airbase The airbase object owning this warehouse.
--- Returns a full itemized list of everything currently in a warehouse. If a category is set to unlimited then the table will be returned empty.
-- Aircraft and weapons are indexed by strings. Liquids are indexed by number.
-- @function [parent=#Warehouse] getInventory
-- @param self
-- @param #string itemName Name of the item.
-- @return #table Itemized list of everything currently in a warehouse
Warehouse = {} --#Warehouse
end
do -- Spot
--- [DCS Class Spot](https://wiki.hoggitworld.com/view/DCS_Class_Spot)

View File

@@ -2354,6 +2354,7 @@ do -- DETECTION_TYPES
if not DetectedItem then
DetectedItem = self:AddDetectedItem( "TYPE", DetectedTypeName )
DetectedItem.TypeName = DetectedTypeName
DetectedItem.Name = DetectedUnitName -- fix by @Nocke
end
DetectedItem.Set:AddUnit( DetectedUnit )

View File

@@ -22,7 +22,7 @@
-- @module Functional.Mantis
-- @image Functional.Mantis.jpg
--
-- Last Update: Oct 2022
-- Last Update: July 2023
-------------------------------------------------------------------------
--- **MANTIS** class, extends Core.Base#BASE
@@ -104,9 +104,13 @@
-- * Silkworm (though strictly speaking this is a surface to ship missile)
-- * SA-2, SA-3, SA-5, SA-6, SA-7, SA-8, SA-9, SA-10, SA-11, SA-13, SA-15, SA-19
-- * From HDS (see note on HDS below): SA-2, SA-3, SA-10B, SA-10C, SA-12, SA-17, SA-20A, SA-20B, SA-23, HQ-2
--
-- * From SMA: RBS98M, RBS70, RBS90, RBS90M, RBS103A, RBS103B, RBS103AM, RBS103BM, Lvkv9040M
-- **NOTE** If you are using the Swedish Military Assets (SMA), please note that the **group name** for RBS-SAM types also needs to contain the keyword "SMA"
--
-- * From CH: 2S38, PantsirS1, PantsirS2, PGL-625, HQ-17A, M903PAC2, M903PAC3, TorM2, TorM2K, TorM2M, NASAMS3-AMRAAMER, NASAMS3-AIM9X2, C-RAM, PGZ-09, S350-9M100, S350-9M96D
-- **NOTE** If you are using the Military Assets by Currenthill (CH), please note that the **group name** for CH-SAM types also needs to contain the keyword "CHM"
--
-- Following the example started above, an SA-6 site group name should start with "Red SAM SA-6" then, or a blue Patriot installation with e.g. "Blue SAM Patriot".
-- **NOTE** If you are using the High-Digit-Sam Mod, please note that the **group name** for the following SAM types also needs to contain the keyword "HDS":
--
@@ -369,6 +373,7 @@ MANTIS.SamData = {
["SA-20A"] = { Range=150, Blindspot=5, Height=27, Type="Long" , Radar="S-300PMU1"},
["SA-20B"] = { Range=200, Blindspot=4, Height=27, Type="Long" , Radar="S-300PMU2"},
["HQ-2"] = { Range=50, Blindspot=6, Height=35, Type="Medium", Radar="HQ_2_Guideline_LN" },
["SHORAD"] = { Range=3, Blindspot=0, Height=3, Type="Short", Radar="Igla" }
}
--- SAM data HDS
@@ -415,6 +420,35 @@ MANTIS.SamDataSMA = {
["Lvkv9040M SMA"] = { Range=4, Blindspot=0, Height=2.5, Type="Short", Radar="LvKv9040" },
}
--- SAM data CH
-- @type MANTIS.SamDataCH
-- @field #number Range Max firing range in km
-- @field #number Blindspot no-firing range (green circle)
-- @field #number Height Max firing height in km
-- @field #string Type #MANTIS.SamType of SAM, i.e. SHORT, MEDIUM or LONG (range)
-- @field #string Radar Radar typename on unit level (used as key)
MANTIS.SamDataCH = {
-- units from CH (Military Assets by Currenthill)
-- https://www.currenthill.com/
-- group name MUST contain CHM to ID launcher type correctly!
["2S38 CH"] = { Range=8, Blindspot=0.5, Height=6, Type="Short", Radar="2S38" },
["PantsirS1 CH"] = { Range=20, Blindspot=1.2, Height=15, Type="Short", Radar="PantsirS1" },
["PantsirS2 CH"] = { Range=30, Blindspot=1.2, Height=18, Type="Medium", Radar="PantsirS2" },
["PGL-625 CH"] = { Range=10, Blindspot=0.5, Height=5, Type="Short", Radar="PGL_625" },
["HQ-17A CH"] = { Range=20, Blindspot=1.5, Height=10, Type="Short", Radar="HQ17A" },
["M903PAC2 CH"] = { Range=160, Blindspot=3, Height=24.5, Type="Long", Radar="MIM104_M903_PAC2" },
["M903PAC3 CH"] = { Range=120, Blindspot=1, Height=40, Type="Long", Radar="MIM104_M903_PAC3" },
["TorM2 CH"] = { Range=12, Blindspot=1, Height=10, Type="Short", Radar="TorM2" },
["TorM2K CH"] = { Range=12, Blindspot=1, Height=10, Type="Short", Radar="TorM2K" },
["TorM2M CH"] = { Range=16, Blindspot=1, Height=10, Type="Short", Radar="TorM2M" },
["NASAMS3-AMRAAMER CH"] = { Range=50, Blindspot=2, Height=35.7, Type="Medium", Radar="CH_NASAMS3_LN_AMRAAM_ER" },
["NASAMS3-AIM9X2 CH"] = { Range=20, Blindspot=0.2, Height=18, Type="Short", Radar="CH_NASAMS3_LN_AIM9X2" },
["C-RAM CH"] = { Range=2, Blindspot=0, Height=2, Type="Short", Radar="CH_Centurion_C_RAM" },
["PGZ-09 CH"] = { Range=4, Blindspot=0, Height=3, Type="Short", Radar="CH_PGZ09" },
["S350-9M100 CH"] = { Range=15, Blindspot=1.5, Height=8, Type="Short", Radar="CH_S350_50P6_9M100" },
["S350-9M96D CH"] = { Range=150, Blindspot=2.5, Height=30, Type="Long", Radar="CH_S350_50P6_9M96D" },
}
-----------------------------------------------------------------------
-- MANTIS System
-----------------------------------------------------------------------
@@ -578,7 +612,7 @@ do
-- TODO Version
-- @field #string version
self.version="0.8.9"
self.version="0.8.11"
self:I(string.format("***** Starting MANTIS Version %s *****", self.version))
--- FSM Functions ---
@@ -1299,11 +1333,12 @@ do
-- @param #string grpname Name of the group
-- @param #boolean mod HDS mod flag
-- @param #boolean sma SMA mod flag
-- @param #boolean chm CH mod flag
-- @return #number range Max firing range
-- @return #number height Max firing height
-- @return #string type Long, medium or short range
-- @return #number blind "blind" spot
function MANTIS:_GetSAMDataFromUnits(grpname,mod,sma)
function MANTIS:_GetSAMDataFromUnits(grpname,mod,sma,chm)
self:T(self.lid.."_GetSAMRangeFromUnits")
local found = false
local range = self.checkradius
@@ -1318,8 +1353,10 @@ do
SAMData = self.SamDataHDS
elseif sma then
SAMData = self.SamDataSMA
elseif chm then
SAMData = self.SamDataCH
end
--self:I("Looking to auto-match for "..grpname)
--self:T("Looking to auto-match for "..grpname)
for _,_unit in pairs(units) do
local unit = _unit -- Wrapper.Unit#UNIT
local type = string.lower(unit:GetTypeName())
@@ -1364,10 +1401,13 @@ do
local found = false
local HDSmod = false
local SMAMod = false
local CHMod = false
if string.find(grpname,"HDS",1,true) then
HDSmod = true
elseif string.find(grpname,"SMA",1,true) then
SMAMod = true
elseif string.find(grpname,"CHM",1,true) then
CHMod = true
end
if self.automode then
for idx,entry in pairs(self.SamData) do
@@ -1386,8 +1426,8 @@ do
end
end
-- secondary filter if not found
if (not found and self.automode) or HDSmod or SMAMod then
range, height, type = self:_GetSAMDataFromUnits(grpname,HDSmod,SMAMod)
if (not found and self.automode) or HDSmod or SMAMod or CHMod then
range, height, type = self:_GetSAMDataFromUnits(grpname,HDSmod,SMAMod,CHMod)
elseif not found then
self:E(self.lid .. string.format("*****Could not match radar data for %s! Will default to midrange values!",grpname))
end

View File

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

View File

@@ -5490,7 +5490,7 @@ function RAT:_ATCInit(airports_map)
if not RAT.ATC.init then
local text
text="Starting RAT ATC.\nSimultanious = "..RAT.ATC.Nclearance.."\n".."Delay = "..RAT.ATC.delay
BASE:T(RAT.id..text)
BASE:T(RAT.id..text)
RAT.ATC.init=true
for _,ap in pairs(airports_map) do
local name=ap:GetName()
@@ -5671,9 +5671,9 @@ function RAT:_ATCClearForLanding(airport, flight)
-- Debug message.
local text1=string.format("ATC %s: Flight %s cleared for landing (flag=%d).", airport, flight, flagvalue)
if string.find(flight,"#") then
flight = string.match(flight,"^(.+)#")
end
if string.find(flight,"#") then
flight = string.match(flight,"^(.+)#")
end
local text2=string.format("ATC %s: Flight %s you are cleared for landing.", airport, flight)
BASE:T( RAT.id..text1)
MESSAGE:New(text2, 10):ToAllIf(RAT.ATC.messages)
@@ -5716,9 +5716,9 @@ function RAT:_ATCFlightLanded(name)
local text1=string.format("ATC %s: Flight %s landed. Tholding = %i:%02d, Tfinal = %i:%02d.", dest, name, Thold/60, Thold%60, Tfinal/60, Tfinal%60)
local text2=string.format("ATC %s: Number of flights still on final %d.", dest, RAT.ATC.airport[dest].Nonfinal)
local text3=string.format("ATC %s: Traffic report: Number of planes landed in total %d. Flights/hour = %3.2f.", dest, RAT.ATC.airport[dest].traffic, TrafficPerHour)
if string.find(name,"#") then
name = string.match(name,"^(.+)#")
end
if string.find(name,"#") then
name = string.match(name,"^(.+)#")
end
local text4=string.format("ATC %s: Flight %s landed. Welcome to %s.", dest, name, dest)
BASE:T(RAT.id..text1)
BASE:T(RAT.id..text2)
@@ -5832,6 +5832,7 @@ RATMANAGER={
rat={},
name={},
alive={},
planned={},
min={},
nrat=0,
ntot=nil,
@@ -5880,6 +5881,7 @@ function RATMANAGER:Add(ratobject,min)
self.rat[self.nrat]=ratobject
self.alive[self.nrat]=0
self.planned[self.nrat]=0
self.name[self.nrat]=ratobject.alias
self.min[self.nrat]=min or 1
@@ -6020,11 +6022,25 @@ function RATMANAGER:_Manage()
for i=1,self.nrat do
for j=1,N[i] do
time=time+self.dTspawn
SCHEDULER:New(nil, RAT._SpawnWithRoute, {self.rat[i]}, time)
self.planned[i]=self.planned[i]+1
SCHEDULER:New(nil, RATMANAGER._Spawn, {self, i}, time)
end
end
end
--- Instantly starts the RAT manager and spawns the initial random number RAT groups for each RAT object.
-- @param #RATMANAGER self
-- @param #RATMANAGER RATMANAGER self object.
-- @param #number i Index.
function RATMANAGER:_Spawn(i)
local rat=self.rat[i] --#RAT
rat:_SpawnWithRoute()
self.planned[i]=self.planned[i]-1
end
--- Counts the number of alive RAT objects.
-- @param #RATMANAGER self
function RATMANAGER:_Count()
@@ -6053,7 +6069,7 @@ function RATMANAGER:_Count()
ntotal=ntotal+n
-- Debug output.
local text=string.format("Number of alive groups of %s = %d", self.name[i], n)
local text=string.format("Number of alive groups of %s = %d, planned=%d", self.name[i], n, self.planned[i])
self:T(RATMANAGER.id..text)
end
@@ -6083,9 +6099,10 @@ function RATMANAGER:_RollDice(nrat,ntot,min,alive)
local M={}
local P={}
for i=1,nrat do
local a=alive[i]+self.planned[i]
N[#N+1]=0
M[#M+1]=math.max(alive[i], min[i])
P[#P+1]=math.max(min[i]-alive[i],0)
M[#M+1]=math.max(a, min[i])
P[#P+1]=math.max(min[i]-a,0)
end
-- Min/max group arrays.
@@ -6102,7 +6119,7 @@ function RATMANAGER:_RollDice(nrat,ntot,min,alive)
-- Number of new groups to be added.
local nnew=ntot
for i=1,nrat do
nnew=nnew-alive[i]
nnew=nnew-alive[i]-self.planned[i]
end
for i=1,nrat-1 do
@@ -6134,7 +6151,7 @@ function RATMANAGER:_RollDice(nrat,ntot,min,alive)
end
-- Debug info
self:T3(string.format("RATMANAGER: i=%d, alive=%d, min=%d, mini=%d, maxi=%d, add=%d, sumN=%d, sumP=%d", j, alive[j], min[j], mini[j], maxi[j], N[j],sN, sP))
self:T3(string.format("RATMANAGER: i=%d, alive=%d, planned=%d, min=%d, mini=%d, maxi=%d, add=%d, sumN=%d, sumP=%d", j, alive[j], self.planned[i], min[j], mini[j], maxi[j], N[j],sN, sP))
end
@@ -6149,7 +6166,7 @@ function RATMANAGER:_RollDice(nrat,ntot,min,alive)
-- Debug info
local text=RATMANAGER.id.."\n"
for i=1,nrat do
text=text..string.format("%s: i=%d, alive=%d, min=%d, mini=%d, maxi=%d, add=%d\n", self.name[i], i, alive[i], min[i], mini[i], maxi[i], N[i])
text=text..string.format("%s: i=%d, alive=%d, planned=%d, min=%d, mini=%d, maxi=%d, add=%d\n", self.name[i], i, alive[i], self.planned[i], min[i], mini[i], maxi[i], N[i])
end
text=text..string.format("Total # of groups to add = %d", sum(N, done))
self:T(text)

View File

@@ -591,7 +591,7 @@ RANGE.MenuF10Root = nil
--- Range script version.
-- @field #string version
RANGE.version = "2.7.0"
RANGE.version = "2.7.1"
-- TODO list:
-- TODO: Verbosity level for messages.
@@ -2044,6 +2044,7 @@ function RANGE:OnEventShot( EventData )
-- Attack parameters.
local attackHdg=_unit:GetHeading()
local attackAlt=_unit:GetHeight()
attackAlt = UTILS.MetersToFeet(attackAlt)
local attackVel=_unit:GetVelocityKNOTS()
-- Tracking info and init of last bomb position.

View File

@@ -715,11 +715,11 @@ function SCORING:AddGoalScorePlayer( PlayerName, GoalTag, Text, Score )
PlayerData.Goals[GoalTag] = PlayerData.Goals[GoalTag] or { Score = 0 }
PlayerData.Goals[GoalTag].Score = PlayerData.Goals[GoalTag].Score + Score
PlayerData.Score = PlayerData.Score + Score
MESSAGE:NewType( self.DisplayMessagePrefix .. Text,
MESSAGE.Type.Information )
:ToAll()
if Text then
MESSAGE:NewType( self.DisplayMessagePrefix .. Text,
MESSAGE.Type.Information )
:ToAll()
end
self:ScoreCSV( PlayerName, "", "GOAL_" .. string.upper( GoalTag ), 1, Score, nil )
end
end
@@ -738,7 +738,7 @@ function SCORING:AddGoalScore( PlayerUnit, GoalTag, Text, Score )
local PlayerName = PlayerUnit:GetPlayerName()
self:F( { PlayerUnit.UnitName, PlayerName, GoalTag, Text, Score } )
self:T2( { PlayerUnit.UnitName, PlayerName, GoalTag, Text, Score } )
-- PlayerName can be nil, if the Unit with the player crashed or due to another reason.
if PlayerName then
@@ -748,10 +748,11 @@ function SCORING:AddGoalScore( PlayerUnit, GoalTag, Text, Score )
PlayerData.Goals[GoalTag].Score = PlayerData.Goals[GoalTag].Score + Score
PlayerData.Score = PlayerData.Score + Score
MESSAGE:NewType( self.DisplayMessagePrefix .. Text,
if Text then
MESSAGE:NewType( self.DisplayMessagePrefix .. Text,
MESSAGE.Type.Information )
:ToAll()
end
self:ScoreCSV( PlayerName, "", "GOAL_" .. string.upper( GoalTag ), 1, Score, PlayerUnit:GetName() )
end
end
@@ -785,10 +786,11 @@ function SCORING:_AddMissionTaskScore( Mission, PlayerUnit, Text, Score )
PlayerData.Score = self.Players[PlayerName].Score + Score
PlayerData.Mission[MissionName].ScoreTask = self.Players[PlayerName].Mission[MissionName].ScoreTask + Score
MESSAGE:NewType( self.DisplayMessagePrefix .. Mission:GetText() .. " : " .. Text .. " Score: " .. Score,
MESSAGE.Type.Information )
:ToAll()
if Text then
MESSAGE:NewType( self.DisplayMessagePrefix .. Mission:GetText() .. " : " .. Text .. " Score: " .. Score,
MESSAGE.Type.Information )
:ToAll()
end
self:ScoreCSV( PlayerName, "", "TASK_" .. MissionName:gsub( ' ', '_' ), 1, Score, PlayerUnit:GetName() )
end
end
@@ -821,7 +823,9 @@ function SCORING:_AddMissionGoalScore( Mission, PlayerName, Text, Score )
PlayerData.Score = self.Players[PlayerName].Score + Score
PlayerData.Mission[MissionName].ScoreTask = self.Players[PlayerName].Mission[MissionName].ScoreTask + Score
MESSAGE:NewType( string.format( "%s%s: %s! Player %s receives %d score!", self.DisplayMessagePrefix, Mission:GetText(), Text, PlayerName, Score ), MESSAGE.Type.Information ):ToAll()
if Text then
MESSAGE:NewType( string.format( "%s%s: %s! Player %s receives %d score!", self.DisplayMessagePrefix, Mission:GetText(), Text, PlayerName, Score ), MESSAGE.Type.Information ):ToAll()
end
self:ScoreCSV( PlayerName, "", "TASK_" .. MissionName:gsub( ' ', '_' ), 1, Score )
end
@@ -848,10 +852,11 @@ function SCORING:_AddMissionScore( Mission, Text, Score )
PlayerData.Score = PlayerData.Score + Score
PlayerData.Mission[MissionName].ScoreMission = PlayerData.Mission[MissionName].ScoreMission + Score
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' has " .. Text .. " in " .. Mission:GetText() .. ". " .. Score .. " mission score!",
if Text then
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' has " .. Text .. " in " .. Mission:GetText() .. ". " .. Score .. " mission score!",
MESSAGE.Type.Information )
:ToAll()
end
self:ScoreCSV( PlayerName, "", "MISSION_" .. MissionName:gsub( ' ', '_' ), 1, Score )
end
end
@@ -1415,7 +1420,7 @@ function SCORING:ReportDetailedPlayerHits( PlayerName )
Penalty = Penalty + UnitData.Penalty
PenaltyHit = UnitData.PenaltyHit
end
local ScoreMessageHit = string.format( "%s:%d ", CategoryName, Score - Penalty )
local ScoreMessageHit = string.format( "%s: %d ", CategoryName, Score - Penalty )
self:T( ScoreMessageHit )
ScoreMessageHits = ScoreMessageHits .. ScoreMessageHit
PlayerScore = PlayerScore + Score
@@ -1471,7 +1476,7 @@ function SCORING:ReportDetailedPlayerDestroys( PlayerName )
end
end
local ScoreMessageDestroy = string.format( " %s:%d ", CategoryName, Score - Penalty )
local ScoreMessageDestroy = string.format( " %s: %d ", CategoryName, Score - Penalty )
self:T( ScoreMessageDestroy )
ScoreMessageDestroys = ScoreMessageDestroys .. ScoreMessageDestroy
@@ -1762,9 +1767,9 @@ function SCORING:SecondsToClock( sSeconds )
-- return nil;
return "00:00:00";
else
nHours = string.format( "%02.f", math.floor( nSeconds / 3600 ) );
nMins = string.format( "%02.f", math.floor( nSeconds / 60 - (nHours * 60) ) );
nSecs = string.format( "%02.f", math.floor( nSeconds - nHours * 3600 - nMins * 60 ) );
local nHours = string.format( "%02.f", math.floor( nSeconds / 3600 ) );
local nMins = string.format( "%02.f", math.floor( nSeconds / 60 - (nHours * 60) ) );
local nSecs = string.format( "%02.f", math.floor( nSeconds - nHours * 3600 - nMins * 60 ) );
return nHours .. ":" .. nMins .. ":" .. nSecs
end
end

View File

@@ -1798,7 +1798,7 @@ _WAREHOUSEDB = {
--- Warehouse class version.
-- @field #string version
WAREHOUSE.version="1.0.2"
WAREHOUSE.version="1.0.2a"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO: Warehouse todo list.
@@ -4561,7 +4561,8 @@ function WAREHOUSE:onafterRequest(From, Event, To, Request)
self:_ErrorMessage("ERROR: Cargo transport by train not supported yet!")
return
elseif Request.transporttype==WAREHOUSE.TransportType.SHIP or Request.transporttype==WAREHOUSE.TransportType.NAVALCARRIER then
elseif Request.transporttype==WAREHOUSE.TransportType.SHIP or Request.transporttype==WAREHOUSE.TransportType.NAVALCARRIER
or Request.transporttype==WAREHOUSE.TransportType.ARMEDSHIP or Request.transporttype==WAREHOUSE.TransportType.WARSHIP then
-- Spawn Ship in port zone
spawngroup=self:_SpawnAssetGroundNaval(_alias, _assetitem, Request, self.portzone)
@@ -5830,59 +5831,62 @@ function WAREHOUSE:_SpawnAssetRequest(Request)
-- Get stock item.
local asset=cargoassets[i] --#WAREHOUSE.Assetitem
-- Set asset status to not spawned until we capture its birth event.
asset.spawned=false
asset.iscargo=true
if not asset.spawned then
-- Set request ID.
asset.rid=Request.uid
-- Set asset status to not spawned until we capture its birth event.
asset.iscargo=true
-- Spawn group name.
local _alias=asset.spawngroupname
-- Set request ID.
asset.rid=Request.uid
--Request add asset by id.
Request.assets[asset.uid]=asset
-- Spawn group name.
local _alias=asset.spawngroupname
-- Spawn an asset group.
local _group=nil --Wrapper.Group#GROUP
if asset.category==Group.Category.GROUND then
--Request add asset by id.
Request.assets[asset.uid]=asset
-- Spawn ground troops.
_group=self:_SpawnAssetGroundNaval(_alias, asset, Request, self.spawnzone, Request.lateActivation)
-- Spawn an asset group.
local _group=nil --Wrapper.Group#GROUP
if asset.category==Group.Category.GROUND then
elseif asset.category==Group.Category.AIRPLANE or asset.category==Group.Category.HELICOPTER then
-- Spawn ground troops.
_group=self:_SpawnAssetGroundNaval(_alias, asset, Request, self.spawnzone, Request.lateActivation)
-- Spawn air units.
if Parking[asset.uid] then
_group=self:_SpawnAssetAircraft(_alias, asset, Request, Parking[asset.uid], UnControlled, Request.lateActivation)
else
_group=self:_SpawnAssetAircraft(_alias, asset, Request, nil, UnControlled, Request.lateActivation)
end
elseif asset.category==Group.Category.AIRPLANE or asset.category==Group.Category.HELICOPTER then
elseif asset.category==Group.Category.TRAIN then
-- Spawn air units.
if Parking[asset.uid] then
_group=self:_SpawnAssetAircraft(_alias, asset, Request, Parking[asset.uid], UnControlled, Request.lateActivation)
else
_group=self:_SpawnAssetAircraft(_alias, asset, Request, nil, UnControlled, Request.lateActivation)
end
-- Spawn train.
if self.rail then
--TODO: Rail should only get one asset because they would spawn on top!
elseif asset.category==Group.Category.TRAIN then
-- Spawn train.
if self.rail then
--TODO: Rail should only get one asset because they would spawn on top!
-- Spawn naval assets.
_group=self:_SpawnAssetGroundNaval(_alias, asset, Request, self.spawnzone, Request.lateActivation)
end
--self:E(self.lid.."ERROR: Spawning of TRAIN assets not possible yet!")
elseif asset.category==Group.Category.SHIP then
-- Spawn naval assets.
_group=self:_SpawnAssetGroundNaval(_alias, asset, Request, self.spawnzone, Request.lateActivation)
_group=self:_SpawnAssetGroundNaval(_alias, asset, Request, self.portzone, Request.lateActivation)
else
self:E(self.lid.."ERROR: Unknown asset category!")
end
--self:E(self.lid.."ERROR: Spawning of TRAIN assets not possible yet!")
-- Trigger event.
if _group then
self:__AssetSpawned(0.01, _group, asset, Request)
end
elseif asset.category==Group.Category.SHIP then
-- Spawn naval assets.
_group=self:_SpawnAssetGroundNaval(_alias, asset, Request, self.portzone, Request.lateActivation)
else
self:E(self.lid.."ERROR: Unknown asset category!")
end
-- Trigger event.
if _group then
self:__AssetSpawned(0.01, _group, asset, Request)
end
end

View File

@@ -48,6 +48,7 @@ __Moose.Include( 'Scripts/Moose/Wrapper/Scenery.lua' )
__Moose.Include( 'Scripts/Moose/Wrapper/Marker.lua' )
__Moose.Include( 'Scripts/Moose/Wrapper/Weapon.lua' )
__Moose.Include( 'Scripts/Moose/Wrapper/Net.lua' )
__Moose.Include( 'Scripts/Moose/Wrapper/Storage.lua' )
__Moose.Include( 'Scripts/Moose/Cargo/Cargo.lua' )
__Moose.Include( 'Scripts/Moose/Cargo/CargoUnit.lua' )

View File

@@ -1,3 +1,4 @@
---@diagnostic disable: cast-local-type
--- **Ops** - Automatic Terminal Information Service (ATIS).
--
-- ===
@@ -45,6 +46,7 @@
-- ===
--
-- ### Author: **funkyfranky**
-- ### Additions for SRS and FARP: **applevangelist**
--
-- @module Ops.ATIS
-- @image OPS_ATIS.png
@@ -418,6 +420,8 @@ ATIS.RunwayM2T = {
TheChannel = -10,
Syria = 5,
MarianaIslands = 2,
Falklands = 12,
Sinai = 5,
}
--- Whether ICAO phraseology is used for ATIS broadcasts.
@@ -429,6 +433,8 @@ ATIS.RunwayM2T = {
-- @field #boolean TheChannel true.
-- @field #boolean Syria true.
-- @field #boolean MarianaIslands true.
-- @field #boolean Falklands true.
-- @field #boolean Sinai true.
ATIS.ICAOPhraseology = {
Caucasus = true,
Nevada = false,
@@ -436,7 +442,9 @@ ATIS.ICAOPhraseology = {
PersianGulf = true,
TheChannel = true,
Syria = true,
MarianaIslands = true
MarianaIslands = true,
Falklands = true,
Sinai = true,
}
--- Nav point data.
@@ -608,15 +616,16 @@ _ATIS = {}
--- ATIS class version.
-- @field #string version
ATIS.version = "0.9.14"
ATIS.version = "0.9.16"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO list
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO: Add new Normandy airfields.
-- TODO: Zulu time --> Zulu in output.
-- TODO: Correct fog for elevation.
-- DONE: Zulu time --> Zulu in output.
-- DONE: Fix for AB not having a runway - Helopost like Naqoura
-- DONE: Add new Normandy airfields.
-- DONE: Use new AIRBASE system to set start/landing runway
-- DONE: SetILS doesn't work
-- DONE: Visibility reported twice over SRS
@@ -1270,6 +1279,8 @@ end
-- @param #string Event Event.
-- @param #string To To state.
function ATIS:onafterStart( From, Event, To )
self:T({From, Event, To})
self:T("Airbase category is "..self.airbase:GetAirbaseCategory())
-- Check that this is an airdrome.
if self.airbase:GetAirbaseCategory() == Airbase.Category.SHIP then
@@ -1331,7 +1342,7 @@ end
-- @param #string Event Event.
-- @param #string To To state.
function ATIS:onafterStatus( From, Event, To )
self:T({From, Event, To})
-- Get FSM state.
local fsmstate = self:GetState()
@@ -1353,7 +1364,7 @@ function ATIS:onafterStatus( From, Event, To )
self:T( self.lid .. text )
if not self:Is("Stopped") then
self:__Status( -60 )
self:__Status( 60 )
end
end
@@ -1367,25 +1378,26 @@ end
-- @param #string Event Event.
-- @param #string To To state.
function ATIS:onafterCheckQueue( From, Event, To )
self:T({From, Event, To})
if not self:Is("Stopped") then
if self.useSRS then
if self.useSRS then
self:Broadcast()
else
if #self.radioqueue.queue == 0 then
self:T( self.lid .. string.format( "Radio queue empty. Repeating message." ) )
self:Broadcast()
else
self:T2( self.lid .. string.format( "Radio queue %d transmissions queued.", #self.radioqueue.queue ) )
if #self.radioqueue.queue == 0 then
self:T( self.lid .. string.format( "Radio queue empty. Repeating message." ) )
self:Broadcast()
else
self:T2( self.lid .. string.format( "Radio queue %d transmissions queued.", #self.radioqueue.queue ) )
end
end
end
if not self:Is("Stopped") then
-- Check back in 5 seconds.
self:__CheckQueue( -math.abs( self.dTQueueCheck ) )
self:__CheckQueue( math.abs( self.dTQueueCheck ) )
end
end
@@ -1395,7 +1407,7 @@ end
-- @param #string Event Event.
-- @param #string To To state.
function ATIS:onafterBroadcast( From, Event, To )
self:T({From, Event, To})
-- Get current coordinate.
local coord = self.airbase:GetCoordinate()
@@ -1821,7 +1833,10 @@ function ATIS:onafterBroadcast( From, Event, To )
-- Airbase name
subtitle = string.format( "%s", self.airbasename )
if (not self.ATISforFARPs) and self.airbasename:find( "AFB" ) == nil and self.airbasename:find( "Airport" ) == nil and self.airbasename:find( "Airstrip" ) == nil and self.airbasename:find( "airfield" ) == nil and self.airbasename:find( "AB" ) == nil then
if (not self.ATISforFARPs) and self.airbasename:find( "AFB" ) == nil and self.airbasename:find( "Airport" ) == nil
and self.airbasename:find( "Airstrip" ) == nil and self.airbasename:find( "airfield" ) == nil and self.airbasename:find( "AB" ) == nil
and self.airbasename:find( "Field" ) == nil
then
subtitle = subtitle .. " Airport"
end
if not self.useSRS then
@@ -2140,15 +2155,20 @@ function ATIS:onafterBroadcast( From, Event, To )
end
alltext = alltext .. ";\n" .. subtitle
local _RUNACT
if not self.ATISforFARPs then
-- Active runway.
local subtitle=string.format("Active runway %s", runwayLanding)
if rwyLandingLeft==true then
subtitle=subtitle.." Left"
elseif rwyLandingLeft==false then
subtitle=subtitle.." Right"
local subtitle
if runwayLanding then
subtitle=string.format("Active runway %s", runwayLanding)
if rwyLandingLeft==true then
subtitle=subtitle.." Left"
elseif rwyLandingLeft==false then
subtitle=subtitle.." Right"
end
end
local _RUNACT = subtitle
_RUNACT = subtitle
if not self.useSRS then
self:Transmission(ATIS.Sound.ActiveRunway, 1.0, subtitle)
self.radioqueue:Number2Transmission(runwayLanding)
@@ -2401,6 +2421,7 @@ end
-- @param #string To To state.
-- @param #string Text Report text.
function ATIS:onafterReport( From, Event, To, Text )
self:T({From, Event, To})
self:T( self.lid .. string.format( "Report:\n%s", Text ) )
if self.useSRS and self.msrs then
@@ -2509,8 +2530,11 @@ function ATIS:GetActiveRunway(Takeoff)
else
runway=self.airbase:GetActiveRunwayLanding()
end
return runway.name, runway.isLeft
if runway then -- some ABs have NO runways, e.g. Syria Naqoura
return runway.name, runway.isLeft
else
return nil, nil
end
end
--- Get runway from user supplied magnetic heading.

View File

@@ -5822,27 +5822,64 @@ function AIRBOSS:_ScanCarrierZone()
-- Get aircraft type name.
local actype = group:GetTypeName()
-- Create a new flight group
if knownflight then
-- Debug output.
self:T2(self.lid..string.format("Known flight group %s of type %s in CCA.", groupname, actype))
-- Check if flight is AI and if we want to handle it at all.
if knownflight.ai and knownflight.flag == -100 and self.handleai and false then --Disabled AI handling because of incorrect OPSGROUP reference!
if knownflight.ai and self.handleai then
local putintomarshal = false
-- Defines if AI group should be handled by the airboss.
local iscarriersquad=true
-- Get flight group.
local flight = _DATABASE:GetOpsGroup( groupname )
if flight and flight:IsInbound() and flight.destbase:GetName() == self.carrier:GetName() then
if flight.ishelo then
-- Check if AI group is part of the group set if a set was defined.
if self.squadsetAI then
local group=self.squadsetAI:FindGroup(groupname)
if group then
iscarriersquad=true
else
putintomarshal = true
iscarriersquad=false
end
flight.airboss = self
end
-- Send AI flight to marshal stack.
if putintomarshal then
-- Check if group was explicitly excluded.
if self.excludesetAI then
local group=self.excludesetAI:FindGroup(groupname)
if group then
iscarriersquad=false
end
end
-- Get distance to carrier.
local dist=knownflight.group:GetCoordinate():Get2DDistance(self:GetCoordinate())
-- Close in distance. Is >0 if AC comes closer wrt to first detected distance d0.
local closein=knownflight.dist0-dist
-- Debug info.
self:T3(self.lid..string.format("Known AI flight group %s closed in by %.1f NM", knownflight.groupname, UTILS.MetersToNM(closein)))
-- Is this group the tanker?
local istanker=self.tanker and self.tanker.tanker:GetName()==groupname
-- Is this group the AWACS?
local isawacs=self.awacs and self.awacs.tanker:GetName()==groupname
-- Send tanker to marshal stack?
local tanker2marshal = istanker and self.tanker:IsReturning() and self.tanker.airbase:GetName()==self.airbase:GetName() and knownflight.flag==-100 and self.tanker.recovery==true
-- Send AWACS to marhsal stack?
local awacs2marshal = isawacs and self.awacs:IsReturning() and self.awacs.airbase:GetName()==self.airbase:GetName() and knownflight.flag==-100 and self.awacs.recovery==true
-- Put flight into Marshal.
local putintomarshal=closein>UTILS.NMToMeters(5) and knownflight.flag==-100 and iscarriersquad and istanker==false and isawacs==false
-- Send AI flight to marshal stack if group closes in more than 5 and has initial flag value.
if putintomarshal or tanker2marshal or awacs2marshal then
-- Get the next free stack for current recovery case.
local stack = self:_GetFreeStack( knownflight.ai )
@@ -8115,6 +8152,8 @@ function AIRBOSS:OnEventBirth( EventData )
return
end
if EventData.IniObjectCategory ~= Object.Category.UNIT then return end
local _unitName = EventData.IniUnitName
local _unit, _playername = self:_GetPlayerUnitAndName( _unitName )
@@ -9793,7 +9832,7 @@ function AIRBOSS:_Groove( playerData )
end
-- Long V/STOL groove time Wave Off over 75 seconds to IC - TOPGUN level Only. --pene testing (WIP)--- Need to think more about this.
-- Long V/STOL groove time Wave Off over 75 seconds to IC - TOPGUN level Only. --pene testing (WIP)--- Need to think more about this.
--if rho>=RAR and rho<=RIC and not playerData.waveoff and playerData.difficulty==AIRBOSS.Difficulty.HARD and playerData.actype== AIRBOSS.AircraftCarrier.AV8B then
-- Get groove time
@@ -10162,7 +10201,7 @@ function AIRBOSS:_GetSternCoord()
elseif case==2 or case==1 then
-- V/Stol: Translate 8 meters port.
self.sterncoord:Translate(self.carrierparam.sterndist, hdg, true, true):Translate(8, FB-90, true, true)
end
end
elseif self.carriertype==AIRBOSS.CarrierType.STENNIS then
-- Stennis: translate 7 meters starboard wrt Final bearing.
self.sterncoord:Translate( self.carrierparam.sterndist, hdg, true, true ):Translate( 7, FB + 90, true, true )

View File

@@ -30,7 +30,7 @@
-- @module Ops.CSAR
-- @image OPS_CSAR.jpg
-- Date: January 2023
-- Date: May 2023
-------------------------------------------------------------------------
--- **CSAR** class, extends Core.Base#BASE, Core.Fsm#FSM
@@ -292,7 +292,7 @@ CSAR.AircraftType["Bronco-OV-10A"] = 2
--- CSAR class version.
-- @field #string version
CSAR.version="1.0.17"
CSAR.version="1.0.18"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- ToDo list
@@ -316,7 +316,7 @@ function CSAR:New(Coalition, Template, Alias)
-- Inherit everything from FSM class.
local self=BASE:Inherit(self, FSM:New()) -- #CSAR
BASE:T({Coalition, Prefixes, Alias})
BASE:T({Coalition, Template, Alias})
--set Coalition
if Coalition and type(Coalition)=="string" then
@@ -1880,7 +1880,7 @@ function CSAR:_SignalFlare(_unitName)
if _SETTINGS:IsImperial() then
_distance = string.format("%.1fnm",UTILS.MetersToNM(_closest.distance))
else
_distance = string.format("%.1fkm",_closest.distance)
_distance = string.format("%.1fkm",_closest.distance/1000)
end
local _msg = string.format("%s - Popping signal flare at your %s o\'clock. Distance %s", self:_GetCustomCallSign(_unitName), _clockDir, _distance)
self:_DisplayMessageToSAR(_heli, _msg, self.messageTime, false, true, true)
@@ -2175,6 +2175,7 @@ function CSAR:_AddBeaconToGroup(_group, _freq)
if _group:IsAlive() then
local _radioUnit = _group:GetUnit(1)
if _radioUnit then
local name = _radioUnit:GetName()
local Frequency = _freq -- Freq in Hertz
local name = _radioUnit:GetName()
local Sound = "l10n/DEFAULT/"..self.radioSound

File diff suppressed because it is too large Load Diff

View File

@@ -805,7 +805,9 @@ function RESCUEHELO:_OnEventCrashOrEject(EventData)
self:T(self.lid..text)
-- Get coordinate of unit.
local coord=unit:GetCoordinate()
--local coord=unit:GetCoordinate()
local Vec3 = EventData.IniDCSUnit:getPoint() -- Vec3
local coord = COORDINATE:NewFromVec3(Vec3)
if coord and self.rescuezone:IsCoordinateInZone(coord) then

View File

@@ -28,11 +28,11 @@ ENUMS = {}
--- Rules of Engagement.
-- @type ENUMS.ROE
-- @field #number WeaponFree AI will engage any enemy group it detects. Target prioritization is based based on the threat of the target.
-- @field #number OpenFireWeaponFree AI will engage any enemy group it detects, but will prioritize targets specified in the groups tasking.
-- @field #number OpenFire AI will engage only targets specified in its taskings.
-- @field #number ReturnFire AI will only engage threats that shoot first.
-- @field #number WeaponHold AI will hold fire under all circumstances.
-- @field #number WeaponFree [AIR] AI will engage any enemy group it detects. Target prioritization is based based on the threat of the target.
-- @field #number OpenFireWeaponFree [AIR] AI will engage any enemy group it detects, but will prioritize targets specified in the groups tasking.
-- @field #number OpenFire [AIR, GROUND, NAVAL] AI will engage only targets specified in its taskings.
-- @field #number ReturnFire [AIR, GROUND, NAVAL] AI will only engage threats that shoot first.
-- @field #number WeaponHold [AIR, GROUND, NAVAL] AI will hold fire under all circumstances.
ENUMS.ROE = {
WeaponFree=0,
OpenFireWeaponFree=1,
@@ -236,6 +236,7 @@ ENUMS.WeaponType.Any={
-- @field #string ESCORT Escort another group.
-- @field #string FIGHTERSWEEP Fighter sweep.
-- @field #string GROUNDATTACK Ground attack.
-- @field #string GROUNDESCORT Ground escort another group.
-- @field #string INTERCEPT Intercept.
-- @field #string PINPOINTSTRIKE Pinpoint strike.
-- @field #string RECONNAISSANCE Reconnaissance mission.
@@ -251,6 +252,7 @@ ENUMS.MissionTask={
CAP="CAP",
CAS="CAS",
ESCORT="Escort",
GROUNDESCORT="Ground escort",
FIGHTERSWEEP="Fighter Sweep",
GROUNDATTACK="Ground Attack",
INTERCEPT="Intercept",
@@ -560,3 +562,578 @@ ENUMS.ReportingName =
Predator = "MQ-1A",
}
}
--- Enums for the STORAGE class for stores - which need to be in ""
-- @type ENUMS.Storage
-- @type ENUMS.Storage.weapons
ENUMS.Storage = {
weapons = {
missiles = {}, -- Missiles
bombs = {}, -- Bombs
nurs = {}, -- Rockets and unguided
containers = {}, -- Containers
droptanks = {}, -- Droptanks
adapters = {}, -- Adapter
torpedoes = {}, -- Torpedoes
}
}
ENUMS.Storage.weapons.nurs.SNEB_TYPE253_F1B = "weapons.nurs.SNEB_TYPE253_F1B"
ENUMS.Storage.weapons.missiles.P_24T = "weapons.missiles.P_24T"
ENUMS.Storage.weapons.bombs.BLU_3B_OLD = "weapons.bombs.BLU-3B_OLD"
ENUMS.Storage.weapons.missiles.AGM_154 = "weapons.missiles.AGM_154"
ENUMS.Storage.weapons.nurs.HYDRA_70_M151_M433 = "weapons.nurs.HYDRA_70_M151_M433"
ENUMS.Storage.weapons.bombs.SAM_Avenger_M1097_Skid_7090lb = "weapons.bombs.SAM Avenger M1097 Skid [7090lb]"
ENUMS.Storage.weapons.bombs.British_GP_250LB_Bomb_Mk5 = "weapons.bombs.British_GP_250LB_Bomb_Mk5"
ENUMS.Storage.weapons.containers.OV10_SMOKE = "weapons.containers.{OV10_SMOKE}"
ENUMS.Storage.weapons.bombs.BLU_4B_OLD = "weapons.bombs.BLU-4B_OLD"
ENUMS.Storage.weapons.bombs.FAB_500M54 = "weapons.bombs.FAB-500M54"
ENUMS.Storage.weapons.bombs.GBU_38 = "weapons.bombs.GBU_38"
ENUMS.Storage.weapons.containers.F_15E_AXQ_14_DATALINK = "weapons.containers.F-15E_AXQ-14_DATALINK"
ENUMS.Storage.weapons.bombs.BEER_BOMB = "weapons.bombs.BEER_BOMB"
ENUMS.Storage.weapons.bombs.P_50T = "weapons.bombs.P-50T"
ENUMS.Storage.weapons.nurs.C_8CM_GN = "weapons.nurs.C_8CM_GN"
ENUMS.Storage.weapons.bombs.FAB_500SL = "weapons.bombs.FAB-500SL"
ENUMS.Storage.weapons.bombs.KAB_1500Kr = "weapons.bombs.KAB_1500Kr"
ENUMS.Storage.weapons.bombs.two50_2 = "weapons.bombs.250-2"
ENUMS.Storage.weapons.droptanks.Spitfire_tank_1 = "weapons.droptanks.Spitfire_tank_1"
ENUMS.Storage.weapons.missiles.AGM_65G = "weapons.missiles.AGM_65G"
ENUMS.Storage.weapons.missiles.AGM_65A = "weapons.missiles.AGM_65A"
ENUMS.Storage.weapons.containers.Hercules_JATO = "weapons.containers.Hercules_JATO"
ENUMS.Storage.weapons.nurs.HYDRA_70_M259 = "weapons.nurs.HYDRA_70_M259"
ENUMS.Storage.weapons.missiles.AGM_84E = "weapons.missiles.AGM_84E"
ENUMS.Storage.weapons.bombs.AN_M30A1 = "weapons.bombs.AN_M30A1"
ENUMS.Storage.weapons.nurs.C_25 = "weapons.nurs.C_25"
ENUMS.Storage.weapons.containers.AV8BNA_ALQ164 = "weapons.containers.AV8BNA_ALQ164"
ENUMS.Storage.weapons.containers.lav_25 = "weapons.containers.lav-25"
ENUMS.Storage.weapons.missiles.P_60 = "weapons.missiles.P_60"
ENUMS.Storage.weapons.bombs.FAB_1500 = "weapons.bombs.FAB_1500"
ENUMS.Storage.weapons.droptanks.FuelTank_350L = "weapons.droptanks.FuelTank_350L"
ENUMS.Storage.weapons.bombs.AAA_Vulcan_M163_Skid_21577lb = "weapons.bombs.AAA Vulcan M163 Skid [21577lb]"
ENUMS.Storage.weapons.missiles.Kormoran = "weapons.missiles.Kormoran"
ENUMS.Storage.weapons.droptanks.HB_F14_EXT_DROPTANK_EMPTY = "weapons.droptanks.HB_F14_EXT_DROPTANK_EMPTY"
ENUMS.Storage.weapons.droptanks.FuelTank_150L = "weapons.droptanks.FuelTank_150L"
ENUMS.Storage.weapons.missiles.Rb_15F_for_A_I = "weapons.missiles.Rb 15F (for A.I.)"
ENUMS.Storage.weapons.missiles.RB75T = "weapons.missiles.RB75T"
ENUMS.Storage.weapons.missiles.Vikhr_M = "weapons.missiles.Vikhr_M"
ENUMS.Storage.weapons.nurs.FFAR_M156_WP = "weapons.nurs.FFAR M156 WP"
ENUMS.Storage.weapons.nurs.British_HE_60LBSAPNo2_3INCHNo1 = "weapons.nurs.British_HE_60LBSAPNo2_3INCHNo1"
ENUMS.Storage.weapons.missiles.DWS39_MJ2 = "weapons.missiles.DWS39_MJ2"
ENUMS.Storage.weapons.bombs.HEBOMBD = "weapons.bombs.HEBOMBD"
ENUMS.Storage.weapons.missiles.CATM_9M = "weapons.missiles.CATM_9M"
ENUMS.Storage.weapons.bombs.Mk_81 = "weapons.bombs.Mk_81"
ENUMS.Storage.weapons.droptanks.Drop_Tank_300_Liter = "weapons.droptanks.Drop_Tank_300_Liter"
ENUMS.Storage.weapons.containers.HMMWV_M1025 = "weapons.containers.HMMWV_M1025"
ENUMS.Storage.weapons.bombs.SAM_CHAPARRAL_Air_21624lb = "weapons.bombs.SAM CHAPARRAL Air [21624lb]"
ENUMS.Storage.weapons.missiles.AGM_154A = "weapons.missiles.AGM_154A"
ENUMS.Storage.weapons.bombs.Mk_84AIR_TP = "weapons.bombs.Mk_84AIR_TP"
ENUMS.Storage.weapons.bombs.GBU_31_V_3B = "weapons.bombs.GBU_31_V_3B"
ENUMS.Storage.weapons.nurs.C_8CM_WH = "weapons.nurs.C_8CM_WH"
ENUMS.Storage.weapons.missiles.Matra_Super_530D = "weapons.missiles.Matra Super 530D"
ENUMS.Storage.weapons.nurs.ARF8M3TPSM = "weapons.nurs.ARF8M3TPSM"
ENUMS.Storage.weapons.missiles.TGM_65H = "weapons.missiles.TGM_65H"
ENUMS.Storage.weapons.nurs.M8rocket = "weapons.nurs.M8rocket"
ENUMS.Storage.weapons.bombs.GBU_27 = "weapons.bombs.GBU_27"
ENUMS.Storage.weapons.missiles.AGR_20A = "weapons.missiles.AGR_20A"
ENUMS.Storage.weapons.missiles.LS_6_250 = "weapons.missiles.LS-6-250"
ENUMS.Storage.weapons.droptanks.M2KC_RPL_522_EMPTY = "weapons.droptanks.M2KC_RPL_522_EMPTY"
ENUMS.Storage.weapons.droptanks.M2KC_02_RPL541 = "weapons.droptanks.M2KC_02_RPL541"
ENUMS.Storage.weapons.missiles.AGM_45 = "weapons.missiles.AGM_45"
ENUMS.Storage.weapons.missiles.AGM_84A = "weapons.missiles.AGM_84A"
ENUMS.Storage.weapons.bombs.APC_BTR_80_Air_23936lb = "weapons.bombs.APC BTR-80 Air [23936lb]"
ENUMS.Storage.weapons.missiles.P_33E = "weapons.missiles.P_33E"
ENUMS.Storage.weapons.missiles.Ataka_9M120 = "weapons.missiles.Ataka_9M120"
ENUMS.Storage.weapons.bombs.MK76 = "weapons.bombs.MK76"
ENUMS.Storage.weapons.bombs.AB_250_2_SD_2 = "weapons.bombs.AB_250_2_SD_2"
ENUMS.Storage.weapons.missiles.Rb_05A = "weapons.missiles.Rb 05A"
ENUMS.Storage.weapons.bombs.ART_GVOZDIKA_34720lb = "weapons.bombs.ART GVOZDIKA [34720lb]"
ENUMS.Storage.weapons.bombs.Generic_Crate_20000lb = "weapons.bombs.Generic Crate [20000lb]"
ENUMS.Storage.weapons.bombs.FAB_100SV = "weapons.bombs.FAB_100SV"
ENUMS.Storage.weapons.bombs.BetAB_500 = "weapons.bombs.BetAB_500"
ENUMS.Storage.weapons.droptanks.M2KC_02_RPL541_EMPTY = "weapons.droptanks.M2KC_02_RPL541_EMPTY"
ENUMS.Storage.weapons.droptanks.PTB600_MIG15 = "weapons.droptanks.PTB600_MIG15"
ENUMS.Storage.weapons.missiles.Rb_24J = "weapons.missiles.Rb 24J"
ENUMS.Storage.weapons.nurs.C_8CM_BU = "weapons.nurs.C_8CM_BU"
ENUMS.Storage.weapons.nurs.SNEB_TYPE259E_F1B = "weapons.nurs.SNEB_TYPE259E_F1B"
ENUMS.Storage.weapons.nurs.WGr21 = "weapons.nurs.WGr21"
ENUMS.Storage.weapons.bombs.SAMP250HD = "weapons.bombs.SAMP250HD"
ENUMS.Storage.weapons.containers.alq_184long = "weapons.containers.alq-184long"
ENUMS.Storage.weapons.nurs.SNEB_TYPE259E_H1 = "weapons.nurs.SNEB_TYPE259E_H1"
ENUMS.Storage.weapons.bombs.British_SAP_250LB_Bomb_Mk5 = "weapons.bombs.British_SAP_250LB_Bomb_Mk5"
ENUMS.Storage.weapons.bombs.Transport_UAZ_469_Air_3747lb = "weapons.bombs.Transport UAZ-469 Air [3747lb]"
ENUMS.Storage.weapons.bombs.Mk_83CT = "weapons.bombs.Mk_83CT"
ENUMS.Storage.weapons.missiles.AIM_7P = "weapons.missiles.AIM-7P"
ENUMS.Storage.weapons.missiles.AT_6 = "weapons.missiles.AT_6"
ENUMS.Storage.weapons.nurs.SNEB_TYPE254_H1_GREEN = "weapons.nurs.SNEB_TYPE254_H1_GREEN"
ENUMS.Storage.weapons.nurs.SNEB_TYPE250_F1B = "weapons.nurs.SNEB_TYPE250_F1B"
ENUMS.Storage.weapons.containers.U22A = "weapons.containers.U22A"
ENUMS.Storage.weapons.bombs.British_GP_250LB_Bomb_Mk1 = "weapons.bombs.British_GP_250LB_Bomb_Mk1"
ENUMS.Storage.weapons.bombs.CBU_105 = "weapons.bombs.CBU_105"
ENUMS.Storage.weapons.droptanks.FW_190_Fuel_Tank = "weapons.droptanks.FW-190_Fuel-Tank"
ENUMS.Storage.weapons.missiles.X_58 = "weapons.missiles.X_58"
ENUMS.Storage.weapons.missiles.BK90_MJ1_MJ2 = "weapons.missiles.BK90_MJ1_MJ2"
ENUMS.Storage.weapons.missiles.TGM_65D = "weapons.missiles.TGM_65D"
ENUMS.Storage.weapons.containers.BRD_4_250 = "weapons.containers.BRD-4-250"
ENUMS.Storage.weapons.missiles.P_73 = "weapons.missiles.P_73"
ENUMS.Storage.weapons.bombs.AN_M66 = "weapons.bombs.AN_M66"
ENUMS.Storage.weapons.bombs.APC_LAV_25_Air_22520lb = "weapons.bombs.APC LAV-25 Air [22520lb]"
ENUMS.Storage.weapons.missiles.AIM_7MH = "weapons.missiles.AIM-7MH"
ENUMS.Storage.weapons.containers.MB339_TravelPod = "weapons.containers.MB339_TravelPod"
ENUMS.Storage.weapons.bombs.GBU_12 = "weapons.bombs.GBU_12"
ENUMS.Storage.weapons.bombs.SC_250_T3_J = "weapons.bombs.SC_250_T3_J"
ENUMS.Storage.weapons.missiles.KD_20 = "weapons.missiles.KD-20"
ENUMS.Storage.weapons.missiles.AGM_86C = "weapons.missiles.AGM_86C"
ENUMS.Storage.weapons.missiles.X_35 = "weapons.missiles.X_35"
ENUMS.Storage.weapons.bombs.MK106 = "weapons.bombs.MK106"
ENUMS.Storage.weapons.bombs.BETAB_500S = "weapons.bombs.BETAB-500S"
ENUMS.Storage.weapons.nurs.C_5 = "weapons.nurs.C_5"
ENUMS.Storage.weapons.nurs.S_24B = "weapons.nurs.S-24B"
ENUMS.Storage.weapons.bombs.British_MC_500LB_Bomb_Mk2 = "weapons.bombs.British_MC_500LB_Bomb_Mk2"
ENUMS.Storage.weapons.containers.ANAWW_13 = "weapons.containers.ANAWW_13"
ENUMS.Storage.weapons.droptanks.droptank_108_gal = "weapons.droptanks.droptank_108_gal"
ENUMS.Storage.weapons.droptanks.DFT_300_GAL_A4E_LR = "weapons.droptanks.DFT_300_GAL_A4E_LR"
ENUMS.Storage.weapons.bombs.CBU_87 = "weapons.bombs.CBU_87"
ENUMS.Storage.weapons.missiles.GAR_8 = "weapons.missiles.GAR-8"
ENUMS.Storage.weapons.bombs.BELOUGA = "weapons.bombs.BELOUGA"
ENUMS.Storage.weapons.containers.EclairM_33 = "weapons.containers.{EclairM_33}"
ENUMS.Storage.weapons.bombs.ART_2S9_NONA_Air_19140lb = "weapons.bombs.ART 2S9 NONA Air [19140lb]"
ENUMS.Storage.weapons.bombs.BR_250 = "weapons.bombs.BR_250"
ENUMS.Storage.weapons.bombs.IAB_500 = "weapons.bombs.IAB-500"
ENUMS.Storage.weapons.containers.AN_ASQ_228 = "weapons.containers.AN_ASQ_228"
ENUMS.Storage.weapons.missiles.P_27P = "weapons.missiles.P_27P"
ENUMS.Storage.weapons.bombs.SD_250_Stg = "weapons.bombs.SD_250_Stg"
ENUMS.Storage.weapons.missiles.R_530F_IR = "weapons.missiles.R_530F_IR"
ENUMS.Storage.weapons.bombs.British_SAP_500LB_Bomb_Mk5 = "weapons.bombs.British_SAP_500LB_Bomb_Mk5"
ENUMS.Storage.weapons.bombs.FAB_250M54 = "weapons.bombs.FAB-250M54"
ENUMS.Storage.weapons.containers.M2KC_AAF = "weapons.containers.{M2KC_AAF}"
ENUMS.Storage.weapons.missiles.CM_802AKG_AI = "weapons.missiles.CM-802AKG_AI"
ENUMS.Storage.weapons.bombs.CBU_103 = "weapons.bombs.CBU_103"
ENUMS.Storage.weapons.containers.US_M10_SMOKE_TANK_RED = "weapons.containers.{US_M10_SMOKE_TANK_RED}"
ENUMS.Storage.weapons.missiles.X_29T = "weapons.missiles.X_29T"
ENUMS.Storage.weapons.bombs.HEMTT_TFFT_34400lb = "weapons.bombs.HEMTT TFFT [34400lb]"
ENUMS.Storage.weapons.missiles.C_701IR = "weapons.missiles.C-701IR"
ENUMS.Storage.weapons.containers.fullCargoSeats = "weapons.containers.fullCargoSeats"
ENUMS.Storage.weapons.bombs.GBU_15_V_31_B = "weapons.bombs.GBU_15_V_31_B"
ENUMS.Storage.weapons.bombs.APC_M1043_HMMWV_Armament_Air_7023lb = "weapons.bombs.APC M1043 HMMWV Armament Air [7023lb]"
ENUMS.Storage.weapons.missiles.PL_5EII = "weapons.missiles.PL-5EII"
ENUMS.Storage.weapons.bombs.SC_250_T1_L2 = "weapons.bombs.SC_250_T1_L2"
ENUMS.Storage.weapons.torpedoes.mk46torp_name = "weapons.torpedoes.mk46torp_name"
ENUMS.Storage.weapons.containers.F_15E_AAQ_33_XR_ATP_SE = "weapons.containers.F-15E_AAQ-33_XR_ATP-SE"
ENUMS.Storage.weapons.missiles.AIM_7 = "weapons.missiles.AIM_7"
ENUMS.Storage.weapons.missiles.AGM_122 = "weapons.missiles.AGM_122"
ENUMS.Storage.weapons.bombs.HEBOMB = "weapons.bombs.HEBOMB"
ENUMS.Storage.weapons.bombs.CBU_97 = "weapons.bombs.CBU_97"
ENUMS.Storage.weapons.bombs.MK_81SE = "weapons.bombs.MK-81SE"
ENUMS.Storage.weapons.nurs.Zuni_127 = "weapons.nurs.Zuni_127"
ENUMS.Storage.weapons.containers.M2KC_AGF = "weapons.containers.{M2KC_AGF}"
ENUMS.Storage.weapons.droptanks.Hercules_ExtFuelTank = "weapons.droptanks.Hercules_ExtFuelTank"
ENUMS.Storage.weapons.containers.SMOKE_WHITE = "weapons.containers.{SMOKE_WHITE}"
ENUMS.Storage.weapons.droptanks.droptank_150_gal = "weapons.droptanks.droptank_150_gal"
ENUMS.Storage.weapons.nurs.HYDRA_70_WTU1B = "weapons.nurs.HYDRA_70_WTU1B"
ENUMS.Storage.weapons.missiles.GB_6_SFW = "weapons.missiles.GB-6-SFW"
ENUMS.Storage.weapons.missiles.KD_63 = "weapons.missiles.KD-63"
ENUMS.Storage.weapons.bombs.GBU_28 = "weapons.bombs.GBU_28"
ENUMS.Storage.weapons.nurs.C_8CM_YE = "weapons.nurs.C_8CM_YE"
ENUMS.Storage.weapons.droptanks.HB_F14_EXT_DROPTANK = "weapons.droptanks.HB_F14_EXT_DROPTANK"
ENUMS.Storage.weapons.missiles.Super_530F = "weapons.missiles.Super_530F"
ENUMS.Storage.weapons.missiles.Ataka_9M220 = "weapons.missiles.Ataka_9M220"
ENUMS.Storage.weapons.bombs.BDU_33 = "weapons.bombs.BDU_33"
ENUMS.Storage.weapons.bombs.British_GP_250LB_Bomb_Mk4 = "weapons.bombs.British_GP_250LB_Bomb_Mk4"
ENUMS.Storage.weapons.missiles.TOW = "weapons.missiles.TOW"
ENUMS.Storage.weapons.bombs.ATGM_M1045_HMMWV_TOW_Air_7183lb = "weapons.bombs.ATGM M1045 HMMWV TOW Air [7183lb]"
ENUMS.Storage.weapons.missiles.X_25MR = "weapons.missiles.X_25MR"
ENUMS.Storage.weapons.droptanks.fueltank230 = "weapons.droptanks.fueltank230"
ENUMS.Storage.weapons.droptanks.PTB_490C_MIG21 = "weapons.droptanks.PTB-490C-MIG21"
ENUMS.Storage.weapons.bombs.M1025_HMMWV_Air_6160lb = "weapons.bombs.M1025 HMMWV Air [6160lb]"
ENUMS.Storage.weapons.nurs.SNEB_TYPE254_F1B_GREEN = "weapons.nurs.SNEB_TYPE254_F1B_GREEN"
ENUMS.Storage.weapons.missiles.R_550 = "weapons.missiles.R_550"
ENUMS.Storage.weapons.bombs.KAB_1500LG = "weapons.bombs.KAB_1500LG"
ENUMS.Storage.weapons.missiles.AGM_84D = "weapons.missiles.AGM_84D"
ENUMS.Storage.weapons.missiles.YJ_83K = "weapons.missiles.YJ-83K"
ENUMS.Storage.weapons.missiles.AIM_54C_Mk47 = "weapons.missiles.AIM_54C_Mk47"
ENUMS.Storage.weapons.missiles.BRM_1_90MM = "weapons.missiles.BRM-1_90MM"
ENUMS.Storage.weapons.missiles.Ataka_9M120F = "weapons.missiles.Ataka_9M120F"
ENUMS.Storage.weapons.droptanks.Eleven00L_Tank = "weapons.droptanks.1100L Tank"
ENUMS.Storage.weapons.bombs.BAP_100 = "weapons.bombs.BAP_100"
ENUMS.Storage.weapons.adapters.lau_88 = "weapons.adapters.lau-88"
ENUMS.Storage.weapons.missiles.P_40T = "weapons.missiles.P_40T"
ENUMS.Storage.weapons.missiles.GB_6 = "weapons.missiles.GB-6"
ENUMS.Storage.weapons.bombs.FAB_250M54TU = "weapons.bombs.FAB-250M54TU"
ENUMS.Storage.weapons.missiles.DWS39_MJ1 = "weapons.missiles.DWS39_MJ1"
ENUMS.Storage.weapons.missiles.CM_802AKG = "weapons.missiles.CM-802AKG"
ENUMS.Storage.weapons.bombs.FAB_250 = "weapons.bombs.FAB_250"
ENUMS.Storage.weapons.missiles.C_802AK = "weapons.missiles.C_802AK"
ENUMS.Storage.weapons.bombs.SD_500_A = "weapons.bombs.SD_500_A"
ENUMS.Storage.weapons.bombs.GBU_32_V_2B = "weapons.bombs.GBU_32_V_2B"
ENUMS.Storage.weapons.containers.marder = "weapons.containers.marder"
ENUMS.Storage.weapons.missiles.ADM_141B = "weapons.missiles.ADM_141B"
ENUMS.Storage.weapons.bombs.ROCKEYE = "weapons.bombs.ROCKEYE"
ENUMS.Storage.weapons.missiles.BK90_MJ1 = "weapons.missiles.BK90_MJ1"
ENUMS.Storage.weapons.containers.BTR_80 = "weapons.containers.BTR-80"
ENUMS.Storage.weapons.bombs.SAM_ROLAND_ADS_34720lb = "weapons.bombs.SAM ROLAND ADS [34720lb]"
ENUMS.Storage.weapons.containers.wmd7 = "weapons.containers.wmd7"
ENUMS.Storage.weapons.missiles.C_701T = "weapons.missiles.C-701T"
ENUMS.Storage.weapons.missiles.AIM_7E_2 = "weapons.missiles.AIM-7E-2"
ENUMS.Storage.weapons.nurs.HVAR = "weapons.nurs.HVAR"
ENUMS.Storage.weapons.containers.HMMWV_M1043 = "weapons.containers.HMMWV_M1043"
ENUMS.Storage.weapons.droptanks.PTB_800_MIG21 = "weapons.droptanks.PTB-800-MIG21"
ENUMS.Storage.weapons.missiles.AGM_114 = "weapons.missiles.AGM_114"
ENUMS.Storage.weapons.bombs.APC_M1126_Stryker_ICV_29542lb = "weapons.bombs.APC M1126 Stryker ICV [29542lb]"
ENUMS.Storage.weapons.bombs.APC_M113_Air_21624lb = "weapons.bombs.APC M113 Air [21624lb]"
ENUMS.Storage.weapons.bombs.M_117 = "weapons.bombs.M_117"
ENUMS.Storage.weapons.missiles.AGM_65D = "weapons.missiles.AGM_65D"
ENUMS.Storage.weapons.droptanks.MB339_TT320_L = "weapons.droptanks.MB339_TT320_L"
ENUMS.Storage.weapons.missiles.AGM_86 = "weapons.missiles.AGM_86"
ENUMS.Storage.weapons.bombs.BDU_45LGB = "weapons.bombs.BDU_45LGB"
ENUMS.Storage.weapons.missiles.AGM_65H = "weapons.missiles.AGM_65H"
ENUMS.Storage.weapons.nurs.RS_82 = "weapons.nurs.RS-82"
ENUMS.Storage.weapons.nurs.SNEB_TYPE252_F1B = "weapons.nurs.SNEB_TYPE252_F1B"
ENUMS.Storage.weapons.bombs.BL_755 = "weapons.bombs.BL_755"
ENUMS.Storage.weapons.containers.F_15E_AAQ_28_LITENING = "weapons.containers.F-15E_AAQ-28_LITENING"
ENUMS.Storage.weapons.nurs.SNEB_TYPE256_F1B = "weapons.nurs.SNEB_TYPE256_F1B"
ENUMS.Storage.weapons.missiles.AGM_84H = "weapons.missiles.AGM_84H"
ENUMS.Storage.weapons.missiles.AIM_54 = "weapons.missiles.AIM_54"
ENUMS.Storage.weapons.missiles.X_31A = "weapons.missiles.X_31A"
ENUMS.Storage.weapons.bombs.KAB_500Kr = "weapons.bombs.KAB_500Kr"
ENUMS.Storage.weapons.containers.SPS_141_100 = "weapons.containers.SPS-141-100"
ENUMS.Storage.weapons.missiles.BK90_MJ2 = "weapons.missiles.BK90_MJ2"
ENUMS.Storage.weapons.missiles.Super_530D = "weapons.missiles.Super_530D"
ENUMS.Storage.weapons.bombs.CBU_52B = "weapons.bombs.CBU_52B"
ENUMS.Storage.weapons.droptanks.PTB_450 = "weapons.droptanks.PTB-450"
ENUMS.Storage.weapons.bombs.IFV_MCV_80_34720lb = "weapons.bombs.IFV MCV-80 [34720lb]"
ENUMS.Storage.weapons.containers.Two_c9 = "weapons.containers.2-c9"
ENUMS.Storage.weapons.missiles.AIM_9JULI = "weapons.missiles.AIM-9JULI"
ENUMS.Storage.weapons.droptanks.MB339_TT500_R = "weapons.droptanks.MB339_TT500_R"
ENUMS.Storage.weapons.nurs.C_8CM = "weapons.nurs.C_8CM"
ENUMS.Storage.weapons.containers.BARAX = "weapons.containers.BARAX"
ENUMS.Storage.weapons.missiles.P_40R = "weapons.missiles.P_40R"
ENUMS.Storage.weapons.missiles.YJ_12 = "weapons.missiles.YJ-12"
ENUMS.Storage.weapons.missiles.CM_802AKG = "weapons.missiles.CM_802AKG"
ENUMS.Storage.weapons.nurs.SNEB_TYPE254_H1_YELLOW = "weapons.nurs.SNEB_TYPE254_H1_YELLOW"
ENUMS.Storage.weapons.bombs.Durandal = "weapons.bombs.Durandal"
ENUMS.Storage.weapons.droptanks.i16_eft = "weapons.droptanks.i16_eft"
ENUMS.Storage.weapons.droptanks.AV8BNA_AERO1D_EMPTY = "weapons.droptanks.AV8BNA_AERO1D_EMPTY"
ENUMS.Storage.weapons.containers.Hercules_Battle_Station_TGP = "weapons.containers.Hercules_Battle_Station_TGP"
ENUMS.Storage.weapons.nurs.C_8CM_VT = "weapons.nurs.C_8CM_VT"
ENUMS.Storage.weapons.missiles.PL_12 = "weapons.missiles.PL-12"
ENUMS.Storage.weapons.missiles.R_3R = "weapons.missiles.R-3R"
ENUMS.Storage.weapons.bombs.GBU_54_V_1B = "weapons.bombs.GBU_54_V_1B"
ENUMS.Storage.weapons.droptanks.MB339_TT320_R = "weapons.droptanks.MB339_TT320_R"
ENUMS.Storage.weapons.bombs.RN_24 = "weapons.bombs.RN-24"
ENUMS.Storage.weapons.containers.Twoc6m = "weapons.containers.2c6m"
ENUMS.Storage.weapons.bombs.ARV_BRDM_2_Air_12320lb = "weapons.bombs.ARV BRDM-2 Air [12320lb]"
ENUMS.Storage.weapons.bombs.ARV_BRDM_2_Skid_12210lb = "weapons.bombs.ARV BRDM-2 Skid [12210lb]"
ENUMS.Storage.weapons.nurs.SNEB_TYPE251_F1B = "weapons.nurs.SNEB_TYPE251_F1B"
ENUMS.Storage.weapons.missiles.X_41 = "weapons.missiles.X_41"
ENUMS.Storage.weapons.containers.MIG21_SMOKE_WHITE = "weapons.containers.{MIG21_SMOKE_WHITE}"
ENUMS.Storage.weapons.bombs.MK_82AIR = "weapons.bombs.MK_82AIR"
ENUMS.Storage.weapons.missiles.R_530F_EM = "weapons.missiles.R_530F_EM"
ENUMS.Storage.weapons.bombs.SAMP400LD = "weapons.bombs.SAMP400LD"
ENUMS.Storage.weapons.bombs.FAB_50 = "weapons.bombs.FAB_50"
ENUMS.Storage.weapons.bombs.AB_250_2_SD_10A = "weapons.bombs.AB_250_2_SD_10A"
ENUMS.Storage.weapons.missiles.ADM_141A = "weapons.missiles.ADM_141A"
ENUMS.Storage.weapons.containers.KBpod = "weapons.containers.KBpod"
ENUMS.Storage.weapons.bombs.British_GP_500LB_Bomb_Mk4 = "weapons.bombs.British_GP_500LB_Bomb_Mk4"
ENUMS.Storage.weapons.missiles.AGM_65E = "weapons.missiles.AGM_65E"
ENUMS.Storage.weapons.containers.sa342_dipole_antenna = "weapons.containers.sa342_dipole_antenna"
ENUMS.Storage.weapons.bombs.OFAB_100_Jupiter = "weapons.bombs.OFAB-100 Jupiter"
ENUMS.Storage.weapons.nurs.SNEB_TYPE257_F1B = "weapons.nurs.SNEB_TYPE257_F1B"
ENUMS.Storage.weapons.missiles.Rb_04E_for_A_I = "weapons.missiles.Rb 04E (for A.I.)"
ENUMS.Storage.weapons.bombs.AN_M66A2 = "weapons.bombs.AN-M66A2"
ENUMS.Storage.weapons.missiles.P_27T = "weapons.missiles.P_27T"
ENUMS.Storage.weapons.droptanks.LNS_VIG_XTANK = "weapons.droptanks.LNS_VIG_XTANK"
ENUMS.Storage.weapons.missiles.R_55 = "weapons.missiles.R-55"
ENUMS.Storage.weapons.torpedoes.YU_6 = "weapons.torpedoes.YU-6"
ENUMS.Storage.weapons.bombs.British_MC_250LB_Bomb_Mk2 = "weapons.bombs.British_MC_250LB_Bomb_Mk2"
ENUMS.Storage.weapons.droptanks.PTB_120_F86F35 = "weapons.droptanks.PTB_120_F86F35"
ENUMS.Storage.weapons.missiles.PL_8B = "weapons.missiles.PL-8B"
ENUMS.Storage.weapons.droptanks.F_15E_Drop_Tank_Empty = "weapons.droptanks.F-15E_Drop_Tank_Empty"
ENUMS.Storage.weapons.nurs.British_HE_60LBFNo1_3INCHNo1 = "weapons.nurs.British_HE_60LBFNo1_3INCHNo1"
ENUMS.Storage.weapons.missiles.P_77 = "weapons.missiles.P_77"
ENUMS.Storage.weapons.torpedoes.LTF_5B = "weapons.torpedoes.LTF_5B"
ENUMS.Storage.weapons.missiles.R_3S = "weapons.missiles.R-3S"
ENUMS.Storage.weapons.nurs.SNEB_TYPE253_H1 = "weapons.nurs.SNEB_TYPE253_H1"
ENUMS.Storage.weapons.missiles.PL_8A = "weapons.missiles.PL-8A"
ENUMS.Storage.weapons.bombs.APC_BTR_82A_Skid_24888lb = "weapons.bombs.APC BTR-82A Skid [24888lb]"
ENUMS.Storage.weapons.containers.Sborka = "weapons.containers.Sborka"
ENUMS.Storage.weapons.missiles.AGM_65L = "weapons.missiles.AGM_65L"
ENUMS.Storage.weapons.missiles.X_28 = "weapons.missiles.X_28"
ENUMS.Storage.weapons.missiles.TGM_65G = "weapons.missiles.TGM_65G"
ENUMS.Storage.weapons.nurs.SNEB_TYPE257_H1 = "weapons.nurs.SNEB_TYPE257_H1"
ENUMS.Storage.weapons.missiles.RB75B = "weapons.missiles.RB75B"
ENUMS.Storage.weapons.missiles.X_25ML = "weapons.missiles.X_25ML"
ENUMS.Storage.weapons.droptanks.FPU_8A = "weapons.droptanks.FPU_8A"
ENUMS.Storage.weapons.bombs.BLG66 = "weapons.bombs.BLG66"
ENUMS.Storage.weapons.nurs.C_8CM_RD = "weapons.nurs.C_8CM_RD"
ENUMS.Storage.weapons.containers.EclairM_06 = "weapons.containers.{EclairM_06}"
ENUMS.Storage.weapons.bombs.RBK_500AO = "weapons.bombs.RBK_500AO"
ENUMS.Storage.weapons.missiles.AIM_9P = "weapons.missiles.AIM-9P"
ENUMS.Storage.weapons.bombs.British_GP_500LB_Bomb_Mk4_Short = "weapons.bombs.British_GP_500LB_Bomb_Mk4_Short"
ENUMS.Storage.weapons.containers.MB339_Vinten = "weapons.containers.MB339_Vinten"
ENUMS.Storage.weapons.missiles.Rb_15F = "weapons.missiles.Rb 15F"
ENUMS.Storage.weapons.nurs.ARAKM70BHE = "weapons.nurs.ARAKM70BHE"
ENUMS.Storage.weapons.bombs.AAA_Vulcan_M163_Air_21666lb = "weapons.bombs.AAA Vulcan M163 Air [21666lb]"
ENUMS.Storage.weapons.missiles.X_29L = "weapons.missiles.X_29L"
ENUMS.Storage.weapons.containers.F14_LANTIRN_TP = "weapons.containers.{F14-LANTIRN-TP}"
ENUMS.Storage.weapons.bombs.FAB_250_M62 = "weapons.bombs.FAB-250-M62"
ENUMS.Storage.weapons.missiles.AIM_120C = "weapons.missiles.AIM_120C"
ENUMS.Storage.weapons.bombs.EWR_SBORKA_Air_21624lb = "weapons.bombs.EWR SBORKA Air [21624lb]"
ENUMS.Storage.weapons.bombs.SAMP250LD = "weapons.bombs.SAMP250LD"
ENUMS.Storage.weapons.droptanks.Spitfire_slipper_tank = "weapons.droptanks.Spitfire_slipper_tank"
ENUMS.Storage.weapons.missiles.LS_6_500 = "weapons.missiles.LS-6-500"
ENUMS.Storage.weapons.bombs.GBU_31_V_4B = "weapons.bombs.GBU_31_V_4B"
ENUMS.Storage.weapons.droptanks.PTB400_MIG15 = "weapons.droptanks.PTB400_MIG15"
ENUMS.Storage.weapons.containers.m_113 = "weapons.containers.m-113"
ENUMS.Storage.weapons.bombs.SPG_M1128_Stryker_MGS_33036lb = "weapons.bombs.SPG M1128 Stryker MGS [33036lb]"
ENUMS.Storage.weapons.missiles.AIM_9L = "weapons.missiles.AIM-9L"
ENUMS.Storage.weapons.missiles.AIM_9X = "weapons.missiles.AIM_9X"
ENUMS.Storage.weapons.nurs.C_8 = "weapons.nurs.C_8"
ENUMS.Storage.weapons.bombs.SAM_CHAPARRAL_Skid_21516lb = "weapons.bombs.SAM CHAPARRAL Skid [21516lb]"
ENUMS.Storage.weapons.missiles.P_27TE = "weapons.missiles.P_27TE"
ENUMS.Storage.weapons.bombs.ODAB_500PM = "weapons.bombs.ODAB-500PM"
ENUMS.Storage.weapons.bombs.MK77mod1_WPN = "weapons.bombs.MK77mod1-WPN"
ENUMS.Storage.weapons.droptanks.PTB400_MIG19 = "weapons.droptanks.PTB400_MIG19"
ENUMS.Storage.weapons.torpedoes.Mark_46 = "weapons.torpedoes.Mark_46"
ENUMS.Storage.weapons.containers.rightSeat = "weapons.containers.rightSeat"
ENUMS.Storage.weapons.containers.US_M10_SMOKE_TANK_ORANGE = "weapons.containers.{US_M10_SMOKE_TANK_ORANGE}"
ENUMS.Storage.weapons.bombs.SAB_100MN = "weapons.bombs.SAB_100MN"
ENUMS.Storage.weapons.nurs.FFAR_Mk5_HEAT = "weapons.nurs.FFAR Mk5 HEAT"
ENUMS.Storage.weapons.bombs.IFV_TPZ_FUCH_33440lb = "weapons.bombs.IFV TPZ FUCH [33440lb]"
ENUMS.Storage.weapons.bombs.IFV_M2A2_Bradley_34720lb = "weapons.bombs.IFV M2A2 Bradley [34720lb]"
ENUMS.Storage.weapons.bombs.MK77mod0_WPN = "weapons.bombs.MK77mod0-WPN"
ENUMS.Storage.weapons.containers.ASO_2 = "weapons.containers.ASO-2"
ENUMS.Storage.weapons.bombs.Mk_84AIR_GP = "weapons.bombs.Mk_84AIR_GP"
ENUMS.Storage.weapons.nurs.S_24A = "weapons.nurs.S-24A"
ENUMS.Storage.weapons.bombs.RBK_250_275_AO_1SCH = "weapons.bombs.RBK_250_275_AO_1SCH"
ENUMS.Storage.weapons.bombs.Transport_Tigr_Skid_15730lb = "weapons.bombs.Transport Tigr Skid [15730lb]"
ENUMS.Storage.weapons.missiles.AIM_7F = "weapons.missiles.AIM-7F"
ENUMS.Storage.weapons.bombs.CBU_99 = "weapons.bombs.CBU_99"
ENUMS.Storage.weapons.bombs.LUU_2B = "weapons.bombs.LUU_2B"
ENUMS.Storage.weapons.bombs.FAB_500TA = "weapons.bombs.FAB-500TA"
ENUMS.Storage.weapons.missiles.AGR_20_M282 = "weapons.missiles.AGR_20_M282"
ENUMS.Storage.weapons.droptanks.MB339_FT330 = "weapons.droptanks.MB339_FT330"
ENUMS.Storage.weapons.bombs.SAMP125LD = "weapons.bombs.SAMP125LD"
ENUMS.Storage.weapons.missiles.X_25MP = "weapons.missiles.X_25MP"
ENUMS.Storage.weapons.nurs.SNEB_TYPE252_H1 = "weapons.nurs.SNEB_TYPE252_H1"
ENUMS.Storage.weapons.missiles.AGM_65F = "weapons.missiles.AGM_65F"
ENUMS.Storage.weapons.missiles.AIM_9P5 = "weapons.missiles.AIM-9P5"
ENUMS.Storage.weapons.bombs.Transport_Tigr_Air_15900lb = "weapons.bombs.Transport Tigr Air [15900lb]"
ENUMS.Storage.weapons.nurs.SNEB_TYPE254_H1_RED = "weapons.nurs.SNEB_TYPE254_H1_RED"
ENUMS.Storage.weapons.nurs.FFAR_Mk1_HE = "weapons.nurs.FFAR Mk1 HE"
ENUMS.Storage.weapons.nurs.SPRD_99 = "weapons.nurs.SPRD-99"
ENUMS.Storage.weapons.bombs.BIN_200 = "weapons.bombs.BIN_200"
ENUMS.Storage.weapons.bombs.BLU_4B_GROUP = "weapons.bombs.BLU_4B_GROUP"
ENUMS.Storage.weapons.bombs.GBU_24 = "weapons.bombs.GBU_24"
ENUMS.Storage.weapons.missiles.Rb_04E = "weapons.missiles.Rb 04E"
ENUMS.Storage.weapons.missiles.Rb_74 = "weapons.missiles.Rb 74"
ENUMS.Storage.weapons.containers.leftSeat = "weapons.containers.leftSeat"
ENUMS.Storage.weapons.bombs.LS_6_100 = "weapons.bombs.LS-6-100"
ENUMS.Storage.weapons.bombs.Transport_URAL_375_14815lb = "weapons.bombs.Transport URAL-375 [14815lb]"
ENUMS.Storage.weapons.containers.US_M10_SMOKE_TANK_GREEN = "weapons.containers.{US_M10_SMOKE_TANK_GREEN}"
ENUMS.Storage.weapons.missiles.X_22 = "weapons.missiles.X_22"
ENUMS.Storage.weapons.containers.FAS = "weapons.containers.FAS"
ENUMS.Storage.weapons.nurs.S_25_O = "weapons.nurs.S-25-O"
ENUMS.Storage.weapons.droptanks.para = "weapons.droptanks.para"
ENUMS.Storage.weapons.droptanks.F_15E_Drop_Tank = "weapons.droptanks.F-15E_Drop_Tank"
ENUMS.Storage.weapons.droptanks.M2KC_08_RPL541_EMPTY = "weapons.droptanks.M2KC_08_RPL541_EMPTY"
ENUMS.Storage.weapons.missiles.X_31P = "weapons.missiles.X_31P"
ENUMS.Storage.weapons.bombs.RBK_500U = "weapons.bombs.RBK_500U"
ENUMS.Storage.weapons.missiles.AIM_54A_Mk47 = "weapons.missiles.AIM_54A_Mk47"
ENUMS.Storage.weapons.droptanks.oiltank = "weapons.droptanks.oiltank"
ENUMS.Storage.weapons.missiles.AGM_154B = "weapons.missiles.AGM_154B"
ENUMS.Storage.weapons.containers.MB339_SMOKE_POD = "weapons.containers.MB339_SMOKE-POD"
ENUMS.Storage.weapons.containers.ECM_POD_L_175V = "weapons.containers.{ECM_POD_L_175V}"
ENUMS.Storage.weapons.droptanks.PTB_580G_F1 = "weapons.droptanks.PTB_580G_F1"
ENUMS.Storage.weapons.containers.EclairM_15 = "weapons.containers.{EclairM_15}"
ENUMS.Storage.weapons.containers.F_15E_AAQ_13_LANTIRN = "weapons.containers.F-15E_AAQ-13_LANTIRN"
ENUMS.Storage.weapons.droptanks.Eight00L_Tank_Empty = "weapons.droptanks.800L Tank Empty"
ENUMS.Storage.weapons.containers.One6c_hts_pod = "weapons.containers.16c_hts_pod"
ENUMS.Storage.weapons.bombs.AN_M81 = "weapons.bombs.AN-M81"
ENUMS.Storage.weapons.droptanks.Mosquito_Drop_Tank_100gal = "weapons.droptanks.Mosquito_Drop_Tank_100gal"
ENUMS.Storage.weapons.droptanks.Mosquito_Drop_Tank_50gal = "weapons.droptanks.Mosquito_Drop_Tank_50gal"
ENUMS.Storage.weapons.droptanks.DFT_150_GAL_A4E = "weapons.droptanks.DFT_150_GAL_A4E"
ENUMS.Storage.weapons.missiles.AIM_9 = "weapons.missiles.AIM_9"
ENUMS.Storage.weapons.bombs.IFV_BTR_D_Air_18040lb = "weapons.bombs.IFV BTR-D Air [18040lb]"
ENUMS.Storage.weapons.containers.EclairM_42 = "weapons.containers.{EclairM_42}"
ENUMS.Storage.weapons.bombs.KAB_1500T = "weapons.bombs.KAB_1500T"
ENUMS.Storage.weapons.droptanks.PTB_490_MIG21 = "weapons.droptanks.PTB-490-MIG21"
ENUMS.Storage.weapons.droptanks.PTB_200_F86F35 = "weapons.droptanks.PTB_200_F86F35"
ENUMS.Storage.weapons.droptanks.PTB760_MIG19 = "weapons.droptanks.PTB760_MIG19"
ENUMS.Storage.weapons.bombs.GBU_43_B_MOAB = "weapons.bombs.GBU-43/B(MOAB)"
ENUMS.Storage.weapons.torpedoes.G7A_T1 = "weapons.torpedoes.G7A_T1"
ENUMS.Storage.weapons.bombs.IFV_BMD_1_Air_18040lb = "weapons.bombs.IFV BMD-1 Air [18040lb]"
ENUMS.Storage.weapons.bombs.SAM_LINEBACKER_34720lb = "weapons.bombs.SAM LINEBACKER [34720lb]"
ENUMS.Storage.weapons.containers.ais_pod_t50_r = "weapons.containers.ais-pod-t50_r"
ENUMS.Storage.weapons.containers.CE2_SMOKE_WHITE = "weapons.containers.{CE2_SMOKE_WHITE}"
ENUMS.Storage.weapons.droptanks.fuel_tank_230 = "weapons.droptanks.fuel_tank_230"
ENUMS.Storage.weapons.droptanks.M2KC_RPL_522 = "weapons.droptanks.M2KC_RPL_522"
ENUMS.Storage.weapons.missiles.AGM_130 = "weapons.missiles.AGM_130"
ENUMS.Storage.weapons.droptanks.Eight00L_Tank = "weapons.droptanks.800L Tank"
ENUMS.Storage.weapons.bombs.IFV_BTR_D_Skid_17930lb = "weapons.bombs.IFV BTR-D Skid [17930lb]"
ENUMS.Storage.weapons.containers.bmp_1 = "weapons.containers.bmp-1"
ENUMS.Storage.weapons.bombs.GBU_31 = "weapons.bombs.GBU_31"
ENUMS.Storage.weapons.containers.aaq_28LEFT_litening = "weapons.containers.aaq-28LEFT litening"
ENUMS.Storage.weapons.missiles.Kh_66_Grom = "weapons.missiles.Kh-66_Grom"
ENUMS.Storage.weapons.containers.MIG21_SMOKE_RED = "weapons.containers.{MIG21_SMOKE_RED}"
ENUMS.Storage.weapons.containers.U22 = "weapons.containers.U22"
ENUMS.Storage.weapons.bombs.IFV_BMD_1_Skid_17930lb = "weapons.bombs.IFV BMD-1 Skid [17930lb]"
ENUMS.Storage.weapons.droptanks.Bidon = "weapons.droptanks.Bidon"
ENUMS.Storage.weapons.bombs.GBU_31_V_2B = "weapons.bombs.GBU_31_V_2B"
ENUMS.Storage.weapons.bombs.Mk_82Y = "weapons.bombs.Mk_82Y"
ENUMS.Storage.weapons.containers.pl5eii = "weapons.containers.pl5eii"
ENUMS.Storage.weapons.bombs.RBK_500U_OAB_2_5RT = "weapons.bombs.RBK_500U_OAB_2_5RT"
ENUMS.Storage.weapons.bombs.British_GP_500LB_Bomb_Mk5 = "weapons.bombs.British_GP_500LB_Bomb_Mk5"
ENUMS.Storage.weapons.containers.Eclair = "weapons.containers.{Eclair}"
ENUMS.Storage.weapons.nurs.S5MO_HEFRAG_FFAR = "weapons.nurs.S5MO_HEFRAG_FFAR"
ENUMS.Storage.weapons.bombs.BETAB_500M = "weapons.bombs.BETAB-500M"
ENUMS.Storage.weapons.bombs.Transport_M818_16000lb = "weapons.bombs.Transport M818 [16000lb]"
ENUMS.Storage.weapons.bombs.British_MC_250LB_Bomb_Mk1 = "weapons.bombs.British_MC_250LB_Bomb_Mk1"
ENUMS.Storage.weapons.nurs.SNEB_TYPE251_H1 = "weapons.nurs.SNEB_TYPE251_H1"
ENUMS.Storage.weapons.bombs.TYPE_200A = "weapons.bombs.TYPE-200A"
ENUMS.Storage.weapons.nurs.HYDRA_70_M151 = "weapons.nurs.HYDRA_70_M151"
ENUMS.Storage.weapons.bombs.IFV_BMP_3_32912lb = "weapons.bombs.IFV BMP-3 [32912lb]"
ENUMS.Storage.weapons.bombs.APC_MTLB_Air_26400lb = "weapons.bombs.APC MTLB Air [26400lb]"
ENUMS.Storage.weapons.nurs.HYDRA_70_M229 = "weapons.nurs.HYDRA_70_M229"
ENUMS.Storage.weapons.bombs.BDU_45 = "weapons.bombs.BDU_45"
ENUMS.Storage.weapons.bombs.OFAB_100_120TU = "weapons.bombs.OFAB-100-120TU"
ENUMS.Storage.weapons.missiles.AIM_9J = "weapons.missiles.AIM-9J"
ENUMS.Storage.weapons.nurs.ARF8M3API = "weapons.nurs.ARF8M3API"
ENUMS.Storage.weapons.bombs.BetAB_500ShP = "weapons.bombs.BetAB_500ShP"
ENUMS.Storage.weapons.nurs.C_8OFP2 = "weapons.nurs.C_8OFP2"
ENUMS.Storage.weapons.bombs.GBU_10 = "weapons.bombs.GBU_10"
ENUMS.Storage.weapons.bombs.APC_MTLB_Skid_26290lb = "weapons.bombs.APC MTLB Skid [26290lb]"
ENUMS.Storage.weapons.nurs.SNEB_TYPE254_F1B_RED = "weapons.nurs.SNEB_TYPE254_F1B_RED"
ENUMS.Storage.weapons.missiles.X_65 = "weapons.missiles.X_65"
ENUMS.Storage.weapons.missiles.R_550_M1 = "weapons.missiles.R_550_M1"
ENUMS.Storage.weapons.missiles.AGM_65K = "weapons.missiles.AGM_65K"
ENUMS.Storage.weapons.nurs.SNEB_TYPE254_F1B_YELLOW = "weapons.nurs.SNEB_TYPE254_F1B_YELLOW"
ENUMS.Storage.weapons.missiles.AGM_88 = "weapons.missiles.AGM_88"
ENUMS.Storage.weapons.nurs.C_8OM = "weapons.nurs.C_8OM"
ENUMS.Storage.weapons.bombs.SAM_ROLAND_LN_34720b = "weapons.bombs.SAM ROLAND LN [34720b]"
ENUMS.Storage.weapons.missiles.AIM_120 = "weapons.missiles.AIM_120"
ENUMS.Storage.weapons.missiles.HOT3_MBDA = "weapons.missiles.HOT3_MBDA"
ENUMS.Storage.weapons.missiles.R_13M = "weapons.missiles.R-13M"
ENUMS.Storage.weapons.missiles.AIM_54C_Mk60 = "weapons.missiles.AIM_54C_Mk60"
ENUMS.Storage.weapons.bombs.AAA_GEPARD_34720lb = "weapons.bombs.AAA GEPARD [34720lb]"
ENUMS.Storage.weapons.missiles.R_13M1 = "weapons.missiles.R-13M1"
ENUMS.Storage.weapons.bombs.APC_Cobra_Air_10912lb = "weapons.bombs.APC Cobra Air [10912lb]"
ENUMS.Storage.weapons.bombs.RBK_250 = "weapons.bombs.RBK_250"
ENUMS.Storage.weapons.bombs.SC_500_J = "weapons.bombs.SC_500_J"
ENUMS.Storage.weapons.missiles.AGM_114K = "weapons.missiles.AGM_114K"
ENUMS.Storage.weapons.missiles.ALARM = "weapons.missiles.ALARM"
ENUMS.Storage.weapons.bombs.Mk_83 = "weapons.bombs.Mk_83"
ENUMS.Storage.weapons.missiles.AGM_65B = "weapons.missiles.AGM_65B"
ENUMS.Storage.weapons.bombs.MK_82SNAKEYE = "weapons.bombs.MK_82SNAKEYE"
ENUMS.Storage.weapons.nurs.HYDRA_70_MK1 = "weapons.nurs.HYDRA_70_MK1"
ENUMS.Storage.weapons.bombs.BLG66_BELOUGA = "weapons.bombs.BLG66_BELOUGA"
ENUMS.Storage.weapons.containers.EclairM_51 = "weapons.containers.{EclairM_51}"
ENUMS.Storage.weapons.missiles.AIM_54A_Mk60 = "weapons.missiles.AIM_54A_Mk60"
ENUMS.Storage.weapons.droptanks.DFT_300_GAL_A4E = "weapons.droptanks.DFT_300_GAL_A4E"
ENUMS.Storage.weapons.bombs.ATGM_M1134_Stryker_30337lb = "weapons.bombs.ATGM M1134 Stryker [30337lb]"
ENUMS.Storage.weapons.bombs.BAT_120 = "weapons.bombs.BAT-120"
ENUMS.Storage.weapons.missiles.DWS39_MJ1_MJ2 = "weapons.missiles.DWS39_MJ1_MJ2"
ENUMS.Storage.weapons.containers.SPRD = "weapons.containers.SPRD"
ENUMS.Storage.weapons.bombs.BR_500 = "weapons.bombs.BR_500"
ENUMS.Storage.weapons.bombs.British_GP_500LB_Bomb_Mk1 = "weapons.bombs.British_GP_500LB_Bomb_Mk1"
ENUMS.Storage.weapons.bombs.BDU_50HD = "weapons.bombs.BDU_50HD"
ENUMS.Storage.weapons.missiles.RS2US = "weapons.missiles.RS2US"
ENUMS.Storage.weapons.bombs.IFV_BMP_2_25168lb = "weapons.bombs.IFV BMP-2 [25168lb]"
ENUMS.Storage.weapons.bombs.SAMP400HD = "weapons.bombs.SAMP400HD"
ENUMS.Storage.weapons.containers.Hercules_Battle_Station = "weapons.containers.Hercules_Battle_Station"
ENUMS.Storage.weapons.bombs.AN_M64 = "weapons.bombs.AN_M64"
ENUMS.Storage.weapons.containers.rearCargoSeats = "weapons.containers.rearCargoSeats"
ENUMS.Storage.weapons.bombs.Mk_82 = "weapons.bombs.Mk_82"
ENUMS.Storage.weapons.missiles.AKD_10 = "weapons.missiles.AKD-10"
ENUMS.Storage.weapons.bombs.BDU_50LGB = "weapons.bombs.BDU_50LGB"
ENUMS.Storage.weapons.missiles.SD_10 = "weapons.missiles.SD-10"
ENUMS.Storage.weapons.containers.IRDeflector = "weapons.containers.IRDeflector"
ENUMS.Storage.weapons.bombs.FAB_500 = "weapons.bombs.FAB_500"
ENUMS.Storage.weapons.bombs.KAB_500 = "weapons.bombs.KAB_500"
ENUMS.Storage.weapons.nurs.S_5M = "weapons.nurs.S-5M"
ENUMS.Storage.weapons.missiles.MICA_R = "weapons.missiles.MICA_R"
ENUMS.Storage.weapons.missiles.X_59M = "weapons.missiles.X_59M"
ENUMS.Storage.weapons.nurs.UG_90MM = "weapons.nurs.UG_90MM"
ENUMS.Storage.weapons.bombs.LYSBOMB = "weapons.bombs.LYSBOMB"
ENUMS.Storage.weapons.nurs.R4M = "weapons.nurs.R4M"
ENUMS.Storage.weapons.containers.dlpod_akg = "weapons.containers.dlpod_akg"
ENUMS.Storage.weapons.missiles.LD_10 = "weapons.missiles.LD-10"
ENUMS.Storage.weapons.bombs.SC_50 = "weapons.bombs.SC_50"
ENUMS.Storage.weapons.nurs.HYDRA_70_MK5 = "weapons.nurs.HYDRA_70_MK5"
ENUMS.Storage.weapons.bombs.FAB_100M = "weapons.bombs.FAB_100M"
ENUMS.Storage.weapons.missiles.Rb_24 = "weapons.missiles.Rb 24"
ENUMS.Storage.weapons.bombs.BDU_45B = "weapons.bombs.BDU_45B"
ENUMS.Storage.weapons.missiles.GB_6_HE = "weapons.missiles.GB-6-HE"
ENUMS.Storage.weapons.missiles.KD_63B = "weapons.missiles.KD-63B"
ENUMS.Storage.weapons.missiles.P_27PE = "weapons.missiles.P_27PE"
ENUMS.Storage.weapons.droptanks.PTB300_MIG15 = "weapons.droptanks.PTB300_MIG15"
ENUMS.Storage.weapons.bombs.Two50_3 = "weapons.bombs.250-3"
ENUMS.Storage.weapons.bombs.SC_500_L2 = "weapons.bombs.SC_500_L2"
ENUMS.Storage.weapons.containers.HMMWV_M1045 = "weapons.containers.HMMWV_M1045"
ENUMS.Storage.weapons.bombs.FAB_500M54TU = "weapons.bombs.FAB-500M54TU"
ENUMS.Storage.weapons.containers.US_M10_SMOKE_TANK_YELLOW = "weapons.containers.{US_M10_SMOKE_TANK_YELLOW}"
ENUMS.Storage.weapons.containers.EclairM_60 = "weapons.containers.{EclairM_60}"
ENUMS.Storage.weapons.bombs.SAB_250_200 = "weapons.bombs.SAB_250_200"
ENUMS.Storage.weapons.bombs.FAB_100 = "weapons.bombs.FAB_100"
ENUMS.Storage.weapons.bombs.KAB_500S = "weapons.bombs.KAB_500S"
ENUMS.Storage.weapons.missiles.AGM_45A = "weapons.missiles.AGM_45A"
ENUMS.Storage.weapons.missiles.Kh25MP_PRGS1VP = "weapons.missiles.Kh25MP_PRGS1VP"
ENUMS.Storage.weapons.nurs.S5M1_HEFRAG_FFAR = "weapons.nurs.S5M1_HEFRAG_FFAR"
ENUMS.Storage.weapons.containers.kg600 = "weapons.containers.kg600"
ENUMS.Storage.weapons.bombs.AN_M65 = "weapons.bombs.AN_M65"
ENUMS.Storage.weapons.bombs.AN_M57 = "weapons.bombs.AN_M57"
ENUMS.Storage.weapons.bombs.BLU_3B_GROUP = "weapons.bombs.BLU_3B_GROUP"
ENUMS.Storage.weapons.bombs.BAP_100 = "weapons.bombs.BAP-100"
ENUMS.Storage.weapons.containers.HEMTT = "weapons.containers.HEMTT"
ENUMS.Storage.weapons.bombs.British_MC_500LB_Bomb_Mk1_Short = "weapons.bombs.British_MC_500LB_Bomb_Mk1_Short"
ENUMS.Storage.weapons.nurs.ARAKM70BAP = "weapons.nurs.ARAKM70BAP"
ENUMS.Storage.weapons.missiles.AGM_119 = "weapons.missiles.AGM_119"
ENUMS.Storage.weapons.missiles.MMagicII = "weapons.missiles.MMagicII"
ENUMS.Storage.weapons.bombs.AB_500_1_SD_10A = "weapons.bombs.AB_500_1_SD_10A"
ENUMS.Storage.weapons.nurs.HYDRA_70_M282 = "weapons.nurs.HYDRA_70_M282"
ENUMS.Storage.weapons.droptanks.DFT_400_GAL_A4E = "weapons.droptanks.DFT_400_GAL_A4E"
ENUMS.Storage.weapons.nurs.HYDRA_70_M257 = "weapons.nurs.HYDRA_70_M257"
ENUMS.Storage.weapons.droptanks.AV8BNA_AERO1D = "weapons.droptanks.AV8BNA_AERO1D"
ENUMS.Storage.weapons.containers.US_M10_SMOKE_TANK_BLUE = "weapons.containers.{US_M10_SMOKE_TANK_BLUE}"
ENUMS.Storage.weapons.nurs.ARF8M3HEI = "weapons.nurs.ARF8M3HEI"
ENUMS.Storage.weapons.bombs.RN_28 = "weapons.bombs.RN-28"
ENUMS.Storage.weapons.bombs.Squad_30_x_Soldier_7950lb = "weapons.bombs.Squad 30 x Soldier [7950lb]"
ENUMS.Storage.weapons.containers.uaz_469 = "weapons.containers.uaz-469"
ENUMS.Storage.weapons.containers.Otokar_Cobra = "weapons.containers.Otokar_Cobra"
ENUMS.Storage.weapons.bombs.APC_BTR_82A_Air_24998lb = "weapons.bombs.APC BTR-82A Air [24998lb]"
ENUMS.Storage.weapons.nurs.HYDRA_70_M274 = "weapons.nurs.HYDRA_70_M274"
ENUMS.Storage.weapons.missiles.P_24R = "weapons.missiles.P_24R"
ENUMS.Storage.weapons.nurs.HYDRA_70_MK61 = "weapons.nurs.HYDRA_70_MK61"
ENUMS.Storage.weapons.missiles.Igla_1E = "weapons.missiles.Igla_1E"
ENUMS.Storage.weapons.missiles.C_802AK = "weapons.missiles.C-802AK"
ENUMS.Storage.weapons.nurs.C_24 = "weapons.nurs.C_24"
ENUMS.Storage.weapons.droptanks.M2KC_08_RPL541 = "weapons.droptanks.M2KC_08_RPL541"
ENUMS.Storage.weapons.nurs.C_13 = "weapons.nurs.C_13"
ENUMS.Storage.weapons.droptanks.droptank_110_gal = "weapons.droptanks.droptank_110_gal"
ENUMS.Storage.weapons.bombs.Mk_84 = "weapons.bombs.Mk_84"
ENUMS.Storage.weapons.missiles.Sea_Eagle = "weapons.missiles.Sea_Eagle"
ENUMS.Storage.weapons.droptanks.PTB_1200_F1 = "weapons.droptanks.PTB_1200_F1"
ENUMS.Storage.weapons.nurs.SNEB_TYPE256_H1 = "weapons.nurs.SNEB_TYPE256_H1"
ENUMS.Storage.weapons.containers.MATRA_PHIMAT = "weapons.containers.MATRA-PHIMAT"
ENUMS.Storage.weapons.containers.smoke_pod = "weapons.containers.smoke_pod"
ENUMS.Storage.weapons.containers.F_15E_AAQ_14_LANTIRN = "weapons.containers.F-15E_AAQ-14_LANTIRN"
ENUMS.Storage.weapons.containers.EclairM_24 = "weapons.containers.{EclairM_24}"
ENUMS.Storage.weapons.bombs.GBU_16 = "weapons.bombs.GBU_16"
ENUMS.Storage.weapons.nurs.HYDRA_70_M156 = "weapons.nurs.HYDRA_70_M156"
ENUMS.Storage.weapons.missiles.R_60 = "weapons.missiles.R-60"
ENUMS.Storage.weapons.containers.zsu_23_4 = "weapons.containers.zsu-23-4"
ENUMS.Storage.weapons.missiles.RB75 = "weapons.missiles.RB75"
ENUMS.Storage.weapons.missiles.Mistral = "weapons.missiles.Mistral"
ENUMS.Storage.weapons.droptanks.MB339_TT500_L = "weapons.droptanks.MB339_TT500_L"
ENUMS.Storage.weapons.bombs.SAM_SA_13_STRELA_21624lb = "weapons.bombs.SAM SA-13 STRELA [21624lb]"
ENUMS.Storage.weapons.bombs.SAM_Avenger_M1097_Air_7200lb = "weapons.bombs.SAM Avenger M1097 Air [7200lb]"
ENUMS.Storage.weapons.droptanks.Eleven00L_Tank_Empty = "weapons.droptanks.1100L Tank Empty"
ENUMS.Storage.weapons.bombs.AN_M88 = "weapons.bombs.AN-M88"
ENUMS.Storage.weapons.missiles.S_25L = "weapons.missiles.S_25L"
ENUMS.Storage.weapons.nurs.British_AP_25LBNo1_3INCHNo1 = "weapons.nurs.British_AP_25LBNo1_3INCHNo1"
ENUMS.Storage.weapons.bombs.BDU_50LD = "weapons.bombs.BDU_50LD"
ENUMS.Storage.weapons.bombs.AGM_62 = "weapons.bombs.AGM_62"
ENUMS.Storage.weapons.containers.US_M10_SMOKE_TANK_WHITE = "weapons.containers.{US_M10_SMOKE_TANK_WHITE}"
ENUMS.Storage.weapons.missiles.MICA_T = "weapons.missiles.MICA_T"
ENUMS.Storage.weapons.containers.HVAR_rocket = "weapons.containers.HVAR_rocket"

View File

@@ -49,17 +49,19 @@ SOCKET = {
-- @field #string BOMBRESULT Range bombing.
-- @field #string STRAFERESULT Range strafeing result.
-- @field #string LSOGRADE Airboss LSO grade.
-- @field #string TTS Text-To-Speech.
SOCKET.DataType={
TEXT="moose_text",
BOMBRESULT="moose_bomb_result",
STRAFERESULT="moose_strafe_result",
LSOGRADE="moose_lso_grade",
TTS="moose_text2speech"
}
--- SOCKET class version.
-- @field #string version
SOCKET.version="0.2.0"
SOCKET.version="0.3.0"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO list
@@ -140,7 +142,7 @@ end
--- Send a text message.
-- @param #SOCKET self
-- @param #string Text Test message.
-- @param #string Text Text message.
-- @return #SOCKET self
function SOCKET:SendText(Text)
@@ -154,4 +156,32 @@ function SOCKET:SendText(Text)
return self
end
--- Send a text-to-speech message.
-- @param #SOCKET self
-- @param #string Text The text message to speek.
-- @param #number Provider The TTS provider: 0=Microsoft (default), 1=Google.
-- @param #string Voice The specific voice to use, e.g. `"Microsoft David Desktop"` or "`en-US-Standard-A`". If not set, the service will choose a voice based on the other parameters such as culture and gender.
-- @param #string Culture The Culture or language code, *e.g.* `"en-US"`.
-- @param #string Gender The Gender, *i.e.* "male", "female". Default "female".
-- @param #number Volume The volume. Microsoft: [0,100] default 50, Google: [-96, 10] default 0.
-- @return #SOCKET self
function SOCKET:SendTextToSpeech(Text, Provider, Voice, Culture, Gender, Volume)
Text=Text or "Hello World!"
local message={}
message.command = SOCKET.DataType.TTS
message.text = Text
message.provider=Provider
message.voice = Voice
message.culture = Culture
message.gender = Gender
message.volume = Volume
self:SendTable(message)
return self
end

View File

@@ -43,7 +43,7 @@ BIGSMOKEPRESET = {
HugeSmoke=8,
}
--- DCS map as returned by env.mission.theatre.
--- DCS map as returned by `env.mission.theatre`.
-- @type DCSMAP
-- @field #string Caucasus Caucasus map.
-- @field #string Normandy Normandy map.
@@ -53,6 +53,7 @@ BIGSMOKEPRESET = {
-- @field #string Syria Syria map.
-- @field #string MarianaIslands Mariana Islands map.
-- @field #string Falklands South Atlantic map.
-- @field #string Sinai Sinai map.
DCSMAP = {
Caucasus="Caucasus",
NTTR="Nevada",
@@ -62,6 +63,7 @@ DCSMAP = {
Syria="Syria",
MarianaIslands="MarianaIslands",
Falklands="Falklands",
Sinai="SinaiMap"
}
@@ -293,18 +295,19 @@ UTILS.DeepCopy = function(object)
end
--- Porting in Slmod's serialize_slmod2.
--- Serialize a given table.
-- @param #table tbl Input table.
-- @return #string Table as a string.
UTILS.OneLineSerialize = function( tbl ) -- serialization of a table all on a single line, no comments, made to replace old get_table_string function
lookup_table = {}
local lookup_table = {}
local function _Serialize( tbl )
if type(tbl) == 'table' then --function only works for tables!
if lookup_table[tbl] then
return lookup_table[object]
return lookup_table[tbl]
end
local tbl_str = {}
@@ -371,7 +374,54 @@ UTILS.OneLineSerialize = function( tbl ) -- serialization of a table all on a s
return objectreturn
end
--porting in Slmod's "safestring" basic serialize
--- Serialize a table to a single line string.
-- @param #table tbl table to serialize.
-- @return #string string containing serialized table.
function UTILS._OneLineSerialize(tbl)
if type(tbl) == 'table' then --function only works for tables!
local tbl_str = {}
tbl_str[#tbl_str + 1] = '{ '
for ind,val in pairs(tbl) do -- serialize its fields
if type(ind) == "number" then
tbl_str[#tbl_str + 1] = '['
tbl_str[#tbl_str + 1] = tostring(ind)
tbl_str[#tbl_str + 1] = '] = '
else --must be a string
tbl_str[#tbl_str + 1] = '['
tbl_str[#tbl_str + 1] = UTILS.BasicSerialize(ind)
tbl_str[#tbl_str + 1] = '] = '
end
if ((type(val) == 'number') or (type(val) == 'boolean')) then
tbl_str[#tbl_str + 1] = tostring(val)
tbl_str[#tbl_str + 1] = ', '
elseif type(val) == 'string' then
tbl_str[#tbl_str + 1] = UTILS.BasicSerialize(val)
tbl_str[#tbl_str + 1] = ', '
elseif type(val) == 'nil' then -- won't ever happen, right?
tbl_str[#tbl_str + 1] = 'nil, '
elseif type(val) == 'table' then
tbl_str[#tbl_str + 1] = UTILS._OneLineSerialize(val)
tbl_str[#tbl_str + 1] = ', ' --I think this is right, I just added it
else
--log:warn('Unable to serialize value type $1 at index $2', mist.utils.basicSerialize(type(val)), tostring(ind))
end
end
tbl_str[#tbl_str + 1] = '}'
return table.concat(tbl_str)
else
return UTILS.BasicSerialize(tbl)
end
end
--- Basic serialize (porting in Slmod's "safestring" basic serialize).
-- @param #string s Table to serialize.
UTILS.BasicSerialize = function(s)
if s == nil then
return "\"\""
@@ -385,6 +435,131 @@ UTILS.BasicSerialize = function(s)
end
end
function UTILS.PrintTableToLog(table, indent)
if not table then
BASE:E("No table passed!")
return
end
if not indent then indent = 0 end
for k, v in pairs(table) do
if type(v) == "table" then
BASE:I(string.rep(" ", indent) .. tostring(k) .. " = {")
UTILS.PrintTableToLog(v, indent + 1)
BASE:I(string.rep(" ", indent) .. "}")
else
BASE:I(string.rep(" ", indent) .. tostring(k) .. " = " .. tostring(v))
end
end
end
--- Returns table in a easy readable string representation.
-- @param tbl table to show
-- @param loc
-- @param indent
-- @param tableshow_tbls
-- @return Human readable string representation of given table.
function UTILS.TableShow(tbl, loc, indent, tableshow_tbls)
tableshow_tbls = tableshow_tbls or {} --create table of tables
loc = loc or ""
indent = indent or ""
if type(tbl) == 'table' then --function only works for tables!
tableshow_tbls[tbl] = loc
local tbl_str = {}
tbl_str[#tbl_str + 1] = indent .. '{\n'
for ind,val in pairs(tbl) do -- serialize its fields
if type(ind) == "number" then
tbl_str[#tbl_str + 1] = indent
tbl_str[#tbl_str + 1] = loc .. '['
tbl_str[#tbl_str + 1] = tostring(ind)
tbl_str[#tbl_str + 1] = '] = '
else
tbl_str[#tbl_str + 1] = indent
tbl_str[#tbl_str + 1] = loc .. '['
tbl_str[#tbl_str + 1] = UTILS.BasicSerialize(ind)
tbl_str[#tbl_str + 1] = '] = '
end
if ((type(val) == 'number') or (type(val) == 'boolean')) then
tbl_str[#tbl_str + 1] = tostring(val)
tbl_str[#tbl_str + 1] = ',\n'
elseif type(val) == 'string' then
tbl_str[#tbl_str + 1] = UTILS.BasicSerialize(val)
tbl_str[#tbl_str + 1] = ',\n'
elseif type(val) == 'nil' then -- won't ever happen, right?
tbl_str[#tbl_str + 1] = 'nil,\n'
elseif type(val) == 'table' then
if tableshow_tbls[val] then
tbl_str[#tbl_str + 1] = tostring(val) .. ' already defined: ' .. tableshow_tbls[val] .. ',\n'
else
tableshow_tbls[val] = loc .. '[' .. UTILS.BasicSerialize(ind) .. ']'
tbl_str[#tbl_str + 1] = tostring(val) .. ' '
tbl_str[#tbl_str + 1] = UTILS.TableShow(val, loc .. '[' .. UTILS.BasicSerialize(ind).. ']', indent .. ' ', tableshow_tbls)
tbl_str[#tbl_str + 1] = ',\n'
end
elseif type(val) == 'function' then
if debug and debug.getinfo then
local fcnname = tostring(val)
local info = debug.getinfo(val, "S")
if info.what == "C" then
tbl_str[#tbl_str + 1] = string.format('%q', fcnname .. ', C function') .. ',\n'
else
if (string.sub(info.source, 1, 2) == [[./]]) then
tbl_str[#tbl_str + 1] = string.format('%q', fcnname .. ', defined in (' .. info.linedefined .. '-' .. info.lastlinedefined .. ')' .. info.source) ..',\n'
else
tbl_str[#tbl_str + 1] = string.format('%q', fcnname .. ', defined in (' .. info.linedefined .. '-' .. info.lastlinedefined .. ')') ..',\n'
end
end
else
tbl_str[#tbl_str + 1] = 'a function,\n'
end
else
tbl_str[#tbl_str + 1] = 'unable to serialize value type ' .. UTILS.BasicSerialize(type(val)) .. ' at index ' .. tostring(ind)
end
end
tbl_str[#tbl_str + 1] = indent .. '}'
return table.concat(tbl_str)
end
end
--- Dumps the global table _G.
-- This dumps the global table _G to a file in the DCS\Logs directory.
-- This function requires you to disable script sanitization in $DCS_ROOT\Scripts\MissionScripting.lua to access lfs and io libraries.
-- @param #string fname File name.
function UTILS.Gdump(fname)
if lfs and io then
local fdir = lfs.writedir() .. [[Logs\]] .. fname
local f = io.open(fdir, 'w')
f:write(UTILS.TableShow(_G))
f:close()
env.info(string.format('Wrote debug data to $1', fdir))
else
env.error("WARNING: lfs and/or io not de-sanitized - cannot dump _G!")
end
end
--- Executes the given string.
-- borrowed from Slmod
-- @param #string s string containing LUA code.
-- @return #boolean `true` if successfully executed, `false` otherwise.
function UTILS.DoString(s)
local f, err = loadstring(s)
if f then
return true, f()
else
return false, err
end
end
UTILS.ToDegree = function(angle)
return angle*180/math.pi
@@ -1373,7 +1548,7 @@ function UTILS.TACANToFrequency(TACANChannel, TACANMode)
end
--- Returns the DCS map/theatre as optained by env.mission.theatre
--- Returns the DCS map/theatre as optained by `env.mission.theatre`.
-- @return #string DCS map name.
function UTILS.GetDCSMap()
return env.mission.theatre
@@ -1429,6 +1604,7 @@ end
-- * Syria +5 (East)
-- * Mariana Islands +2 (East)
-- * Falklands +12 (East) - note there's a LOT of deviation across the map, as we're closer to the South Pole
-- * Sinai +4.8 (East)
-- @param #string map (Optional) Map for which the declination is returned. Default is from env.mission.theatre
-- @return #number Declination in degrees.
function UTILS.GetMagneticDeclination(map)
@@ -1453,6 +1629,8 @@ function UTILS.GetMagneticDeclination(map)
declination=2
elseif map==DCSMAP.Falklands then
declination=12
elseif map==DCSMAP.Sinai then
declination=4.8
else
declination=0
end
@@ -1668,6 +1846,8 @@ function UTILS.GMTToLocalTimeDifference()
return 10 -- Guam is UTC+10 hours.
elseif theatre==DCSMAP.Falklands then
return -3 -- Fireland is UTC-3 hours.
elseif theatre==DCSMAP.Sinai then
return 2 -- Currently map is +2 but should be +3 (DCS bug?)
else
BASE:E(string.format("ERROR: Unknown Map %s in UTILS.GMTToLocal function. Returning 0", tostring(theatre)))
return 0

View File

@@ -11,8 +11,8 @@
-- @module Wrapper.Airbase
-- @image Wrapper_Airbase.JPG
--- @type AIRBASE
---
-- @type AIRBASE
-- @field #string ClassName Name of the class, i.e. "AIRBASE".
-- @field #table CategoryName Names of airbase categories.
-- @field #string AirbaseName Name of the airbase.
@@ -30,6 +30,7 @@
-- @field #table runways Runways of airdromes.
-- @field #AIRBASE.Runway runwayLanding Runway used for landing.
-- @field #AIRBASE.Runway runwayTakeoff Runway used for takeoff.
-- @field Wrapper.Storage#STORAGE storage The DCS warehouse storage.
-- @extends Wrapper.Positionable#POSITIONABLE
--- Wrapper class to handle the DCS Airbase objects:
@@ -198,7 +199,46 @@ AIRBASE.Nevada = {
-- * AIRBASE.Normandy.Needs_Oar_Point
-- * AIRBASE.Normandy.Funtington
-- * AIRBASE.Normandy.Tangmere
-- * AIRBASE.Normandy.Ford_AF
-- * AIRBASE.Normandy.Ford
-- * AIRBASE.Normandy.Argentan
-- * AIRBASE.Normandy.Goulet
-- * AIRBASE.Normandy.Barville
-- * AIRBASE.Normandy.Essay
-- * AIRBASE.Normandy.Hauterive
-- * AIRBASE.Normandy.Lymington
-- * AIRBASE.Normandy.Vrigny
-- * AIRBASE.Normandy.Odiham
-- * AIRBASE.Normandy.Conches
-- * AIRBASE.Normandy.West_Malling
-- * AIRBASE.Normandy.Villacoublay
-- * AIRBASE.Normandy.Kenley
-- * AIRBASE.Normandy.Beauvais_Tille
-- * AIRBASE.Normandy.Cormeilles_en_Vexin
-- * AIRBASE.Normandy.Creil
-- * AIRBASE.Normandy.Guyancourt
-- * AIRBASE.Normandy.Lonrai
-- * AIRBASE.Normandy.Dinan_Trelivan
-- * AIRBASE.Normandy.Heathrow
-- * AIRBASE.Normandy.Fecamp_Benouville
-- * AIRBASE.Normandy.Farnborough
-- * AIRBASE.Normandy.Friston
-- * AIRBASE.Normandy.Deanland
-- * AIRBASE.Normandy.Triqueville
-- * AIRBASE.Normandy.Poix
-- * AIRBASE.Normandy.Orly
-- * AIRBASE.Normandy.Stoney_Cross
-- * AIRBASE.Normandy.Amiens_Glisy
-- * AIRBASE.Normandy.Ronai
-- * AIRBASE.Normandy.Rouen_Boos
-- * AIRBASE.Normandy.Deauville
-- * AIRBASE.Normandy.Saint_Aubin
-- * AIRBASE.Normandy.Flers
-- * AIRBASE.Normandy.Avranches_Le_Val_Saint_Pere
-- * AIRBASE.Normandy.Gravesend
-- * AIRBASE.Normandy.Beaumont_le_Roger
-- * AIRBASE.Normandy.Broglie
-- * AIRBASE.Normandy.Bernay_Saint_Martin
-- * AIRBASE.Normandy.Saint_Andre_de_lEure
--
-- @field Normandy
AIRBASE.Normandy = {
@@ -232,14 +272,46 @@ AIRBASE.Normandy = {
["Needs_Oar_Point"] = "Needs Oar Point",
["Funtington"] = "Funtington",
["Tangmere"] = "Tangmere",
["Ford_AF"] = "Ford_AF",
["Goulet"] = "Goulet",
["Ford"] = "Ford",
["Argentan"] = "Argentan",
["Vrigny"] = "Vrigny",
["Goulet"] = "Goulet",
["Barville"] = "Barville",
["Essay"] = "Essay",
["Hauterive"] = "Hauterive",
["Barville"] = "Barville",
["Lymington"] = "Lymington",
["Vrigny"] = "Vrigny",
["Odiham"] = "Odiham",
["Conches"] = "Conches",
["West_Malling"] = "West Malling",
["Villacoublay"] = "Villacoublay",
["Kenley"] = "Kenley",
["Beauvais_Tille"] = "Beauvais-Tille",
["Cormeilles_en_Vexin"] = "Cormeilles-en-Vexin",
["Creil"] = "Creil",
["Guyancourt"] = "Guyancourt",
["Lonrai"] = "Lonrai",
["Dinan_Trelivan"] = "Dinan-Trelivan",
["Heathrow"] = "Heathrow",
["Fecamp_Benouville"] = "Fecamp-Benouville",
["Farnborough"] = "Farnborough",
["Friston"] = "Friston",
["Deanland "] = "Deanland ",
["Triqueville"] = "Triqueville",
["Poix"] = "Poix",
["Orly"] = "Orly",
["Stoney_Cross"] = "Stoney Cross",
["Amiens_Glisy"] = "Amiens-Glisy",
["Ronai"] = "Ronai",
["Rouen_Boos"] = "Rouen-Boos",
["Deauville"] = "Deauville",
["Saint_Aubin"] = "Saint-Aubin",
["Flers"] = "Flers",
["Avranches_Le_Val_Saint_Pere"] = "Avranches Le Val-Saint-Pere",
["Gravesend"] = "Gravesend",
["Beaumont_le_Roger"] = "Beaumont-le-Roger",
["Broglie"] = "Broglie",
["Bernay_Saint_Martin"] = "Bernay Saint Martin",
["Saint_Andre_de_lEure"] = "Saint-Andre-de-lEure",
}
--- Airbases of the Persion Gulf Map:
@@ -355,7 +427,7 @@ AIRBASE.TheChannel = {
-- * AIRBASE.Syria.Al_Dumayr
-- * AIRBASE.Syria.Gazipasa
-- * AIRBASE.Syria.Hatay
-- * AIRBASE.Syria.Nicosia
-- * AIRBASE.Syria.Nicosia [Deactivated by ED as of June/2023]
-- * AIRBASE.Syria.Pinarbashi
-- * AIRBASE.Syria.Paphos
-- * AIRBASE.Syria.Kingsfield
@@ -396,8 +468,8 @@ AIRBASE.TheChannel = {
-- * AIRBASE.Syria.H3_Northwest
-- * AIRBASE.Syria.H3_Southwest
-- * AIRBASE.Syria.Kharab_Ishk
-- * AIRBASE.Syria.Raj_al_Issa_East
-- * AIRBASE.Syria.Raj_al_Issa_West
-- * AIRBASE.Syria.Raj_al_Issa_East (deleted by ED)
-- * AIRBASE.Syria.Raj_al_Issa_West (deleted by ED)
-- * AIRBASE.Syria.Ruwayshid
-- * AIRBASE.Syria.Sanliurfa
-- * AIRBASE.Syria.Tal_Siman
@@ -419,9 +491,8 @@ AIRBASE.Syria={
["Wujah_Al_Hajar"]="Wujah Al Hajar",
["Al_Dumayr"]="Al-Dumayr",
["Gazipasa"]="Gazipasa",
--["Ru_Convoy_4"]="Ru Convoy-4",
["Hatay"]="Hatay",
["Nicosia"]="Nicosia",
--["Nicosia"]="Nicosia",
["Pinarbashi"]="Pinarbashi",
["Paphos"]="Paphos",
["Kingsfield"]="Kingsfield",
@@ -462,8 +533,8 @@ AIRBASE.Syria={
["H3_Northwest"]="H3 Northwest",
["H3_Southwest"]="H3 Southwest",
["Kharab_Ishk"]="Kharab Ishk",
["Raj_al_Issa_East"]="Raj al Issa East",
["Raj_al_Issa_West"]="Raj al Issa West",
-- ["Raj_al_Issa_East"]="Raj al Issa East",
-- ["Raj_al_Issa_West"]="Raj al Issa West",
["Ruwayshid"]="Ruwayshid",
["Sanliurfa"]="Sanliurfa",
["Tal_Siman"]="Tal Siman",
@@ -478,6 +549,8 @@ AIRBASE.Syria={
-- * AIRBASE.MarianaIslands.Saipan_Intl
-- * AIRBASE.MarianaIslands.Tinian_Intl
-- * AIRBASE.MarianaIslands.Olf_Orote
-- * AIRBASE.MarianaIslands.Pagan_Airstrip
-- * AIRBASE.MarianaIslands.North_West_Field
--
-- @field MarianaIslands
AIRBASE.MarianaIslands = {
@@ -487,6 +560,8 @@ AIRBASE.MarianaIslands = {
["Saipan_Intl"] = "Saipan Intl",
["Tinian_Intl"] = "Tinian Intl",
["Olf_Orote"] = "Olf Orote",
["Pagan_Airstrip"] = "Pagan Airstrip",
["North_West_Field"] = "North West Field",
}
--- Airbases of the South Atlantic map:
@@ -548,6 +623,72 @@ AIRBASE.SouthAtlantic={
["Gull_Point"] = "Gull Point",
}
--- Airbases of the Sinai map:
--
-- * AIRBASE.Sinai.Abu_Suwayr
-- * AIRBASE.Sinai.Sde_Dov
-- * AIRBASE.Sinai.AzZaqaziq
-- * AIRBASE.Sinai.Hatzor
-- * AIRBASE.Sinai.Kedem
-- * AIRBASE.Sinai.Nevatim
-- * AIRBASE.Sinai.Cairo_International_Airport
-- * AIRBASE.Sinai.Al_Ismailiyah
-- * AIRBASE.Sinai.As_Salihiyah
-- * AIRBASE.Sinai.Fayed
-- * AIRBASE.Sinai.Bilbeis_Air_Base
-- * AIRBASE.Sinai.Ramon_Airbase
-- * AIRBASE.Sinai.Kibrit_Air_Base
-- * AIRBASE.Sinai.El_Arish
-- * AIRBASE.Sinai.Ovda
-- * AIRBASE.Sinai.Melez
-- * AIRBASE.Sinai.Al_Mansurah
-- * AIRBASE.Sinai.Palmahim
-- * AIRBASE.Sinai.Baluza
-- * AIRBASE.Sinai.El_Gora
-- * AIRBASE.Sinai.Difarsuwar_Airfield
-- * AIRBASE.Sinai.Wadi_al_Jandali
-- * AIRBASE.Sinai.St_Catherine
-- * AIRBASE.Sinai.Tel_Nof
-- * AIRBASE.Sinai.Abu_Rudeis
-- * AIRBASE.Sinai.Inshas_Airbase
-- * AIRBASE.Sinai.Ben_Gurion
-- * AIRBASE.Sinai.Bir_Hasanah
-- * AIRBASE.Sinai.Cairo_West
--
-- @field Sinai
AIRBASE.Sinai = {
["Hatzerim"] = "Hatzerim",
["Abu_Suwayr"] = "Abu Suwayr",
["Sde_Dov"] = "Sde Dov",
["AzZaqaziq"] = "AzZaqaziq",
["Hatzor"] = "Hatzor",
["Kedem"] = "Kedem",
["Nevatim"] = "Nevatim",
["Cairo_International_Airport"] = "Cairo International Airport",
["Al_Ismailiyah"] = "Al Ismailiyah",
["As_Salihiyah"] = "As Salihiyah",
["Fayed"] = "Fayed",
["Bilbeis_Air_Base"] = "Bilbeis Air Base",
["Ramon_Airbase"] = "Ramon Airbase",
["Kibrit_Air_Base"] = "Kibrit Air Base",
["El_Arish"] = "El Arish",
["Ovda"] = "Ovda",
["Melez"] = "Melez",
["Al_Mansurah"] = "Al Mansurah",
["Palmahim"] = "Palmahim",
["Baluza"] = "Baluza",
["El_Gora"] = "El Gora",
["Difarsuwar_Airfield"] = "Difarsuwar Airfield",
["Wadi_al_Jandali"] = "Wadi al Jandali",
["St_Catherine"] = "St Catherine",
["Tel_Nof"] = "Tel Nof",
["Abu_Rudeis"] = "Abu Rudeis",
["Inshas_Airbase"] = "Inshas Airbase",
["Ben_Gurion"] = "Ben-Gurion",
["Bir_Hasanah"] = "Bir Hasanah",
["Cairo_West"] = "Cairo West",
}
--- AIRBASE.ParkingSpot ".Coordinate, ".TerminalID", ".TerminalType", ".TOAC", ".Free", ".TerminalID0", ".DistToRwy".
-- @type AIRBASE.ParkingSpot
-- @field Core.Point#COORDINATE Coordinate Coordinate of the parking spot.
@@ -652,6 +793,12 @@ function AIRBASE:Register(AirbaseName)
-- Category.
self.category=self.descriptors and self.descriptors.category or Airbase.Category.AIRDROME
-- H2 is bugged
--if self.AirbaseName == "H4" and self.descriptors == nil then
--self:E("***** H4 on Syria map is currently bugged!")
--return nil
--end
-- Set category.
if self.category==Airbase.Category.AIRDROME then
self.isAirdrome=true
@@ -687,6 +834,9 @@ function AIRBASE:Register(AirbaseName)
-- Init coordinate.
self:GetCoordinate()
-- Storage.
self.storage=_DATABASE:AddStorage(AirbaseName)
if vec2 then
if self.isShip then
local unit=UNIT:FindByName(AirbaseName)
@@ -773,6 +923,87 @@ function AIRBASE:GetZone()
return self.AirbaseZone
end
--- Get the DCS warehouse.
-- @param #AIRBASE self
-- @return DCS#Warehouse The DCS warehouse object.
function AIRBASE:GetWarehouse()
local warehouse=nil --DCS#Warehouse
local airbase=self:GetDCSObject()
if airbase then
warehouse=airbase:getWarehouse()
end
return warehouse
end
--- Get the warehouse storage of this airbase. The returned `STORAGE` object is the wrapper of the DCS warehouse.
-- This allows you to add and remove items such as aircraft, liquids, weapons and other equipment.
-- @param #AIRBASE self
-- @return Wrapper.Storage#STORAGE The storage.
function AIRBASE:GetStorage()
return self.storage
end
--- Enables or disables automatic capturing of the airbase.
-- @param #AIRBASE self
-- @param #boolean Switch If `true`, enable auto capturing. If `false`, disable it.
-- @return #AIRBASE self
function AIRBASE:SetAutoCapture(Switch)
local airbase=self:GetDCSObject()
if airbase then
airbase:autoCapture(Switch)
end
return self
end
--- Enables automatic capturing of the airbase.
-- @param #AIRBASE self
-- @return #AIRBASE self
function AIRBASE:SetAutoCaptureON()
self:SetAutoCapture(true)
return self
end
--- Disables automatic capturing of the airbase.
-- @param #AIRBASE self
-- @return #AIRBASE self
function AIRBASE:SetAutoCaptureOFF()
self:SetAutoCapture(false)
return self
end
--- Returns whether auto capturing of the airbase is on or off.
-- @param #AIRBASE self
-- @return #boolean Returns `true` if auto capturing is on, `false` if off and `nil` if the airbase object cannot be retrieved.
function AIRBASE:IsAutoCapture()
local airbase=self:GetDCSObject()
local auto=nil
if airbase then
auto=airbase:autoCaptureIsOn()
end
return auto
end
--- Sets the coalition of the airbase.
-- @param #AIRBASE self
-- @param #number Coal Coalition that the airbase should have (0=Neutral, 1=Red, 2=Blue).
-- @return #AIRBASE self
function AIRBASE:SetCoalition(Coal)
local airbase=self:GetDCSObject()
if airbase then
airbase:setCoalition(Coal)
end
return self
end
--- Get all airbases of the current map. This includes ships and FARPS.
-- @param DCS#Coalition coalition (Optional) Return only airbases belonging to the specified coalition. By default, all airbases of the map are returned.
-- @param #number category (Optional) Return only airbases of a certain category, e.g. Airbase.Category.FARP
@@ -1365,16 +1596,16 @@ function AIRBASE:FindFreeParkingSpotForAircraft(group, terminaltype, scanradius,
-- Get the aircraft size, i.e. it's longest side of x,z.
local aircraft = nil -- fix local problem below
local _aircraftsize, ax,ay,az
-- SU27 dimensions as default
local _aircraftsize = 23
local ax = 23 -- l
local ay = 7 -- h
local az = 17 -- w
if group and group.ClassName == "GROUP" then
aircraft=group:GetUnit(1)
_aircraftsize, ax,ay,az=aircraft:GetObjectSize()
else
-- SU27 dimensions
_aircraftsize = 23
ax = 23 -- length
ay = 7 -- height
az = 17 -- width
if aircraft then
_aircraftsize, ax,ay,az=aircraft:GetObjectSize()
end
end
@@ -2224,3 +2455,17 @@ function AIRBASE:CheckOnRunWay(group, radius, despawn)
return false
end
--- Get category of airbase.
-- @param #AIRBASE self
-- @return #number Category of airbase from GetDesc().category.
function AIRBASE:GetCategory()
return self.category
end
--- Get category name of airbase.
-- @param #AIRBASE self
-- @return #string Category of airbase, i.e. Airdrome, Ship, or Helipad
function AIRBASE:GetCategoryName()
return AIRBASE.CategoryName[self.category]
end

File diff suppressed because it is too large Load Diff

View File

@@ -4,8 +4,8 @@
--
-- ===
--
-- ### Author: **applevangelist**
-- # Last Update Feb 2023
-- ### Author: **Applevangelist**
-- # Last Update June 2023
--
-- ===
--
@@ -42,7 +42,7 @@ do
-- @field #NET
NET = {
ClassName = "NET",
Version = "0.1.0",
Version = "0.1.2",
BlockTime = 600,
BlockedPilots = {},
BlockedUCIDs = {},
@@ -90,7 +90,7 @@ function NET:New()
-- @param #string From State.
-- @param #string Event Trigger.
-- @param #string To State.
-- @param Wrapper.Unit#UNIT Client Unit Object.
-- @param Wrapper.Client#CLIENT Client Object.
-- @param #string Name Name of joining Pilot.
-- @return #NET self
@@ -196,7 +196,7 @@ function NET:_EventHandler(EventData)
-- Get Player Data
local name = data.IniPlayerName and data.IniPlayerName or data.IniUnit:GetPlayerName()
local ucid = self:GetPlayerUCID(nil,name)
local ucid = self:GetPlayerUCID(nil,name) or "none"
local PlayerID = self:GetPlayerIDByName(name) or "none"
local PlayerSide, PlayerSlot = self:GetSlot(data.IniUnit)
local TNow = timer.getTime()
@@ -220,7 +220,8 @@ function NET:_EventHandler(EventData)
side = PlayerSide,
slot = PlayerSlot,
}
self:__PlayerJoined(1,data.IniUnit,name)
local client = CLIENT:FindByPlayerName(name) or data.IniUnit
self:__PlayerJoined(1,client,name)
return self
end
end
@@ -807,7 +808,7 @@ function NET:onafterRun(From,Event,To)
self:HandleEvent(EVENTS.Ejection,self._EventHandler)
self:HandleEvent(EVENTS.Crash,self._EventHandler)
self:HandleEvent(EVENTS.SelfKillPilot,self._EventHandler)
self:__Status(-30)
self:__Status(-10)
end
--- Stop the event functions

View File

@@ -237,22 +237,23 @@ end
-- @return DCS#Vec3 The 3D point vector of the POSITIONABLE.
-- @return #nil The POSITIONABLE is not existing or alive.
function POSITIONABLE:GetVec3()
local DCSPositionable = self:GetDCSObject()
if DCSPositionable then
--local status, vec3 = pcall(
-- function()
-- local vec3 = DCSPositionable:getPoint()
-- return vec3
--end
--)
local vec3 = DCSPositionable:getPoint()
if vec3 then
--if status then
return vec3
else
self:E( "ERROR: Cannot get vec3!" )
end
--else
--self:E( { "Cannot get Vec3 from DCS Object", Positionable = self, Alive = self:IsAlive() } )
--end
end
-- ERROR!
self:E( { "Cannot GetVec3", Positionable = self, Alive = self:IsAlive() } )
self:E( { "Cannot get the Positionable DCS Object for GetVec3", Positionable = self, Alive = self:IsAlive() } )
return nil
end
@@ -394,6 +395,35 @@ function POSITIONABLE:GetCoordinate()
return nil
end
--- Triggers an explosion at the coordinates of the positionable.
-- @param #POSITIONABLE self
-- @param #number power Power of the explosion in kg TNT. Default 100 kg TNT.
-- @param #number delay (Optional) Delay of explosion in seconds.
-- @return #POSITIONABLE self
function POSITIONABLE:Explode(power, delay)
-- Default.
power=power or 100
-- Check if delay or not.
if delay and delay>0 then
-- Delayed call.
self:ScheduleOnce(delay, POSITIONABLE.Explode, self, power, 0)
else
local coord=self:GetCoord()
if coord then
-- Create an explotion at the coordinate of the positionable.
coord:Explosion(power)
end
end
return self
end
--- Returns a COORDINATE object, which is offset with respect to the orientation of the POSITIONABLE.
-- @param #POSITIONABLE self
-- @param #number x Offset in the direction "the nose" of the unit is pointing in meters. Default 0 m.
@@ -435,6 +465,115 @@ function POSITIONABLE:GetOffsetCoordinate( x, y, z )
return coord
end
--- Returns a COORDINATE object, which is transformed to be relative to the POSITIONABLE. Inverse of @{#POSITIONABLE.GetOffsetCoordinate}.
-- @param #POSITIONABLE self
-- @param #number x Offset along the world x-axis in meters. Default 0 m.
-- @param #number y Offset along the world y-axis in meters. Default 0 m.
-- @param #number z Offset along the world z-axis in meters. Default 0 m.
-- @return Core.Point#COORDINATE The relative COORDINATE with respect to the orientation of the POSITIONABLE.
function POSITIONABLE:GetRelativeCoordinate( x, y, z )
-- Default if nil.
x = x or 0
y = y or 0
z = z or 0
-- Vector from the origin of the map to self.
local selfPos = self:GetVec3()
-- Vectors making up self's local coordinate system.
local X = self:GetOrientationX()
local Y = self:GetOrientationY()
local Z = self:GetOrientationZ()
-- Offset from self to self's position (still in the world coordinate system).
local off = {
x = x - selfPos.x,
y = y - selfPos.y,
z = z - selfPos.z
}
-- The end result
local res = { x = 0, y = 0, z = 0 }
-- Matrix equation to solve:
-- | X.x, Y.x, Z.x | | res.x | | off.x |
-- | X.y, Y.y, Z.y | . | res.y | = | off.y |
-- | X.z, Y.z, Z.z | | res.z | | off.z |
-- Use gaussian elimination to solve the system of equations.
-- https://en.wikipedia.org/wiki/Gaussian_elimination
local mat = {
{ X.x, Y.x, Z.x, off.x },
{ X.y, Y.y, Z.y, off.y },
{ X.z, Y.z, Z.z, off.z }
}
-- Matrix dimensions
local m = 3
local n = 4
-- Pivot indices
local h = 1
local k = 1
while h <= m and k <= n do
local v_max = math.abs( mat[h][k] )
local i_max = h
for i = h,m,1 do
local value = math.abs( mat[i][k] )
if value > v_max then
i_max = i
v_max = value
end
end
if mat[i_max][k] == 0 then
-- Already all 0s, nothing to do.
k = k + 1
else
-- Swap rows h and i_max
local tmp = mat[h]
mat[h] = mat[i_max]
mat[i_max] = tmp
for i = h + 1,m,1 do
-- The scaling factor to use to reduce all values in this column
local f = mat[i][k] / mat[h][k]
mat[i][k] = 0
for j = k+1,n,1 do
mat[i][j] = mat[i][j] - f*mat[h][j]
end
end
h = h + 1
k = k + 1
end
end
-- mat is now in row echelon form:
-- | #, #, #, # |
-- | 0, #, #, # |
-- | 0, 0, #, # |
--
-- and the linear equation is now effectively:
-- | #, #, # | | res.x | | # |
-- | 0, #, # | . | res.y | = | # |
-- | 0, 0, # | | res.z | | # |
-- this resulting system of equations can be easily solved via substitution.
res.z = mat[3][4] / mat[3][3]
res.y = (mat[2][4] - res.z * mat[2][3]) / mat[2][2]
res.x = (mat[1][4] - res.y * mat[1][2] - res.z * mat[1][3]) / mat[1][1]
local coord = COORDINATE:NewFromVec3( res )
-- Return the relative coordinate.
return coord
end
--- Returns a random @{DCS#Vec3} vector within a range, indicating the point in 3D of the POSITIONABLE within the mission.
-- @param #POSITIONABLE self
-- @param #number Radius
@@ -452,10 +591,10 @@ function POSITIONABLE:GetRandomVec3( Radius )
if Radius then
local PositionableRandomVec3 = {}
local angle = math.random() * math.pi * 2;
PositionableRandomVec3.x = PositionablePointVec3.x + math.cos( angle ) * math.random() * Radius;
local angle = math.random() * math.pi * 2
PositionableRandomVec3.x = PositionablePointVec3.x + math.cos( angle ) * math.random() * Radius
PositionableRandomVec3.y = PositionablePointVec3.y
PositionableRandomVec3.z = PositionablePointVec3.z + math.sin( angle ) * math.random() * Radius;
PositionableRandomVec3.z = PositionablePointVec3.z + math.sin( angle ) * math.random() * Radius
self:T3( PositionableRandomVec3 )
return PositionableRandomVec3
@@ -1630,6 +1769,93 @@ do -- Cargo
return self.__.CargoBayWeightLimit - CargoWeight
end
---
-- @field DefaultInfantryWeight
-- Abstract out the "XYZ*95" calculation in the Ground POSITIONABLE case, where the table
-- holds number of infantry that the vehicle could carry, instead of actual cargo weights.
POSITIONABLE.DefaultInfantryWeight = 95
---
-- @field CargoBayCapacityValues
-- @field CargoBayCapacityValues.Air
-- @field CargoBayCapacityValues.Naval
-- @field CargoBayCapacityValues.Ground
POSITIONABLE.CargoBayCapacityValues = {
["Air"] = {
-- C-17A
-- Wiki says: max=265,352, empty=128,140, payload=77,516 (134 troops, 1 M1 Abrams tank, 2 M2 Bradley or 3 Stryker)
-- DCS says: max=265,350, empty=125,645, fuel=132,405 ==> Cargo Bay=7300 kg with a full fuel load (lot of fuel!) and 73300 with half a fuel load.
--["C-17A"] = 35000, --77519 cannot be used, because it loads way too much apcs and infantry.
-- C-130:
-- DCS says: max=79,380, empty=36,400, fuel=10,415 kg ==> Cargo Bay=32,565 kg with fuel load.
-- Wiki says: max=70,307, empty=34,382, payload=19,000 kg (92 passengers, 2-3 Humvees or 2 M113s), max takeoff weight 70,037 kg.
-- Here we say two M113s should be transported. Each one weights 11,253 kg according to DCS. So the cargo weight should be 23,000 kg with a full load of fuel.
-- This results in a max takeoff weight of 69,815 kg (23,000+10,415+36,400), which is very close to the Wiki value of 70,037 kg.
["C_130"] = 70000,
},
["Naval"] = {
["Type_071"] = 245000,
["LHA_Tarawa"] = 500000,
["Ropucha_class"] = 150000,
["Dry_cargo_ship_1"] = 70000,
["Dry_cargo_ship_2"] = 70000,
["Higgins_boat"] = 3700, -- Higgins Boat can load 3700 kg of general cargo or 36 men (source wikipedia).
["USS_Samuel_Chase"] = 25000, -- Let's say 25 tons for now. Wiki says 33 Higgins boats, which would be 264 tons (can't be right!) and/or 578 troops.
["LST_Mk2"] = 2100000, -- Can carry 2100 tons according to wiki source!
["speedboat"] = 500, -- 500 kg ~ 5 persons
["Seawise_Giant"] =261000000, -- Gross tonnage is 261,000 tonns.
},
["Ground"] = {
["AAV7"] = 25*POSITIONABLE.DefaultInfantryWeight,
["Bedford_MWD"] = 8*POSITIONABLE.DefaultInfantryWeight, -- new by kappa
["Blitz_36_6700A"] = 10*POSITIONABLE.DefaultInfantryWeight, -- new by kappa
["BMD_1"] = 9*POSITIONABLE.DefaultInfantryWeight, -- IRL should be 4 passengers
["BMP_1"] = 8*POSITIONABLE.DefaultInfantryWeight,
["BMP_2"] = 7*POSITIONABLE.DefaultInfantryWeight,
["BMP_3"] = 8*POSITIONABLE.DefaultInfantryWeight, -- IRL should be 7+2 passengers
["Boman"] = 25*POSITIONABLE.DefaultInfantryWeight,
["BTR_80"] = 9*POSITIONABLE.DefaultInfantryWeight, -- IRL should be 7 passengers
["BTR_82A"] = 9*POSITIONABLE.DefaultInfantryWeight, -- new by kappa -- IRL should be 7 passengers
["BTR_D"] = 12*POSITIONABLE.DefaultInfantryWeight, -- IRL should be 10 passengers
["Cobra"] = 8*POSITIONABLE.DefaultInfantryWeight,
["Land_Rover_101_FC"] = 11*POSITIONABLE.DefaultInfantryWeight, -- new by kappa
["Land_Rover_109_S3"] = 7*POSITIONABLE.DefaultInfantryWeight, -- new by kappa
["LAV_25"] = 6*POSITIONABLE.DefaultInfantryWeight,
["M_2_Bradley"] = 6*POSITIONABLE.DefaultInfantryWeight,
["M1043_HMMWV_Armament"] = 4*POSITIONABLE.DefaultInfantryWeight,
["M1045_HMMWV_TOW"] = 4*POSITIONABLE.DefaultInfantryWeight,
["M1126_Stryker_ICV"] = 9*POSITIONABLE.DefaultInfantryWeight,
["M1134_Stryker_ATGM"] = 9*POSITIONABLE.DefaultInfantryWeight,
["M2A1_halftrack"] = 9*POSITIONABLE.DefaultInfantryWeight,
["M_113"] = 9*POSITIONABLE.DefaultInfantryWeight, -- IRL should be 11 passengers
["Marder"] = 6*POSITIONABLE.DefaultInfantryWeight,
["MCV_80"] = 9*POSITIONABLE.DefaultInfantryWeight, -- IRL should be 7 passengers
["MLRS_FDDM"] = 4*POSITIONABLE.DefaultInfantryWeight,
["MTLB"] = 25*POSITIONABLE.DefaultInfantryWeight, -- IRL should be 11 passengers
["GAZ_66"] = 8*POSITIONABLE.DefaultInfantryWeight,
["GAZ_3307"] = 12*POSITIONABLE.DefaultInfantryWeight,
["GAZ_3308"] = 14*POSITIONABLE.DefaultInfantryWeight,
["Grad_FDDM"] = 6*POSITIONABLE.DefaultInfantryWeight, -- new by kappa
["KAMAZ_Truck"] = 12*POSITIONABLE.DefaultInfantryWeight,
["KrAZ6322"] = 12*POSITIONABLE.DefaultInfantryWeight,
["M_818"] = 12*POSITIONABLE.DefaultInfantryWeight,
["Tigr_233036"] = 6*POSITIONABLE.DefaultInfantryWeight,
["TPZ"] = 10*POSITIONABLE.DefaultInfantryWeight, -- Fuchs
["UAZ_469"] = 4*POSITIONABLE.DefaultInfantryWeight, -- new by kappa
["Ural_375"] = 12*POSITIONABLE.DefaultInfantryWeight,
["Ural_4320_31"] = 14*POSITIONABLE.DefaultInfantryWeight,
["Ural_4320_APA_5D"] = 10*POSITIONABLE.DefaultInfantryWeight,
["Ural_4320T"] = 14*POSITIONABLE.DefaultInfantryWeight,
["ZBD04A"] = 7*POSITIONABLE.DefaultInfantryWeight, -- new by kappa
["VAB_Mephisto"] = 8*POSITIONABLE.DefaultInfantryWeight, -- new by Apple
["tt_KORD"] = 6*POSITIONABLE.DefaultInfantryWeight, -- 2.7.1 HL/TT
["tt_DSHK"] = 6*POSITIONABLE.DefaultInfantryWeight,
["HL_KORD"] = 6*POSITIONABLE.DefaultInfantryWeight,
["HL_DSHK"] = 6*POSITIONABLE.DefaultInfantryWeight,
["CCKW_353"] = 16*POSITIONABLE.DefaultInfantryWeight, --GMC CCKW 2½-ton 6×6 truck, estimating 16 soldiers,
}
}
--- Set Cargo Bay Weight Limit in kg.
-- @param #POSITIONABLE self
-- @param #number WeightLimit (Optional) Weight limit in kg. If not given, the value is taken from the descriptors or hard coded.
@@ -1653,23 +1879,13 @@ do -- Cargo
-- Unit type name.
local TypeName=Desc.typeName or "Unknown Type"
TypeName = string.gsub(TypeName,"[%p%s]","_")
-- When an airplane or helicopter, we calculate the WeightLimit based on the descriptor.
if self:IsAir() then
-- Max takeoff weight if DCS descriptors have unrealstic values.
local Weights = {
-- C-17A
-- Wiki says: max=265,352, empty=128,140, payload=77,516 (134 troops, 1 M1 Abrams tank, 2 M2 Bradley or 3 Stryker)
-- DCS says: max=265,350, empty=125,645, fuel=132,405 ==> Cargo Bay=7300 kg with a full fuel load (lot of fuel!) and 73300 with half a fuel load.
--["C-17A"] = 35000, --77519 cannot be used, because it loads way too much apcs and infantry.
-- C-130:
-- DCS says: max=79,380, empty=36,400, fuel=10,415 kg ==> Cargo Bay=32,565 kg with fuel load.
-- Wiki says: max=70,307, empty=34,382, payload=19,000 kg (92 passengers, 2-3 Humvees or 2 M113s), max takeoff weight 70,037 kg.
-- Here we say two M113s should be transported. Each one weights 11,253 kg according to DCS. So the cargo weight should be 23,000 kg with a full load of fuel.
-- This results in a max takeoff weight of 69,815 kg (23,000+10,415+36,400), which is very close to the Wiki value of 70,037 kg.
["C-130"] = 70000,
}
local Weights = POSITIONABLE.CargoBayCapacityValues.Air
-- Max (takeoff) weight (empty+fuel+cargo weight).
local massMax= Desc.massMax or 0
@@ -1704,75 +1920,16 @@ do -- Cargo
elseif self:IsShip() then
-- Hard coded cargo weights in kg.
local Weights = {
["Type_071"] = 245000,
["LHA_Tarawa"] = 500000,
["Ropucha-class"] = 150000,
["Dry-cargo ship-1"] = 70000,
["Dry-cargo ship-2"] = 70000,
["Higgins_boat"] = 3700, -- Higgins Boat can load 3700 kg of general cargo or 36 men (source wikipedia).
["USS_Samuel_Chase"] = 25000, -- Let's say 25 tons for now. Wiki says 33 Higgins boats, which would be 264 tons (can't be right!) and/or 578 troops.
["LST_Mk2"] = 2100000, -- Can carry 2100 tons according to wiki source!
["speedboat"] = 500, -- 500 kg ~ 5 persons
["Seawise_Giant"] =261000000, -- Gross tonnage is 261,000 tonns.
}
local Weights = POSITIONABLE.CargoBayCapacityValues.Naval
self.__.CargoBayWeightLimit = ( Weights[TypeName] or 50000 )
else
-- Hard coded number of soldiers.
local Weights = {
["AAV7"] = 25,
["Bedford_MWD"] = 8, -- new by kappa
["Blitz_36-6700A"] = 10, -- new by kappa
["BMD-1"] = 9, -- IRL should be 4 passengers
["BMP-1"] = 8,
["BMP-2"] = 7,
["BMP-3"] = 8, -- IRL should be 7+2 passengers
["Boman"] = 25,
["BTR-80"] = 9, -- IRL should be 7 passengers
["BTR-82A"] = 9, -- new by kappa -- IRL should be 7 passengers
["BTR_D"] = 12, -- IRL should be 10 passengers
["Cobra"] = 8,
["Land_Rover_101_FC"] = 11, -- new by kappa
["Land_Rover_109_S3"] = 7, -- new by kappa
["LAV-25"] = 6,
["M-2 Bradley"] = 6,
["M1043 HMMWV Armament"] = 4,
["M1045 HMMWV TOW"] = 4,
["M1126 Stryker ICV"] = 9,
["M1134 Stryker ATGM"] = 9,
["M2A1_halftrack"] = 9,
["M-113"] = 9, -- IRL should be 11 passengers
["Marder"] = 6,
["MCV-80"] = 9, -- IRL should be 7 passengers
["MLRS FDDM"] = 4,
["MTLB"] = 25, -- IRL should be 11 passengers
["GAZ-66"] = 8,
["GAZ-3307"] = 12,
["GAZ-3308"] = 14,
["Grad_FDDM"] = 6, -- new by kappa
["KAMAZ Truck"] = 12,
["KrAZ6322"] = 12,
["M 818"] = 12,
["Tigr_233036"] = 6,
["TPZ"] = 10, -- Fuchs
["UAZ-469"] = 4, -- new by kappa
["Ural-375"] = 12,
["Ural-4320-31"] = 14,
["Ural-4320 APA-5D"] = 10,
["Ural-4320T"] = 14,
["ZBD04A"] = 7, -- new by kappa
["VAB_Mephisto"] = 8, -- new by Apple
["tt_KORD"] = 6, -- 2.7.1 HL/TT
["tt_DSHK"] = 6,
["HL_KORD"] = 6,
["HL_DSHK"] = 6,
["CCKW_353"] = 16, --GMC CCKW 2½-ton 6×6 truck, estimating 16 soldiers
}
local Weights = POSITIONABLE.CargoBayCapacityValues.Ground
-- Assuming that each passenger weighs 95 kg on average.
local CargoBayWeightLimit = ( Weights[TypeName] or 0 ) * 95
local CargoBayWeightLimit = ( Weights[TypeName] or 0 )
self.__.CargoBayWeightLimit = CargoBayWeightLimit
end

View File

@@ -18,6 +18,7 @@
-- @field #string SceneryName Name of the scenery object.
-- @field DCS#Object SceneryObject DCS scenery object.
-- @field #number Life0 Initial life points.
-- @field #table Properties
-- @extends Wrapper.Positionable#POSITIONABLE
@@ -43,7 +44,7 @@ function SCENERY:Register( SceneryName, SceneryObject )
local self = BASE:Inherit( self, POSITIONABLE:New( SceneryName ) )
self.SceneryName = SceneryName
self.SceneryName = tostring(SceneryName)
self.SceneryObject = SceneryObject
@@ -52,9 +53,43 @@ function SCENERY:Register( SceneryName, SceneryObject )
else
self.Life0 = 0
end
self.Properties = {}
return self
end
--- Returns the Value of the zone with the given PropertyName, or nil if no matching property exists.
-- @param #SCENERY self
-- @param #string PropertyName The name of a the QuadZone Property from the scenery assignment to be retrieved.
-- @return #string The Value of the QuadZone Property from the scenery assignment with the given PropertyName, or nil if absent.
function SCENERY:GetProperty(PropertyName)
return self.Properties[PropertyName]
end
--- Returns the scenery Properties table.
-- @param #SCENERY self
-- @return #table The Key:Value table of QuadZone properties of the zone from the scenery assignment .
function SCENERY:GetAllProperties()
return self.Properties
end
--- Set a scenery property
-- @param #SCENERY self
-- @param #string PropertyName
-- @param #string PropertyValue
-- @return #SCENERY self
function SCENERY:SetProperty(PropertyName, PropertyValue)
self.Properties[PropertyName] = PropertyValue
return self
end
--- Obtain object name.
--@param #SCENERY self
--@return #string Name
function SCENERY:GetName()
return self.SceneryName
end
--- Obtain DCS Object from the SCENERY Object.
--@param #SCENERY self
--@return DCS#Object DCS scenery object.
@@ -63,12 +98,18 @@ function SCENERY:GetDCSObject()
end
--- Get current life points from the SCENERY Object.
-- **CAVEAT**: Some objects change their life value or "hitpoints" **after** the first hit. Hence we will adjust the life0 value to 120%
-- of the last life value if life exceeds life0 (initial life) at any point. Thus will will get a smooth percentage decrease, if you use this e.g. as success
-- criteria for a bombing task.
--@param #SCENERY self
--@return #number life
function SCENERY:GetLife()
local life = 0
if self.SceneryObject then
life = self.SceneryObject:getLife()
if life > self.Life0 then
self.Life0 = math.floor(life * 1.2)
end
end
return life
end
@@ -109,7 +150,7 @@ end
--@param Core.Point#COORDINATE Coordinate Where to find the scenery object
--@param #number Radius (optional) Search radius around coordinate, defaults to 100
--@return #SCENERY Scenery Object or `nil` if it cannot be found
function SCENERY:FindByName(Name, Coordinate, Radius)
function SCENERY:FindByName(Name, Coordinate, Radius, Role)
local radius = Radius or 100
local name = Name or "unknown"
@@ -119,14 +160,18 @@ function SCENERY:FindByName(Name, Coordinate, Radius)
-- @param Core.Point#COORDINATE coordinate
-- @param #number radius
-- @param #string name
local function SceneryScan(coordinate, radius, name)
if coordinate ~= nil then
local scenerylist = coordinate:ScanScenery(radius)
local rscenery = nil
for _,_scenery in pairs(scenerylist) do
local function SceneryScan(scoordinate, sradius, sname)
if scoordinate ~= nil then
local Vec2 = scoordinate:GetVec2()
local scanzone = ZONE_RADIUS:New("Zone-"..sname,Vec2,sradius,true)
scanzone:Scan({Object.Category.SCENERY})
local scanned = scanzone:GetScannedSceneryObjects()
local rscenery = nil -- Wrapper.Scenery#SCENERY
for _,_scenery in pairs(scanned) do
local scenery = _scenery -- Wrapper.Scenery#SCENERY
if tostring(scenery.SceneryName) == tostring(name) then
if tostring(scenery.SceneryName) == tostring(sname) then
rscenery = scenery
if Role then rscenery:SetProperty("ROLE",Role) end
break
end
end
@@ -136,6 +181,7 @@ function SCENERY:FindByName(Name, Coordinate, Radius)
end
if Coordinate then
--BASE:I("Coordinate Scenery Scan")
scenery = SceneryScan(Coordinate, radius, name)
end
@@ -146,7 +192,7 @@ end
-- to find the correct object.
--@param #SCENERY self
--@param #string Name The name or id of the scenery object as taken from the ME. Ex. '595785449'
--@param Core.Zone#ZONE Zone Where to find the scenery object. Can be handed as zone name.
--@param Core.Zone#ZONE_BASE Zone Where to find the scenery object. Can be handed as zone name.
--@param #number Radius (optional) Search radius around coordinate, defaults to 100
--@return #SCENERY Scenery Object or `nil` if it cannot be found
function SCENERY:FindByNameInZone(Name, Zone, Radius)
@@ -156,7 +202,7 @@ function SCENERY:FindByNameInZone(Name, Zone, Radius)
Zone = ZONE:FindByName(Zone)
end
local coordinate = Zone:GetCoordinate()
return self:FindByName(Name,coordinate,Radius)
return self:FindByName(Name,coordinate,Radius,Zone:GetProperty("ROLE"))
end
--- Find a SCENERY object from its zone name. Since SCENERY isn't registered in the Moose database (just too many objects per map), we need to do a scan first
@@ -165,37 +211,34 @@ end
--@param #string ZoneName The name of the scenery zone as created with a right-click on the map in the mission editor and select "assigned to...". Can be handed over as ZONE object.
--@return #SCENERY First found Scenery Object or `nil` if it cannot be found
function SCENERY:FindByZoneName( ZoneName )
local zone = ZoneName -- Core.Zone#ZONE
local zone = ZoneName -- Core.Zone#ZONE_BASE
if type(ZoneName) == "string" then
zone = ZONE:FindByName(ZoneName)
zone = ZONE:FindByName(ZoneName) -- Core.Zone#ZONE_POLYGON
end
local _id = zone:GetProperty('OBJECT ID')
--local properties = zone:GetAllProperties() or {}
--BASE:I(string.format("Object ID is: %s",_id or "none"))
--BASE:T("Object ID ".._id)
if not _id then
-- this zone has no object ID
BASE:E("**** Zone without object ID: "..ZoneName.." | Type: "..tostring(zone.ClassName))
if string.find(zone.ClassName,"POLYGON") then
zone:Scan({Object.Category.SCENERY})
local scanned = zone:GetScannedScenery()
local scanned = zone:GetScannedSceneryObjects()
for _,_scenery in (scanned) do
local scenery = _scenery -- Wrapper.Scenery#SCENERY
if scenery:IsAlive() then
local role = zone:GetProperty("ROLE")
if role then scenery:SetProperty("ROLE",role) end
return scenery
end
end
return nil
else
local coordinate = zone:GetCoordinate()
local scanned = coordinate:ScanScenery()
for _,_scenery in (scanned) do
local scenery = _scenery -- Wrapper.Scenery#SCENERY
if scenery:IsAlive() then
return scenery
end
end
return nil
return self:FindByName(_id, zone:GetCoordinate(),nil,zone:GetProperty("ROLE"))
end
else
return self:FindByName(_id, zone:GetCoordinate())
return self:FindByName(_id, zone:GetCoordinate(),nil,zone:GetProperty("ROLE"))
end
end
@@ -210,6 +253,7 @@ function SCENERY:FindAllByZoneName( ZoneName )
zone = ZONE:FindByName(ZoneName)
end
local _id = zone:GetProperty('OBJECT ID')
--local properties = zone:GetAllProperties() or {}
if not _id then
-- this zone has no object ID
--BASE:E("**** Zone without object ID: "..ZoneName.." | Type: "..tostring(zone.ClassName))
@@ -221,7 +265,7 @@ function SCENERY:FindAllByZoneName( ZoneName )
return nil
end
else
local obj = self:FindByName(_id, zone:GetCoordinate())
local obj = self:FindByName(_id, zone:GetCoordinate(),nil,zone:GetProperty("ROLE"))
if obj then
return {obj}
else

View File

@@ -0,0 +1,359 @@
--- **Wrapper** - Warehouse storage of DCS airbases.
--
-- ## Main Features:
--
-- * Convenient access to DCS API functions
--
-- ===
--
-- ## Example Missions:
--
-- Demo missions can be found on [github](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/Wrapper%20-%20Storage).
--
-- ===
--
-- ### Author: **funkyfranky**
--
-- ===
-- @module Wrapper.Storage
-- @image Wrapper_Storage.png
--- STORAGE class.
-- @type STORAGE
-- @field #string ClassName Name of the class.
-- @field #number verbose Verbosity level.
-- @field #string lid Class id string for output to DCS log file.
-- @field DCS#Warehouse warehouse The DCS warehouse object.
-- @field DCS#Airbase airbase The DCS airbase object.
-- @extends Core.Base#BASE
--- *The capitalist cannot store labour-power in warehouses after he has bought it, as he may do with the raw material.* -- Karl Marx
--
-- ===
--
-- # The STORAGE Concept
--
-- The STORAGE class offers an easy-to-use wrapper interface to all DCS API functions of DCS warehouses.
-- We named the class STORAGE, because the name WAREHOUSE is already taken by another MOOSE class.
--
-- This class allows you to add and remove items to a DCS warehouse, such as aircraft, liquids, weapons and other equipment.
--
-- # Constructor
--
-- A DCS warehouse is associated with an airbase. Therefore, a `STORAGE` instance is automatically created, once an airbase is registered and added to the MOOSE database.
--
-- You can get the `STORAGE` object from the
--
-- -- Create a STORAGE instance of the Batumi warehouse
-- local storage=STORAGE:FindByName("Batumi")
--
-- An other way to get the `STORAGE` object is to retrieve it from the AIRBASE function `AIRBASE:GetStorage()`
--
-- -- Get storage instance of Batumi airbase
-- local Batumi=AIRBASE:FindByName("Batumi")
-- local storage=Batumi:GetStorage()
--
-- # Aircraft, Weapons and Equipment
--
-- ## Adding Items
--
-- To add aircraft, weapons and/or othe equipment, you can use the @{#STORAGE.AddItem}() function
--
-- storage:AddItem("A-10C", 3)
-- storage:AddItem("weapons.missiles.AIM_120C", 10)
--
-- This will add three A-10Cs and ten AIM-120C missiles to the warehouse inventory.
--
-- ## Setting Items
--
-- You can also explicitly set, how many items are in the inventory with the @{#STORAGE.SetItem}() function.
--
-- ## Removing Items
--
-- Items can be removed from the inventory with the @{#STORAGE.RemoveItem}() function.
--
-- ## Getting Amount
--
-- The number of items currently in the inventory can be obtained with the @{#STORAGE.GetItemAmount}() function
--
-- local N=storage:GetItemAmount("A-10C")
-- env.info(string.format("We currently have %d A-10Cs available", N))
--
-- # Liquids
--
-- Liquids can be added and removed by slightly different functions as described below. Currently there are four types of liquids
--
-- * Jet fuel `STORAGE.Liquid.JETFUEL`
-- * Aircraft gasoline `STORAGE.Liquid.GASOLINE`
-- * MW 50 `STORAGE.Liquid.MW50`
-- * Diesel `STORAGE.Liquid.DIESEL`
--
-- ## Adding Liquids
--
-- To add a certain type of liquid, you can use the @{#STORAGE.AddItem}(Type, Amount) function
--
-- storage:AddLiquid(STORAGE.Liquid.JETFUEL, 10000)
-- storage:AddLiquid(STORAGE.Liquid.DIESEL, 20000)
--
-- This will add 10,000 kg of jet fuel and 20,000 kg of diesel to the inventory.
--
-- ## Setting Liquids
--
-- You can also explicitly set the amount of liquid with the @{#STORAGE.SetLiquid}(Type, Amount) function.
--
-- ## Removing Liquids
--
-- Liquids can be removed with @{#STORAGE.RemoveLiquid}(Type, Amount) function.
--
-- ## Getting Amount
--
-- The current amount of a certain liquid can be obtained with the @{#STORAGE.GetLiquidAmount}(Type) function
--
-- local N=storage:GetLiquidAmount(STORAGE.Liquid.DIESEL)
-- env.info(string.format("We currently have %d kg of Diesel available", N))
--
--
-- # Inventory
--
-- The current inventory of the warehouse can be obtained with the @{#STORAGE.GetInventory}() function. This returns three tables with the aircraft, liquids and weapons:
--
-- local aircraft, liquids, weapons=storage:GetInventory()
--
-- UTILS.PrintTableToLog(aircraft)
-- UTILS.PrintTableToLog(liquids)
-- UTILS.PrintTableToLog(weapons)
--
-- @field #STORAGE
STORAGE = {
ClassName = "STORAGE",
verbose = 0,
}
--- Liquid types.
-- @type STORAGE.Liquid
-- @field #number JETFUEL Jet fuel (0).
-- @field #number GASOLINE Aviation gasoline (1).
-- @field #number MW50 MW50 (2).
-- @field #number DIESEL Diesel (3).
STORAGE.Liquid = {
JETFUEL = 0,
GASOLINE = 1,
MW50 = 2,
DIESEL = 3,
}
--- STORAGE class version.
-- @field #string version
STORAGE.version="0.0.1"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO list
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO: A lot...
-- TODO: Persistence
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Constructor
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Create a new STORAGE object from the DCS weapon object.
-- @param #STORAGE self
-- @param #string AirbaseName Name of the airbase.
-- @return #STORAGE self
function STORAGE:New(AirbaseName)
-- Inherit everything from BASE class.
local self=BASE:Inherit(self, BASE:New()) -- #STORAGE
self.airbase=Airbase.getByName(AirbaseName)
self.warehouse=self.airbase:getWarehouse()
self.lid = string.format("STORAGE %s", AirbaseName)
return self
end
--- Find a STORAGE in the **_DATABASE** using the name associated airbase.
-- @param #STORAGE self
-- @param #string AirbaseName The Airbase Name.
-- @return #STORAGE self
function STORAGE:FindByName( AirbaseName )
local storage = _DATABASE:FindStorage( AirbaseName )
return storage
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- User API Functions
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Set verbosity level.
-- @param #STORAGE self
-- @param #number VerbosityLevel Level of output (higher=more). Default 0.
-- @return #STORAGE self
function STORAGE:SetVerbosity(VerbosityLevel)
self.verbose=VerbosityLevel or 0
return self
end
--- Adds the passed amount of a given item to the warehouse.
-- @param #STORAGE self
-- @param #string Name Name of the item to add.
-- @param #number Amount Amount of items to add.
-- @return #STORAGE self
function STORAGE:AddItem(Name, Amount)
self:T(self.lid..string.format("Adding %d items of %s", Amount, UTILS.OneLineSerialize(Name)))
self.warehouse:addItem(Name, Amount)
return self
end
--- Sets the specified amount of a given item to the warehouse.
-- @param #STORAGE self
-- @param #string Name Name of the item.
-- @param #number Amount Amount of items.
-- @return #STORAGE self
function STORAGE:SetItem(Name, Amount)
self:T(self.lid..string.format("Setting item %s to N=%d", UTILS.OneLineSerialize(Name), Amount))
self.warehouse:setItem(Name, Amount)
return self
end
--- Gets the amount of a given item currently present the warehouse.
-- @param #STORAGE self
-- @param #string Name Name of the item.
-- @return #number Amount of items.
function STORAGE:GetItemAmount(Name)
local N=self.warehouse:getItemCount(Name)
return N
end
--- Removes the amount of the passed item from the warehouse.
-- @param #STORAGE self
-- @param #string Name Name of the item.
-- @param #number Amount Amount of items.
-- @return #STORAGE self
function STORAGE:RemoveItem(Name, Amount)
self:T(self.lid..string.format("Removing N=%d of item %s", Amount, Name))
self.warehouse:removeItem(Name, Amount)
return self
end
--- Adds the passed amount of a given liquid to the warehouse.
-- @param #STORAGE self
-- @param #number Type Type of liquid.
-- @param #number Amount Amount of liquid to add.
-- @return #STORAGE self
function STORAGE:AddLiquid(Type, Amount)
self:T(self.lid..string.format("Adding %d liquids of %s", Amount, self:GetLiquidName(Type)))
self.warehouse:addLiquid(Type, Amount)
return self
end
--- Sets the specified amount of a given liquid to the warehouse.
-- @param #STORAGE self
-- @param #number Type Type of liquid.
-- @param #number Amount Amount of liquid.
-- @return #STORAGE self
function STORAGE:SetLiquid(Type, Amount)
self:T(self.lid..string.format("Setting liquid %s to N=%d", self:GetLiquidName(Type), Amount))
self.warehouse:setLiquid(Type, Amount)
return self
end
--- Removes the amount of the given liquid type from the warehouse.
-- @param #STORAGE self
-- @param #number Type Type of liquid.
-- @param #number Amount Amount of liquid in kg to be removed.
-- @return #STORAGE self
function STORAGE:RemoveLiquid(Type, Amount)
self:T(self.lid..string.format("Removing N=%d of liquid %s", Amount, self:GetLiquidName(Type)))
self.warehouse:removeLiquid(Type, Amount)
return self
end
--- Gets the amount of a given liquid currently present the warehouse.
-- @param #STORAGE self
-- @param #number Type Type of liquid.
-- @return #number Amount of liquid in kg.
function STORAGE:GetLiquidAmount(Type)
local N=self.warehouse:getLiquidAmount(Type)
return N
end
--- Returns the name of the liquid from its numeric type.
-- @param #STORAGE self
-- @param #number Type Type of liquid.
-- @return #string Name of the liquid.
function STORAGE:GetLiquidName(Type)
local name="Unknown"
if Type==STORAGE.Liquid.JETFUEL then
name = "Jet fuel"
elseif Type==STORAGE.Liquid.GASOLINE then
name = "Aircraft gasoline"
elseif Type==STORAGE.Liquid.MW50 then
name = "MW 50"
elseif Type==STORAGE.Liquid.DIESEL then
name = "Diesel"
else
self:E(self.lid..string.format("ERROR: Unknown liquid type %s", tostring(Type)))
end
return name
end
--- Returns a full itemized list of everything currently in a warehouse. If a category is set to unlimited then the table will be returned empty.
-- @param #STORAGE self
-- @param #string Item Name of item as #string or type of liquid as #number.
-- @return #table Table of aircraft. Table is emtpy `{}` if number of aircraft is set to be unlimited.
-- @return #table Table of liquids. Table is emtpy `{}` if number of liquids is set to be unlimited.
-- @return #table Table of weapons and other equipment. Table is emtpy `{}` if number of liquids is set to be unlimited.
function STORAGE:GetInventory(Item)
local inventory=self.warehouse:getInventory(Item)
return inventory.aircraft, inventory.liquids, inventory.weapon
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Private Functions
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -25,6 +25,7 @@
-- @field #string ClassName Name of the class.
-- @field #string UnitName Name of the unit.
-- @field #string GroupName Name of the group the unit belongs to.
-- @field #table DCSUnit The DCS Unit object from the API.
-- @extends Wrapper.Controllable#CONTROLLABLE
--- For each DCS Unit object alive within a running mission, a UNIT wrapper object (instance) will be created within the global _DATABASE object (an instance of @{Core.Database#DATABASE}).
@@ -92,6 +93,7 @@ UNIT = {
ClassName="UNIT",
UnitName=nil,
GroupName=nil,
DCSUnit = nil,
}
@@ -124,6 +126,7 @@ function UNIT:Register( UnitName )
if group then
self.GroupName=group:getName()
end
self.DCSUnit = unit
end
-- Set event prio.
@@ -176,6 +179,10 @@ function UNIT:GetDCSObject()
return DCSUnit
end
if self.DCSUnit then
return self.DCSUnit
end
return nil
end
@@ -313,19 +320,36 @@ function UNIT:IsActive()
return nil
end
--- Returns if the Unit is alive.
-- If the Unit is not alive, nil is returned.
-- If the Unit is alive and active, true is returned.
-- If the Unit is alive but not active, false is returned.
--- Returns if the unit is exists in the mission.
-- If not even the DCS unit object does exist, `nil` is returned.
-- If the unit object exists, the value of the DCS API function [isExist](https://wiki.hoggitworld.com/view/DCS_func_isExist) is returned.
-- @param #UNIT self
-- @return #boolean `true` if Unit is alive and active. `false` if Unit is alive but not active. `nil` if the Unit is not existing or is not alive.
-- @return #boolean Returns `true` if unit exists in the mission.
function UNIT:IsExist()
local DCSUnit = self:GetDCSObject() -- DCS#Unit
if DCSUnit then
local exists = DCSUnit:isExist()
return exists
end
return nil
end
--- Returns if the Unit is alive.
-- If the Unit is not alive/existent, `nil` is returned.
-- If the Unit is alive and active, `true` is returned.
-- If the Unit is alive but not active, `false`` is returned.
-- @param #UNIT self
-- @return #boolean Returns `true` if Unit is alive and active, `false` if it exists but is not active and `nil` if the object does not exist or DCS `isExist` function returns false.
function UNIT:IsAlive()
self:F3( self.UnitName )
local DCSUnit = self:GetDCSObject() -- DCS#Unit
if DCSUnit then
local UnitIsAlive = DCSUnit:isExist() and DCSUnit:isActive() -- and DCSUnit:getLife() > 1
if DCSUnit and DCSUnit:isExist() then
local UnitIsAlive = DCSUnit:isActive()
return UnitIsAlive
end
@@ -677,17 +701,24 @@ end
-- @return DCS#Unit.Ammo Table with ammuntion of the unit (or nil). This can be a complex table!
function UNIT:GetAmmo()
self:F2( self.UnitName )
local DCSUnit = self:GetDCSObject()
if DCSUnit then
--local status, unitammo = pcall(
-- function()
-- local UnitAmmo = DCSUnit:getAmmo()
-- return UnitAmmo
--end
--)
--if status then
--return unitammo
--end
local UnitAmmo = DCSUnit:getAmmo()
return UnitAmmo
end
return nil
end
--- Sets the Unit's Internal Cargo Mass, in kg
-- @param #UNIT self
-- @param #number mass to set cargo to

View File

@@ -804,7 +804,7 @@ function WEAPON:_TrackWeapon(time)
-- Return next time the function is called or nil to stop the scheduler.
if self.tracking then
if self.dtTrack and self.dtTrack>0.001 then
if self.dtTrack and self.dtTrack>=0.00001 then
return time+self.dtTrack
else
return nil

View File

@@ -49,6 +49,7 @@ Wrapper/Scenery.lua
Wrapper/Marker.lua
Wrapper/Weapon.lua
Wrapper/Net.lua
Wrapper/Storage.lua
Cargo/Cargo.lua
Cargo/CargoUnit.lua