mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Compare commits
247 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9520782a04 | ||
|
|
f172f6efeb | ||
|
|
b6b6686873 | ||
|
|
5e724e7a3f | ||
|
|
90f1d1df2a | ||
|
|
a5726c0ed8 | ||
|
|
1860366986 | ||
|
|
9db1d38a15 | ||
|
|
04ceda693b | ||
|
|
23ff128ac8 | ||
|
|
3749142670 | ||
|
|
7d3fc1740a | ||
|
|
b2a084d669 | ||
|
|
30203668e4 | ||
|
|
ebecc70693 | ||
|
|
74712b6e27 | ||
|
|
40253ea8bb | ||
|
|
7279da7f09 | ||
|
|
31c40c96f2 | ||
|
|
7a833365ce | ||
|
|
4e56078d2a | ||
|
|
0ac156f2b5 | ||
|
|
4bbf20ca4e | ||
|
|
a462c5a493 | ||
|
|
179cb5f589 | ||
|
|
367014ebf3 | ||
|
|
9d8d0c2155 | ||
|
|
edfe91274d | ||
|
|
326b20b08d | ||
|
|
11b0ce6275 | ||
|
|
03763e16d6 | ||
|
|
c1e8ee12e0 | ||
|
|
ac8cc408c1 | ||
|
|
dad91cca8c | ||
|
|
2f9c384ac0 | ||
|
|
f23a2267cf | ||
|
|
ada38fa3ea | ||
|
|
2ee0597d48 | ||
|
|
b39a83ad6e | ||
|
|
7ae4cdc8f1 | ||
|
|
7d47227fab | ||
|
|
1f09b8fe0b | ||
|
|
8c92a578ed | ||
|
|
992f09d9ba | ||
|
|
096f2caf9c | ||
|
|
0b37c909b3 | ||
|
|
bdad38e707 | ||
|
|
1b18ae1597 | ||
|
|
8dcc3cbe8f | ||
|
|
aa8f3a824c | ||
|
|
b5a19528a1 | ||
|
|
bd20e8fc81 | ||
|
|
2f806801bc | ||
|
|
be006bd2bf | ||
|
|
18a08288ec | ||
|
|
c9ac6d73e6 | ||
|
|
f602455d1f | ||
|
|
d5c34a37b0 | ||
|
|
8a0e9a3400 | ||
|
|
0e836973fd | ||
|
|
1b57af88a0 | ||
|
|
be40d7be9a | ||
|
|
00de8d911c | ||
|
|
9df3fcfdf7 | ||
|
|
d675e34f37 | ||
|
|
2d96ba0f56 | ||
|
|
21c2bd1103 | ||
|
|
f3b7740041 | ||
|
|
7d7488db6f | ||
|
|
b9197d65d5 | ||
|
|
ec6f190b68 | ||
|
|
5e4f9f035b | ||
|
|
7b6bf7f39b | ||
|
|
2e8875dd2f | ||
|
|
4964cc2f2d | ||
|
|
f0a4c5b008 | ||
|
|
1b6412821b | ||
|
|
926a0733e4 | ||
|
|
124ebd3240 | ||
|
|
7728609165 | ||
|
|
da70f4ce6c | ||
|
|
69b3e9abad | ||
|
|
f9f77bfa7b | ||
|
|
429db73854 | ||
|
|
1e9c45c115 | ||
|
|
727cb3276c | ||
|
|
a68175448d | ||
|
|
33e63a4819 | ||
|
|
d7431478d1 | ||
|
|
3543b2c79a | ||
|
|
4489efff94 | ||
|
|
dcdea379ef | ||
|
|
6a4bddde99 | ||
|
|
2088359756 | ||
|
|
dc2511942c | ||
|
|
f0c257c4a5 | ||
|
|
068d21612f | ||
|
|
773461aad9 | ||
|
|
f9257b2b0d | ||
|
|
9e0f03a3cd | ||
|
|
0ab6a10ec4 | ||
|
|
73f393c542 | ||
|
|
a467fabdc8 | ||
|
|
a2ab84c45a | ||
|
|
7ec7228cb8 | ||
|
|
9fd6729967 | ||
|
|
f1d4f1753a | ||
|
|
1f268b3b5d | ||
|
|
6d9c3fd0aa | ||
|
|
28ae63bd8d | ||
|
|
42e7e3f94f | ||
|
|
4a5204aecb | ||
|
|
6466c5e95e | ||
|
|
829f5af25f | ||
|
|
0d1147bac4 | ||
|
|
24b47b02e0 | ||
|
|
10262fd30b | ||
|
|
3cabc07d58 | ||
|
|
b0546b1e60 | ||
|
|
a988e67490 | ||
|
|
fa951838d2 | ||
|
|
2594c5bbf0 | ||
|
|
db70fa341c | ||
|
|
763e3852ac | ||
|
|
66157d0596 | ||
|
|
8ec86973c6 | ||
|
|
eb2c6ac6f2 | ||
|
|
93a8d8bc2d | ||
|
|
cbcc893ce5 | ||
|
|
c19713949d | ||
|
|
54450935a1 | ||
|
|
d0f5712ca8 | ||
|
|
382b049c5f | ||
|
|
6c2cc37abe | ||
|
|
a53763221c | ||
|
|
83447a3fb4 | ||
|
|
b7bac28113 | ||
|
|
a9edb16554 | ||
|
|
52cbb7202c | ||
|
|
f6a8317c42 | ||
|
|
2a9a7db9b8 | ||
|
|
3aeec78f79 | ||
|
|
0aeb1fc6af | ||
|
|
26565d7549 | ||
|
|
62816f217b | ||
|
|
eeeeda4e5e | ||
|
|
95767c5ef4 | ||
|
|
f5881eda53 | ||
|
|
fca6faa3a8 | ||
|
|
c1997d9f70 | ||
|
|
bb1caa6642 | ||
|
|
638f083729 | ||
|
|
59d41cf98b | ||
|
|
793adafda7 | ||
|
|
dd5ca93f26 | ||
|
|
0d1a7c770b | ||
|
|
1889df4952 | ||
|
|
7ca219748d | ||
|
|
b3f944e82e | ||
|
|
2fc16ba694 | ||
|
|
432fc0ef4b | ||
|
|
20c50c751f | ||
|
|
d3b62d0260 | ||
|
|
d0449265c1 | ||
|
|
a4feafab8e | ||
|
|
309eedd165 | ||
|
|
997baf21a0 | ||
|
|
fa676cc750 | ||
|
|
b126cc00d0 | ||
|
|
1e0c27f599 | ||
|
|
09b7922b84 | ||
|
|
66032d6894 | ||
|
|
7c98a793c7 | ||
|
|
7a5b9a75f3 | ||
|
|
0ea5631955 | ||
|
|
4bab2ee1de | ||
|
|
f5b9713639 | ||
|
|
1bfb4fc4e1 | ||
|
|
d7defe6f7f | ||
|
|
ebb94c07b3 | ||
|
|
f4cdbec376 | ||
|
|
21d5a5dfac | ||
|
|
f8947aab9c | ||
|
|
db869bcb6d | ||
|
|
36a0cfd635 | ||
|
|
ea4a1f9ff9 | ||
|
|
20406e40ca | ||
|
|
acbcb14cba | ||
|
|
3b50fee5a0 | ||
|
|
804004198b | ||
|
|
67ef6c6e7b | ||
|
|
5b8b8a5566 | ||
|
|
0468bacc0b | ||
|
|
eacc43cb5a | ||
|
|
f3dcde075c | ||
|
|
7eba1349ae | ||
|
|
b6074a4795 | ||
|
|
615afb7cc4 | ||
|
|
36c9f551d9 | ||
|
|
89c3f7310b | ||
|
|
6791a0e704 | ||
|
|
a6b622ed31 | ||
|
|
f1af3a50b8 | ||
|
|
f999e45323 | ||
|
|
0c90e90c18 | ||
|
|
4747f3f48f | ||
|
|
f97ef25104 | ||
|
|
e1a670185e | ||
|
|
069c0aa03f | ||
|
|
b145588ed5 | ||
|
|
b678e2cde1 | ||
|
|
db23a0bf2b | ||
|
|
3ad60a95ce | ||
|
|
5c3b7312c0 | ||
|
|
f177d0a257 | ||
|
|
ac4b620f16 | ||
|
|
c49b56eefc | ||
|
|
ccada18a6a | ||
|
|
1547d66327 | ||
|
|
e21236655a | ||
|
|
cdad3bd058 | ||
|
|
0db9c27f7e | ||
|
|
8042e8bfaf | ||
|
|
dd7b87e9cd | ||
|
|
68a539923f | ||
|
|
460d2768ff | ||
|
|
3c74272749 | ||
|
|
3442725525 | ||
|
|
82c409d77a | ||
|
|
195aac4504 | ||
|
|
326e27327d | ||
|
|
08d8f3e25f | ||
|
|
6f72697e26 | ||
|
|
296d4b1e93 | ||
|
|
0f6439cf9f | ||
|
|
9705b49dbe | ||
|
|
9364579a18 | ||
|
|
02a6d8f2c0 | ||
|
|
2c10943cb1 | ||
|
|
a293c59d6d | ||
|
|
544db963ea | ||
|
|
d3fd21e6da | ||
|
|
207698a2dd | ||
|
|
27cd90a0ce | ||
|
|
d1ae2c0f5e | ||
|
|
66e6a603f1 | ||
|
|
0392417189 |
@@ -1953,7 +1953,7 @@ local function refct_from_id(id) -- refct = refct_from_id(CTypeID)
|
|||||||
unsigned = refct.unsigned,
|
unsigned = refct.unsigned,
|
||||||
size = bit.band(bit.rshift(ctype.info, 16), 127),
|
size = bit.band(bit.rshift(ctype.info, 16), 127),
|
||||||
}
|
}
|
||||||
refct.bool, refct.const, refct.volatile, refct.unsigned = nil
|
refct.bool, refct.const, refct.volatile, refct.unsigned = nil, nil, nil, nil
|
||||||
end
|
end
|
||||||
|
|
||||||
if CT[4] then -- Merge sibling attributes onto this type.
|
if CT[4] then -- Merge sibling attributes onto this type.
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
--- The AI_A2A_CAP class implements the core functions to patrol a @{Core.Zone} by an AI @{Wrapper.Group} or @{Wrapper.Group}
|
--- The AI_A2A_CAP class implements the core functions to patrol a @{Core.Zone} by an AI @{Wrapper.Group} or @{Wrapper.Group}
|
||||||
-- and automatically engage any airborne enemies that are within a certain range or within a certain zone.
|
-- and automatically engage any airborne enemies that are within a certain range or within a certain zone.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
-- The AI_A2A_CAP is assigned a @{Wrapper.Group} and this must be done before the AI_A2A_CAP process can be started using the **Start** event.
|
-- The AI_A2A_CAP is assigned a @{Wrapper.Group} and this must be done before the AI_A2A_CAP process can be started using the **Start** event.
|
||||||
|
|||||||
@@ -33,6 +33,8 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- # QUICK START GUIDE
|
-- # QUICK START GUIDE
|
||||||
--
|
--
|
||||||
-- There are basically two classes available to model an A2A defense system.
|
-- There are basically two classes available to model an A2A defense system.
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
|
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- The AI_A2A_GCI is assigned a @{Wrapper.Group} and this must be done before the AI_A2A_GCI process can be started using the **Start** event.
|
-- The AI_A2A_GCI is assigned a @{Wrapper.Group} and this must be done before the AI_A2A_GCI process can be started using the **Start** event.
|
||||||
--
|
--
|
||||||
-- The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits.
|
-- The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits.
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
--- Implements the core functions to patrol a @{Core.Zone} by an AI @{Wrapper.Group} or @{Wrapper.Group}.
|
--- Implements the core functions to patrol a @{Core.Zone} by an AI @{Wrapper.Group} or @{Wrapper.Group}.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
-- The AI_A2A_PATROL is assigned a @{Wrapper.Group} and this must be done before the AI_A2A_PATROL process can be started using the **Start** event.
|
-- The AI_A2A_PATROL is assigned a @{Wrapper.Group} and this must be done before the AI_A2A_PATROL process can be started using the **Start** event.
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
|
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- # Developer Note
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
||||||
-- Therefore, this class is considered to be deprecated
|
-- Therefore, this class is considered to be deprecated
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -36,6 +36,8 @@
|
|||||||
--
|
--
|
||||||
-- # QUICK START GUIDE
|
-- # QUICK START GUIDE
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- The following class is available to model an A2G defense system.
|
-- The following class is available to model an A2G defense system.
|
||||||
--
|
--
|
||||||
-- AI_A2G_DISPATCHER is the main A2G defense class that models the A2G defense system.
|
-- AI_A2G_DISPATCHER is the main A2G defense class that models the A2G defense system.
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
--- Implements the core functions to SEAD intruders. Use the Engage trigger to intercept intruders.
|
--- Implements the core functions to SEAD intruders. Use the Engage trigger to intercept intruders.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- The AI_A2G_SEAD is assigned a @{Wrapper.Group} and this must be done before the AI_A2G_SEAD process can be started using the **Start** event.
|
-- The AI_A2G_SEAD is assigned a @{Wrapper.Group} and this must be done before the AI_A2G_SEAD process can be started using the **Start** event.
|
||||||
--
|
--
|
||||||
-- The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits.
|
-- The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits.
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
--- The AI_AIR class implements the core functions to operate an AI @{Wrapper.Group}.
|
--- The AI_AIR class implements the core functions to operate an AI @{Wrapper.Group}.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
--
|
--
|
||||||
-- # 1) AI_AIR constructor
|
-- # 1) AI_AIR constructor
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -36,6 +36,8 @@
|
|||||||
--
|
--
|
||||||
-- # QUICK START GUIDE
|
-- # QUICK START GUIDE
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- The following class is available to model an AIR defense system.
|
-- The following class is available to model an AIR defense system.
|
||||||
--
|
--
|
||||||
-- AI_AIR_DISPATCHER is the main AIR defense class that models the AIR defense system.
|
-- AI_AIR_DISPATCHER is the main AIR defense class that models the AIR defense system.
|
||||||
|
|||||||
@@ -13,12 +13,14 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- @type AI_AIR_ENGAGE
|
--- @type AI_AIR_ENGAGE
|
||||||
-- @extends AI.AI_AIR#AI_AIR
|
-- @extends AI.AI_AIR#AI_AIR
|
||||||
|
|
||||||
|
|
||||||
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
|
--- Implements the core functions to intercept intruders. Use the Engage trigger to intercept intruders.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- The AI_AIR_ENGAGE is assigned a @{Wrapper.Group} and this must be done before the AI_AIR_ENGAGE process can be started using the **Start** event.
|
-- The AI_AIR_ENGAGE is assigned a @{Wrapper.Group} and this must be done before the AI_AIR_ENGAGE process can be started using the **Start** event.
|
||||||
--
|
--
|
||||||
-- The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits.
|
-- The AI will fly towards the random 3D point within the patrol zone, using a random speed within the given altitude and speed limits.
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
--- The AI_AIR_PATROL class implements the core functions to patrol a @{Core.Zone} by an AI @{Wrapper.Group}
|
--- The AI_AIR_PATROL class implements the core functions to patrol a @{Core.Zone} by an AI @{Wrapper.Group}
|
||||||
-- and automatically engage any airborne enemies that are within a certain range or within a certain zone.
|
-- and automatically engage any airborne enemies that are within a certain range or within a certain zone.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
-- The AI_AIR_PATROL is assigned a @{Wrapper.Group} and this must be done before the AI_AIR_PATROL process can be started using the **Start** event.
|
-- The AI_AIR_PATROL is assigned a @{Wrapper.Group} and this must be done before the AI_AIR_PATROL process can be started using the **Start** event.
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- @type AI_AIR_SQUADRON
|
--- @type AI_AIR_SQUADRON
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
|
|
||||||
@@ -21,6 +21,8 @@
|
|||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
||||||
-- Therefore, this class is considered to be deprecated
|
-- Therefore, this class is considered to be deprecated
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -38,6 +38,8 @@
|
|||||||
|
|
||||||
--- Implements the core functions to provide BattleGround Air Interdiction in an Engage @{Core.Zone} by an AIR @{Wrapper.Controllable} or @{Wrapper.Group}.
|
--- Implements the core functions to provide BattleGround Air Interdiction in an Engage @{Core.Zone} by an AIR @{Wrapper.Controllable} or @{Wrapper.Group}.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- The AI_BAI_ZONE runs a process. It holds an AI in a Patrol Zone and when the AI is commanded to engage, it will fly to an Engage Zone.
|
-- The AI_BAI_ZONE runs a process. It holds an AI in a Patrol Zone and when the AI is commanded to engage, it will fly to an Engage Zone.
|
||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
|
|||||||
@@ -33,8 +33,9 @@
|
|||||||
-- @field Wrapper.Group#GROUP Test
|
-- @field Wrapper.Group#GROUP Test
|
||||||
-- @extends Core.Fsm#FSM_SET
|
-- @extends Core.Fsm#FSM_SET
|
||||||
|
|
||||||
|
--- 
|
||||||
--- Monitors and manages as many replacement AI groups as there are
|
--
|
||||||
|
-- Monitors and manages as many replacement AI groups as there are
|
||||||
-- CLIENTS in a SET\_CLIENT collection, which are not occupied by human players.
|
-- CLIENTS in a SET\_CLIENT collection, which are not occupied by human players.
|
||||||
-- In other words, use AI_BALANCER to simulate human behaviour by spawning in replacement AI in multi player missions.
|
-- In other words, use AI_BALANCER to simulate human behaviour by spawning in replacement AI in multi player missions.
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -39,6 +39,8 @@
|
|||||||
--- Implements the core functions to patrol a @{Core.Zone} by an AI @{Wrapper.Controllable} or @{Wrapper.Group}
|
--- Implements the core functions to patrol a @{Core.Zone} by an AI @{Wrapper.Controllable} or @{Wrapper.Group}
|
||||||
-- and automatically engage any airborne enemies that are within a certain range or within a certain zone.
|
-- and automatically engage any airborne enemies that are within a certain range or within a certain zone.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
-- The AI_CAP_ZONE is assigned a @{Wrapper.Group} and this must be done before the AI_CAP_ZONE process can be started using the **Start** event.
|
-- The AI_CAP_ZONE is assigned a @{Wrapper.Group} and this must be done before the AI_CAP_ZONE process can be started using the **Start** event.
|
||||||
|
|||||||
@@ -38,6 +38,9 @@
|
|||||||
-- @extends AI.AI_Patrol#AI_PATROL_ZONE
|
-- @extends AI.AI_Patrol#AI_PATROL_ZONE
|
||||||
|
|
||||||
--- Implements the core functions to provide Close Air Support in an Engage @{Core.Zone} by an AIR @{Wrapper.Controllable} or @{Wrapper.Group}.
|
--- Implements the core functions to provide Close Air Support in an Engage @{Core.Zone} by an AIR @{Wrapper.Controllable} or @{Wrapper.Group}.
|
||||||
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- The AI_CAS_ZONE runs a process. It holds an AI in a Patrol Zone and when the AI is commanded to engage, it will fly to an Engage Zone.
|
-- The AI_CAS_ZONE runs a process. It holds an AI in a Patrol Zone and when the AI is commanded to engage, it will fly to an Engage Zone.
|
||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
|
|||||||
@@ -9,12 +9,14 @@
|
|||||||
-- @module AI.AI_Cargo
|
-- @module AI.AI_Cargo
|
||||||
-- @image Cargo.JPG
|
-- @image Cargo.JPG
|
||||||
|
|
||||||
-- @type AI_CARGO
|
--- @type AI_CARGO
|
||||||
-- @extends Core.Fsm#FSM_CONTROLLABLE
|
-- @extends Core.Fsm#FSM_CONTROLLABLE
|
||||||
|
|
||||||
|
|
||||||
--- Base class for the dynamic cargo handling capability for AI groups.
|
--- Base class for the dynamic cargo handling capability for AI groups.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- Carriers can be mobilized to intelligently transport infantry and other cargo within the simulation.
|
-- Carriers can be mobilized to intelligently transport infantry and other cargo within the simulation.
|
||||||
-- The AI_CARGO module uses the @{Cargo.Cargo} capabilities within the MOOSE framework.
|
-- The AI_CARGO module uses the @{Cargo.Cargo} capabilities within the MOOSE framework.
|
||||||
-- CARGO derived objects must be declared within the mission to make the AI_CARGO object recognize the cargo.
|
-- CARGO derived objects must be declared within the mission to make the AI_CARGO object recognize the cargo.
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
--- Brings a dynamic cargo handling capability for an AI vehicle group.
|
--- Brings a dynamic cargo handling capability for an AI vehicle group.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- Armoured Personnel Carriers (APC), Trucks, Jeeps and other ground based carrier equipment can be mobilized to intelligently transport infantry and other cargo within the simulation.
|
-- Armoured Personnel Carriers (APC), Trucks, Jeeps and other ground based carrier equipment can be mobilized to intelligently transport infantry and other cargo within the simulation.
|
||||||
--
|
--
|
||||||
-- The AI_CARGO_APC class uses the @{Cargo.Cargo} capabilities within the MOOSE framework.
|
-- The AI_CARGO_APC class uses the @{Cargo.Cargo} capabilities within the MOOSE framework.
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
--- Brings a dynamic cargo handling capability for an AI airplane group.
|
--- Brings a dynamic cargo handling capability for an AI airplane group.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- Airplane carrier equipment can be mobilized to intelligently transport infantry and other cargo within the simulation between airbases.
|
-- Airplane carrier equipment can be mobilized to intelligently transport infantry and other cargo within the simulation between airbases.
|
||||||
--
|
--
|
||||||
-- The AI_CARGO_AIRPLANE module uses the @{Cargo.Cargo} capabilities within the MOOSE framework.
|
-- The AI_CARGO_AIRPLANE module uses the @{Cargo.Cargo} capabilities within the MOOSE framework.
|
||||||
|
|||||||
@@ -22,6 +22,8 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- # The dispatcher concept.
|
-- # The dispatcher concept.
|
||||||
--
|
--
|
||||||
-- Carrier equipment can be mobilized to intelligently transport infantry and other cargo within the simulation.
|
-- Carrier equipment can be mobilized to intelligently transport infantry and other cargo within the simulation.
|
||||||
|
|||||||
@@ -36,6 +36,8 @@
|
|||||||
|
|
||||||
--- A dynamic cargo transportation capability for AI groups.
|
--- A dynamic cargo transportation capability for AI groups.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- Armoured Personnel APCs (APC), Trucks, Jeeps and other carrier equipment can be mobilized to intelligently transport infantry and other cargo within the simulation.
|
-- Armoured Personnel APCs (APC), Trucks, Jeeps and other carrier equipment can be mobilized to intelligently transport infantry and other cargo within the simulation.
|
||||||
--
|
--
|
||||||
-- The AI_CARGO_DISPATCHER_APC module is derived from the AI_CARGO_DISPATCHER module.
|
-- The AI_CARGO_DISPATCHER_APC module is derived from the AI_CARGO_DISPATCHER module.
|
||||||
|
|||||||
@@ -30,6 +30,8 @@
|
|||||||
|
|
||||||
--- Brings a dynamic cargo handling capability for AI groups.
|
--- Brings a dynamic cargo handling capability for AI groups.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- Airplanes can be mobilized to intelligently transport infantry and other cargo within the simulation.
|
-- Airplanes can be mobilized to intelligently transport infantry and other cargo within the simulation.
|
||||||
--
|
--
|
||||||
-- The AI_CARGO_DISPATCHER_AIRPLANE module is derived from the AI_CARGO_DISPATCHER module.
|
-- The AI_CARGO_DISPATCHER_AIRPLANE module is derived from the AI_CARGO_DISPATCHER module.
|
||||||
|
|||||||
@@ -31,6 +31,8 @@
|
|||||||
|
|
||||||
--- A dynamic cargo handling capability for AI helicopter groups.
|
--- A dynamic cargo handling capability for AI helicopter groups.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- Helicopters can be mobilized to intelligently transport infantry and other cargo within the simulation.
|
-- Helicopters can be mobilized to intelligently transport infantry and other cargo within the simulation.
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -29,6 +29,8 @@
|
|||||||
|
|
||||||
--- A dynamic cargo transportation capability for AI groups.
|
--- A dynamic cargo transportation capability for AI groups.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- Naval vessels can be mobilized to semi-intelligently transport cargo within the simulation.
|
-- Naval vessels can be mobilized to semi-intelligently transport cargo within the simulation.
|
||||||
--
|
--
|
||||||
-- The AI_CARGO_DISPATCHER_SHIP module is derived from the AI_CARGO_DISPATCHER module.
|
-- The AI_CARGO_DISPATCHER_SHIP module is derived from the AI_CARGO_DISPATCHER module.
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
--- Brings a dynamic cargo handling capability for an AI helicopter group.
|
--- Brings a dynamic cargo handling capability for an AI helicopter group.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- Helicopter carriers can be mobilized to intelligently transport infantry and other cargo within the simulation.
|
-- Helicopter carriers can be mobilized to intelligently transport infantry and other cargo within the simulation.
|
||||||
--
|
--
|
||||||
-- The AI_CARGO_HELICOPTER class uses the @{Cargo.Cargo} capabilities within the MOOSE framework.
|
-- The AI_CARGO_HELICOPTER class uses the @{Cargo.Cargo} capabilities within the MOOSE framework.
|
||||||
|
|||||||
@@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
--- Brings a dynamic cargo handling capability for an AI naval group.
|
--- Brings a dynamic cargo handling capability for an AI naval group.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- Naval ships can be utilized to transport cargo around the map following naval shipping lanes.
|
-- Naval ships can be utilized to transport cargo around the map following naval shipping lanes.
|
||||||
-- The AI_CARGO_SHIP class uses the @{Cargo.Cargo} capabilities within the MOOSE framework.
|
-- The AI_CARGO_SHIP class uses the @{Cargo.Cargo} capabilities within the MOOSE framework.
|
||||||
-- @{Cargo.Cargo} must be declared within the mission or warehouse to make the AI_CARGO_SHIP recognize the cargo.
|
-- @{Cargo.Cargo} must be declared within the mission or warehouse to make the AI_CARGO_SHIP recognize the cargo.
|
||||||
|
|||||||
@@ -25,6 +25,8 @@
|
|||||||
--
|
--
|
||||||
-- Allows you to interact with escorting AI on your flight and take the lead.
|
-- Allows you to interact with escorting AI on your flight and take the lead.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- Each escorting group can be commanded with a complete set of radio commands (radio menu in your flight, and then F10).
|
-- Each escorting group can be commanded with a complete set of radio commands (radio menu in your flight, and then F10).
|
||||||
--
|
--
|
||||||
-- The radio commands will vary according the category of the group. The richest set of commands are with helicopters and airPlanes.
|
-- The radio commands will vary according the category of the group. The richest set of commands are with helicopters and airPlanes.
|
||||||
|
|||||||
@@ -23,6 +23,8 @@
|
|||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
||||||
-- Therefore, this class is considered to be deprecated
|
-- Therefore, this class is considered to be deprecated
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -21,6 +21,8 @@
|
|||||||
|
|
||||||
--- Models the assignment of AI escorts to player flights upon request using the radio menu.
|
--- Models the assignment of AI escorts to player flights upon request using the radio menu.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- # Developer Note
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
||||||
|
|||||||
@@ -25,6 +25,8 @@
|
|||||||
--
|
--
|
||||||
-- Allows you to interact with escorting AI on your flight and take the lead.
|
-- Allows you to interact with escorting AI on your flight and take the lead.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- Each escorting group can be commanded with a complete set of radio commands (radio menu in your flight, and then F10).
|
-- Each escorting group can be commanded with a complete set of radio commands (radio menu in your flight, and then F10).
|
||||||
--
|
--
|
||||||
-- The radio commands will vary according the category of the group. The richest set of commands are with helicopters and airPlanes.
|
-- The radio commands will vary according the category of the group. The richest set of commands are with helicopters and airPlanes.
|
||||||
|
|||||||
@@ -41,6 +41,8 @@
|
|||||||
|
|
||||||
--- Build large formations, make AI follow a @{Wrapper.Client#CLIENT} (player) leader or a @{Wrapper.Unit#UNIT} (AI) leader.
|
--- Build large formations, make AI follow a @{Wrapper.Client#CLIENT} (player) leader or a @{Wrapper.Unit#UNIT} (AI) leader.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- AI_FORMATION makes AI @{Wrapper.Group#GROUP}s fly in formation of various compositions.
|
-- AI_FORMATION makes AI @{Wrapper.Group#GROUP}s fly in formation of various compositions.
|
||||||
-- The AI_FORMATION class models formations in a different manner than the internal DCS formation logic!!!
|
-- The AI_FORMATION class models formations in a different manner than the internal DCS formation logic!!!
|
||||||
-- The purpose of the class is to:
|
-- The purpose of the class is to:
|
||||||
|
|||||||
@@ -48,6 +48,8 @@
|
|||||||
|
|
||||||
--- Implements the core functions to patrol a @{Core.Zone} by an AI @{Wrapper.Controllable} or @{Wrapper.Group}.
|
--- Implements the core functions to patrol a @{Core.Zone} by an AI @{Wrapper.Controllable} or @{Wrapper.Group}.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
-- The AI_PATROL_ZONE is assigned a @{Wrapper.Group} and this must be done before the AI_PATROL_ZONE process can be started using the **Start** event.
|
-- The AI_PATROL_ZONE is assigned a @{Wrapper.Group} and this must be done before the AI_PATROL_ZONE process can be started using the **Start** event.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- **Actions** - ACT_ACCOUNT_ classes **account for** (detect, count & report) various DCS events occurring on UNITs.
|
--- **Actions** - ACT_ACCOUNT_ classes **account for** (detect, count & report) various DCS events occurring on UNITs.
|
||||||
--
|
--
|
||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -11,6 +11,8 @@ do -- ACT_ACCOUNT
|
|||||||
|
|
||||||
--- # @{#ACT_ACCOUNT} FSM class, extends @{Core.Fsm#FSM_PROCESS}
|
--- # @{#ACT_ACCOUNT} FSM class, extends @{Core.Fsm#FSM_PROCESS}
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- ## ACT_ACCOUNT state machine:
|
-- ## ACT_ACCOUNT state machine:
|
||||||
--
|
--
|
||||||
-- This class is a state machine: it manages a process that is triggered by events causing state transitions to occur.
|
-- This class is a state machine: it manages a process that is triggered by events causing state transitions to occur.
|
||||||
@@ -133,7 +135,7 @@ do -- ACT_ACCOUNT
|
|||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
function ACT_ACCOUNT:onafterEvent( ProcessUnit, From, Event, To, Event )
|
function ACT_ACCOUNT:onafterEvent( ProcessUnit, From, Event, To )
|
||||||
|
|
||||||
self:__NoMore( 1 )
|
self:__NoMore( 1 )
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- # @{#ACT_ASSIGN} FSM template class, extends @{Core.Fsm#FSM_PROCESS}
|
-- # @{#ACT_ASSIGN} FSM template class, extends @{Core.Fsm#FSM_PROCESS}
|
||||||
--
|
--
|
||||||
-- ## ACT_ASSIGN state machine:
|
-- ## ACT_ASSIGN state machine:
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
--- (SP) (MP) (FSM) Route AI or players through waypoints or to zones.
|
--- (SP) (MP) (FSM) Route AI or players through waypoints or to zones.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
-- ## ACT_ASSIST state machine:
|
-- ## ACT_ASSIST state machine:
|
||||||
--
|
--
|
||||||
-- This class is a state machine: it manages a process that is triggered by events causing state transitions to occur.
|
-- This class is a state machine: it manages a process that is triggered by events causing state transitions to occur.
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- # @{#ACT_ROUTE} FSM class, extends @{Core.Fsm#FSM_PROCESS}
|
-- # @{#ACT_ROUTE} FSM class, extends @{Core.Fsm#FSM_PROCESS}
|
||||||
--
|
--
|
||||||
-- ## ACT_ROUTE state machine:
|
-- ## ACT_ROUTE state machine:
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- # 1) MOOSE Cargo System.
|
-- # 1) MOOSE Cargo System.
|
||||||
--
|
--
|
||||||
-- #### Those who have used the mission editor, know that the DCS mission editor provides cargo facilities.
|
-- #### Those who have used the mission editor, know that the DCS mission editor provides cargo facilities.
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ do -- CARGO_CRATE
|
|||||||
-- @type CARGO_CRATE
|
-- @type CARGO_CRATE
|
||||||
-- @extends Cargo.Cargo#CARGO_REPRESENTABLE
|
-- @extends Cargo.Cargo#CARGO_REPRESENTABLE
|
||||||
|
|
||||||
|
---
|
||||||
|
-- 
|
||||||
|
--
|
||||||
--- Defines a cargo that is represented by a UNIT object within the simulator, and can be transported by a carrier.
|
--- Defines a cargo that is represented by a UNIT object within the simulator, and can be transported by a carrier.
|
||||||
-- Use the event functions as described above to Load, UnLoad, Board, UnBoard the CARGO\_CRATE objects to and from carriers.
|
-- Use the event functions as described above to Load, UnLoad, Board, UnBoard the CARGO\_CRATE objects to and from carriers.
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ do -- CARGO_GROUP
|
|||||||
-- @extends Cargo.Cargo#CARGO_REPORTABLE
|
-- @extends Cargo.Cargo#CARGO_REPORTABLE
|
||||||
|
|
||||||
--- Defines a cargo that is represented by a @{Wrapper.Group} object within the simulator.
|
--- Defines a cargo that is represented by a @{Wrapper.Group} object within the simulator.
|
||||||
|
--
|
||||||
|
-- 
|
||||||
-- The cargo can be Loaded, UnLoaded, Boarded, UnBoarded to and from Carriers.
|
-- The cargo can be Loaded, UnLoaded, Boarded, UnBoarded to and from Carriers.
|
||||||
--
|
--
|
||||||
-- The above cargo classes are used by the following AI_CARGO_ classes to allow AI groups to transport cargo:
|
-- The above cargo classes are used by the following AI_CARGO_ classes to allow AI groups to transport cargo:
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ do -- CARGO_SLINGLOAD
|
|||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
||||||
-- Therefore, this class is considered to be deprecated
|
-- Therefore, this class is considered to be deprecated
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ do -- CARGO_UNIT
|
|||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
||||||
-- Therefore, this class is considered to be deprecated
|
-- Therefore, this class is considered to be deprecated
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -974,7 +974,7 @@ do -- Scheduling
|
|||||||
-- @param #BASE self
|
-- @param #BASE self
|
||||||
-- @param #number Start Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.
|
-- @param #number Start Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.
|
||||||
-- @param #function SchedulerFunction The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in SchedulerArguments.
|
-- @param #function SchedulerFunction The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in SchedulerArguments.
|
||||||
-- @param #table ... Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.
|
-- @param ... Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.
|
||||||
-- @return #string The Schedule ID of the planned schedule.
|
-- @return #string The Schedule ID of the planned schedule.
|
||||||
function BASE:ScheduleOnce( Start, SchedulerFunction, ... )
|
function BASE:ScheduleOnce( Start, SchedulerFunction, ... )
|
||||||
|
|
||||||
|
|||||||
@@ -872,6 +872,8 @@ end
|
|||||||
-- @return Wrapper.Group#GROUP The found GROUP.
|
-- @return Wrapper.Group#GROUP The found GROUP.
|
||||||
function DATABASE:FindGroup( GroupName )
|
function DATABASE:FindGroup( GroupName )
|
||||||
|
|
||||||
|
if type(GroupName) ~= "string" or GroupName == "" then return end
|
||||||
|
|
||||||
local GroupFound = self.GROUPS[GroupName]
|
local GroupFound = self.GROUPS[GroupName]
|
||||||
|
|
||||||
if GroupFound == nil and GroupName ~= nil and self.Templates.Groups[GroupName] == nil then
|
if GroupFound == nil and GroupName ~= nil and self.Templates.Groups[GroupName] == nil then
|
||||||
@@ -1110,7 +1112,7 @@ function DATABASE:_RegisterGroupTemplate( GroupTemplate, CoalitionSide, Category
|
|||||||
self:E("WARNING: Invalid STN "..tostring(UnitTemplate.AddPropAircraft.STN_L16).." for ".. UnitTemplate.name)
|
self:E("WARNING: Invalid STN "..tostring(UnitTemplate.AddPropAircraft.STN_L16).." for ".. UnitTemplate.name)
|
||||||
else
|
else
|
||||||
self.STNS[stn] = UnitTemplate.name
|
self.STNS[stn] = UnitTemplate.name
|
||||||
self:I("Register STN "..tostring(UnitTemplate.AddPropAircraft.STN_L16).." for ".. UnitTemplate.name)
|
self:T("Register STN "..tostring(UnitTemplate.AddPropAircraft.STN_L16).." for ".. UnitTemplate.name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if UnitTemplate.AddPropAircraft.SADL_TN then
|
if UnitTemplate.AddPropAircraft.SADL_TN then
|
||||||
@@ -1119,7 +1121,7 @@ function DATABASE:_RegisterGroupTemplate( GroupTemplate, CoalitionSide, Category
|
|||||||
self:E("WARNING: Invalid SADL "..tostring(UnitTemplate.AddPropAircraft.SADL_TN).." for ".. UnitTemplate.name)
|
self:E("WARNING: Invalid SADL "..tostring(UnitTemplate.AddPropAircraft.SADL_TN).." for ".. UnitTemplate.name)
|
||||||
else
|
else
|
||||||
self.SADL[sadl] = UnitTemplate.name
|
self.SADL[sadl] = UnitTemplate.name
|
||||||
self:I("Register SADL "..tostring(UnitTemplate.AddPropAircraft.SADL_TN).." for ".. UnitTemplate.name)
|
self:T("Register SADL "..tostring(UnitTemplate.AddPropAircraft.SADL_TN).." for ".. UnitTemplate.name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1380,7 +1382,7 @@ function DATABASE:GetCoalitionFromClientTemplate( ClientName )
|
|||||||
if self.Templates.ClientsByName[ClientName] then
|
if self.Templates.ClientsByName[ClientName] then
|
||||||
return self.Templates.ClientsByName[ClientName].CoalitionID
|
return self.Templates.ClientsByName[ClientName].CoalitionID
|
||||||
end
|
end
|
||||||
self:E("WARNING: Template does not exist for client "..tostring(ClientName))
|
self:T("WARNING: Template does not exist for client "..tostring(ClientName))
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1392,7 +1394,7 @@ function DATABASE:GetCategoryFromClientTemplate( ClientName )
|
|||||||
if self.Templates.ClientsByName[ClientName] then
|
if self.Templates.ClientsByName[ClientName] then
|
||||||
return self.Templates.ClientsByName[ClientName].CategoryID
|
return self.Templates.ClientsByName[ClientName].CategoryID
|
||||||
end
|
end
|
||||||
self:E("WARNING: Template does not exist for client "..tostring(ClientName))
|
self:T("WARNING: Template does not exist for client "..tostring(ClientName))
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1404,7 +1406,7 @@ function DATABASE:GetCountryFromClientTemplate( ClientName )
|
|||||||
if self.Templates.ClientsByName[ClientName] then
|
if self.Templates.ClientsByName[ClientName] then
|
||||||
return self.Templates.ClientsByName[ClientName].CountryID
|
return self.Templates.ClientsByName[ClientName].CountryID
|
||||||
end
|
end
|
||||||
self:E("WARNING: Template does not exist for client "..tostring(ClientName))
|
self:T("WARNING: Template does not exist for client "..tostring(ClientName))
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1697,7 +1699,7 @@ function DATABASE:_EventOnBirth( Event )
|
|||||||
if PlayerName then
|
if PlayerName then
|
||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
self:I(string.format("Player '%s' joined unit '%s' of group '%s'", tostring(PlayerName), tostring(Event.IniDCSUnitName), tostring(Event.IniDCSGroupName)))
|
self:I(string.format("Player '%s' joined unit '%s' (%s) of group '%s'", tostring(PlayerName), tostring(Event.IniDCSUnitName), tostring(Event.IniTypeName), tostring(Event.IniDCSGroupName)))
|
||||||
|
|
||||||
-- Add client in case it does not exist already.
|
-- Add client in case it does not exist already.
|
||||||
if client == nil or (client and client:CountPlayers() == 0) then
|
if client == nil or (client and client:CountPlayers() == 0) then
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ MARKEROPS_BASE = {
|
|||||||
ClassName = "MARKEROPS",
|
ClassName = "MARKEROPS",
|
||||||
Tag = "mytag",
|
Tag = "mytag",
|
||||||
Keywords = {},
|
Keywords = {},
|
||||||
version = "0.1.3",
|
version = "0.1.4",
|
||||||
debug = false,
|
debug = false,
|
||||||
Casesensitive = true,
|
Casesensitive = true,
|
||||||
}
|
}
|
||||||
@@ -154,14 +154,7 @@ function MARKEROPS_BASE:OnEventMark(Event)
|
|||||||
self:E("Skipping onEvent. Event or Event.idx unknown.")
|
self:E("Skipping onEvent. Event or Event.idx unknown.")
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
--position
|
|
||||||
local vec3={y=Event.pos.y, x=Event.pos.x, z=Event.pos.z}
|
|
||||||
local coord=COORDINATE:NewFromVec3(vec3)
|
|
||||||
if self.debug then
|
|
||||||
local coordtext = coord:ToStringLLDDM()
|
|
||||||
local text = tostring(Event.text)
|
|
||||||
local m = MESSAGE:New(string.format("Mark added at %s with text: %s",coordtext,text),10,"Info",false):ToAll()
|
|
||||||
end
|
|
||||||
local coalition = Event.MarkCoalition
|
local coalition = Event.MarkCoalition
|
||||||
-- decision
|
-- decision
|
||||||
if Event.id==world.event.S_EVENT_MARK_ADDED then
|
if Event.id==world.event.S_EVENT_MARK_ADDED then
|
||||||
@@ -170,6 +163,12 @@ function MARKEROPS_BASE:OnEventMark(Event)
|
|||||||
local Eventtext = tostring(Event.text)
|
local Eventtext = tostring(Event.text)
|
||||||
if Eventtext~=nil then
|
if Eventtext~=nil then
|
||||||
if self:_MatchTag(Eventtext) then
|
if self:_MatchTag(Eventtext) then
|
||||||
|
local coord=COORDINATE:NewFromVec3({y=Event.pos.y, x=Event.pos.x, z=Event.pos.z})
|
||||||
|
if self.debug then
|
||||||
|
local coordtext = coord:ToStringLLDDM()
|
||||||
|
local text = tostring(Event.text)
|
||||||
|
local m = MESSAGE:New(string.format("Mark added at %s with text: %s",coordtext,text),10,"Info",false):ToAll()
|
||||||
|
end
|
||||||
local matchtable = self:_MatchKeywords(Eventtext)
|
local matchtable = self:_MatchKeywords(Eventtext)
|
||||||
self:MarkAdded(Eventtext,matchtable,coord,Event.idx,coalition,Event.PlayerName,Event)
|
self:MarkAdded(Eventtext,matchtable,coord,Event.idx,coalition,Event.PlayerName,Event)
|
||||||
end
|
end
|
||||||
@@ -180,6 +179,12 @@ function MARKEROPS_BASE:OnEventMark(Event)
|
|||||||
local Eventtext = tostring(Event.text)
|
local Eventtext = tostring(Event.text)
|
||||||
if Eventtext~=nil then
|
if Eventtext~=nil then
|
||||||
if self:_MatchTag(Eventtext) then
|
if self:_MatchTag(Eventtext) then
|
||||||
|
local coord=COORDINATE:NewFromVec3({y=Event.pos.y, x=Event.pos.x, z=Event.pos.z})
|
||||||
|
if self.debug then
|
||||||
|
local coordtext = coord:ToStringLLDDM()
|
||||||
|
local text = tostring(Event.text)
|
||||||
|
local m = MESSAGE:New(string.format("Mark changed at %s with text: %s",coordtext,text),10,"Info",false):ToAll()
|
||||||
|
end
|
||||||
local matchtable = self:_MatchKeywords(Eventtext)
|
local matchtable = self:_MatchKeywords(Eventtext)
|
||||||
self:MarkChanged(Eventtext,matchtable,coord,Event.idx,coalition,Event.PlayerName,Event)
|
self:MarkChanged(Eventtext,matchtable,coord,Event.idx,coalition,Event.PlayerName,Event)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ end
|
|||||||
function MESSAGE:ToGroup( Group, Settings )
|
function MESSAGE:ToGroup( Group, Settings )
|
||||||
self:F( Group.GroupName )
|
self:F( Group.GroupName )
|
||||||
|
|
||||||
if Group then
|
if Group and Group:IsAlive() then
|
||||||
|
|
||||||
if self.MessageType then
|
if self.MessageType then
|
||||||
local Settings = Settings or (Group and _DATABASE:GetPlayerSettings( Group:GetPlayerName() )) or _SETTINGS -- Core.Settings#SETTINGS
|
local Settings = Settings or (Group and _DATABASE:GetPlayerSettings( Group:GetPlayerName() )) or _SETTINGS -- Core.Settings#SETTINGS
|
||||||
@@ -231,7 +231,7 @@ end
|
|||||||
function MESSAGE:ToUnit( Unit, Settings )
|
function MESSAGE:ToUnit( Unit, Settings )
|
||||||
self:F( Unit.IdentifiableName )
|
self:F( Unit.IdentifiableName )
|
||||||
|
|
||||||
if Unit then
|
if Unit and Unit:IsAlive() then
|
||||||
|
|
||||||
if self.MessageType then
|
if self.MessageType then
|
||||||
local Settings = Settings or ( Unit and _DATABASE:GetPlayerSettings( Unit:GetPlayerName() ) ) or _SETTINGS -- Core.Settings#SETTINGS
|
local Settings = Settings or ( Unit and _DATABASE:GetPlayerSettings( Unit:GetPlayerName() ) ) or _SETTINGS -- Core.Settings#SETTINGS
|
||||||
@@ -452,7 +452,7 @@ end
|
|||||||
_MESSAGESRS = {}
|
_MESSAGESRS = {}
|
||||||
|
|
||||||
--- Set up MESSAGE generally to allow Text-To-Speech via SRS and TTS functions. `SetMSRS()` will try to use as many attributes configured with @{Sound.SRS#MSRS.LoadConfigFile}() as possible.
|
--- Set up MESSAGE generally to allow Text-To-Speech via SRS and TTS functions. `SetMSRS()` will try to use as many attributes configured with @{Sound.SRS#MSRS.LoadConfigFile}() as possible.
|
||||||
-- @param #string PathToSRS (optional) Path to SRS Folder, defaults to "C:\\\\Program Files\\\\DCS-SimpleRadio-Standalone" or your configuration file setting.
|
-- @param #string PathToSRS (optional) Path to SRS TTS Folder, defaults to "C:\\\\Program Files\\\\DCS-SimpleRadio-Standalone\\ExternalAudio" or your configuration file setting.
|
||||||
-- @param #number Port Port (optional) number of SRS, defaults to 5002 or your configuration file setting.
|
-- @param #number Port Port (optional) number of SRS, defaults to 5002 or your configuration file setting.
|
||||||
-- @param #string PathToCredentials (optional) Path to credentials file for Google.
|
-- @param #string PathToCredentials (optional) Path to credentials file for Google.
|
||||||
-- @param #number Frequency Frequency in MHz. Can also be given as a #table of frequencies.
|
-- @param #number Frequency Frequency in MHz. Can also be given as a #table of frequencies.
|
||||||
@@ -468,13 +468,13 @@ _MESSAGESRS = {}
|
|||||||
-- @usage
|
-- @usage
|
||||||
-- -- Mind the dot here, not using the colon this time around!
|
-- -- Mind the dot here, not using the colon this time around!
|
||||||
-- -- Needed once only
|
-- -- Needed once only
|
||||||
-- MESSAGE.SetMSRS("D:\\Program Files\\DCS-SimpleRadio-Standalone",5012,nil,127,radio.modulation.FM,"female","en-US",nil,coalition.side.BLUE)
|
-- MESSAGE.SetMSRS("D:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio",5012,nil,127,radio.modulation.FM,"female","en-US",nil,coalition.side.BLUE)
|
||||||
-- -- later on in your code
|
-- -- later on in your code
|
||||||
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRS()
|
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRS()
|
||||||
--
|
--
|
||||||
function MESSAGE.SetMSRS(PathToSRS,Port,PathToCredentials,Frequency,Modulation,Gender,Culture,Voice,Coalition,Volume,Label,Coordinate,Backend)
|
function MESSAGE.SetMSRS(PathToSRS,Port,PathToCredentials,Frequency,Modulation,Gender,Culture,Voice,Coalition,Volume,Label,Coordinate,Backend)
|
||||||
|
|
||||||
_MESSAGESRS.PathToSRS = PathToSRS or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone"
|
_MESSAGESRS.PathToSRS = PathToSRS or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio"
|
||||||
|
|
||||||
_MESSAGESRS.frequency = Frequency or MSRS.frequencies or 243
|
_MESSAGESRS.frequency = Frequency or MSRS.frequencies or 243
|
||||||
_MESSAGESRS.modulation = Modulation or MSRS.modulations or radio.modulation.AM
|
_MESSAGESRS.modulation = Modulation or MSRS.modulations or radio.modulation.AM
|
||||||
@@ -535,7 +535,7 @@ end
|
|||||||
-- @usage
|
-- @usage
|
||||||
-- -- Mind the dot here, not using the colon this time around!
|
-- -- Mind the dot here, not using the colon this time around!
|
||||||
-- -- Needed once only
|
-- -- Needed once only
|
||||||
-- MESSAGE.SetMSRS("D:\\Program Files\\DCS-SimpleRadio-Standalone",5012,nil,127,radio.modulation.FM,"female","en-US",nil,coalition.side.BLUE)
|
-- MESSAGE.SetMSRS("D:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio",5012,nil,127,radio.modulation.FM,"female","en-US",nil,coalition.side.BLUE)
|
||||||
-- -- later on in your code
|
-- -- later on in your code
|
||||||
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRS()
|
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRS()
|
||||||
--
|
--
|
||||||
@@ -567,7 +567,7 @@ end
|
|||||||
-- @usage
|
-- @usage
|
||||||
-- -- Mind the dot here, not using the colon this time around!
|
-- -- Mind the dot here, not using the colon this time around!
|
||||||
-- -- Needed once only
|
-- -- Needed once only
|
||||||
-- MESSAGE.SetMSRS("D:\\Program Files\\DCS-SimpleRadio-Standalone",5012,nil,127,radio.modulation.FM,"female","en-US",nil,coalition.side.BLUE)
|
-- MESSAGE.SetMSRS("D:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio",5012,nil,127,radio.modulation.FM,"female","en-US",nil,coalition.side.BLUE)
|
||||||
-- -- later on in your code
|
-- -- later on in your code
|
||||||
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRSBlue()
|
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRSBlue()
|
||||||
--
|
--
|
||||||
@@ -589,7 +589,7 @@ end
|
|||||||
-- @usage
|
-- @usage
|
||||||
-- -- Mind the dot here, not using the colon this time around!
|
-- -- Mind the dot here, not using the colon this time around!
|
||||||
-- -- Needed once only
|
-- -- Needed once only
|
||||||
-- MESSAGE.SetMSRS("D:\\Program Files\\DCS-SimpleRadio-Standalone",5012,nil,127,radio.modulation.FM,"female","en-US",nil,coalition.side.RED)
|
-- MESSAGE.SetMSRS("D:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio",5012,nil,127,radio.modulation.FM,"female","en-US",nil,coalition.side.RED)
|
||||||
-- -- later on in your code
|
-- -- later on in your code
|
||||||
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRSRed()
|
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRSRed()
|
||||||
--
|
--
|
||||||
@@ -611,7 +611,7 @@ end
|
|||||||
-- @usage
|
-- @usage
|
||||||
-- -- Mind the dot here, not using the colon this time around!
|
-- -- Mind the dot here, not using the colon this time around!
|
||||||
-- -- Needed once only
|
-- -- Needed once only
|
||||||
-- MESSAGE.SetMSRS("D:\\Program Files\\DCS-SimpleRadio-Standalone",5012,nil,127,radio.modulation.FM,"female","en-US",nil,coalition.side.NEUTRAL)
|
-- MESSAGE.SetMSRS("D:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio",5012,nil,127,radio.modulation.FM,"female","en-US",nil,coalition.side.NEUTRAL)
|
||||||
-- -- later on in your code
|
-- -- later on in your code
|
||||||
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRSAll()
|
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRSAll()
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
do -- COORDINATE
|
do -- COORDINATE
|
||||||
|
|
||||||
---
|
--- Coordinate class
|
||||||
-- @type COORDINATE
|
-- @type COORDINATE
|
||||||
-- @field #string ClassName Name of the class
|
-- @field #string ClassName Name of the class
|
||||||
-- @field #number x Component of the 3D vector.
|
-- @field #number x Component of the 3D vector.
|
||||||
@@ -59,6 +59,10 @@ do -- COORDINATE
|
|||||||
-- * @{#COORDINATE.SmokeOrange}(): To smoke the point in orange.
|
-- * @{#COORDINATE.SmokeOrange}(): To smoke the point in orange.
|
||||||
-- * @{#COORDINATE.SmokeWhite}(): To smoke the point in white.
|
-- * @{#COORDINATE.SmokeWhite}(): To smoke the point in white.
|
||||||
-- * @{#COORDINATE.SmokeGreen}(): To smoke the point in green.
|
-- * @{#COORDINATE.SmokeGreen}(): To smoke the point in green.
|
||||||
|
-- * @{#COORDINATE.SetSmokeOffsetDirection}(): To set an offset point direction for smoke.
|
||||||
|
-- * @{#COORDINATE.SetSmokeOffsetDistance}(): To set an offset point distance for smoke.
|
||||||
|
-- * @{#COORDINATE.SwitchSmokeOffsetOn}(): To set an offset point for smoke to on.
|
||||||
|
-- * @{#COORDINATE.SwitchSmokeOffsetOff}(): To set an offset point for smoke to off.
|
||||||
--
|
--
|
||||||
-- ## 2.2) Flare
|
-- ## 2.2) Flare
|
||||||
--
|
--
|
||||||
@@ -833,6 +837,26 @@ do -- COORDINATE
|
|||||||
return land.getHeight( Vec2 )
|
return land.getHeight( Vec2 )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Returns a table of DCS#Vec3 points representing the terrain profile between two points.
|
||||||
|
-- @param #COORDINATE self
|
||||||
|
-- @param Destination DCS#Vec3 Ending point of the profile.
|
||||||
|
-- @return #table DCS#Vec3 table of the profile
|
||||||
|
function COORDINATE:GetLandProfileVec3(Destination)
|
||||||
|
return land.profile(self:GetVec3(), Destination)
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Returns a table of #COORDINATE representing the terrain profile between two points.
|
||||||
|
-- @param #COORDINATE self
|
||||||
|
-- @param Destination #COORDINATE Ending coordinate of the profile.
|
||||||
|
-- @return #table #COORDINATE table of the profile
|
||||||
|
function COORDINATE:GetLandProfileCoordinates(Destination)
|
||||||
|
local points = self:GetLandProfileVec3(Destination:GetVec3())
|
||||||
|
local coords = {}
|
||||||
|
for _, point in ipairs(points) do
|
||||||
|
table.insert(coords, COORDINATE:NewFromVec3(point))
|
||||||
|
end
|
||||||
|
return coords
|
||||||
|
end
|
||||||
|
|
||||||
--- Set the heading of the coordinate, if applicable.
|
--- Set the heading of the coordinate, if applicable.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
@@ -2118,16 +2142,114 @@ do -- COORDINATE
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Smokes the point in a color.
|
--- Create colored smoke the point. The smoke we last up to 5 min (DCS limitation) but you can optionally specify a shorter duration or stop it manually.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param Utilities.Utils#SMOKECOLOR SmokeColor
|
-- @param #number SmokeColor Color of smoke, e.g. `SMOKECOLOR.Green` for green smoke.
|
||||||
-- @param #string name (Optional) Name if you want to stop the smoke early (normal duration: 5mins)
|
-- @param #number Duration (Optional) Duration of the smoke in seconds. DCS stopps the smoke automatically after 5 min.
|
||||||
function COORDINATE:Smoke( SmokeColor, name )
|
-- @param #number Delay (Optional) Delay before the smoke is started in seconds.
|
||||||
self:F2( { SmokeColor } )
|
-- @param #string Name (Optional) Name if you want to stop the smoke early (normal duration: 5mins)
|
||||||
self.firename = name or "Smoke-"..math.random(1,100000)
|
-- @param #boolean Offset (Optional) If true, offset the smokle a bit.
|
||||||
|
-- @param #number Direction (Optional) If Offset is true this is the direction of the offset, 1-359 (degrees). Default random.
|
||||||
|
-- @param #number Distance (Optional) If Offset is true this is the distance of the offset in meters. Default random 10-20.
|
||||||
|
-- @return #COORDINATE self
|
||||||
|
function COORDINATE:Smoke( SmokeColor, Duration, Delay, Name, Offset,Direction,Distance)
|
||||||
|
self:F2( { SmokeColor, Name, Duration, Delay, Offset } )
|
||||||
|
|
||||||
|
SmokeColor=SmokeColor or SMOKECOLOR.Green
|
||||||
|
|
||||||
|
if Delay and Delay>0 then
|
||||||
|
self:ScheduleOnce(Delay, COORDINATE.Smoke, self, SmokeColor, Duration, 0, Name, Direction,Distance)
|
||||||
|
else
|
||||||
|
|
||||||
|
-- Create a name which is used to stop the smoke manually
|
||||||
|
self.firename = Name or "Smoke-"..math.random(1,100000)
|
||||||
|
|
||||||
|
-- Create smoke
|
||||||
|
if Offset or self.SmokeOffset then
|
||||||
|
local Angle = Direction or self:GetSmokeOffsetDirection()
|
||||||
|
local Distance = Distance or self:GetSmokeOffsetDistance()
|
||||||
|
local newpos = self:Translate(Distance,Angle,true,false)
|
||||||
|
local newvec3 = newpos:GetVec3()
|
||||||
|
trigger.action.smoke( newvec3, SmokeColor, self.firename )
|
||||||
|
else
|
||||||
trigger.action.smoke( self:GetVec3(), SmokeColor, self.firename )
|
trigger.action.smoke( self:GetVec3(), SmokeColor, self.firename )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Stop smoke
|
||||||
|
if Duration and Duration>0 then
|
||||||
|
self:ScheduleOnce(Duration, COORDINATE.StopSmoke, self, self.firename )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Get the offset direction when using `COORDINATE:Smoke()`.
|
||||||
|
-- @param #COORDINATE self
|
||||||
|
-- @return #number Direction in degrees.
|
||||||
|
function COORDINATE:GetSmokeOffsetDirection()
|
||||||
|
local direction = self.SmokeOffsetDirection or math.random(1,359)
|
||||||
|
return direction
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Set the offset direction when using `COORDINATE:Smoke()`.
|
||||||
|
-- @param #COORDINATE self
|
||||||
|
-- @param #number Direction (Optional) This is the direction of the offset, 1-359 (degrees). Default random.
|
||||||
|
-- @return #COORDINATE self
|
||||||
|
function COORDINATE:SetSmokeOffsetDirection(Direction)
|
||||||
|
if self then
|
||||||
|
self.SmokeOffsetDirection = Direction or math.random(1,359)
|
||||||
|
return self
|
||||||
|
else
|
||||||
|
COORDINATE.SmokeOffsetDirection = Direction or math.random(1,359)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Get the offset distance when using `COORDINATE:Smoke()`.
|
||||||
|
-- @param #COORDINATE self
|
||||||
|
-- @return #number Distance Distance in meters.
|
||||||
|
function COORDINATE:GetSmokeOffsetDistance()
|
||||||
|
local distance = self.SmokeOffsetDistance or math.random(10,20)
|
||||||
|
return distance
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Set the offset distance when using `COORDINATE:Smoke()`.
|
||||||
|
-- @param #COORDINATE self
|
||||||
|
-- @param #number Distance (Optional) This is the distance of the offset in meters. Default random 10-20.
|
||||||
|
-- @return #COORDINATE self
|
||||||
|
function COORDINATE:SetSmokeOffsetDistance(Distance)
|
||||||
|
if self then
|
||||||
|
self.SmokeOffsetDistance = Distance or math.random(10,20)
|
||||||
|
return self
|
||||||
|
else
|
||||||
|
COORDINATE.SmokeOffsetDistance = Distance or math.random(10,20)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Set the offset on when using `COORDINATE:Smoke()`.
|
||||||
|
-- @param #COORDINATE self
|
||||||
|
-- @return #COORDINATE self
|
||||||
|
function COORDINATE:SwitchSmokeOffsetOn()
|
||||||
|
if self then
|
||||||
|
self.SmokeOffset = true
|
||||||
|
return self
|
||||||
|
else
|
||||||
|
COORDINATE.SmokeOffset = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Set the offset off when using `COORDINATE:Smoke()`.
|
||||||
|
-- @param #COORDINATE self
|
||||||
|
-- @return #COORDINATE self
|
||||||
|
function COORDINATE:SwitchSmokeOffsetOff()
|
||||||
|
if self then
|
||||||
|
self.SmokeOffset = false
|
||||||
|
return self
|
||||||
|
else
|
||||||
|
COORDINATE.SmokeOffset = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--- Stops smoking the point in a color.
|
--- Stops smoking the point in a color.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param #string name (Optional) Name if you want to stop the smoke early (normal duration: 5mins)
|
-- @param #string name (Optional) Name if you want to stop the smoke early (normal duration: 5mins)
|
||||||
@@ -2137,49 +2259,83 @@ do -- COORDINATE
|
|||||||
|
|
||||||
--- Smoke the COORDINATE Green.
|
--- Smoke the COORDINATE Green.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
function COORDINATE:SmokeGreen()
|
-- @param #number Duration (Optional) Duration of the smoke in seconds. DCS stopps the smoke automatically after 5 min.
|
||||||
self:F2()
|
-- @param #number Delay (Optional) Delay before the smoke is started in seconds.
|
||||||
self:Smoke( SMOKECOLOR.Green )
|
-- @return #COORDINATE self
|
||||||
|
function COORDINATE:SmokeGreen(Duration, Delay)
|
||||||
|
self:Smoke( SMOKECOLOR.Green, Duration, Delay )
|
||||||
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Smoke the COORDINATE Red.
|
--- Smoke the COORDINATE Red.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
function COORDINATE:SmokeRed()
|
-- @param #number Duration (Optional) Duration of the smoke in seconds. DCS stopps the smoke automatically after 5 min.
|
||||||
self:F2()
|
-- @param #number Delay (Optional) Delay before the smoke is started in seconds.
|
||||||
self:Smoke( SMOKECOLOR.Red )
|
-- @return #COORDINATE self
|
||||||
|
function COORDINATE:SmokeRed(Duration, Delay)
|
||||||
|
self:Smoke( SMOKECOLOR.Red, Duration, Delay )
|
||||||
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Smoke the COORDINATE White.
|
--- Smoke the COORDINATE White.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
function COORDINATE:SmokeWhite()
|
-- @param #number Duration (Optional) Duration of the smoke in seconds. DCS stopps the smoke automatically after 5 min.
|
||||||
self:F2()
|
-- @param #number Delay (Optional) Delay before the smoke is started in seconds.
|
||||||
self:Smoke( SMOKECOLOR.White )
|
-- @return #COORDINATE self
|
||||||
|
function COORDINATE:SmokeWhite(Duration, Delay)
|
||||||
|
self:Smoke( SMOKECOLOR.White, Duration, Delay )
|
||||||
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Smoke the COORDINATE Orange.
|
--- Smoke the COORDINATE Orange.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
function COORDINATE:SmokeOrange()
|
-- @param #number Duration (Optional) Duration of the smoke in seconds. DCS stopps the smoke automatically after 5 min.
|
||||||
self:F2()
|
-- @param #number Delay (Optional) Delay before the smoke is started in seconds.
|
||||||
self:Smoke( SMOKECOLOR.Orange )
|
-- @return #COORDINATE self
|
||||||
|
function COORDINATE:SmokeOrange(Duration, Delay)
|
||||||
|
self:Smoke( SMOKECOLOR.Orange, Duration, Delay )
|
||||||
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Smoke the COORDINATE Blue.
|
--- Smoke the COORDINATE Blue.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
function COORDINATE:SmokeBlue()
|
-- @param #number Duration (Optional) Duration of the smoke in seconds. DCS stopps the smoke automatically after 5 min.
|
||||||
self:F2()
|
-- @param #number Delay (Optional) Delay before the smoke is started in seconds.
|
||||||
self:Smoke( SMOKECOLOR.Blue )
|
-- @return #COORDINATE self
|
||||||
|
function COORDINATE:SmokeBlue(Duration, Delay)
|
||||||
|
self:Smoke( SMOKECOLOR.Blue, Duration, Delay )
|
||||||
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Big smoke and fire at the coordinate.
|
--- Big smoke and fire at the coordinate.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param Utilities.Utils#BIGSMOKEPRESET preset Smoke preset (1=small smoke and fire, 2=medium smoke and fire, 3=large smoke and fire, 4=huge smoke and fire, 5=small smoke, 6=medium smoke, 7=large smoke, 8=huge smoke).
|
-- @param #number Preset Smoke preset (1=small smoke and fire, 2=medium smoke and fire, 3=large smoke and fire, 4=huge smoke and fire, 5=small smoke, 6=medium smoke, 7=large smoke, 8=huge smoke).
|
||||||
-- @param #number density (Optional) Smoke density. Number in [0,...,1]. Default 0.5.
|
-- @param #number Density (Optional) Smoke density. Number in [0,...,1]. Default 0.5.
|
||||||
-- @param #string name (Optional) Name of the fire to stop it later again if not using the same COORDINATE object. Defaults to "Fire-" plus a random 5-digit-number.
|
-- @param #number Duration (Optional) Duration of the smoke and fire in seconds.
|
||||||
function COORDINATE:BigSmokeAndFire( preset, density, name )
|
-- @param #number Delay (Optional) Delay before the smoke and fire is started in seconds.
|
||||||
self:F2( { preset=preset, density=density } )
|
-- @param #string Name (Optional) Name of the fire to stop it later again if not using the same COORDINATE object. Defaults to "Fire-" plus a random 5-digit-number.
|
||||||
density=density or 0.5
|
-- @return #COORDINATE self
|
||||||
self.firename = name or "Fire-"..math.random(1,10000)
|
function COORDINATE:BigSmokeAndFire( Preset, Density, Duration, Delay, Name )
|
||||||
trigger.action.effectSmokeBig( self:GetVec3(), preset, density, self.firename )
|
self:F2( { preset=Preset, density=Density } )
|
||||||
|
|
||||||
|
Preset=Preset or BIGSMOKEPRESET.SmallSmokeAndFire
|
||||||
|
Density=Density or 0.5
|
||||||
|
|
||||||
|
if Delay and Delay>0 then
|
||||||
|
self:ScheduleOnce(Delay, COORDINATE.BigSmokeAndFire, self, Preset, Density, Duration, 0, Name)
|
||||||
|
else
|
||||||
|
|
||||||
|
self.firename = Name or "Fire-"..math.random(1,10000)
|
||||||
|
|
||||||
|
trigger.action.effectSmokeBig( self:GetVec3(), Preset, Density, self.firename )
|
||||||
|
|
||||||
|
-- Stop smoke
|
||||||
|
if Duration and Duration>0 then
|
||||||
|
self:ScheduleOnce(Duration, COORDINATE.StopBigSmokeAndFire, self, self.firename )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Stop big smoke and fire at the coordinate.
|
--- Stop big smoke and fire at the coordinate.
|
||||||
@@ -2192,82 +2348,98 @@ do -- COORDINATE
|
|||||||
|
|
||||||
--- Small smoke and fire at the coordinate.
|
--- Small smoke and fire at the coordinate.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param #number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
-- @param #number Density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
||||||
-- @param #string name (Optional) Name of the fire to stop it later again if not using the same COORDINATE object. Defaults to "Fire-" plus a random 5-digit-number.
|
-- @param #number Duration (Optional) Duration of the smoke and fire in seconds.
|
||||||
function COORDINATE:BigSmokeAndFireSmall( density, name )
|
-- @param #number Delay (Optional) Delay before the smoke and fire is started in seconds.
|
||||||
self:F2( { density=density } )
|
-- @param #string Name (Optional) Name of the fire to stop it later again if not using the same COORDINATE object. Defaults to "Fire-" plus a random 5-digit-number.
|
||||||
density=density or 0.5
|
-- @return #COORDINATE self
|
||||||
self:BigSmokeAndFire(BIGSMOKEPRESET.SmallSmokeAndFire, density, name)
|
function COORDINATE:BigSmokeAndFireSmall( Density, Duration, Delay, Name )
|
||||||
|
self:BigSmokeAndFire(BIGSMOKEPRESET.SmallSmokeAndFire, Density, Duration, Delay, Name)
|
||||||
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Medium smoke and fire at the coordinate.
|
--- Medium smoke and fire at the coordinate.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param #number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
-- @param #number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
||||||
|
-- @param #number Duration (Optional) Duration of the smoke and fire in seconds.
|
||||||
|
-- @param #number Delay (Optional) Delay before the smoke and fire is started in seconds.
|
||||||
-- @param #string name (Optional) Name of the fire to stop it later again if not using the same COORDINATE object. Defaults to "Fire-" plus a random 5-digit-number.
|
-- @param #string name (Optional) Name of the fire to stop it later again if not using the same COORDINATE object. Defaults to "Fire-" plus a random 5-digit-number.
|
||||||
function COORDINATE:BigSmokeAndFireMedium( density, name )
|
-- @return #COORDINATE self
|
||||||
self:F2( { density=density } )
|
function COORDINATE:BigSmokeAndFireMedium( Density, Duration, Delay, Name )
|
||||||
density=density or 0.5
|
self:BigSmokeAndFire(BIGSMOKEPRESET.MediumSmokeAndFire, Density, Duration, Delay, Name)
|
||||||
self:BigSmokeAndFire(BIGSMOKEPRESET.MediumSmokeAndFire, density, name)
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Large smoke and fire at the coordinate.
|
--- Large smoke and fire at the coordinate.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param #number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
-- @param #number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
||||||
|
-- @param #number Duration (Optional) Duration of the smoke and fire in seconds.
|
||||||
|
-- @param #number Delay (Optional) Delay before the smoke and fire is started in seconds.
|
||||||
-- @param #string name (Optional) Name of the fire to stop it later again if not using the same COORDINATE object. Defaults to "Fire-" plus a random 5-digit-number.
|
-- @param #string name (Optional) Name of the fire to stop it later again if not using the same COORDINATE object. Defaults to "Fire-" plus a random 5-digit-number.
|
||||||
function COORDINATE:BigSmokeAndFireLarge( density, name )
|
-- @return #COORDINATE self
|
||||||
self:F2( { density=density } )
|
function COORDINATE:BigSmokeAndFireLarge( Density, Duration, Delay, Name )
|
||||||
density=density or 0.5
|
self:BigSmokeAndFire(BIGSMOKEPRESET.LargeSmokeAndFire, Density, Duration, Delay, Name)
|
||||||
self:BigSmokeAndFire(BIGSMOKEPRESET.LargeSmokeAndFire, density, name)
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Huge smoke and fire at the coordinate.
|
--- Huge smoke and fire at the coordinate.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param #number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
-- @param #number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
||||||
|
-- @param #number Duration (Optional) Duration of the smoke and fire in seconds.
|
||||||
|
-- @param #number Delay (Optional) Delay before the smoke and fire is started in seconds.
|
||||||
-- @param #string name (Optional) Name of the fire to stop it later again if not using the same COORDINATE object. Defaults to "Fire-" plus a random 5-digit-number.
|
-- @param #string name (Optional) Name of the fire to stop it later again if not using the same COORDINATE object. Defaults to "Fire-" plus a random 5-digit-number.
|
||||||
function COORDINATE:BigSmokeAndFireHuge( density, name )
|
-- @return #COORDINATE self
|
||||||
self:F2( { density=density } )
|
function COORDINATE:BigSmokeAndFireHuge( Density, Duration, Delay, Name )
|
||||||
density=density or 0.5
|
self:BigSmokeAndFire(BIGSMOKEPRESET.HugeSmokeAndFire, Density, Duration, Delay, Name)
|
||||||
self:BigSmokeAndFire(BIGSMOKEPRESET.HugeSmokeAndFire, density, name)
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Small smoke at the coordinate.
|
--- Small smoke at the coordinate.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param #number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
-- @param #number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
||||||
|
-- @param #number Duration (Optional) Duration of the smoke and fire in seconds.
|
||||||
|
-- @param #number Delay (Optional) Delay before the smoke and fire is started in seconds.
|
||||||
-- @param #string name (Optional) Name of the fire to stop it later again if not using the same COORDINATE object. Defaults to "Fire-" plus a random 5-digit-number.
|
-- @param #string name (Optional) Name of the fire to stop it later again if not using the same COORDINATE object. Defaults to "Fire-" plus a random 5-digit-number.
|
||||||
function COORDINATE:BigSmokeSmall( density, name )
|
-- @return #COORDINATE self
|
||||||
self:F2( { density=density } )
|
function COORDINATE:BigSmokeSmall( Density, Duration, Delay, Name )
|
||||||
density=density or 0.5
|
self:BigSmokeAndFire(BIGSMOKEPRESET.SmallSmoke, Density, Duration, Delay, Name)
|
||||||
self:BigSmokeAndFire(BIGSMOKEPRESET.SmallSmoke, density, name)
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Medium smoke at the coordinate.
|
--- Medium smoke at the coordinate.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
-- @param number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
||||||
|
-- @param #number Duration (Optional) Duration of the smoke and fire in seconds.
|
||||||
|
-- @param #number Delay (Optional) Delay before the smoke and fire is started in seconds.
|
||||||
-- @param #string name (Optional) Name of the fire to stop it later again if not using the same COORDINATE object. Defaults to "Fire-" plus a random 5-digit-number.
|
-- @param #string name (Optional) Name of the fire to stop it later again if not using the same COORDINATE object. Defaults to "Fire-" plus a random 5-digit-number.
|
||||||
function COORDINATE:BigSmokeMedium( density, name )
|
-- @return #COORDINATE self
|
||||||
self:F2( { density=density } )
|
function COORDINATE:BigSmokeMedium( Density, Duration, Delay, Name )
|
||||||
density=density or 0.5
|
self:BigSmokeAndFire(BIGSMOKEPRESET.MediumSmoke, Density, Duration, Delay, Name)
|
||||||
self:BigSmokeAndFire(BIGSMOKEPRESET.MediumSmoke, density, name)
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Large smoke at the coordinate.
|
--- Large smoke at the coordinate.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param #number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
-- @param #number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
||||||
|
-- @param #number Duration (Optional) Duration of the smoke and fire in seconds.
|
||||||
|
-- @param #number Delay (Optional) Delay before the smoke and fire is started in seconds.
|
||||||
-- @param #string name (Optional) Name of the fire to stop it later again if not using the same COORDINATE object. Defaults to "Fire-" plus a random 5-digit-number.
|
-- @param #string name (Optional) Name of the fire to stop it later again if not using the same COORDINATE object. Defaults to "Fire-" plus a random 5-digit-number.
|
||||||
function COORDINATE:BigSmokeLarge( density, name )
|
-- @return #COORDINATE self
|
||||||
self:F2( { density=density } )
|
function COORDINATE:BigSmokeLarge( Density, Duration, Delay, Name )
|
||||||
density=density or 0.5
|
self:BigSmokeAndFire(BIGSMOKEPRESET.LargeSmoke, Density, Duration, Delay, Name)
|
||||||
self:BigSmokeAndFire(BIGSMOKEPRESET.LargeSmoke, density,name)
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Huge smoke at the coordinate.
|
--- Huge smoke at the coordinate.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param #number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
-- @param #number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
||||||
|
-- @param #number Duration (Optional) Duration of the smoke and fire in seconds.
|
||||||
|
-- @param #number Delay (Optional) Delay before the smoke and fire is started in seconds.
|
||||||
-- @param #string name (Optional) Name of the fire to stop it later again if not using the same COORDINATE object. Defaults to "Fire-" plus a random 5-digit-number.
|
-- @param #string name (Optional) Name of the fire to stop it later again if not using the same COORDINATE object. Defaults to "Fire-" plus a random 5-digit-number.
|
||||||
function COORDINATE:BigSmokeHuge( density, name )
|
-- @return #COORDINATE self
|
||||||
self:F2( { density=density } )
|
function COORDINATE:BigSmokeHuge( Density, Duration, Delay, Name )
|
||||||
density=density or 0.5
|
self:BigSmokeAndFire(BIGSMOKEPRESET.HugeSmoke, Density, Duration, Delay, Name)
|
||||||
self:BigSmokeAndFire(BIGSMOKEPRESET.HugeSmoke, density,name)
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Flares the point in a color.
|
--- Flares the point in a color.
|
||||||
@@ -2921,8 +3093,10 @@ do -- COORDINATE
|
|||||||
local sunrise=UTILS.GetSunRiseAndSet(DayOfYear, Latitude, Longitude, true, Tdiff)
|
local sunrise=UTILS.GetSunRiseAndSet(DayOfYear, Latitude, Longitude, true, Tdiff)
|
||||||
local sunset=UTILS.GetSunRiseAndSet(DayOfYear, Latitude, Longitude, false, Tdiff)
|
local sunset=UTILS.GetSunRiseAndSet(DayOfYear, Latitude, Longitude, false, Tdiff)
|
||||||
|
|
||||||
|
if type(sunrise) == "string" or type(sunset) == "string" then
|
||||||
if sunrise == "N/R" then return false end
|
if sunrise == "N/R" then return false end
|
||||||
if sunrise == "N/S" then return true end
|
if sunset == "N/S" then return true end
|
||||||
|
end
|
||||||
|
|
||||||
local time=UTILS.ClockToSeconds(clock)
|
local time=UTILS.ClockToSeconds(clock)
|
||||||
|
|
||||||
@@ -2941,6 +3115,11 @@ do -- COORDINATE
|
|||||||
-- Todays sun set in sec.
|
-- Todays sun set in sec.
|
||||||
local sunset=self:GetSunset(true)
|
local sunset=self:GetSunset(true)
|
||||||
|
|
||||||
|
if type(sunrise) == "string" or type(sunset) == "string" then
|
||||||
|
if sunrise == "N/R" then return false end
|
||||||
|
if sunset == "N/S" then return true end
|
||||||
|
end
|
||||||
|
|
||||||
-- Seconds passed since midnight.
|
-- Seconds passed since midnight.
|
||||||
local time=UTILS.SecondsOfToday()
|
local time=UTILS.SecondsOfToday()
|
||||||
|
|
||||||
@@ -3639,6 +3818,25 @@ do -- COORDINATE
|
|||||||
return COORDINATE:NewFromVec3( self:GetRandomVec3InRadius( OuterRadius, InnerRadius ) )
|
return COORDINATE:NewFromVec3( self:GetRandomVec3InRadius( OuterRadius, InnerRadius ) )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Search for clear zones in a given area. A powerful and efficient function using Disposition to find clear areas for spawning ground units avoiding trees, water and map scenery.
|
||||||
|
-- @param #number SearchRadius Radius of the search area.
|
||||||
|
-- @param #number PosRadius Required clear radius around each position.
|
||||||
|
-- @param #number NumPositions Number of positions to find.
|
||||||
|
-- @return #table A table of Core.Point#COORDINATE that are clear of map objects within the given PosRadius. nil if no positions are found.
|
||||||
|
function COORDINATE:GetSimpleZones(SearchRadius, PosRadius, NumPositions)
|
||||||
|
local clearPositions = UTILS.GetSimpleZones(self:GetVec3(), SearchRadius, PosRadius, NumPositions)
|
||||||
|
if clearPositions and #clearPositions > 0 then
|
||||||
|
local coords = {}
|
||||||
|
for _, pos in pairs(clearPositions) do
|
||||||
|
local coord = COORDINATE:NewFromVec2(pos)
|
||||||
|
table.insert(coords, coord)
|
||||||
|
end
|
||||||
|
return coords
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
do
|
do
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ function SCHEDULEDISPATCHER:AddSchedule( Scheduler, ScheduleFunction, ScheduleAr
|
|||||||
local Name = Info.name or "?"
|
local Name = Info.name or "?"
|
||||||
|
|
||||||
local ErrorHandler = function( errmsg )
|
local ErrorHandler = function( errmsg )
|
||||||
env.info( "Error in timer function: " .. errmsg )
|
env.info( "Error in timer function: " .. errmsg or "" )
|
||||||
if BASE.Debug ~= nil then
|
if BASE.Debug ~= nil then
|
||||||
env.info( BASE.Debug.traceback() )
|
env.info( BASE.Debug.traceback() )
|
||||||
end
|
end
|
||||||
@@ -326,7 +326,7 @@ function SCHEDULEDISPATCHER:Stop( Scheduler, CallID )
|
|||||||
local Schedule = self.Schedule[Scheduler][CallID] -- #SCHEDULEDISPATCHER.ScheduleData
|
local Schedule = self.Schedule[Scheduler][CallID] -- #SCHEDULEDISPATCHER.ScheduleData
|
||||||
|
|
||||||
-- Only stop when there is a ScheduleID defined for the CallID. So, when the scheduler was stopped before, do nothing.
|
-- Only stop when there is a ScheduleID defined for the CallID. So, when the scheduler was stopped before, do nothing.
|
||||||
if Schedule.ScheduleID then
|
if Schedule and Schedule.ScheduleID then
|
||||||
|
|
||||||
self:T( string.format( "SCHEDULEDISPATCHER stopping scheduler CallID=%s, ScheduleID=%s", tostring( CallID ), tostring( Schedule.ScheduleID ) ) )
|
self:T( string.format( "SCHEDULEDISPATCHER stopping scheduler CallID=%s, ScheduleID=%s", tostring( CallID ), tostring( Schedule.ScheduleID ) ) )
|
||||||
|
|
||||||
|
|||||||
@@ -959,6 +959,25 @@ do -- SET_BASE
|
|||||||
return ObjectNames
|
return ObjectNames
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Get a *new* set table that only contains alive objects.
|
||||||
|
-- @param #SET_BASE self
|
||||||
|
-- @return #table Set table of alive objects.
|
||||||
|
function SET_BASE:GetAliveSet()
|
||||||
|
--self:F2()
|
||||||
|
|
||||||
|
local AliveSet = {}
|
||||||
|
-- Clean the Set before returning with only the alive Objects.
|
||||||
|
for ObjectName, Object in pairs( self.Set ) do
|
||||||
|
if Object then
|
||||||
|
if Object:IsAlive() then
|
||||||
|
AliveSet[#AliveSet+1] = Object
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return AliveSet or {}
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
do
|
do
|
||||||
@@ -1125,25 +1144,25 @@ do
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get a *new* set that only contains alive groups.
|
--- Get a *new* set table that only contains alive groups.
|
||||||
-- @param #SET_GROUP self
|
-- @param #SET_GROUP self
|
||||||
-- @return #SET_GROUP Set of alive groups.
|
-- @return #table Set of alive groups.
|
||||||
function SET_GROUP:GetAliveSet()
|
function SET_GROUP:GetAliveSet()
|
||||||
--self:F2()
|
--self:F2()
|
||||||
|
|
||||||
local AliveSet = SET_GROUP:New()
|
--local AliveSet = SET_GROUP:New()
|
||||||
|
local AliveSet = {}
|
||||||
-- Clean the Set before returning with only the alive Groups.
|
-- Clean the Set before returning with only the alive Groups.
|
||||||
for GroupName, GroupObject in pairs( self.Set ) do
|
for GroupName, GroupObject in pairs( self.Set ) do
|
||||||
local GroupObject = GroupObject -- Wrapper.Group#GROUP
|
local GroupObject = GroupObject -- Wrapper.Group#GROUP
|
||||||
if GroupObject then
|
if GroupObject then
|
||||||
if GroupObject:IsAlive() then
|
if GroupObject:IsAlive() then
|
||||||
AliveSet:Add( GroupName, GroupObject )
|
AliveSet[GroupName] = GroupObject
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return AliveSet.Set or {}
|
return AliveSet or {}
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Returns a report of of unit types.
|
--- Returns a report of of unit types.
|
||||||
@@ -2595,7 +2614,7 @@ do -- SET_UNIT
|
|||||||
|
|
||||||
--- Gets the alive set.
|
--- Gets the alive set.
|
||||||
-- @param #SET_UNIT self
|
-- @param #SET_UNIT self
|
||||||
-- @return #table Table of SET objects
|
-- @return #table Table of alive UNIT objects
|
||||||
-- @return #SET_UNIT AliveSet
|
-- @return #SET_UNIT AliveSet
|
||||||
function SET_UNIT:GetAliveSet()
|
function SET_UNIT:GetAliveSet()
|
||||||
|
|
||||||
@@ -2603,10 +2622,8 @@ do -- SET_UNIT
|
|||||||
|
|
||||||
-- Clean the Set before returning with only the alive Groups.
|
-- Clean the Set before returning with only the alive Groups.
|
||||||
for GroupName, GroupObject in pairs(self.Set) do
|
for GroupName, GroupObject in pairs(self.Set) do
|
||||||
local GroupObject=GroupObject --Wrapper.Client#CLIENT
|
|
||||||
|
|
||||||
if GroupObject and GroupObject:IsAlive() then
|
if GroupObject and GroupObject:IsAlive() then
|
||||||
AliveSet:Add(GroupName, GroupObject)
|
AliveSet[GroupName] = GroupObject
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -4784,18 +4801,16 @@ do -- SET_CLIENT
|
|||||||
-- @return #table Table of SET objects
|
-- @return #table Table of SET objects
|
||||||
function SET_CLIENT:GetAliveSet()
|
function SET_CLIENT:GetAliveSet()
|
||||||
|
|
||||||
local AliveSet = SET_CLIENT:New()
|
local AliveSet = {}
|
||||||
|
|
||||||
-- Clean the Set before returning with only the alive Groups.
|
-- Clean the Set before returning with only the alive Groups.
|
||||||
for GroupName, GroupObject in pairs(self.Set) do
|
for GroupName, GroupObject in pairs(self.Set) do
|
||||||
local GroupObject=GroupObject --Wrapper.Client#CLIENT
|
|
||||||
|
|
||||||
if GroupObject and GroupObject:IsAlive() then
|
if GroupObject and GroupObject:IsAlive() then
|
||||||
AliveSet:Add(GroupName, GroupObject)
|
AliveSet[GroupName] = GroupObject
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return AliveSet.Set or {}
|
return AliveSet or {}
|
||||||
end
|
end
|
||||||
|
|
||||||
--- [User] Add a custom condition function.
|
--- [User] Add a custom condition function.
|
||||||
|
|||||||
@@ -149,6 +149,7 @@ function SPAWNSTATIC:NewFromStatic(SpawnTemplateName, SpawnCountryID)
|
|||||||
self.CategoryID = CategoryID
|
self.CategoryID = CategoryID
|
||||||
self.CoalitionID = CoalitionID
|
self.CoalitionID = CoalitionID
|
||||||
self.SpawnIndex = 0
|
self.SpawnIndex = 0
|
||||||
|
self.StaticCopyFrom = SpawnTemplateName
|
||||||
else
|
else
|
||||||
error( "SPAWNSTATIC:New: There is no static declared in the mission editor with SpawnTemplatePrefix = '" .. tostring(SpawnTemplateName) .. "'" )
|
error( "SPAWNSTATIC:New: There is no static declared in the mission editor with SpawnTemplatePrefix = '" .. tostring(SpawnTemplateName) .. "'" )
|
||||||
end
|
end
|
||||||
@@ -302,12 +303,16 @@ end
|
|||||||
-- @param #number CallsignID Callsign ID. Default 1 (="London").
|
-- @param #number CallsignID Callsign ID. Default 1 (="London").
|
||||||
-- @param #number Frequency Frequency in MHz. Default 127.5 MHz.
|
-- @param #number Frequency Frequency in MHz. Default 127.5 MHz.
|
||||||
-- @param #number Modulation Modulation 0=AM, 1=FM.
|
-- @param #number Modulation Modulation 0=AM, 1=FM.
|
||||||
|
-- @param #boolean DynamicSpawns If true, allow Dynamic Spawns
|
||||||
|
-- @param #boolean DynamicHotStarts If true, and DynamicSpawns is true, then allow Dynamic Spawns with hot starts.
|
||||||
-- @return #SPAWNSTATIC self
|
-- @return #SPAWNSTATIC self
|
||||||
function SPAWNSTATIC:InitFARP(CallsignID, Frequency, Modulation)
|
function SPAWNSTATIC:InitFARP(CallsignID, Frequency, Modulation, DynamicSpawns,DynamicHotStarts)
|
||||||
self.InitFarp=true
|
self.InitFarp=true
|
||||||
self.InitFarpCallsignID=CallsignID or 1
|
self.InitFarpCallsignID=CallsignID or 1
|
||||||
self.InitFarpFreq=Frequency or 127.5
|
self.InitFarpFreq=Frequency or 127.5
|
||||||
self.InitFarpModu=Modulation or 0
|
self.InitFarpModu=Modulation or 0
|
||||||
|
self.InitFarpDynamicSpawns = DynamicSpawns
|
||||||
|
self.InitFarpDynamicHotStarts = (DynamicSpawns == true and DynamicHotStarts == true) and true or nil
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -459,7 +464,8 @@ end
|
|||||||
function SPAWNSTATIC:SpawnFromZone(Zone, Heading, NewName)
|
function SPAWNSTATIC:SpawnFromZone(Zone, Heading, NewName)
|
||||||
|
|
||||||
-- Spawn the new static at the center of the zone.
|
-- Spawn the new static at the center of the zone.
|
||||||
local Static = self:SpawnFromPointVec2( Zone:GetPointVec2(), Heading, NewName )
|
--local Static = self:SpawnFromPointVec2( Zone:GetPointVec2(), Heading, NewName )
|
||||||
|
local Static = self:SpawnFromCoordinate(Zone:GetCoordinate(), Heading, NewName)
|
||||||
|
|
||||||
return Static
|
return Static
|
||||||
end
|
end
|
||||||
@@ -550,12 +556,20 @@ function SPAWNSTATIC:_SpawnStatic(Template, CountryID)
|
|||||||
TemplateGroup.y=Template.y
|
TemplateGroup.y=Template.y
|
||||||
TemplateGroup.name=Template.name
|
TemplateGroup.name=Template.name
|
||||||
|
|
||||||
|
if self.InitFarpDynamicSpawns == true then
|
||||||
|
TemplateGroup.units[1].dynamicSpawn = true
|
||||||
|
if self.InitFarpDynamicHotStarts == true then
|
||||||
|
TemplateGroup.units[1].allowHotStart = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
self:T("Spawning FARP")
|
self:T("Spawning FARP")
|
||||||
self:T({Template=Template})
|
self:T({Template=Template})
|
||||||
self:T({TemplateGroup=TemplateGroup})
|
self:T({TemplateGroup=TemplateGroup})
|
||||||
|
|
||||||
-- ED's dirty way to spawn FARPS.
|
-- ED's dirty way to spawn FARPS.
|
||||||
Static=coalition.addGroup(CountryID, -1, TemplateGroup)
|
Static=coalition.addGroup(CountryID, -1, TemplateGroup)
|
||||||
|
--Static=coalition.addStaticObject(CountryID, Template)
|
||||||
|
|
||||||
-- Currently DCS 2.8 does not trigger birth events if FARPS are spawned!
|
-- Currently DCS 2.8 does not trigger birth events if FARPS are spawned!
|
||||||
-- We create such an event. The airbase is registered in Core.Event
|
-- We create such an event. The airbase is registered in Core.Event
|
||||||
@@ -595,5 +609,18 @@ function SPAWNSTATIC:_SpawnStatic(Template, CountryID)
|
|||||||
self:ScheduleOnce(0.3, self.SpawnFunctionHook, mystatic, unpack(self.SpawnFunctionArguments))
|
self:ScheduleOnce(0.3, self.SpawnFunctionHook, mystatic, unpack(self.SpawnFunctionArguments))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if self.StaticCopyFrom ~= nil then
|
||||||
|
mystatic.StaticCopyFrom = self.StaticCopyFrom
|
||||||
|
if not _DATABASE.Templates.Statics[Template.name] then
|
||||||
|
local TemplateGroup={}
|
||||||
|
TemplateGroup.units={}
|
||||||
|
TemplateGroup.units[1]=Template
|
||||||
|
TemplateGroup.x=Template.x
|
||||||
|
TemplateGroup.y=Template.y
|
||||||
|
TemplateGroup.name=Template.name
|
||||||
|
_DATABASE:_RegisterStaticTemplate( TemplateGroup, self.CoalitionID, self.CategoryID, CountryID )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return mystatic
|
return mystatic
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -534,6 +534,19 @@ function ZONE_BASE:GetZoneProbability()
|
|||||||
return self.ZoneProbability
|
return self.ZoneProbability
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Get the coordinate on the radius of the zone nearest to Outsidecoordinate. Useto e.g. find an ingress point.
|
||||||
|
-- @param #ZONE_BASE self
|
||||||
|
-- @param Core.Point#COORDINATE Outsidecoordinate The coordinate outside of the zone from where to look.
|
||||||
|
-- @return Core.Point#COORDINATE CoordinateOnRadius
|
||||||
|
function ZONE_BASE:FindNearestCoordinateOnRadius(Outsidecoordinate)
|
||||||
|
local Vec1 = self:GetVec2()
|
||||||
|
local Radius = self:GetRadius()
|
||||||
|
local Vec2 = Outsidecoordinate:GetVec2()
|
||||||
|
local Point = UTILS.FindNearestPointOnCircle(Vec1,Radius,Vec2)
|
||||||
|
local rc = COORDINATE:NewFromVec2(Point)
|
||||||
|
return rc
|
||||||
|
end
|
||||||
|
|
||||||
--- Get the zone taking into account the randomization probability of a zone to be selected.
|
--- Get the zone taking into account the randomization probability of a zone to be selected.
|
||||||
-- @param #ZONE_BASE self
|
-- @param #ZONE_BASE self
|
||||||
-- @return #ZONE_BASE The zone is selected taking into account the randomization probability factor.
|
-- @return #ZONE_BASE The zone is selected taking into account the randomization probability factor.
|
||||||
@@ -1509,6 +1522,26 @@ function ZONE_RADIUS:IsVec3InZone( Vec3 )
|
|||||||
return InZone
|
return InZone
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Search for clear ground spawn zones within this zone. A powerful and efficient function using Disposition to find clear areas for spawning ground units avoiding trees, water and map scenery.
|
||||||
|
-- @param #ZONE_RADIUS self
|
||||||
|
-- @param #number PosRadius Required clear radius around each position.
|
||||||
|
-- @param #number NumPositions Number of positions to find.
|
||||||
|
-- @return #table A table of DCS#Vec2 positions that are clear of map objects within the given PosRadius. nil if no clear positions are found.
|
||||||
|
function ZONE_RADIUS:GetClearZonePositions(PosRadius, NumPositions)
|
||||||
|
return UTILS.GetClearZonePositions(self, PosRadius, NumPositions)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Search for a random clear ground spawn coordinate within this zone. A powerful and efficient function using Disposition to find clear areas for spawning ground units avoiding trees, water and map scenery.
|
||||||
|
-- @param #ZONE_RADIUS self
|
||||||
|
-- @param #number PosRadius (Optional) Required clear radius around each position. (Default is math.min(Radius/10, 200))
|
||||||
|
-- @param #number NumPositions (Optional) Number of positions to find. (Default 50)
|
||||||
|
-- @return Core.Point#COORDINATE A random coordinate for a clear zone. nil if no clear positions are found.
|
||||||
|
-- @return #number Assigned radius for the found zones. nil if no clear positions are found.
|
||||||
|
function ZONE_RADIUS:GetRandomClearZoneCoordinate(PosRadius, NumPositions)
|
||||||
|
return UTILS.GetRandomClearZoneCoordinate(self, PosRadius, NumPositions)
|
||||||
|
end
|
||||||
|
|
||||||
--- Returns a random Vec2 location within the zone.
|
--- Returns a random Vec2 location within the zone.
|
||||||
-- @param #ZONE_RADIUS self
|
-- @param #ZONE_RADIUS self
|
||||||
-- @param #number inner (Optional) Minimal distance from the center of the zone. Default is 0.
|
-- @param #number inner (Optional) Minimal distance from the center of the zone. Default is 0.
|
||||||
@@ -2487,6 +2520,26 @@ function ZONE_POLYGON_BASE:Flush()
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Search for clear ground spawn zones within this zone. A powerful and efficient function using Disposition to find clear areas for spawning ground units avoiding trees, water and map scenery.
|
||||||
|
-- @param #ZONE_POLYGON_BASE self
|
||||||
|
-- @param #number PosRadius Required clear radius around each position.
|
||||||
|
-- @param #number NumPositions Number of positions to find.
|
||||||
|
-- @return #table A table of DCS#Vec2 positions that are clear of map objects within the given PosRadius. nil if no clear positions are found.
|
||||||
|
function ZONE_POLYGON_BASE:GetClearZonePositions(PosRadius, NumPositions)
|
||||||
|
return UTILS.GetClearZonePositions(self, PosRadius, NumPositions)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Search for a random clear ground spawn coordinate within this zone. A powerful and efficient function using Disposition to find clear areas for spawning ground units avoiding trees, water and map scenery.
|
||||||
|
-- @param #ZONE_POLYGON_BASE self
|
||||||
|
-- @param #number PosRadius (Optional) Required clear radius around each position. (Default is math.min(Radius/10, 200))
|
||||||
|
-- @param #number NumPositions (Optional) Number of positions to find. (Default 50)
|
||||||
|
-- @return Core.Point#COORDINATE A random coordinate for a clear zone. nil if no clear positions are found.
|
||||||
|
-- @return #number Assigned radius for the found zones. nil if no clear positions are found.
|
||||||
|
function ZONE_POLYGON_BASE:GetRandomClearZoneCoordinate(PosRadius, NumPositions)
|
||||||
|
return UTILS.GetRandomClearZoneCoordinate(self, PosRadius, NumPositions)
|
||||||
|
end
|
||||||
|
|
||||||
--- Smokes the zone boundaries in a color.
|
--- Smokes the zone boundaries in a color.
|
||||||
-- @param #ZONE_POLYGON_BASE self
|
-- @param #ZONE_POLYGON_BASE self
|
||||||
-- @param #boolean UnBound If true, the tyres will be destroyed.
|
-- @param #boolean UnBound If true, the tyres will be destroyed.
|
||||||
@@ -3204,12 +3257,7 @@ function ZONE_POLYGON:Scan( ObjectCategories, UnitCategories )
|
|||||||
|
|
||||||
local vectors = self:GetBoundingSquare()
|
local vectors = self:GetBoundingSquare()
|
||||||
|
|
||||||
local minVec3 = {x=vectors.x1, y=0, z=vectors.y1}
|
local ZoneRadius = UTILS.VecDist2D({x=vectors.x1, y=vectors.y1}, {x=vectors.x2, y=vectors.y2})/2
|
||||||
local maxVec3 = {x=vectors.x2, y=0, z=vectors.y2}
|
|
||||||
|
|
||||||
local minmarkcoord = COORDINATE:NewFromVec3(minVec3)
|
|
||||||
local maxmarkcoord = COORDINATE:NewFromVec3(maxVec3)
|
|
||||||
local ZoneRadius = minmarkcoord:Get2DDistance(maxmarkcoord)/2
|
|
||||||
-- self:I("Scan Radius:" ..ZoneRadius)
|
-- self:I("Scan Radius:" ..ZoneRadius)
|
||||||
local CenterVec3 = self:GetCoordinate():GetVec3()
|
local CenterVec3 = self:GetCoordinate():GetVec3()
|
||||||
|
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ end -- env
|
|||||||
|
|
||||||
do -- radio
|
do -- radio
|
||||||
|
|
||||||
---@type radio
|
--@type radio
|
||||||
-- @field #radio.modulation modulation
|
-- @field #radio.modulation modulation
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Author: **Applevangelist**
|
-- ### Author: **Applevangelist**
|
||||||
-- Last Update Sept 2023
|
-- Last Update July 2025
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
-- @module Functional.AICSAR
|
-- @module Functional.AICSAR
|
||||||
@@ -57,6 +57,8 @@
|
|||||||
-- @field #number Speed Default speed setting for the helicopter FLIGHTGROUP is 100kn.
|
-- @field #number Speed Default speed setting for the helicopter FLIGHTGROUP is 100kn.
|
||||||
-- @field #boolean UseEventEject In case Event LandingAfterEjection isn't working, use set this to true.
|
-- @field #boolean UseEventEject In case Event LandingAfterEjection isn't working, use set this to true.
|
||||||
-- @field #number Delay In case of UseEventEject wait this long until we spawn a landed pilot.
|
-- @field #number Delay In case of UseEventEject wait this long until we spawn a landed pilot.
|
||||||
|
-- @field #boolean UseRescueZone If true, use a rescue zone and not the max distance to FARP/MASH
|
||||||
|
-- @field Core.Zone#ZONE_RADIUS RescueZone Use this zone as operational area for the AICSAR instance.
|
||||||
-- @extends Core.Fsm#FSM
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
|
|
||||||
@@ -153,10 +155,10 @@
|
|||||||
-- To set up AICSAR for SRS TTS output, add e.g. the following to your script:
|
-- To set up AICSAR for SRS TTS output, add e.g. the following to your script:
|
||||||
--
|
--
|
||||||
-- -- setup for google TTS, radio 243 AM, SRS server port 5002 with a google standard-quality voice (google cloud account required)
|
-- -- setup for google TTS, radio 243 AM, SRS server port 5002 with a google standard-quality voice (google cloud account required)
|
||||||
-- my_aicsar:SetSRSTTSRadio(true,"C:\\Program Files\\DCS-SimpleRadio-Standalone",243,radio.modulation.AM,5002,MSRS.Voices.Google.Standard.en_US_Standard_D,"en-US","female","C:\\Program Files\\DCS-SimpleRadio-Standalone\\google.json")
|
-- my_aicsar:SetSRSTTSRadio(true,"C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio",243,radio.modulation.AM,5002,MSRS.Voices.Google.Standard.en_US_Standard_D,"en-US","female","C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio\\google.json")
|
||||||
--
|
--
|
||||||
-- -- alternatively for MS Desktop TTS (voices need to be installed locally first!)
|
-- -- alternatively for MS Desktop TTS (voices need to be installed locally first!)
|
||||||
-- my_aicsar:SetSRSTTSRadio(true,"C:\\Program Files\\DCS-SimpleRadio-Standalone",243,radio.modulation.AM,5002,MSRS.Voices.Microsoft.Hazel,"en-GB","female")
|
-- my_aicsar:SetSRSTTSRadio(true,"C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio",243,radio.modulation.AM,5002,MSRS.Voices.Microsoft.Hazel,"en-GB","female")
|
||||||
--
|
--
|
||||||
-- -- define a different voice for the downed pilot(s)
|
-- -- define a different voice for the downed pilot(s)
|
||||||
-- my_aicsar:SetPilotTTSVoice(MSRS.Voices.Google.Standard.en_AU_Standard_D,"en-AU","male")
|
-- my_aicsar:SetPilotTTSVoice(MSRS.Voices.Google.Standard.en_AU_Standard_D,"en-AU","male")
|
||||||
@@ -177,7 +179,7 @@
|
|||||||
--
|
--
|
||||||
-- Switch on radio transmissions via **either** SRS **or** "normal" DCS radio e.g. like so:
|
-- Switch on radio transmissions via **either** SRS **or** "normal" DCS radio e.g. like so:
|
||||||
--
|
--
|
||||||
-- my_aicsar:SetSRSRadio(true,"C:\\Program Files\\DCS-SimpleRadio-Standalone",270,radio.modulation.AM,nil,5002)
|
-- my_aicsar:SetSRSRadio(true,"C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio",270,radio.modulation.AM,nil,5002)
|
||||||
--
|
--
|
||||||
-- or
|
-- or
|
||||||
--
|
--
|
||||||
@@ -191,7 +193,7 @@
|
|||||||
-- @field #AICSAR
|
-- @field #AICSAR
|
||||||
AICSAR = {
|
AICSAR = {
|
||||||
ClassName = "AICSAR",
|
ClassName = "AICSAR",
|
||||||
version = "0.1.16",
|
version = "0.1.18",
|
||||||
lid = "",
|
lid = "",
|
||||||
coalition = coalition.side.BLUE,
|
coalition = coalition.side.BLUE,
|
||||||
template = "",
|
template = "",
|
||||||
@@ -236,6 +238,8 @@ AICSAR = {
|
|||||||
Altitude = 1500,
|
Altitude = 1500,
|
||||||
UseEventEject = false,
|
UseEventEject = false,
|
||||||
Delay = 100,
|
Delay = 100,
|
||||||
|
UseRescueZone = false,
|
||||||
|
RescueZone = nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- TODO Messages
|
-- TODO Messages
|
||||||
@@ -304,8 +308,9 @@ AICSAR.RadioLength = {
|
|||||||
-- @param #string Helotemplate Helicopter template name.
|
-- @param #string Helotemplate Helicopter template name.
|
||||||
-- @param Wrapper.Airbase#AIRBASE FARP FARP object or Airbase from where to start.
|
-- @param Wrapper.Airbase#AIRBASE FARP FARP object or Airbase from where to start.
|
||||||
-- @param Core.Zone#ZONE MASHZone Zone where to drop pilots after rescue.
|
-- @param Core.Zone#ZONE MASHZone Zone where to drop pilots after rescue.
|
||||||
|
-- @param #number Helonumber Max number of alive Ai Helos at the same time. Defaults to three.
|
||||||
-- @return #AICSAR self
|
-- @return #AICSAR self
|
||||||
function AICSAR:New(Alias,Coalition,Pilottemplate,Helotemplate,FARP,MASHZone)
|
function AICSAR:New(Alias,Coalition,Pilottemplate,Helotemplate,FARP,MASHZone,Helonumber)
|
||||||
-- Inherit everything from FSM class.
|
-- Inherit everything from FSM class.
|
||||||
local self=BASE:Inherit(self, FSM:New())
|
local self=BASE:Inherit(self, FSM:New())
|
||||||
|
|
||||||
@@ -373,7 +378,7 @@ function AICSAR:New(Alias,Coalition,Pilottemplate,Helotemplate,FARP,MASHZone)
|
|||||||
|
|
||||||
-- limit number of available helos at the same time
|
-- limit number of available helos at the same time
|
||||||
self.limithelos = true
|
self.limithelos = true
|
||||||
self.helonumber = 3
|
self.helonumber = Helonumber or 3
|
||||||
|
|
||||||
-- localization
|
-- localization
|
||||||
self:InitLocalization()
|
self:InitLocalization()
|
||||||
@@ -524,10 +529,20 @@ function AICSAR:InitLocalization()
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- [User] Use a defined zone as area of operation and not the distance to FARP.
|
||||||
|
-- @param #AICSAR self
|
||||||
|
-- @param Core.Zone#ZONE Zone The operational zone to use. Downed pilots in this area will be rescued. Can be any known #ZONE type.
|
||||||
|
-- @return #AICSAR self
|
||||||
|
function AICSAR:SetUsingRescueZone(Zone)
|
||||||
|
self.UseRescueZone = true
|
||||||
|
self.RescueZone = Zone
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- [User] Switch sound output on and use SRS output for sound files.
|
--- [User] Switch sound output on and use SRS output for sound files.
|
||||||
-- @param #AICSAR self
|
-- @param #AICSAR self
|
||||||
-- @param #boolean OnOff Switch on (true) or off (false).
|
-- @param #boolean OnOff Switch on (true) or off (false).
|
||||||
-- @param #string Path Path to your SRS Server Component, e.g. "C:\\\\Program Files\\\\DCS-SimpleRadio-Standalone"
|
-- @param #string Path Path to your SRS Server External Audio Component, e.g. "C:\\\\Program Files\\\\DCS-SimpleRadio-Standalone\\\\ExternalAudio"
|
||||||
-- @param #number Frequency Defaults to 243 (guard)
|
-- @param #number Frequency Defaults to 243 (guard)
|
||||||
-- @param #number Modulation Radio modulation. Defaults to radio.modulation.AM
|
-- @param #number Modulation Radio modulation. Defaults to radio.modulation.AM
|
||||||
-- @param #string SoundPath Where to find the audio files. Defaults to nil, i.e. add messages via "Sound to..." in the Mission Editor.
|
-- @param #string SoundPath Where to find the audio files. Defaults to nil, i.e. add messages via "Sound to..." in the Mission Editor.
|
||||||
@@ -538,7 +553,7 @@ function AICSAR:SetSRSRadio(OnOff,Path,Frequency,Modulation,SoundPath,Port)
|
|||||||
self.SRSRadio = OnOff and true
|
self.SRSRadio = OnOff and true
|
||||||
self.SRSTTSRadio = false
|
self.SRSTTSRadio = false
|
||||||
self.SRSFrequency = Frequency or 243
|
self.SRSFrequency = Frequency or 243
|
||||||
self.SRSPath = Path or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone"
|
self.SRSPath = Path or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio"
|
||||||
self.SRS:SetLabel("ACSR")
|
self.SRS:SetLabel("ACSR")
|
||||||
self.SRS:SetCoalition(self.coalition)
|
self.SRS:SetCoalition(self.coalition)
|
||||||
self.SRSModulation = Modulation or radio.modulation.AM
|
self.SRSModulation = Modulation or radio.modulation.AM
|
||||||
@@ -556,7 +571,7 @@ end
|
|||||||
-- See `AICSAR:SetPilotTTSVoice()` and `AICSAR:SetOperatorTTSVoice()`
|
-- See `AICSAR:SetPilotTTSVoice()` and `AICSAR:SetOperatorTTSVoice()`
|
||||||
-- @param #AICSAR self
|
-- @param #AICSAR self
|
||||||
-- @param #boolean OnOff Switch on (true) or off (false).
|
-- @param #boolean OnOff Switch on (true) or off (false).
|
||||||
-- @param #string Path Path to your SRS Server Component, e.g. "E:\\\\Program Files\\\\DCS-SimpleRadio-Standalone"
|
-- @param #string Path Path to your SRS Server Component, e.g. "E:\\\\Program Files\\\\DCS-SimpleRadio-Standalone\\ExternalAudio"
|
||||||
-- @param #number Frequency (Optional) Defaults to 243 (guard)
|
-- @param #number Frequency (Optional) Defaults to 243 (guard)
|
||||||
-- @param #number Modulation (Optional) Radio modulation. Defaults to radio.modulation.AM
|
-- @param #number Modulation (Optional) Radio modulation. Defaults to radio.modulation.AM
|
||||||
-- @param #number Port (Optional) Port of the SRS, defaults to 5002.
|
-- @param #number Port (Optional) Port of the SRS, defaults to 5002.
|
||||||
@@ -570,7 +585,7 @@ function AICSAR:SetSRSTTSRadio(OnOff,Path,Frequency,Modulation,Port,Voice,Cultur
|
|||||||
self.SRSTTSRadio = OnOff and true
|
self.SRSTTSRadio = OnOff and true
|
||||||
self.SRSRadio = false
|
self.SRSRadio = false
|
||||||
self.SRSFrequency = Frequency or 243
|
self.SRSFrequency = Frequency or 243
|
||||||
self.SRSPath = Path or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone"
|
self.SRSPath = Path or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio"
|
||||||
self.SRSModulation = Modulation or radio.modulation.AM
|
self.SRSModulation = Modulation or radio.modulation.AM
|
||||||
self.SRSPort = Port or MSRS.port or 5002
|
self.SRSPort = Port or MSRS.port or 5002
|
||||||
if OnOff then
|
if OnOff then
|
||||||
@@ -693,7 +708,7 @@ function AICSAR:_EjectEventHandler(EventData)
|
|||||||
local _LandingPos = COORDINATE:NewFromVec3(_event.initiator:getPosition().p)
|
local _LandingPos = COORDINATE:NewFromVec3(_event.initiator:getPosition().p)
|
||||||
local _country = _event.initiator:getCountry()
|
local _country = _event.initiator:getCountry()
|
||||||
local _coalition = coalition.getCountryCoalition( _country )
|
local _coalition = coalition.getCountryCoalition( _country )
|
||||||
local data = UTILS.DeepCopy(EventData)
|
--local data = UTILS.DeepCopy(EventData)
|
||||||
Unit.destroy(_event.initiator) -- shagrat remove static Pilot model
|
Unit.destroy(_event.initiator) -- shagrat remove static Pilot model
|
||||||
self:ScheduleOnce(self.Delay,self._DelayedSpawnPilot,self,_LandingPos,_coalition)
|
self:ScheduleOnce(self.Delay,self._DelayedSpawnPilot,self,_LandingPos,_coalition)
|
||||||
end
|
end
|
||||||
@@ -709,6 +724,13 @@ end
|
|||||||
function AICSAR:_DelayedSpawnPilot(_LandingPos,_coalition)
|
function AICSAR:_DelayedSpawnPilot(_LandingPos,_coalition)
|
||||||
|
|
||||||
local distancetofarp = _LandingPos:Get2DDistance(self.farp:GetCoordinate())
|
local distancetofarp = _LandingPos:Get2DDistance(self.farp:GetCoordinate())
|
||||||
|
if self.UseRescueZone == true and self.RescueZone ~= nil then
|
||||||
|
if self.RescueZone:IsCoordinateInZone(_LandingPos) then
|
||||||
|
distancetofarp = self.maxdistance - 10
|
||||||
|
else
|
||||||
|
distancetofarp = self.maxdistance + 10
|
||||||
|
end
|
||||||
|
end
|
||||||
-- Mayday Message
|
-- Mayday Message
|
||||||
local Text,Soundfile,Soundlength,Subtitle = self.gettext:GetEntry("PILOTDOWN",self.locale)
|
local Text,Soundfile,Soundlength,Subtitle = self.gettext:GetEntry("PILOTDOWN",self.locale)
|
||||||
local text = ""
|
local text = ""
|
||||||
@@ -795,7 +817,13 @@ function AICSAR:_EventHandler(EventData, FromEject)
|
|||||||
|
|
||||||
-- DONE: add distance check
|
-- DONE: add distance check
|
||||||
local distancetofarp = _LandingPos:Get2DDistance(self.farp:GetCoordinate())
|
local distancetofarp = _LandingPos:Get2DDistance(self.farp:GetCoordinate())
|
||||||
|
if self.UseRescueZone == true and self.RescueZone ~= nil then
|
||||||
|
if self.RescueZone:IsCoordinateInZone(_LandingPos) then
|
||||||
|
distancetofarp = self.maxdistance - 10
|
||||||
|
else
|
||||||
|
distancetofarp = self.maxdistance + 10
|
||||||
|
end
|
||||||
|
end
|
||||||
-- Mayday Message
|
-- Mayday Message
|
||||||
local Text,Soundfile,Soundlength,Subtitle = self.gettext:GetEntry("PILOTDOWN",self.locale)
|
local Text,Soundfile,Soundlength,Subtitle = self.gettext:GetEntry("PILOTDOWN",self.locale)
|
||||||
local text = ""
|
local text = ""
|
||||||
@@ -817,7 +845,6 @@ function AICSAR:_EventHandler(EventData, FromEject)
|
|||||||
if _coalition == self.coalition then
|
if _coalition == self.coalition then
|
||||||
if self.verbose then
|
if self.verbose then
|
||||||
MESSAGE:New(msgtxt,15,"AICSAR"):ToCoalition(self.coalition)
|
MESSAGE:New(msgtxt,15,"AICSAR"):ToCoalition(self.coalition)
|
||||||
-- MESSAGE:New(msgtxt,15,"AICSAR"):ToLog()
|
|
||||||
end
|
end
|
||||||
if self.SRSRadio then
|
if self.SRSRadio then
|
||||||
local sound = SOUNDFILE:New(Soundfile,self.SRSSoundPath,Soundlength)
|
local sound = SOUNDFILE:New(Soundfile,self.SRSSoundPath,Soundlength)
|
||||||
@@ -869,6 +896,7 @@ function AICSAR:_GetFlight()
|
|||||||
:InitUnControlled(true)
|
:InitUnControlled(true)
|
||||||
:OnSpawnGroup(
|
:OnSpawnGroup(
|
||||||
function(Group)
|
function(Group)
|
||||||
|
Group:OptionPreferVerticalLanding()
|
||||||
self:__HeloOnDuty(1,Group)
|
self:__HeloOnDuty(1,Group)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
@@ -934,6 +962,10 @@ function AICSAR:_InitMission(Pilot,Index)
|
|||||||
helo:__UnloadingDone(5)
|
helo:__UnloadingDone(5)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function helo:OnAfterLandAtAirbase(From,Event,To,airbase)
|
||||||
|
helo:Despawn(2)
|
||||||
|
end
|
||||||
|
|
||||||
self.helos[Index] = helo
|
self.helos[Index] = helo
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -984,7 +1016,9 @@ function AICSAR:_CheckHelos()
|
|||||||
local name = helo:GetName()
|
local name = helo:GetName()
|
||||||
self:T("Helo group "..name.." in state "..state)
|
self:T("Helo group "..name.." in state "..state)
|
||||||
if state == "Arrived" then
|
if state == "Arrived" then
|
||||||
helo:__Stop(5)
|
--helo:__Stop(5)
|
||||||
|
helo.OnAfterDead = nil
|
||||||
|
helo:Despawn(35)
|
||||||
self.helos[_index] = nil
|
self.helos[_index] = nil
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -1025,7 +1059,7 @@ function AICSAR:_CheckQueue(OpsGroup)
|
|||||||
if self:_CheckInMashZone(_pilot) then
|
if self:_CheckInMashZone(_pilot) then
|
||||||
self:T("Pilot" .. _pilot.GroupName .. " rescued!")
|
self:T("Pilot" .. _pilot.GroupName .. " rescued!")
|
||||||
if OpsGroup then
|
if OpsGroup then
|
||||||
OpsGroup:Despawn(10)
|
--OpsGroup:Despawn(10)
|
||||||
else
|
else
|
||||||
_pilot:Destroy(true,10)
|
_pilot:Destroy(true,10)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ AUTOLASE = {
|
|||||||
debug = false,
|
debug = false,
|
||||||
smokemenu = true,
|
smokemenu = true,
|
||||||
RoundingPrecision = 0,
|
RoundingPrecision = 0,
|
||||||
increasegroundawareness = true,
|
increasegroundawareness = false,
|
||||||
MonitorFrequency = 30,
|
MonitorFrequency = 30,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,7 +216,7 @@ function AUTOLASE:New(RecceSet, Coalition, Alias, PilotSet)
|
|||||||
self.smokemenu = true
|
self.smokemenu = true
|
||||||
self.threatmenu = true
|
self.threatmenu = true
|
||||||
self.RoundingPrecision = 0
|
self.RoundingPrecision = 0
|
||||||
self.increasegroundawareness = true
|
self.increasegroundawareness = false
|
||||||
self.MonitorFrequency = 30
|
self.MonitorFrequency = 30
|
||||||
|
|
||||||
self:EnableSmokeMenu({Angle=math.random(0,359),Distance=math.random(10,20)})
|
self:EnableSmokeMenu({Angle=math.random(0,359),Distance=math.random(10,20)})
|
||||||
@@ -493,7 +493,7 @@ end
|
|||||||
--- (User) Function enable sending messages via SRS.
|
--- (User) Function enable sending messages via SRS.
|
||||||
-- @param #AUTOLASE self
|
-- @param #AUTOLASE self
|
||||||
-- @param #boolean OnOff Switch usage on and off
|
-- @param #boolean OnOff Switch usage on and off
|
||||||
-- @param #string Path Path to SRS directory, e.g. C:\\Program Files\\DCS-SimpleRadio-Standalone
|
-- @param #string Path Path to SRS TTS directory, e.g. C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio
|
||||||
-- @param #number Frequency Frequency to send, e.g. 243
|
-- @param #number Frequency Frequency to send, e.g. 243
|
||||||
-- @param #number Modulation Modulation i.e. radio.modulation.AM or radio.modulation.FM
|
-- @param #number Modulation Modulation i.e. radio.modulation.AM or radio.modulation.FM
|
||||||
-- @param #string Label (Optional) Short label to be used on the SRS Client Overlay
|
-- @param #string Label (Optional) Short label to be used on the SRS Client Overlay
|
||||||
@@ -508,7 +508,7 @@ end
|
|||||||
function AUTOLASE:SetUsingSRS(OnOff,Path,Frequency,Modulation,Label,Gender,Culture,Port,Voice,Volume,PathToGoogleKey)
|
function AUTOLASE:SetUsingSRS(OnOff,Path,Frequency,Modulation,Label,Gender,Culture,Port,Voice,Volume,PathToGoogleKey)
|
||||||
if OnOff then
|
if OnOff then
|
||||||
self.useSRS = true
|
self.useSRS = true
|
||||||
self.SRSPath = Path or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone"
|
self.SRSPath = Path or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio"
|
||||||
self.SRSFreq = Frequency or 271
|
self.SRSFreq = Frequency or 271
|
||||||
self.SRSMod = Modulation or radio.modulation.AM
|
self.SRSMod = Modulation or radio.modulation.AM
|
||||||
self.Gender = Gender or MSRS.gender or "male"
|
self.Gender = Gender or MSRS.gender or "male"
|
||||||
@@ -1020,7 +1020,7 @@ function AUTOLASE:_Prescient()
|
|||||||
self:T(self.lid.."Checking possibly visible STATICs for Recce "..unit:GetName())
|
self:T(self.lid.."Checking possibly visible STATICs for Recce "..unit:GetName())
|
||||||
for _,_static in pairs(Statics) do -- DCS static object here
|
for _,_static in pairs(Statics) do -- DCS static object here
|
||||||
local static = STATIC:Find(_static)
|
local static = STATIC:Find(_static)
|
||||||
if static and static:GetCoalition() ~= self.coalition then
|
if static and static:GetCoalition() ~= self.coalition and static:GetCoordinate() then
|
||||||
local IsLOS = position:IsLOS(static:GetCoordinate())
|
local IsLOS = position:IsLOS(static:GetCoordinate())
|
||||||
if IsLOS then
|
if IsLOS then
|
||||||
unit:KnowUnit(static,true,true)
|
unit:KnowUnit(static,true,true)
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
-- @module Functional.Mantis
|
-- @module Functional.Mantis
|
||||||
-- @image Functional.Mantis.jpg
|
-- @image Functional.Mantis.jpg
|
||||||
--
|
--
|
||||||
-- Last Update: Mar 2025
|
-- Last Update: July 2025
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
--- **MANTIS** class, extends Core.Base#BASE
|
--- **MANTIS** class, extends Core.Base#BASE
|
||||||
@@ -62,7 +62,9 @@
|
|||||||
-- @field #table FilterZones Table of Core.Zone#ZONE Zones Consider SAM groups in this zone(s) only for this MANTIS instance, must be handed as #table of Zone objects.
|
-- @field #table FilterZones Table of Core.Zone#ZONE Zones Consider SAM groups in this zone(s) only for this MANTIS instance, must be handed as #table of Zone objects.
|
||||||
-- @field #boolean SmokeDecoy If true, smoke short range SAM units as decoy if a plane is in firing range.
|
-- @field #boolean SmokeDecoy If true, smoke short range SAM units as decoy if a plane is in firing range.
|
||||||
-- @field #number SmokeDecoyColor Color to use, defaults to SMOKECOLOR.White
|
-- @field #number SmokeDecoyColor Color to use, defaults to SMOKECOLOR.White
|
||||||
-- @field #number checkcounter Counter for SAM Table refreshes
|
-- @field #number checkcounter Counter for SAM Table refreshes.
|
||||||
|
-- @field #number DLinkCacheTime Seconds after which cached contacts in DLink will decay.
|
||||||
|
-- @field #boolean logsamstatus Log SAM status in dcs.log every cycle if true
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
|
|
||||||
@@ -74,10 +76,9 @@
|
|||||||
--
|
--
|
||||||
-- * Moose derived Modular, Automatic and Network capable Targeting and Interception System.
|
-- * Moose derived Modular, Automatic and Network capable Targeting and Interception System.
|
||||||
-- * Controls a network of SAM sites. Uses detection to switch on the SAM site closest to the enemy.
|
-- * Controls a network of SAM sites. Uses detection to switch on the SAM site closest to the enemy.
|
||||||
-- * **Automatic mode** (default since 0.8) will set-up your SAM site network automatically for you
|
-- * **Automatic mode** (default) will set-up your SAM site network automatically for you.
|
||||||
-- * **Classic mode** behaves like before
|
-- * Leverage evasiveness from SEAD, leverage attack range setting.
|
||||||
-- * Leverage evasiveness from SEAD, leverage attack range setting
|
-- * Automatic setup of SHORAD based on groups of the class "short-range".
|
||||||
-- * Automatic setup of SHORAD based on groups of the class "short-range"
|
|
||||||
--
|
--
|
||||||
-- # 0. Base considerations and naming conventions
|
-- # 0. Base considerations and naming conventions
|
||||||
--
|
--
|
||||||
@@ -110,7 +111,7 @@
|
|||||||
-- * Silkworm (though strictly speaking this is a surface to ship missile)
|
-- * Silkworm (though strictly speaking this is a surface to ship missile)
|
||||||
-- * SA-2, SA-3, SA-5, SA-6, SA-7, SA-8, SA-9, SA-10, SA-11, SA-13, SA-15, SA-19
|
-- * SA-2, SA-3, SA-5, SA-6, SA-7, SA-8, SA-9, SA-10, SA-11, SA-13, SA-15, SA-19
|
||||||
-- * From IDF mod: STUNNER IDFA, TAMIR IDFA (Note all caps!)
|
-- * From IDF mod: STUNNER IDFA, TAMIR IDFA (Note all caps!)
|
||||||
-- * From HDS (see note on HDS below): SA-2, SA-3, SA-10B, SA-10C, SA-12, SA-17, SA-20A, SA-20B, SA-23, HQ-2
|
-- * From HDS (see note on HDS below): SA-2, SA-3, SA-10B, SA-10C, SA-12, SA-17, SA-20A, SA-20B, SA-23, HQ-2, SAMP/T Block 1, SAMP/T Block 1INT, SAMP/T Block2
|
||||||
--
|
--
|
||||||
-- * From SMA: RBS98M, RBS70, RBS90, RBS90M, RBS103A, RBS103B, RBS103AM, RBS103BM, Lvkv9040M
|
-- * From SMA: RBS98M, RBS70, RBS90, RBS90M, RBS103A, RBS103B, RBS103AM, RBS103BM, Lvkv9040M
|
||||||
-- **NOTE** If you are using the Swedish Military Assets (SMA), please note that the **group name** for RBS-SAM types also needs to contain the keyword "SMA"
|
-- **NOTE** If you are using the Swedish Military Assets (SMA), please note that the **group name** for RBS-SAM types also needs to contain the keyword "SMA"
|
||||||
@@ -124,19 +125,20 @@
|
|||||||
-- * SA-2 (with V759 missile, e.g. "Red SAM SA-2 HDS")
|
-- * SA-2 (with V759 missile, e.g. "Red SAM SA-2 HDS")
|
||||||
-- * SA-2 (with HQ-2 launcher, use HQ-2 in the group name, e.g. "Red SAM HQ-2" )
|
-- * SA-2 (with HQ-2 launcher, use HQ-2 in the group name, e.g. "Red SAM HQ-2" )
|
||||||
-- * SA-3 (with V601P missile, e.g. "Red SAM SA-3 HDS")
|
-- * SA-3 (with V601P missile, e.g. "Red SAM SA-3 HDS")
|
||||||
-- * SA-10B (overlap with other SA-10 types, e.g. "Red SAM SA-10B HDS")
|
-- * SA-10B (overlap with other SA-10 types, e.g. "Red SAM SA-10B HDS" with 5P85CE launcher)
|
||||||
-- * SA-10C (overlap with other SA-10 types, e.g. "Red SAM SA-10C HDS")
|
-- * SA-10C (overlap with other SA-10 types, e.g. "Red SAM SA-10C HDS" with 5P85SE launcher)
|
||||||
-- * SA-12 (launcher dependent range, e.g. "Red SAM SA-12 HDS")
|
-- * SA-12 (launcher dependent range, e.g. "Red SAM SA-12 HDS 2" for the 9A82 variant and "Red SAM SA-12 HDS 1" for the 9A83 variant)
|
||||||
-- * SA-23 (launcher dependent range, e.g. "Red SAM SA-23 HDS")
|
-- * SA-23 (launcher dependent range, e.g. "Red SAM SA-23 HDS 2" for the 9A82ME variant and "Red SAM SA-23 HDS 1" for the 9A83ME variant)
|
||||||
|
-- * SAMP/T (launcher dependent range, e.g. "Blue SAM SAMPT Block 1 HDS" for Block 1, "Blue SAM SAMPT Block 1INT HDS", "Blue SAM SAMPT Block 2 HDS")
|
||||||
--
|
--
|
||||||
-- The other HDS types work like the rest of the known SAM systems.
|
-- The other HDS types work like the rest of the known SAM systems.
|
||||||
--
|
--
|
||||||
-- # 0.1 Set-up in the mission editor
|
-- # 0.1 Set-up in the mission editor
|
||||||
--
|
--
|
||||||
-- Set up your SAM sites in the mission editor. Name the groups using a systematic approach like above.
|
-- Set up your SAM sites in the mission editor. Name the groups using a systematic approach like above.Can be e.g. AWACS or a combination of AWACS and Search Radars like e.g. EWR 1L13 etc.
|
||||||
-- Set up your EWR system in the mission editor. Name the groups using a systematic approach like above. Can be e.g. AWACS or a combination of AWACS and Search Radars like e.g. EWR 1L13 etc.
|
|
||||||
-- Search Radars usually have "SR" or "STR" in their names. Use the encyclopedia in the mission editor to inform yourself.
|
-- Search Radars usually have "SR" or "STR" in their names. Use the encyclopedia in the mission editor to inform yourself.
|
||||||
-- Set up your SHORAD systems. They need to be **close** to (i.e. around) the SAM sites to be effective. Use **one** group per SAM location. SA-15 TOR systems offer a good missile defense.
|
-- Set up your SHORAD systems. They need to be **close** to (i.e. around) the SAM sites to be effective. Use **one unit ** per group (multiple groups) for the SAM location.
|
||||||
|
-- Else, evasive manoevers might club up all defenders in one place. Red SA-15 TOR systems offer a good missile defense.
|
||||||
--
|
--
|
||||||
-- [optional] Set up your HQ. Can be any group, e.g. a command vehicle.
|
-- [optional] Set up your HQ. Can be any group, e.g. a command vehicle.
|
||||||
--
|
--
|
||||||
@@ -188,7 +190,7 @@
|
|||||||
--
|
--
|
||||||
-- ## 2.1 Auto mode features
|
-- ## 2.1 Auto mode features
|
||||||
--
|
--
|
||||||
-- ### 2.1.1 You can now add Accept-, Reject- and Conflict-Zones to your setup, e.g. to consider borders or de-militarized zones:
|
-- ### 2.1.1 You can add Accept-, Reject- and Conflict-Zones to your setup, e.g. to consider borders or de-militarized zones:
|
||||||
--
|
--
|
||||||
-- -- Parameters are tables of Core.Zone#ZONE objects!
|
-- -- Parameters are tables of Core.Zone#ZONE objects!
|
||||||
-- -- This is effectively a 3-stage filter allowing for zone overlap. A coordinate is accepted first when
|
-- -- This is effectively a 3-stage filter allowing for zone overlap. A coordinate is accepted first when
|
||||||
@@ -206,9 +208,6 @@
|
|||||||
--
|
--
|
||||||
-- ### 2.1.4 Advanced features
|
-- ### 2.1.4 Advanced features
|
||||||
--
|
--
|
||||||
-- -- Option to switch off auto mode **before** you start MANTIS (not recommended)
|
|
||||||
-- mybluemantis.automode = false
|
|
||||||
--
|
|
||||||
-- -- Option to set the scale of the activation range, i.e. don't activate at the fringes of max range, defaults below.
|
-- -- Option to set the scale of the activation range, i.e. don't activate at the fringes of max range, defaults below.
|
||||||
-- -- also see engagerange below.
|
-- -- also see engagerange below.
|
||||||
-- self.radiusscale[MANTIS.SamType.LONG] = 1.1
|
-- self.radiusscale[MANTIS.SamType.LONG] = 1.1
|
||||||
@@ -221,6 +220,12 @@
|
|||||||
-- -- For some scenarios, like Cold War, it might be useful not to activate SAMs if friendly aircraft are around to avoid death by friendly fire.
|
-- -- For some scenarios, like Cold War, it might be useful not to activate SAMs if friendly aircraft are around to avoid death by friendly fire.
|
||||||
-- mybluemantis.checkforfriendlies = true
|
-- mybluemantis.checkforfriendlies = true
|
||||||
--
|
--
|
||||||
|
-- ### 2.1.6 Shoot & Scoot
|
||||||
|
--
|
||||||
|
-- -- Option to make the (driveable) SHORAD units drive around and shuffle positions
|
||||||
|
-- -- We use a SET_ZONE for that, number of zones to consider defaults to three, Random is true for random coordinates and Formation is e.g. "Vee".
|
||||||
|
-- mybluemantis:AddScootZones(ZoneSet, Number, Random, Formation)
|
||||||
|
--
|
||||||
-- # 3. Default settings [both modes unless stated otherwise]
|
-- # 3. Default settings [both modes unless stated otherwise]
|
||||||
--
|
--
|
||||||
-- By default, the following settings are active:
|
-- By default, the following settings are active:
|
||||||
@@ -243,25 +248,7 @@
|
|||||||
--
|
--
|
||||||
-- Use this option if you want to make use of or allow advanced SEAD tactics.
|
-- Use this option if you want to make use of or allow advanced SEAD tactics.
|
||||||
--
|
--
|
||||||
-- # 5. Integrate SHORAD [classic mode, not necessary in automode, not recommended for manual setup]
|
-- # 5. Integrated SEAD
|
||||||
--
|
|
||||||
-- You can also choose to integrate Mantis with @{Functional.Shorad#SHORAD} for protection against HARMs and AGMs manually. When SHORAD detects a missile fired at one of MANTIS' SAM sites, it will activate SHORAD systems in
|
|
||||||
-- the given defense checkradius around that SAM site. Create a SHORAD object first, then integrate with MANTIS like so:
|
|
||||||
--
|
|
||||||
-- local SamSet = SET_GROUP:New():FilterPrefixes("Blue SAM"):FilterCoalitions("blue"):FilterStart()
|
|
||||||
-- myshorad = SHORAD:New("BlueShorad", "Blue SHORAD", SamSet, 22000, 600, "blue")
|
|
||||||
-- -- now set up MANTIS
|
|
||||||
-- mymantis = MANTIS:New("BlueMantis","Blue SAM","Blue EWR",nil,"blue",false,"Blue Awacs")
|
|
||||||
-- mymantis:AddShorad(myshorad,720)
|
|
||||||
-- mymantis:Start()
|
|
||||||
--
|
|
||||||
-- If you systematically name your SHORAD groups starting with "Blue SHORAD" you'll need exactly **one** SHORAD instance to manage all SHORAD groups.
|
|
||||||
--
|
|
||||||
-- (Optionally) you can remove the link later on with
|
|
||||||
--
|
|
||||||
-- mymantis:RemoveShorad()
|
|
||||||
--
|
|
||||||
-- # 6. Integrated SEAD
|
|
||||||
--
|
--
|
||||||
-- MANTIS is using @{Functional.Sead#SEAD} internally to both detect and evade HARM attacks. No extra efforts needed to set this up!
|
-- MANTIS is using @{Functional.Sead#SEAD} internally to both detect and evade HARM attacks. No extra efforts needed to set this up!
|
||||||
-- Once a HARM attack is detected, MANTIS (via SEAD) will shut down the radars of the attacked SAM site and take evasive action by moving the SAM
|
-- Once a HARM attack is detected, MANTIS (via SEAD) will shut down the radars of the attacked SAM site and take evasive action by moving the SAM
|
||||||
@@ -288,6 +275,7 @@
|
|||||||
MANTIS = {
|
MANTIS = {
|
||||||
ClassName = "MANTIS",
|
ClassName = "MANTIS",
|
||||||
name = "mymantis",
|
name = "mymantis",
|
||||||
|
version = "0.9.32",
|
||||||
SAM_Templates_Prefix = "",
|
SAM_Templates_Prefix = "",
|
||||||
SAM_Group = nil,
|
SAM_Group = nil,
|
||||||
EWR_Templates_Prefix = "",
|
EWR_Templates_Prefix = "",
|
||||||
@@ -336,6 +324,8 @@ MANTIS = {
|
|||||||
SmokeDecoy = false,
|
SmokeDecoy = false,
|
||||||
SmokeDecoyColor = SMOKECOLOR.White,
|
SmokeDecoyColor = SMOKECOLOR.White,
|
||||||
checkcounter = 1,
|
checkcounter = 1,
|
||||||
|
DLinkCacheTime = 120,
|
||||||
|
logsamstatus = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Advanced state enumerator
|
--- Advanced state enumerator
|
||||||
@@ -374,7 +364,7 @@ MANTIS.radiusscale[MANTIS.SamType.POINT] = 3
|
|||||||
MANTIS.SamData = {
|
MANTIS.SamData = {
|
||||||
["Hawk"] = { Range=35, Blindspot=0, Height=12, Type="Medium", Radar="Hawk" }, -- measures in km
|
["Hawk"] = { Range=35, Blindspot=0, Height=12, Type="Medium", Radar="Hawk" }, -- measures in km
|
||||||
["NASAMS"] = { Range=14, Blindspot=0, Height=7, Type="Short", Radar="NSAMS" }, -- AIM 120B
|
["NASAMS"] = { Range=14, Blindspot=0, Height=7, Type="Short", Radar="NSAMS" }, -- AIM 120B
|
||||||
["Patriot"] = { Range=99, Blindspot=0, Height=25, Type="Long", Radar="Patriot" },
|
["Patriot"] = { Range=99, Blindspot=0, Height=25, Type="Long", Radar="Patriot str" },
|
||||||
["Rapier"] = { Range=10, Blindspot=0, Height=3, Type="Short", Radar="rapier" },
|
["Rapier"] = { Range=10, Blindspot=0, Height=3, Type="Short", Radar="rapier" },
|
||||||
["SA-2"] = { Range=40, Blindspot=7, Height=25, Type="Medium", Radar="S_75M_Volhov" },
|
["SA-2"] = { Range=40, Blindspot=7, Height=25, Type="Medium", Radar="S_75M_Volhov" },
|
||||||
["SA-3"] = { Range=18, Blindspot=6, Height=18, Type="Short", Radar="5p73 s-125 ln" },
|
["SA-3"] = { Range=18, Blindspot=6, Height=18, Type="Short", Radar="5p73 s-125 ln" },
|
||||||
@@ -382,7 +372,8 @@ MANTIS.SamData = {
|
|||||||
["SA-6"] = { Range=25, Blindspot=0, Height=8, Type="Medium", Radar="1S91" },
|
["SA-6"] = { Range=25, Blindspot=0, Height=8, Type="Medium", Radar="1S91" },
|
||||||
["SA-10"] = { Range=119, Blindspot=0, Height=18, Type="Long" , Radar="S-300PS 4"},
|
["SA-10"] = { Range=119, Blindspot=0, Height=18, Type="Long" , Radar="S-300PS 4"},
|
||||||
["SA-11"] = { Range=35, Blindspot=0, Height=20, Type="Medium", Radar="SA-11" },
|
["SA-11"] = { Range=35, Blindspot=0, Height=20, Type="Medium", Radar="SA-11" },
|
||||||
["Roland"] = { Range=5, Blindspot=0, Height=5, Type="Point", Radar="Roland" },
|
["Roland"] = { Range=6, Blindspot=0, Height=5, Type="Short", Radar="Roland" },
|
||||||
|
["Gepard"] = { Range=5, Blindspot=0, Height=4, Type="Point", Radar="Gepard" },
|
||||||
["HQ-7"] = { Range=12, Blindspot=0, Height=3, Type="Short", Radar="HQ-7" },
|
["HQ-7"] = { Range=12, Blindspot=0, Height=3, Type="Short", Radar="HQ-7" },
|
||||||
["SA-9"] = { Range=4, Blindspot=0, Height=3, Type="Point", Radar="Strela", Point="true" },
|
["SA-9"] = { Range=4, Blindspot=0, Height=3, Type="Point", Radar="Strela", Point="true" },
|
||||||
["SA-8"] = { Range=10, Blindspot=0, Height=5, Type="Short", Radar="Osa 9A33" },
|
["SA-8"] = { Range=10, Blindspot=0, Height=5, Type="Short", Radar="Osa 9A33" },
|
||||||
@@ -393,9 +384,10 @@ MANTIS.SamData = {
|
|||||||
["Chaparral"] = { Range=8, Blindspot=0, Height=3, Type="Short", Radar="Chaparral" },
|
["Chaparral"] = { Range=8, Blindspot=0, Height=3, Type="Short", Radar="Chaparral" },
|
||||||
["Linebacker"] = { Range=4, Blindspot=0, Height=3, Type="Point", Radar="Linebacker", Point="true" },
|
["Linebacker"] = { Range=4, Blindspot=0, Height=3, Type="Point", Radar="Linebacker", Point="true" },
|
||||||
["Silkworm"] = { Range=90, Blindspot=1, Height=0.2, Type="Long", Radar="Silkworm" },
|
["Silkworm"] = { Range=90, Blindspot=1, Height=0.2, Type="Long", Radar="Silkworm" },
|
||||||
|
["HEMTT_C-RAM_Phalanx"] = { Range=2, Blindspot=0, Height=2, Type="Point", Radar="HEMTT_C-RAM_Phalanx", Point="true" },
|
||||||
-- units from HDS Mod, multi launcher options is tricky
|
-- units from HDS Mod, multi launcher options is tricky
|
||||||
["SA-10B"] = { Range=75, Blindspot=0, Height=18, Type="Medium" , Radar="SA-10B"},
|
["SA-10B"] = { Range=75, Blindspot=0, Height=18, Type="Medium" , Radar="SA-10B"},
|
||||||
["SA-17"] = { Range=50, Blindspot=3, Height=30, Type="Medium", Radar="SA-17" },
|
["SA-17"] = { Range=50, Blindspot=3, Height=50, Type="Medium", Radar="SA-17" },
|
||||||
["SA-20A"] = { Range=150, Blindspot=5, Height=27, Type="Long" , Radar="S-300PMU1"},
|
["SA-20A"] = { Range=150, Blindspot=5, Height=27, Type="Long" , Radar="S-300PMU1"},
|
||||||
["SA-20B"] = { Range=200, Blindspot=4, Height=27, Type="Long" , Radar="S-300PMU2"},
|
["SA-20B"] = { Range=200, Blindspot=4, Height=27, Type="Long" , Radar="S-300PMU2"},
|
||||||
["HQ-2"] = { Range=50, Blindspot=6, Height=35, Type="Medium", Radar="HQ_2_Guideline_LN" },
|
["HQ-2"] = { Range=50, Blindspot=6, Height=35, Type="Medium", Radar="HQ_2_Guideline_LN" },
|
||||||
@@ -416,13 +408,17 @@ MANTIS.SamDataHDS = {
|
|||||||
-- group name MUST contain HDS to ID launcher type correctly!
|
-- group name MUST contain HDS to ID launcher type correctly!
|
||||||
["SA-2 HDS"] = { Range=56, Blindspot=7, Height=30, Type="Medium", Radar="V759" },
|
["SA-2 HDS"] = { Range=56, Blindspot=7, Height=30, Type="Medium", Radar="V759" },
|
||||||
["SA-3 HDS"] = { Range=20, Blindspot=6, Height=30, Type="Short", Radar="V-601P" },
|
["SA-3 HDS"] = { Range=20, Blindspot=6, Height=30, Type="Short", Radar="V-601P" },
|
||||||
["SA-10C HDS 2"] = { Range=90, Blindspot=5, Height=25, Type="Long" , Radar="5P85DE ln"}, -- V55RUD
|
["SA-10B HDS"] = { Range=90, Blindspot=5, Height=25, Type="Long" , Radar="5P85CE ln"}, -- V55RUD
|
||||||
["SA-10C HDS 1"] = { Range=90, Blindspot=5, Height=25, Type="Long" , Radar="5P85CE ln"}, -- V55RUD
|
["SA-10C HDS"] = { Range=75, Blindspot=5, Height=25, Type="Long" , Radar="5P85SE ln"}, -- V55RUD
|
||||||
["SA-12 HDS 2"] = { Range=100, Blindspot=10, Height=25, Type="Long" , Radar="S-300V 9A82 l"},
|
["SA-17 HDS"] = { Range=50, Blindspot=3, Height=50, Type="Medium", Radar="SA-17 " },
|
||||||
["SA-12 HDS 1"] = { Range=75, Blindspot=1, Height=25, Type="Long" , Radar="S-300V 9A83 l"},
|
["SA-12 HDS 2"] = { Range=100, Blindspot=13, Height=30, Type="Long" , Radar="S-300V 9A82 l"},
|
||||||
|
["SA-12 HDS 1"] = { Range=75, Blindspot=6, Height=25, Type="Long" , Radar="S-300V 9A83 l"},
|
||||||
["SA-23 HDS 2"] = { Range=200, Blindspot=5, Height=37, Type="Long", Radar="S-300VM 9A82ME" },
|
["SA-23 HDS 2"] = { Range=200, Blindspot=5, Height=37, Type="Long", Radar="S-300VM 9A82ME" },
|
||||||
["SA-23 HDS 1"] = { Range=100, Blindspot=1, Height=50, Type="Long", Radar="S-300VM 9A83ME" },
|
["SA-23 HDS 1"] = { Range=100, Blindspot=1, Height=50, Type="Long", Radar="S-300VM 9A83ME" },
|
||||||
["HQ-2 HDS"] = { Range=50, Blindspot=6, Height=35, Type="Medium", Radar="HQ_2_Guideline_LN" },
|
["HQ-2 HDS"] = { Range=50, Blindspot=6, Height=35, Type="Medium", Radar="HQ_2_Guideline_LN" },
|
||||||
|
["SAMPT Block 1 HDS"] = { Range=120, Blindspot=1, Height=20, Type="long", Radar="SAMPT_MLT_Blk1" }, -- Block 1 Launcher
|
||||||
|
["SAMPT Block 1INT HDS"] = { Range=150, Blindspot=1, Height=25, Type="long", Radar="SAMPT_MLT_Blk1NT" }, -- Block 1-INT Launcher
|
||||||
|
["SAMPT Block 2 HDS"] = { Range=200, Blindspot=10, Height=70, Type="long", Radar="SAMPT_MLT_Blk2" }, -- Block 2 Launcher
|
||||||
}
|
}
|
||||||
|
|
||||||
--- SAM data SMA
|
--- SAM data SMA
|
||||||
@@ -625,6 +621,7 @@ do
|
|||||||
self.advAwacs = false
|
self.advAwacs = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
self:SetDLinkCacheTime()
|
||||||
|
|
||||||
-- Set the string id for output to DCS.log file.
|
-- Set the string id for output to DCS.log file.
|
||||||
self.lid=string.format("MANTIS %s | ", self.name)
|
self.lid=string.format("MANTIS %s | ", self.name)
|
||||||
@@ -658,6 +655,8 @@ do
|
|||||||
table.insert(self.ewr_templates,awacs)
|
table.insert(self.ewr_templates,awacs)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
self.logsamstatus = false
|
||||||
|
|
||||||
self:T({self.ewr_templates})
|
self:T({self.ewr_templates})
|
||||||
|
|
||||||
self.SAM_Group = SET_GROUP:New():FilterPrefixes(self.SAM_Templates_Prefix):FilterCoalitions(self.Coalition)
|
self.SAM_Group = SET_GROUP:New():FilterPrefixes(self.SAM_Templates_Prefix):FilterCoalitions(self.Coalition)
|
||||||
@@ -687,9 +686,6 @@ do
|
|||||||
-- counter for SAM table updates
|
-- counter for SAM table updates
|
||||||
self.checkcounter = 1
|
self.checkcounter = 1
|
||||||
|
|
||||||
-- TODO Version
|
|
||||||
-- @field #string version
|
|
||||||
self.version="0.9.27"
|
|
||||||
self:I(string.format("***** Starting MANTIS Version %s *****", self.version))
|
self:I(string.format("***** Starting MANTIS Version %s *****", self.version))
|
||||||
|
|
||||||
--- FSM Functions ---
|
--- FSM Functions ---
|
||||||
@@ -1040,6 +1036,16 @@ do
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Function to set how long INTEL DLINK remembers contacts.
|
||||||
|
-- @param #MANTIS self
|
||||||
|
-- @param #number seconds Remember this many seconds, at least 5 seconds.
|
||||||
|
-- @return #MANTIS self
|
||||||
|
function MANTIS:SetDLinkCacheTime(seconds)
|
||||||
|
self.DLinkCacheTime = math.abs(seconds or 120)
|
||||||
|
if self.DLinkCacheTime < 5 then self.DLinkCacheTime = 5 end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Function to set the detection interval
|
--- Function to set the detection interval
|
||||||
-- @param #MANTIS self
|
-- @param #MANTIS self
|
||||||
-- @param #number interval The interval in seconds
|
-- @param #number interval The interval in seconds
|
||||||
@@ -1431,7 +1437,9 @@ do
|
|||||||
--IntelTwo:SetClusterRadius(5000)
|
--IntelTwo:SetClusterRadius(5000)
|
||||||
IntelTwo:Start()
|
IntelTwo:Start()
|
||||||
|
|
||||||
local IntelDlink = INTEL_DLINK:New({IntelOne,IntelTwo},self.name.." DLINK",22,300)
|
local CacheTime = self.DLinkCacheTime or 120
|
||||||
|
local IntelDlink = INTEL_DLINK:New({IntelOne,IntelTwo},self.name.." DLINK",22,CacheTime)
|
||||||
|
|
||||||
IntelDlink:__Start(1)
|
IntelDlink:__Start(1)
|
||||||
|
|
||||||
self:SetUsingDLink(IntelDlink)
|
self:SetUsingDLink(IntelDlink)
|
||||||
@@ -1493,7 +1501,7 @@ do
|
|||||||
elseif chm then
|
elseif chm then
|
||||||
SAMData = self.SamDataCH
|
SAMData = self.SamDataCH
|
||||||
end
|
end
|
||||||
--self:T("Looking to auto-match for "..grpname)
|
--self:I("Looking to auto-match for "..grpname)
|
||||||
for _,_unit in pairs(units) do
|
for _,_unit in pairs(units) do
|
||||||
local unit = _unit -- Wrapper.Unit#UNIT
|
local unit = _unit -- Wrapper.Unit#UNIT
|
||||||
local type = string.lower(unit:GetTypeName())
|
local type = string.lower(unit:GetTypeName())
|
||||||
@@ -1694,7 +1702,9 @@ do
|
|||||||
local grpname = group:GetName()
|
local grpname = group:GetName()
|
||||||
local grpcoord = group:GetCoordinate()
|
local grpcoord = group:GetCoordinate()
|
||||||
local grprange, grpheight,type,blind = self:_GetSAMRange(grpname)
|
local grprange, grpheight,type,blind = self:_GetSAMRange(grpname)
|
||||||
local radaralive = group:IsSAM()
|
-- TODO the below might stop working at some point after some hours, needs testing
|
||||||
|
--local radaralive = group:IsSAM()
|
||||||
|
local radaralive = true
|
||||||
table.insert( SAM_Tbl, {grpname, grpcoord, grprange, grpheight, blind, type}) -- make the table lighter, as I don't really use the zone here
|
table.insert( SAM_Tbl, {grpname, grpcoord, grprange, grpheight, blind, type}) -- make the table lighter, as I don't really use the zone here
|
||||||
table.insert( SEAD_Grps, grpname )
|
table.insert( SEAD_Grps, grpname )
|
||||||
if type == MANTIS.SamType.LONG and radaralive then
|
if type == MANTIS.SamType.LONG and radaralive then
|
||||||
@@ -1791,7 +1801,7 @@ do
|
|||||||
if self.Shorad and self.Shorad.ActiveGroups and self.Shorad.ActiveGroups[name] then
|
if self.Shorad and self.Shorad.ActiveGroups and self.Shorad.ActiveGroups[name] then
|
||||||
activeshorad = true
|
activeshorad = true
|
||||||
end
|
end
|
||||||
if IsInZone and not suppressed and not activeshorad then --check any target in zone and not currently managed by SEAD
|
if IsInZone and (not suppressed) and (not activeshorad) then --check any target in zone and not currently managed by SEAD
|
||||||
if samgroup:IsAlive() then
|
if samgroup:IsAlive() then
|
||||||
-- switch on SAM
|
-- switch on SAM
|
||||||
local switch = false
|
local switch = false
|
||||||
@@ -1823,7 +1833,7 @@ do
|
|||||||
-- link in to SHORAD if available
|
-- link in to SHORAD if available
|
||||||
-- DONE: Test integration fully
|
-- DONE: Test integration fully
|
||||||
if self.ShoradLink and (Distance < self.ShoradActDistance or Distance < blind ) then -- don't give SHORAD position away too early
|
if self.ShoradLink and (Distance < self.ShoradActDistance or Distance < blind ) then -- don't give SHORAD position away too early
|
||||||
local Shorad = self.Shorad
|
local Shorad = self.Shorad --Functional.Shorad#SHORAD
|
||||||
local radius = self.checkradius
|
local radius = self.checkradius
|
||||||
local ontime = self.ShoradTime
|
local ontime = self.ShoradTime
|
||||||
Shorad:WakeUpShorad(name, radius, ontime)
|
Shorad:WakeUpShorad(name, radius, ontime)
|
||||||
@@ -1856,7 +1866,7 @@ do
|
|||||||
end --end alive
|
end --end alive
|
||||||
end --end check
|
end --end check
|
||||||
end --for loop
|
end --for loop
|
||||||
if self.debug or self.verbose then
|
if self.debug or self.verbose or self.logsamstatus then
|
||||||
for _,_status in pairs(self.SamStateTracker) do
|
for _,_status in pairs(self.SamStateTracker) do
|
||||||
if _status == "GREEN" then
|
if _status == "GREEN" then
|
||||||
instatusgreen=instatusgreen+1
|
instatusgreen=instatusgreen+1
|
||||||
@@ -1877,8 +1887,9 @@ do
|
|||||||
-- @param #MANTIS self
|
-- @param #MANTIS self
|
||||||
-- @param Functional.Detection#DETECTION_AREAS detection Detection object
|
-- @param Functional.Detection#DETECTION_AREAS detection Detection object
|
||||||
-- @param #boolean dlink
|
-- @param #boolean dlink
|
||||||
|
-- @param #boolean reporttolog
|
||||||
-- @return #MANTIS self
|
-- @return #MANTIS self
|
||||||
function MANTIS:_Check(detection,dlink)
|
function MANTIS:_Check(detection,dlink,reporttolog)
|
||||||
self:T(self.lid .. "Check")
|
self:T(self.lid .. "Check")
|
||||||
--get detected set
|
--get detected set
|
||||||
local detset = detection:GetDetectedItemCoordinates()
|
local detset = detection:GetDetectedItemCoordinates()
|
||||||
@@ -1905,7 +1916,8 @@ do
|
|||||||
local samset = self:_GetSAMTable() -- table of i.1=names, i.2=coordinates, i.3=firing range, i.4=firing height
|
local samset = self:_GetSAMTable() -- table of i.1=names, i.2=coordinates, i.3=firing range, i.4=firing height
|
||||||
instatusred, instatusgreen, activeshorads = self:_CheckLoop(samset,detset,dlink,self.maxclassic)
|
instatusred, instatusgreen, activeshorads = self:_CheckLoop(samset,detset,dlink,self.maxclassic)
|
||||||
end
|
end
|
||||||
if self.debug or self.verbose then
|
|
||||||
|
local function GetReport()
|
||||||
local statusreport = REPORT:New("\nMANTIS Status "..self.name)
|
local statusreport = REPORT:New("\nMANTIS Status "..self.name)
|
||||||
statusreport:Add("+-----------------------------+")
|
statusreport:Add("+-----------------------------+")
|
||||||
statusreport:Add(string.format("+ SAM in RED State: %2d",instatusred))
|
statusreport:Add(string.format("+ SAM in RED State: %2d",instatusred))
|
||||||
@@ -1914,7 +1926,15 @@ do
|
|||||||
statusreport:Add(string.format("+ SHORAD active: %2d",activeshorads))
|
statusreport:Add(string.format("+ SHORAD active: %2d",activeshorads))
|
||||||
end
|
end
|
||||||
statusreport:Add("+-----------------------------+")
|
statusreport:Add("+-----------------------------+")
|
||||||
|
return statusreport
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.debug or self.verbose then
|
||||||
|
local statusreport = GetReport()
|
||||||
MESSAGE:New(statusreport:Text(),10):ToAll():ToLog()
|
MESSAGE:New(statusreport:Text(),10):ToAll():ToLog()
|
||||||
|
elseif reporttolog == true then
|
||||||
|
local statusreport = GetReport()
|
||||||
|
MESSAGE:New(statusreport:Text(),10):ToLog()
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -2022,7 +2042,7 @@ do
|
|||||||
self:T({From, Event, To})
|
self:T({From, Event, To})
|
||||||
-- check detection
|
-- check detection
|
||||||
if not self.state2flag then
|
if not self.state2flag then
|
||||||
self:_Check(self.Detection,self.DLink)
|
self:_Check(self.Detection,self.DLink,self.logsamstatus)
|
||||||
end
|
end
|
||||||
|
|
||||||
local EWRAlive = self:_CheckAnyEWRAlive()
|
local EWRAlive = self:_CheckAnyEWRAlive()
|
||||||
@@ -2093,7 +2113,7 @@ do
|
|||||||
if self.debug and self.verbose then
|
if self.debug and self.verbose then
|
||||||
self:I(self.lid .. "Status Report")
|
self:I(self.lid .. "Status Report")
|
||||||
for _name,_state in pairs(self.SamStateTracker) do
|
for _name,_state in pairs(self.SamStateTracker) do
|
||||||
self:I(string.format("Site %s\tStatus %s",_name,_state))
|
self:I(string.format("Site %s | Status %s",_name,_state))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local interval = self.detectinterval * -1
|
local interval = self.detectinterval * -1
|
||||||
|
|||||||
@@ -53,6 +53,8 @@
|
|||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE.
|
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE.
|
||||||
-- Therefore, this class is considered to be deprecated and superseded by the [Functional.Fox](https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Functional.Fox.html) class, which provides the same functionality.
|
-- Therefore, this class is considered to be deprecated and superseded by the [Functional.Fox](https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Functional.Fox.html) class, which provides the same functionality.
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -603,7 +603,7 @@ RANGE.MenuF10Root = nil
|
|||||||
|
|
||||||
--- Range script version.
|
--- Range script version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
RANGE.version = "2.8.0"
|
RANGE.version = "2.8.1"
|
||||||
|
|
||||||
-- TODO list:
|
-- TODO list:
|
||||||
-- TODO: Verbosity level for messages.
|
-- TODO: Verbosity level for messages.
|
||||||
@@ -2032,10 +2032,10 @@ function RANGE._OnImpact(weapon, self, playerData, attackHdg, attackAlt, attackV
|
|||||||
|
|
||||||
-- Smoke impact point of bomb.
|
-- Smoke impact point of bomb.
|
||||||
if playerData and playerData.smokebombimpact and insidezone then
|
if playerData and playerData.smokebombimpact and insidezone then
|
||||||
if playerData and playerData.delaysmoke then
|
if playerData.delaysmoke then
|
||||||
timer.scheduleFunction( self._DelayedSmoke, { coord = impactcoord, color = playerData.smokecolor }, timer.getTime() + self.TdelaySmoke )
|
impactcoord:Smoke(playerData.smokecolor, 30, self.TdelaySmoke)
|
||||||
else
|
else
|
||||||
impactcoord:Smoke( playerData.smokecolor )
|
impactcoord:Smoke(playerData.smokecolor, 30)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -2102,7 +2102,12 @@ function RANGE._OnImpact(weapon, self, playerData, attackHdg, attackAlt, attackV
|
|||||||
result.attackHdg = attackHdg
|
result.attackHdg = attackHdg
|
||||||
result.attackVel = attackVel
|
result.attackVel = attackVel
|
||||||
result.attackAlt = attackAlt
|
result.attackAlt = attackAlt
|
||||||
result.date=os and os.date() or "n/a"
|
if os and os.date then
|
||||||
|
result.date=os.date()
|
||||||
|
else
|
||||||
|
self:E(self.lid.."os or os.date() not available")
|
||||||
|
result.date = "n/a"
|
||||||
|
end
|
||||||
|
|
||||||
-- Add to table.
|
-- Add to table.
|
||||||
table.insert( _results, result )
|
table.insert( _results, result )
|
||||||
@@ -2635,13 +2640,6 @@ end
|
|||||||
-- Display Messages
|
-- Display Messages
|
||||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
--- Start smoking a coordinate with a delay.
|
|
||||||
-- @param #table _args Argements passed.
|
|
||||||
function RANGE._DelayedSmoke( _args )
|
|
||||||
_args.coord:Smoke(_args.color)
|
|
||||||
--trigger.action.smoke( _args.coord:GetVec3(), _args.color )
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Display top 10 stafing results of a specific player.
|
--- Display top 10 stafing results of a specific player.
|
||||||
-- @param #RANGE self
|
-- @param #RANGE self
|
||||||
-- @param #string _unitName Name of the player unit.
|
-- @param #string _unitName Name of the player unit.
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
--- **Functional** - TIRESIAS - manages AI behaviour.
|
----- **Functional** - TIRESIAS - manages AI behaviour (OPTIMIZED VERSION).
|
||||||
|
|
||||||
|
---- ===
|
||||||
|
|
||||||
|
--- The @{#TIRESIAS} class is working in the back to keep your large-scale ground units in check.
|
||||||
--
|
--
|
||||||
-- ===
|
-- -- Features:
|
||||||
--
|
|
||||||
-- The @{#TIRESIAS} class is working in the back to keep your large-scale ground units in check.
|
|
||||||
--
|
|
||||||
-- ## Features:
|
|
||||||
--
|
--
|
||||||
-- * Designed to keep CPU and Network usage lower on missions with a lot of ground units.
|
-- * Designed to keep CPU and Network usage lower on missions with a lot of ground units.
|
||||||
-- * Does not affect ships to keep the Navy guys happy.
|
-- * Does not affect ships to keep the Navy guys happy.
|
||||||
@@ -16,24 +16,29 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ## Missions:
|
-- ## Optimizations Applied:
|
||||||
--
|
--
|
||||||
-- ### [TIRESIAS](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master)
|
-- * Cached frequently used functions and constants
|
||||||
|
-- * Reduced string concatenations and formatting
|
||||||
|
-- * Optimized loop structures and conditions
|
||||||
|
-- * Pre-allocated tables where possible
|
||||||
|
-- * Reduced function call overhead
|
||||||
|
-- * Improved memory management
|
||||||
--
|
--
|
||||||
-- ===
|
---- ===
|
||||||
--
|
--
|
||||||
-- ### Author : **applevangelist **
|
---- #-- Author : **applevangelist ** (Optimized by AI)
|
||||||
--
|
|
||||||
-- @module Functional.Tiresias
|
---
|
||||||
-- @image Functional.Tiresias.jpg
|
-- - @module Functional.Tiresias
|
||||||
--
|
-- - @image Functional.Tiresias.jpg
|
||||||
-- Last Update: Dec 2023
|
|
||||||
|
--- Last Update: Dec 2023 (Optimized July 2025)
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
|
||||||
--- **TIRESIAS** class, extends Core.Base#BASE
|
--- **TIRESIAS** class, extends Core.Base#BASE
|
||||||
-- @type TIRESIAS
|
-- @type TIRESIAS
|
||||||
-- @field #string ClassName
|
-- @field #string ClassName
|
||||||
-- @field #booelan debug
|
-- @field #boolean debug
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
-- @field #number Interval
|
-- @field #number Interval
|
||||||
-- @field Core.Set#SET_GROUP GroundSet
|
-- @field Core.Set#SET_GROUP GroundSet
|
||||||
@@ -48,6 +53,8 @@
|
|||||||
-- @field #number PlaneSwitchRange
|
-- @field #number PlaneSwitchRange
|
||||||
-- @field Core.Set#SET_GROUP FlightSet
|
-- @field Core.Set#SET_GROUP FlightSet
|
||||||
-- @field #boolean SwitchAAA
|
-- @field #boolean SwitchAAA
|
||||||
|
-- @field #string lid
|
||||||
|
-- @field #table _cached_zones
|
||||||
-- @extends Core.Fsm#FSM
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -58,8 +65,8 @@
|
|||||||
-- @field #boolean AIOff
|
-- @field #boolean AIOff
|
||||||
-- @field #boolean exception
|
-- @field #boolean exception
|
||||||
|
|
||||||
|
---
|
||||||
--- *Tiresias, Greek demi-god and shapeshifter, blinded by the Gods, works as oracle for you.* (Wiki)
|
-- *Tiresias, Greek demi-god and shapeshifter, blinded by the Gods, works as oracle for you.* (Wiki)
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -74,18 +81,17 @@
|
|||||||
-- * Easy setup.
|
-- * Easy setup.
|
||||||
--
|
--
|
||||||
-- ## Setup
|
-- ## Setup
|
||||||
--
|
-- -- Setup is a one-liner:
|
||||||
-- Setup is a one-liner:
|
|
||||||
--
|
--
|
||||||
-- local blinder = TIRESIAS:New()
|
-- local blinder = TIRESIAS:New()
|
||||||
--
|
--
|
||||||
-- Optionally you can set up exceptions, e.g. for convoys driving around
|
-- -- Optionally you can set up exceptions, e.g. for convoys driving around
|
||||||
--
|
--
|
||||||
-- local exceptionset = SET_GROUP:New():FilterCoalitions("red"):FilterPrefixes("Convoy"):FilterStart()
|
-- local exceptionset = SET_GROUP:New():FilterCoalitions(" red" ):FilterPrefixes(" Convoy" ):FilterStart()
|
||||||
-- local blinder = TIRESIAS:New()
|
-- local blinder = TIRESIAS:New()
|
||||||
-- blinder:AddExceptionSet(exceptionset)
|
-- blinder:AddExceptionSet(exceptionset)
|
||||||
--
|
--
|
||||||
-- Options
|
-- -- Options
|
||||||
--
|
--
|
||||||
-- -- Setup different radius for activation around helo and airplane groups (applies to AI and humans)
|
-- -- Setup different radius for activation around helo and airplane groups (applies to AI and humans)
|
||||||
-- blinder:SetActivationRanges(10,25) -- defaults are 10, and 25
|
-- blinder:SetActivationRanges(10,25) -- defaults are 10, and 25
|
||||||
@@ -93,11 +99,12 @@
|
|||||||
-- -- Setup engagement ranges for AAA (non-advanced SAM units like Flaks etc) and if you want them to be AIOff
|
-- -- Setup engagement ranges for AAA (non-advanced SAM units like Flaks etc) and if you want them to be AIOff
|
||||||
-- blinder:SetAAARanges(60,true) -- defaults are 60, and true
|
-- blinder:SetAAARanges(60,true) -- defaults are 60, and true
|
||||||
--
|
--
|
||||||
|
---
|
||||||
-- @field #TIRESIAS
|
-- @field #TIRESIAS
|
||||||
TIRESIAS = {
|
TIRESIAS = {
|
||||||
ClassName = "TIRESIAS",
|
ClassName = "TIRESIAS",
|
||||||
debug = false,
|
debug = true,
|
||||||
version = "0.0.5",
|
version = " 0.0.6-OPT" ,
|
||||||
Interval = 20,
|
Interval = 20,
|
||||||
GroundSet = nil,
|
GroundSet = nil,
|
||||||
VehicleSet = nil,
|
VehicleSet = nil,
|
||||||
@@ -108,9 +115,11 @@ TIRESIAS = {
|
|||||||
HeloSwitchRange = 10, -- NM
|
HeloSwitchRange = 10, -- NM
|
||||||
PlaneSwitchRange = 25, -- NM
|
PlaneSwitchRange = 25, -- NM
|
||||||
SwitchAAA = true,
|
SwitchAAA = true,
|
||||||
}
|
_cached_zones = {}, -- Cache for zone objects
|
||||||
|
}
|
||||||
|
|
||||||
--- [USER] Create a new Tiresias object and start it up.
|
---
|
||||||
|
-- [USER] Create a new Tiresias object and start it up.
|
||||||
-- @param #TIRESIAS self
|
-- @param #TIRESIAS self
|
||||||
-- @return #TIRESIAS self
|
-- @return #TIRESIAS self
|
||||||
function TIRESIAS:New()
|
function TIRESIAS:New()
|
||||||
@@ -129,13 +138,15 @@ function TIRESIAS:New()
|
|||||||
self:AddTransition("*", "Status", "*") -- TIRESIAS status update.
|
self:AddTransition("*", "Status", "*") -- TIRESIAS status update.
|
||||||
self:AddTransition("*", "Stop", "Stopped") -- Stop FSM.
|
self:AddTransition("*", "Stop", "Stopped") -- Stop FSM.
|
||||||
|
|
||||||
self.ExceptionSet = SET_GROUP:New():Clear(false)
|
self.ExceptionSet = nil --SET_GROUP:New():Clear(false)
|
||||||
|
self._cached_zones = {} -- Initialize zone cache
|
||||||
|
|
||||||
self:HandleEvent(EVENTS.PlayerEnterAircraft,self._EventHandler)
|
self:HandleEvent(EVENTS.PlayerEnterAircraft, self._EventHandler)
|
||||||
|
|
||||||
self.lid = string.format("TIRESIAS %s | ",self.version)
|
-- Cache the log identifier to avoid string concatenation in loops
|
||||||
|
self.lid = "TIRESIAS " .. self.version .. " | "
|
||||||
|
|
||||||
self:I(self.lid.."Managing ground groups!")
|
self:I(self.lid .. "Managing ground groups!")
|
||||||
|
|
||||||
--- Triggers the FSM event "Stop". Stops TIRESIAS and all its event handlers.
|
--- Triggers the FSM event "Stop". Stops TIRESIAS and all its event handlers.
|
||||||
-- @function [parent=#TIRESIAS] Stop
|
-- @function [parent=#TIRESIAS] Stop
|
||||||
@@ -156,23 +167,26 @@ function TIRESIAS:New()
|
|||||||
-- @param #number delay Delay in seconds.
|
-- @param #number delay Delay in seconds.
|
||||||
|
|
||||||
self:__Start(1)
|
self:__Start(1)
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-----
|
||||||
--
|
|
||||||
-- Helper Functions
|
|
||||||
--
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
---[USER] Set activation radius for Helos and Planes in Nautical Miles.
|
---
|
||||||
|
-- Helper Functions
|
||||||
|
---
|
||||||
|
|
||||||
|
--- [USER] Set activation radius for Helos and Planes in Nautical Miles.
|
||||||
-- @param #TIRESIAS self
|
-- @param #TIRESIAS self
|
||||||
-- @param #number HeloMiles Radius around a Helicopter in which AI ground units will be activated. Defaults to 10NM.
|
-- @param #number HeloMiles Radius around a Helicopter in which AI ground units will be activated. Defaults to 10NM.
|
||||||
-- @param #number PlaneMiles Radius around an Airplane in which AI ground units will be activated. Defaults to 25NM.
|
-- @param #number PlaneMiles Radius around an Airplane in which AI ground units will be activated. Defaults to 25NM.
|
||||||
-- @return #TIRESIAS self
|
-- @return #TIRESIAS self
|
||||||
function TIRESIAS:SetActivationRanges(HeloMiles,PlaneMiles)
|
function TIRESIAS:SetActivationRanges(HeloMiles, PlaneMiles)
|
||||||
self.HeloSwitchRange = HeloMiles or 10
|
self.HeloSwitchRange = HeloMiles or 10
|
||||||
self.PlaneSwitchRange = PlaneMiles or 25
|
self.PlaneSwitchRange = PlaneMiles or 25
|
||||||
|
-- Clear zone cache when ranges change
|
||||||
|
self._cached_zones = {}
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -181,7 +195,7 @@ end
|
|||||||
-- @param #number FiringRange The engagement range that AAA units will be set to. Can be 0 to 100 (percent). Defaults to 60.
|
-- @param #number FiringRange The engagement range that AAA units will be set to. Can be 0 to 100 (percent). Defaults to 60.
|
||||||
-- @param #boolean SwitchAAA Decide if these system will have their AI switched off, too. Defaults to true.
|
-- @param #boolean SwitchAAA Decide if these system will have their AI switched off, too. Defaults to true.
|
||||||
-- @return #TIRESIAS self
|
-- @return #TIRESIAS self
|
||||||
function TIRESIAS:SetAAARanges(FiringRange,SwitchAAA)
|
function TIRESIAS:SetAAARanges(FiringRange, SwitchAAA)
|
||||||
self.AAARange = FiringRange or 60
|
self.AAARange = FiringRange or 60
|
||||||
self.SwitchAAA = (SwitchAAA == false) and false or true
|
self.SwitchAAA = (SwitchAAA == false) and false or true
|
||||||
return self
|
return self
|
||||||
@@ -192,330 +206,384 @@ end
|
|||||||
-- @param Core.Set#SET_GROUP Set to add to the exception list.
|
-- @param Core.Set#SET_GROUP Set to add to the exception list.
|
||||||
-- @return #TIRESIAS self
|
-- @return #TIRESIAS self
|
||||||
function TIRESIAS:AddExceptionSet(Set)
|
function TIRESIAS:AddExceptionSet(Set)
|
||||||
self:T(self.lid.."AddExceptionSet")
|
self:T(self.lid .. " AddExceptionSet" )
|
||||||
|
|
||||||
|
if not self.ExceptionSet then
|
||||||
|
self.ExceptionSet = SET_GROUP:New()
|
||||||
|
end
|
||||||
|
|
||||||
local exceptions = self.ExceptionSet
|
local exceptions = self.ExceptionSet
|
||||||
Set:ForEachGroupAlive(
|
|
||||||
function(grp)
|
-- Cache the exception data structure for reuse
|
||||||
if not grp.Tiresias then
|
local exception_data = {
|
||||||
grp.Tiresias = { -- #TIRESIAS.Data
|
type = " Exception" ,
|
||||||
type = "Exception",
|
|
||||||
exception = true,
|
exception = true,
|
||||||
}
|
}
|
||||||
exceptions:AddGroup(grp,true)
|
|
||||||
|
Set:ForEachGroupAlive(
|
||||||
|
function(grp)
|
||||||
|
local inAAASet = self.AAASet:IsIncludeObject(grp)
|
||||||
|
local inVehSet = self.VehicleSet:IsIncludeObject(grp)
|
||||||
|
local inSAMSet = self.SAMSet:IsIncludeObject(grp)
|
||||||
|
if grp:IsGround() and (not grp.Tiresias) and (not inAAASet) and (not inVehSet) and (not inSAMSet) then
|
||||||
|
grp.Tiresias = exception_data
|
||||||
|
exceptions:AddGroup(grp, true)
|
||||||
|
BASE:T(" TIRESIAS: Added exception group: " .. grp:GetName())
|
||||||
end
|
end
|
||||||
BASE:T("TIRESIAS: Added exception group: "..grp:GetName())
|
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- [INTERNAL] Filter Function
|
--- [INTERNAL] Filter Function - Optimized with cached calls
|
||||||
-- @param Wrapper.Group#GROUP Group
|
-- @param Wrapper.Group#GROUP Group
|
||||||
-- @return #boolean isin
|
-- @return #boolean isin
|
||||||
function TIRESIAS._FilterNotAAA(Group)
|
function TIRESIAS._FilterNotAAA(Group)
|
||||||
local grp = Group -- Wrapper.Group#GROUP
|
local grp = Group -- Wrapper.Group#GROUP
|
||||||
local isaaa = grp:IsAAA()
|
-- Cache method calls to reduce overhead
|
||||||
if isaaa == true and grp:IsGround() and not grp:IsShip() then
|
local is_air = grp:IsAir()
|
||||||
return false -- remove from SET
|
local is_ship = grp:IsShip()
|
||||||
else
|
local is_AAA = grp:IsAAA()
|
||||||
|
if is_air or grp:IsShip() then -- air or ship - no AAA
|
||||||
return true -- keep in SET
|
return true -- keep in SET
|
||||||
end
|
end
|
||||||
|
return not is_AAA -- remove AAA, keep others
|
||||||
end
|
end
|
||||||
|
|
||||||
--- [INTERNAL] Filter Function
|
--- [INTERNAL] Filter Function - Optimized with cached calls
|
||||||
-- @param Wrapper.Group#GROUP Group
|
-- @param Wrapper.Group#GROUP Group
|
||||||
-- @return #boolean isin
|
-- @return #boolean isin
|
||||||
function TIRESIAS._FilterNotSAM(Group)
|
function TIRESIAS._FilterNotSAM(Group)
|
||||||
local grp = Group -- Wrapper.Group#GROUP
|
local grp = Group -- Wrapper.Group#GROUP
|
||||||
local issam = grp:IsSAM()
|
-- Cache method calls to reduce overhead
|
||||||
if issam == true and grp:IsGround() and not grp:IsShip() then
|
local is_air = grp:IsGround()
|
||||||
return false -- remove from SET
|
local is_ship = grp:IsShip()
|
||||||
else
|
local is_SAM = grp:IsSAM()
|
||||||
|
if is_air or grp:IsShip() then
|
||||||
return true -- keep in SET
|
return true -- keep in SET
|
||||||
end
|
end
|
||||||
|
return not is_SAM -- remove SAM, keep others
|
||||||
end
|
end
|
||||||
|
|
||||||
--- [INTERNAL] Filter Function
|
--- [INTERNAL] Filter Function - Optimized with cached calls
|
||||||
-- @param Wrapper.Group#GROUP Group
|
-- @param Wrapper.Group#GROUP Group
|
||||||
-- @return #boolean isin
|
-- @return #boolean isin
|
||||||
function TIRESIAS._FilterAAA(Group)
|
function TIRESIAS._FilterAAA(Group)
|
||||||
local grp = Group -- Wrapper.Group#GROUP
|
local grp = Group -- Wrapper.Group#GROUP
|
||||||
local isaaa = grp:IsAAA()
|
-- Cache method calls to reduce overhead
|
||||||
if isaaa == true and grp:IsGround() and not grp:IsShip() then
|
local is_ground = grp:IsGround()
|
||||||
return true -- remove from SET
|
if (not is_ground) or grp:IsShip() then
|
||||||
else
|
return false -- not AAA
|
||||||
return false -- keep in SET
|
|
||||||
end
|
end
|
||||||
|
return grp:IsAAA() -- only AAA
|
||||||
end
|
end
|
||||||
|
|
||||||
--- [INTERNAL] Filter Function
|
--- [INTERNAL] Filter Function - Optimized with cached calls
|
||||||
-- @param Wrapper.Group#GROUP Group
|
-- @param Wrapper.Group#GROUP Group
|
||||||
-- @return #boolean isin
|
-- @return #boolean isin
|
||||||
function TIRESIAS._FilterSAM(Group)
|
function TIRESIAS._FilterSAM(Group)
|
||||||
local grp = Group -- Wrapper.Group#GROUP
|
local grp = Group -- Wrapper.Group#GROUP
|
||||||
local issam = grp:IsSAM()
|
-- Cache method calls to reduce overhead
|
||||||
if issam == true and grp:IsGround() and not grp:IsShip() then
|
local is_ground = grp:IsGround()
|
||||||
return true -- remove from SET
|
if (not is_ground) or grp:IsShip() then
|
||||||
else
|
return false -- not SAM
|
||||||
return false -- keep in SET
|
|
||||||
end
|
end
|
||||||
|
return grp:IsSAM() -- only SAM
|
||||||
end
|
end
|
||||||
|
|
||||||
--- [INTERNAL] Init Groups
|
--- [INTERNAL] Init Groups - Optimized with reduced function calls
|
||||||
-- @param #TIRESIAS self
|
-- @param #TIRESIAS self
|
||||||
-- @return #TIRESIAS self
|
-- @return #TIRESIAS self
|
||||||
function TIRESIAS:_InitGroups()
|
function TIRESIAS:_InitGroups()
|
||||||
self:T(self.lid.."_InitGroups")
|
self:T(self.lid .. " _InitGroups" )
|
||||||
-- Set all groups invisible/motionless
|
|
||||||
local EngageRange = self.AAARange
|
-- Cache frequently used values
|
||||||
local SwitchAAA = self.SwitchAAA
|
local EngageRange = self.AAARange
|
||||||
--- AAA
|
local SwitchAAA = self.SwitchAAA
|
||||||
self.AAASet:ForEachGroupAlive(
|
|
||||||
|
-- Pre-create data structures to avoid repeated table creation
|
||||||
|
local aaa_data_template = {
|
||||||
|
type = " AAA" ,
|
||||||
|
invisible = true,
|
||||||
|
range = EngageRange,
|
||||||
|
exception = false,
|
||||||
|
AIOff = SwitchAAA,
|
||||||
|
}
|
||||||
|
|
||||||
|
local vehicle_data_template = {
|
||||||
|
type = " Vehicle" ,
|
||||||
|
invisible = true,
|
||||||
|
AIOff = true,
|
||||||
|
exception = false,
|
||||||
|
}
|
||||||
|
|
||||||
|
local sam_data_template = {
|
||||||
|
type = " SAM" ,
|
||||||
|
invisible = true,
|
||||||
|
exception = false,
|
||||||
|
}
|
||||||
|
|
||||||
|
--- AAA - Optimized loop
|
||||||
|
self.AAASet:ForEachGroupAlive(
|
||||||
function(grp)
|
function(grp)
|
||||||
if not grp.Tiresias then
|
local tiresias_data = grp.Tiresias
|
||||||
|
if not tiresias_data then
|
||||||
grp:OptionEngageRange(EngageRange)
|
grp:OptionEngageRange(EngageRange)
|
||||||
grp:SetCommandInvisible(true)
|
grp:SetCommandInvisible(true)
|
||||||
if SwitchAAA then
|
if SwitchAAA then
|
||||||
grp:SetAIOff()
|
grp:SetAIOff()
|
||||||
grp:EnableEmission(false)
|
grp:EnableEmission(false)
|
||||||
end
|
end
|
||||||
grp.Tiresias = { -- #TIRESIAS.Data
|
grp.Tiresias = aaa_data_template
|
||||||
type = "AAA",
|
elseif not tiresias_data.exception == true then
|
||||||
invisible = true,
|
if not tiresias_data.invisible == true then
|
||||||
range = EngageRange,
|
|
||||||
exception = false,
|
|
||||||
AIOff = SwitchAAA,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
if grp.Tiresias and (not grp.Tiresias.exception == true) then
|
|
||||||
if grp.Tiresias.invisible == false then
|
|
||||||
grp:SetCommandInvisible(true)
|
grp:SetCommandInvisible(true)
|
||||||
grp.Tiresias.invisible = true
|
tiresias_data.invisible = true
|
||||||
if SwitchAAA then
|
if SwitchAAA == true then
|
||||||
grp:SetAIOff()
|
grp:SetAIOff()
|
||||||
grp:EnableEmission(false)
|
grp:EnableEmission(false)
|
||||||
grp.Tiresias.AIOff = true
|
tiresias_data.AIOff = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--BASE:I(string.format("Init/Switch off AAA %s (Exception %s)",grp:GetName(),tostring(grp.Tiresias.exception)))
|
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
--- Vehicles
|
|
||||||
self.VehicleSet:ForEachGroupAlive(
|
--- Vehicles - Optimized loop
|
||||||
|
self.VehicleSet:ForEachGroupAlive(
|
||||||
function(grp)
|
function(grp)
|
||||||
if not grp.Tiresias then
|
local tiresias_data = grp.Tiresias
|
||||||
|
if not tiresias_data then
|
||||||
grp:SetAIOff()
|
grp:SetAIOff()
|
||||||
grp:SetCommandInvisible(true)
|
grp:SetCommandInvisible(true)
|
||||||
grp.Tiresias = { -- #TIRESIAS.Data
|
grp.Tiresias = vehicle_data_template
|
||||||
type = "Vehicle",
|
elseif not tiresias_data.exception == true then
|
||||||
invisible = true,
|
if not tiresias_data.invisible then
|
||||||
AIOff = true,
|
|
||||||
exception = false,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
if grp.Tiresias and (not grp.Tiresias.exception == true) then
|
|
||||||
if grp.Tiresias and grp.Tiresias.invisible == false then
|
|
||||||
grp:SetCommandInvisible(true)
|
grp:SetCommandInvisible(true)
|
||||||
grp:SetAIOff()
|
grp:SetAIOff()
|
||||||
grp.Tiresias.invisible = true
|
tiresias_data.invisible = true
|
||||||
grp.Tiresias.AIOff = true
|
tiresias_data.AIOff = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--BASE:I(string.format("Init/Switch off Vehicle %s (Exception %s)",grp:GetName(),tostring(grp.Tiresias.exception)))
|
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
--- SAM
|
|
||||||
self.SAMSet:ForEachGroupAlive(
|
--- SAM - Optimized loop
|
||||||
|
self.SAMSet:ForEachGroupAlive(
|
||||||
function(grp)
|
function(grp)
|
||||||
if not grp.Tiresias then
|
local tiresias_data = grp.Tiresias
|
||||||
|
if not tiresias_data then
|
||||||
grp:SetCommandInvisible(true)
|
grp:SetCommandInvisible(true)
|
||||||
grp.Tiresias = { -- #TIRESIAS.Data
|
grp.Tiresias = sam_data_template
|
||||||
type = "SAM",
|
elseif not tiresias_data.exception == true then
|
||||||
invisible = true,
|
if not tiresias_data.invisible then
|
||||||
exception = false,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
if grp.Tiresias and (not grp.Tiresias.exception == true) then
|
|
||||||
if grp.Tiresias and grp.Tiresias.invisible == false then
|
|
||||||
grp:SetCommandInvisible(true)
|
grp:SetCommandInvisible(true)
|
||||||
grp.Tiresias.invisible = true
|
tiresias_data.invisible = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--BASE:I(string.format("Init/Switch off SAM %s (Exception %s)",grp:GetName(),tostring(grp.Tiresias.exception)))
|
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
return self
|
|
||||||
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- [INTERNAL] Event handler function
|
--- [INTERNAL] Event handler function - Optimized
|
||||||
-- @param #TIRESIAS self
|
-- @param #TIRESIAS self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
-- @return #TIRESIAS self
|
-- @return #TIRESIAS self
|
||||||
function TIRESIAS:_EventHandler(EventData)
|
function TIRESIAS:_EventHandler(EventData)
|
||||||
self:T(string.format("%s Event = %d",self.lid, EventData.id))
|
self:T(string.format(" %s Event = %d" , self.lid, EventData.id))
|
||||||
|
|
||||||
local event = EventData -- Core.Event#EVENTDATA
|
local event = EventData -- Core.Event#EVENTDATA
|
||||||
if event.id == EVENTS.PlayerEnterAircraft or event.id == EVENTS.PlayerEnterUnit then
|
if event.id == EVENTS.PlayerEnterAircraft or event.id == EVENTS.PlayerEnterUnit then
|
||||||
--local _coalition = event.IniCoalition
|
|
||||||
--if _coalition ~= self.Coalition then
|
|
||||||
-- return --ignore!
|
|
||||||
--end
|
|
||||||
local unitname = event.IniUnitName or "none"
|
|
||||||
local _unit = event.IniUnit
|
|
||||||
local _group = event.IniGroup
|
local _group = event.IniGroup
|
||||||
if _group and _group:IsAlive() then
|
if _group and _group:IsAlive() then
|
||||||
local radius = self.PlaneSwitchRange
|
-- Cache the radius calculation
|
||||||
if _group:IsHelicopter() then
|
local radius = _group:IsHelicopter() and self.HeloSwitchRange or self.PlaneSwitchRange
|
||||||
radius = self.HeloSwitchRange
|
self:_SwitchOnGroups(_group, radius)
|
||||||
end
|
|
||||||
self:_SwitchOnGroups(_group,radius)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- [INTERNAL] Switch Groups Behaviour
|
--- [INTERNAL] Switch Groups Behaviour - Optimized with zone caching
|
||||||
-- @param #TIRESIAS self
|
-- @param #TIRESIAS self
|
||||||
-- @param Wrapper.Group#GROUP group
|
-- @param Wrapper.Group#GROUP group
|
||||||
-- @param #number radius Radius in NM
|
-- @param #number radius Radius in NM
|
||||||
-- @return #TIRESIAS self
|
-- @return #TIRESIAS self
|
||||||
function TIRESIAS:_SwitchOnGroups(group,radius)
|
function TIRESIAS:_SwitchOnGroups(group, radius)
|
||||||
self:T(self.lid.."_SwitchOnGroups "..group:GetName().." Radius "..radius.." NM")
|
self:T(self.lid .. " _SwitchOnGroups " .. group:GetName() .. " Radius " .. radius .. " NM" )
|
||||||
local zone = ZONE_GROUP:New("Zone-"..group:GetName(),group,UTILS.NMToMeters(radius))
|
|
||||||
|
-- Use cached zones to reduce object creation
|
||||||
|
local group_name = group:GetName()
|
||||||
|
local cache_key = group_name .. " _" .. radius
|
||||||
|
local zone = self._cached_zones[cache_key]
|
||||||
|
|
||||||
|
if not zone then
|
||||||
|
zone = ZONE_GROUP:New(" Zone-" .. group_name, group, UTILS.NMToMeters(radius))
|
||||||
|
self._cached_zones[cache_key] = zone
|
||||||
|
else
|
||||||
|
-- Update zone center to current group position
|
||||||
|
zone:UpdateFromGroup(group)
|
||||||
|
end
|
||||||
|
|
||||||
local ground = SET_GROUP:New():FilterCategoryGround():FilterZones({zone}):FilterOnce()
|
local ground = SET_GROUP:New():FilterCategoryGround():FilterZones({zone}):FilterOnce()
|
||||||
local count = ground:CountAlive()
|
local count = ground:CountAlive()
|
||||||
|
|
||||||
if self.debug then
|
if self.debug then
|
||||||
local text = string.format("There are %d groups around this plane or helo!",count)
|
self:I(string.format(" There are %d groups around this plane or helo!" , count))
|
||||||
self:I(text)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if count > 0 then
|
||||||
|
-- Cache values outside the loop
|
||||||
local SwitchAAA = self.SwitchAAA
|
local SwitchAAA = self.SwitchAAA
|
||||||
if ground:CountAlive() > 0 then
|
local group_coalition = group:GetCoalition()
|
||||||
|
|
||||||
ground:ForEachGroupAlive(
|
ground:ForEachGroupAlive(
|
||||||
function(grp)
|
function(grp)
|
||||||
local name = grp:GetName()
|
local tiresias_data = grp.Tiresias
|
||||||
if grp:GetCoalition() ~= group:GetCoalition()
|
if grp:GetCoalition() ~= group_coalition
|
||||||
and grp.Tiresias and grp.Tiresias.type and (not grp.Tiresias.exception == true ) then
|
and tiresias_data
|
||||||
if grp.Tiresias.invisible == true then
|
and tiresias_data.type
|
||||||
|
and not tiresias_data.exception == true then
|
||||||
|
|
||||||
|
-- Make group visible if invisible
|
||||||
|
if tiresias_data.invisible == true then
|
||||||
grp:SetCommandInvisible(false)
|
grp:SetCommandInvisible(false)
|
||||||
grp.Tiresias.invisible = false
|
tiresias_data.invisible = false
|
||||||
end
|
end
|
||||||
if grp.Tiresias.type == "Vehicle" and grp.Tiresias.AIOff and grp.Tiresias.AIOff == true then
|
|
||||||
|
-- Handle AI activation based on type
|
||||||
|
local grp_type = tiresias_data.type
|
||||||
|
if grp_type == "Vehicle" and tiresias_data.AIOff == true then
|
||||||
grp:SetAIOn()
|
grp:SetAIOn()
|
||||||
grp.Tiresias.AIOff = false
|
tiresias_data.AIOff = false
|
||||||
end
|
elseif SwitchAAA == true and grp_type == "AAA" and tiresias_data.AIOff == true then
|
||||||
if SwitchAAA and grp.Tiresias.type == "AAA" and grp.Tiresias.AIOff and grp.Tiresias.AIOff == true then
|
|
||||||
grp:SetAIOn()
|
grp:SetAIOn()
|
||||||
grp:EnableEmission(true)
|
grp:EnableEmission(true)
|
||||||
grp.Tiresias.AIOff = false
|
tiresias_data.AIOff = false
|
||||||
end
|
end
|
||||||
--BASE:I(string.format("TIRESIAS - Switch on %s %s (Exception %s)",tostring(grp.Tiresias.type),grp:GetName(),tostring(grp.Tiresias.exception)))
|
|
||||||
else
|
else
|
||||||
BASE:T("TIRESIAS - This group "..tostring(name).. " has not been initialized or is an exception!")
|
BASE:T("TIRESIAS - This group " .. tostring(grp:GetName()) .. " has not been initialized or is an exception!")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-----
|
||||||
--
|
|
||||||
-- FSM Functions
|
|
||||||
--
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
--- [INTERNAL] FSM Function
|
---
|
||||||
|
-- FSM Functions
|
||||||
|
----
|
||||||
|
|
||||||
|
--- [INTERNAL] FSM Function - Optimized initialization
|
||||||
-- @param #TIRESIAS self
|
-- @param #TIRESIAS self
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @return #TIRESIAS self
|
-- @return #TIRESIAS self
|
||||||
function TIRESIAS:onafterStart(From, Event, To)
|
function TIRESIAS:onafterStart(From, Event, To)
|
||||||
self:T({From, Event, To})
|
self:T({From, Event, To})
|
||||||
|
|
||||||
local VehicleSet = SET_GROUP:New():FilterCategoryGround():FilterFunction(TIRESIAS._FilterNotAAA):FilterFunction(TIRESIAS._FilterNotSAM):FilterStart()
|
-- Create sets with optimized filters
|
||||||
local AAASet = SET_GROUP:New():FilterCategoryGround():FilterFunction(TIRESIAS._FilterAAA):FilterStart()
|
local VehicleSet = SET_GROUP:New():FilterCategoryGround():FilterFunction(TIRESIAS._FilterNotAAA):FilterFunction(TIRESIAS._FilterNotSAM):FilterStart()
|
||||||
local SAMSet = SET_GROUP:New():FilterCategoryGround():FilterFunction(TIRESIAS._FilterSAM):FilterStart()
|
local AAASet = SET_GROUP:New():FilterCategoryGround():FilterFunction(TIRESIAS._FilterAAA):FilterStart()
|
||||||
local OpsGroupSet = SET_OPSGROUP:New():FilterActive(true):FilterStart()
|
local SAMSet = SET_GROUP:New():FilterCategoryGround():FilterFunction(TIRESIAS._FilterSAM):FilterStart()
|
||||||
self.FlightSet = SET_GROUP:New():FilterCategories({"plane","helicopter"}):FilterStart()
|
local OpsGroupSet = SET_OPSGROUP:New():FilterActive(true):FilterStart()
|
||||||
|
self.FlightSet = SET_GROUP:New():FilterCategories({" plane" ," helicopter" }):FilterStart()
|
||||||
|
|
||||||
local EngageRange = self.AAARange
|
-- Cache frequently used values
|
||||||
|
local EngageRange = self.AAARange
|
||||||
|
local SwitchAAA = self.SwitchAAA
|
||||||
|
local ExceptionSet = self.ExceptionSet
|
||||||
|
|
||||||
local ExceptionSet = self.ExceptionSet
|
-- Pre-create data templates to reduce object creation
|
||||||
if self.ExceptionSet then
|
local exception_data = {
|
||||||
function ExceptionSet:OnAfterAdded(From,Event,To,ObjectName,Object)
|
type = " Exception" ,
|
||||||
BASE:I("TIRESIAS: EXCEPTION Object Added: "..Object:GetName())
|
|
||||||
if Object and Object:IsAlive() then
|
|
||||||
Object.Tiresias = { -- #TIRESIAS.Data
|
|
||||||
type = "Exception",
|
|
||||||
exception = true,
|
exception = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local vehicle_data = {
|
||||||
|
type = " Vehicle" ,
|
||||||
|
invisible = true,
|
||||||
|
AIOff = true,
|
||||||
|
exception = false,
|
||||||
|
}
|
||||||
|
|
||||||
|
local aaa_data = {
|
||||||
|
type = " AAA" ,
|
||||||
|
invisible = true,
|
||||||
|
range = EngageRange,
|
||||||
|
exception = false,
|
||||||
|
AIOff = SwitchAAA,
|
||||||
|
}
|
||||||
|
|
||||||
|
local sam_data = {
|
||||||
|
type = " SAM" ,
|
||||||
|
invisible = true,
|
||||||
|
exception = false,
|
||||||
|
}
|
||||||
|
|
||||||
|
if ExceptionSet then
|
||||||
|
function ExceptionSet:OnAfterAdded(From, Event, To, ObjectName, Object)
|
||||||
|
BASE:I(" TIRESIAS: EXCEPTION Object Added: " .. Object:GetName())
|
||||||
|
if Object and Object:IsAlive() then
|
||||||
|
Object.Tiresias = exception_data
|
||||||
Object:SetAIOn()
|
Object:SetAIOn()
|
||||||
Object:SetCommandInvisible(false)
|
Object:SetCommandInvisible(false)
|
||||||
Object:EnableEmission(true)
|
Object:EnableEmission(true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Process existing OpsGroups more efficiently
|
||||||
local OGS = OpsGroupSet:GetAliveSet()
|
local OGS = OpsGroupSet:GetAliveSet()
|
||||||
for _,_OG in pairs(OGS or {}) do
|
for _, _OG in pairs(OGS or {}) do
|
||||||
local OG = _OG -- Ops.OpsGroup#OPSGROUP
|
local OG = _OG -- Ops.OpsGroup#OPSGROUP
|
||||||
local grp = OG:GetGroup()
|
local grp = OG:GetGroup()
|
||||||
ExceptionSet:AddGroup(grp,true)
|
ExceptionSet:AddGroup(grp, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
function OpsGroupSet:OnAfterAdded(From,Event,To,ObjectName,Object)
|
function OpsGroupSet:OnAfterAdded(From, Event, To, ObjectName, Object)
|
||||||
local grp = Object:GetGroup()
|
local grp = Object:GetGroup()
|
||||||
ExceptionSet:AddGroup(grp,true)
|
ExceptionSet:AddGroup(grp, true)
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function VehicleSet:OnAfterAdded(From,Event,To,ObjectName,Object)
|
-- Optimized event handlers with pre-created data objects
|
||||||
BASE:I("TIRESIAS: VEHCILE Object Added: "..Object:GetName())
|
function VehicleSet:OnAfterAdded(From, Event, To, ObjectName, Object)
|
||||||
|
BASE:T(" TIRESIAS: VEHICLE Object Added: " .. Object:GetName())
|
||||||
if Object and Object:IsAlive() then
|
if Object and Object:IsAlive() then
|
||||||
Object:SetAIOff()
|
Object:SetAIOff()
|
||||||
Object:SetCommandInvisible(true)
|
Object:SetCommandInvisible(true)
|
||||||
Object.Tiresias = { -- #TIRESIAS.Data
|
Object.Tiresias = vehicle_data
|
||||||
type = "Vehicle",
|
|
||||||
invisible = true,
|
|
||||||
AIOff = true,
|
|
||||||
exception = false,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local SwitchAAA = self.SwitchAAA
|
function AAASet:OnAfterAdded(From, Event, To, ObjectName, Object)
|
||||||
|
|
||||||
function AAASet:OnAfterAdded(From,Event,To,ObjectName,Object)
|
|
||||||
if Object and Object:IsAlive() then
|
if Object and Object:IsAlive() then
|
||||||
BASE:I("TIRESIAS: AAA Object Added: "..Object:GetName())
|
BASE:I(" TIRESIAS: AAA Object Added: " .. Object:GetName())
|
||||||
Object:OptionEngageRange(EngageRange)
|
Object:OptionEngageRange(EngageRange)
|
||||||
Object:SetCommandInvisible(true)
|
Object:SetCommandInvisible(true)
|
||||||
if SwitchAAA then
|
if SwitchAAA then
|
||||||
Object:SetAIOff()
|
Object:SetAIOff()
|
||||||
Object:EnableEmission(false)
|
Object:EnableEmission(false)
|
||||||
end
|
end
|
||||||
Object.Tiresias = { -- #TIRESIAS.Data
|
Object.Tiresias = aaa_data
|
||||||
type = "AAA",
|
|
||||||
invisible = true,
|
|
||||||
range = EngageRange,
|
|
||||||
exception = false,
|
|
||||||
AIOff = SwitchAAA,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function SAMSet:OnAfterAdded(From,Event,To,ObjectName,Object)
|
function SAMSet:OnAfterAdded(From, Event, To, ObjectName, Object)
|
||||||
if Object and Object:IsAlive() then
|
if Object and Object:IsAlive() then
|
||||||
BASE:I("TIRESIAS: SAM Object Added: "..Object:GetName())
|
BASE:T(" TIRESIAS: SAM Object Added: " .. Object:GetName())
|
||||||
Object:SetCommandInvisible(true)
|
Object:SetCommandInvisible(true)
|
||||||
Object.Tiresias = { -- #TIRESIAS.Data
|
Object.Tiresias = sam_data
|
||||||
type = "SAM",
|
|
||||||
invisible = true,
|
|
||||||
exception = false,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Store references
|
||||||
self.VehicleSet = VehicleSet
|
self.VehicleSet = VehicleSet
|
||||||
self.AAASet = AAASet
|
self.AAASet = AAASet
|
||||||
self.SAMSet = SAMSet
|
self.SAMSet = SAMSet
|
||||||
@@ -535,13 +603,10 @@ end
|
|||||||
-- @return #TIRESIAS self
|
-- @return #TIRESIAS self
|
||||||
function TIRESIAS:onbeforeStatus(From, Event, To)
|
function TIRESIAS:onbeforeStatus(From, Event, To)
|
||||||
self:T({From, Event, To})
|
self:T({From, Event, To})
|
||||||
if self:GetState() == "Stopped" then
|
return self:GetState() ~= " Stopped"
|
||||||
return false
|
|
||||||
end
|
|
||||||
return self
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- [INTERNAL] FSM Function
|
--- [INTERNAL] FSM Function - Optimized status processing
|
||||||
-- @param #TIRESIAS self
|
-- @param #TIRESIAS self
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
@@ -549,28 +614,36 @@ end
|
|||||||
-- @return #TIRESIAS self
|
-- @return #TIRESIAS self
|
||||||
function TIRESIAS:onafterStatus(From, Event, To)
|
function TIRESIAS:onafterStatus(From, Event, To)
|
||||||
self:T({From, Event, To})
|
self:T({From, Event, To})
|
||||||
|
|
||||||
if self.debug then
|
if self.debug then
|
||||||
local count = self.VehicleSet:CountAlive()
|
local count = self.VehicleSet:CountAlive()
|
||||||
local AAAcount = self.AAASet:CountAlive()
|
local AAAcount = self.AAASet:CountAlive()
|
||||||
local SAMcount = self.SAMSet:CountAlive()
|
local SAMcount = self.SAMSet:CountAlive()
|
||||||
local text = string.format("Overall: %d | Vehicles: %d | AAA: %d | SAM: %d",count+AAAcount+SAMcount,count,AAAcount,SAMcount)
|
self:I(string.format(" Overall: %d | Vehicles: %d | AAA: %d | SAM: %d" ,
|
||||||
self:I(text)
|
count + AAAcount + SAMcount, count, AAAcount, SAMcount))
|
||||||
end
|
end
|
||||||
|
|
||||||
self:_InitGroups()
|
self:_InitGroups()
|
||||||
if self.FlightSet:CountAlive() > 0 then
|
|
||||||
|
-- Process flight groups more efficiently
|
||||||
|
local flight_count = self.FlightSet:CountAlive()
|
||||||
|
if flight_count > 0 then
|
||||||
local Set = self.FlightSet:GetAliveSet()
|
local Set = self.FlightSet:GetAliveSet()
|
||||||
for _,_plane in pairs(Set) do
|
-- Cache range values outside loop
|
||||||
|
local helo_range = self.HeloSwitchRange
|
||||||
|
local plane_range = self.PlaneSwitchRange
|
||||||
|
|
||||||
|
for _, _plane in pairs(Set or {}) do
|
||||||
local plane = _plane -- Wrapper.Group#GROUP
|
local plane = _plane -- Wrapper.Group#GROUP
|
||||||
local radius = self.PlaneSwitchRange
|
local radius = plane:IsHelicopter() and helo_range or plane_range
|
||||||
if plane:IsHelicopter() then
|
self:_SwitchOnGroups(plane, radius)
|
||||||
radius = self.HeloSwitchRange
|
|
||||||
end
|
|
||||||
self:_SwitchOnGroups(_plane,radius)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if self:GetState() ~= "Stopped" then
|
|
||||||
|
if self:GetState() ~= " Stopped" then
|
||||||
self:__Status(self.Interval)
|
self:__Status(self.Interval)
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -583,11 +656,11 @@ end
|
|||||||
function TIRESIAS:onafterStop(From, Event, To)
|
function TIRESIAS:onafterStop(From, Event, To)
|
||||||
self:T({From, Event, To})
|
self:T({From, Event, To})
|
||||||
self:UnHandleEvent(EVENTS.PlayerEnterAircraft)
|
self:UnHandleEvent(EVENTS.PlayerEnterAircraft)
|
||||||
|
-- Clear zone cache on stop to free memory
|
||||||
|
self._cached_zones = {}
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-----
|
||||||
--
|
---- End
|
||||||
-- End
|
-----
|
||||||
--
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
|
||||||
@@ -3153,7 +3153,7 @@ end
|
|||||||
-- @param #WAREHOUSE self
|
-- @param #WAREHOUSE self
|
||||||
-- @return Core.Point#COORDINATE The coordinate of the warehouse.
|
-- @return Core.Point#COORDINATE The coordinate of the warehouse.
|
||||||
function WAREHOUSE:GetCoordinate()
|
function WAREHOUSE:GetCoordinate()
|
||||||
return self.warehouse:GetCoordinate()
|
return self.warehouse:GetCoord()
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get 3D vector of warehouse static.
|
--- Get 3D vector of warehouse static.
|
||||||
@@ -6893,7 +6893,7 @@ function WAREHOUSE:_CheckConquered()
|
|||||||
for _,_unit in pairs(units) do
|
for _,_unit in pairs(units) do
|
||||||
local unit=_unit --Wrapper.Unit#UNIT
|
local unit=_unit --Wrapper.Unit#UNIT
|
||||||
|
|
||||||
local distance=coord:Get2DDistance(unit:GetCoordinate())
|
local distance=coord:Get2DDistance(unit:GetCoord())
|
||||||
|
|
||||||
-- Filter only alive groud units. Also check distance again, because the scan routine might give some larger distances.
|
-- Filter only alive groud units. Also check distance again, because the scan routine might give some larger distances.
|
||||||
if unit:IsGround() and unit:IsAlive() and distance <= radius then
|
if unit:IsGround() and unit:IsAlive() and distance <= radius then
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # Developer Note
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
-- Note while this class still works, it is no longer supported as the original author stopped active development of MOOSE
|
||||||
-- Therefore, this class is considered to be deprecated
|
-- Therefore, this class is considered to be deprecated
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -115,7 +115,6 @@ __Moose.Include( 'Ops\\Operation.lua' )
|
|||||||
__Moose.Include( 'Ops\\FlightControl.lua' )
|
__Moose.Include( 'Ops\\FlightControl.lua' )
|
||||||
__Moose.Include( 'Ops\\PlayerRecce.lua' )
|
__Moose.Include( 'Ops\\PlayerRecce.lua' )
|
||||||
__Moose.Include( 'Ops\\EasyGCICAP.lua' )
|
__Moose.Include( 'Ops\\EasyGCICAP.lua' )
|
||||||
__Moose.Include( 'Ops\\EasyA2G.lua' )
|
|
||||||
|
|
||||||
__Moose.Include( 'AI\\AI_Balancer.lua' )
|
__Moose.Include( 'AI\\AI_Balancer.lua' )
|
||||||
__Moose.Include( 'AI\\AI_Air.lua' )
|
__Moose.Include( 'AI\\AI_Air.lua' )
|
||||||
|
|||||||
@@ -2798,7 +2798,7 @@ function ATIS:onafterBroadcast( From, Event, To )
|
|||||||
|
|
||||||
end
|
end
|
||||||
_RUNACT = subtitle
|
_RUNACT = subtitle
|
||||||
alltext = alltext .. ";\n" .. subtitle
|
--alltext = alltext .. ";\n" .. subtitle
|
||||||
|
|
||||||
-- Runway length.
|
-- Runway length.
|
||||||
if self.rwylength then
|
if self.rwylength then
|
||||||
|
|||||||
@@ -974,6 +974,46 @@ function AIRWING:SetTakeoffAir()
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Set the aircraft of the AirWing to land straight in.
|
||||||
|
-- @param #AIRWING self
|
||||||
|
-- @return #FLIGHTGROUP self
|
||||||
|
function AIRWING:SetLandingStraightIn()
|
||||||
|
self.OptionLandingStraightIn = true
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Set the aircraft of the AirWing to land in pairs for groups > 1 aircraft.
|
||||||
|
-- @param #AIRWING self
|
||||||
|
-- @return #AIRWING self
|
||||||
|
function AIRWING:SetLandingForcePair()
|
||||||
|
self.OptionLandingForcePair = true
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Set the aircraft of the AirWing to NOT land in pairs.
|
||||||
|
-- @param #AIRWING self
|
||||||
|
-- @return #AIRWING self
|
||||||
|
function AIRWING:SetLandingRestrictPair()
|
||||||
|
self.OptionLandingRestrictPair = true
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Set the aircraft of the AirWing to land after overhead break.
|
||||||
|
-- @param #AIRWING self
|
||||||
|
-- @return #AIRWING self
|
||||||
|
function AIRWING:SetLandingOverheadBreak()
|
||||||
|
self.OptionLandingOverheadBreak = true
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- [Helicopter] Set the aircraft of the AirWing to prefer vertical takeoff and landing.
|
||||||
|
-- @param #AIRWING self
|
||||||
|
-- @return #AIRWING self
|
||||||
|
function AIRWING:SetOptionPreferVerticalLanding()
|
||||||
|
self.OptionPreferVerticalLanding = true
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Set despawn after landing. Aircraft will be despawned after the landing event.
|
--- Set despawn after landing. Aircraft will be despawned after the landing event.
|
||||||
-- Can help to avoid DCS AI taxiing issues.
|
-- Can help to avoid DCS AI taxiing issues.
|
||||||
-- @param #AIRWING self
|
-- @param #AIRWING self
|
||||||
@@ -1465,6 +1505,20 @@ function AIRWING:onafterFlightOnMission(From, Event, To, FlightGroup, Mission)
|
|||||||
if self.UseConnectedOpsAwacs and self.ConnectedOpsAwacs then
|
if self.UseConnectedOpsAwacs and self.ConnectedOpsAwacs then
|
||||||
self.ConnectedOpsAwacs:__FlightOnMission(2,FlightGroup,Mission)
|
self.ConnectedOpsAwacs:__FlightOnMission(2,FlightGroup,Mission)
|
||||||
end
|
end
|
||||||
|
-- Landing Options
|
||||||
|
if self.OptionLandingForcePair then
|
||||||
|
FlightGroup:SetOptionLandingForcePair()
|
||||||
|
elseif self.OptionLandingOverheadBreak then
|
||||||
|
FlightGroup:SetOptionLandingOverheadBreak()
|
||||||
|
elseif self.OptionLandingRestrictPair then
|
||||||
|
FlightGroup:SetOptionLandingRestrictPair()
|
||||||
|
elseif self.OptionLandingStraightIn then
|
||||||
|
FlightGroup:SetOptionLandingStraightIn()
|
||||||
|
end
|
||||||
|
-- Landing Options Helo
|
||||||
|
if self.OptionPreferVerticalLanding then
|
||||||
|
FlightGroup:SetOptionPreferVertical()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -397,6 +397,7 @@ AUFTRAG = {
|
|||||||
conditionPush = {},
|
conditionPush = {},
|
||||||
conditionSuccessSet = false,
|
conditionSuccessSet = false,
|
||||||
conditionFailureSet = false,
|
conditionFailureSet = false,
|
||||||
|
repeatDelay = 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Global mission counter.
|
--- Global mission counter.
|
||||||
@@ -1428,7 +1429,7 @@ function AUFTRAG:NewCAP(ZoneCAP, Altitude, Speed, Coordinate, Heading, Leg, Targ
|
|||||||
mission:_SetLogID()
|
mission:_SetLogID()
|
||||||
|
|
||||||
-- DCS task parameters:
|
-- DCS task parameters:
|
||||||
mission.engageZone=ZoneCAP
|
mission.engageZone=ZoneCAP or Coordinate
|
||||||
mission.engageTargetTypes=TargetTypes or {"Air"}
|
mission.engageTargetTypes=TargetTypes or {"Air"}
|
||||||
|
|
||||||
-- Mission options:
|
-- Mission options:
|
||||||
@@ -1715,9 +1716,45 @@ function AUFTRAG:NewSEAD(Target, Altitude)
|
|||||||
return mission
|
return mission
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- **[AIR]** Create a SEAD in Zone mission.
|
||||||
|
-- @param #AUFTRAG self
|
||||||
|
-- @param Core.Zone#ZONE TargetZone The target zone to attack.
|
||||||
|
-- @param #number Altitude Engage altitude in feet. Default 25000 ft.
|
||||||
|
-- @param #table TargetTypes Table of string of DCS known target types, defaults to {"Air Defence"}. See [DCS Target Attributes](https://wiki.hoggitworld.com/view/DCS_enum_attributes)
|
||||||
|
-- @param #number Duration Engage this much time when the AUFTRAG starts executing.
|
||||||
|
-- @return #AUFTRAG self
|
||||||
|
function AUFTRAG:NewSEADInZone(TargetZone, Altitude, TargetTypes, Duration)
|
||||||
|
|
||||||
|
local mission=AUFTRAG:New(AUFTRAG.Type.SEAD)
|
||||||
|
|
||||||
|
mission:_TargetFromObject(TargetZone)
|
||||||
|
|
||||||
|
-- DCS Task options:
|
||||||
|
mission.engageWeaponType=ENUMS.WeaponFlag.Auto
|
||||||
|
mission.engageWeaponExpend=AI.Task.WeaponExpend.ALL
|
||||||
|
mission.engageAltitude=UTILS.FeetToMeters(Altitude or 25000)
|
||||||
|
mission.engageZone = TargetZone
|
||||||
|
mission.engageTargetTypes = TargetTypes or {"Air Defence"}
|
||||||
|
|
||||||
|
-- Mission options:
|
||||||
|
mission.missionTask=ENUMS.MissionTask.SEAD
|
||||||
|
mission.missionAltitude=mission.engageAltitude
|
||||||
|
mission.missionFraction=0.2
|
||||||
|
mission.optionROE=ENUMS.ROE.OpenFire
|
||||||
|
mission.optionROT=ENUMS.ROT.EvadeFire
|
||||||
|
|
||||||
|
mission.categories={AUFTRAG.Category.AIRCRAFT}
|
||||||
|
|
||||||
|
mission.DCStask=mission:GetDCSMissionTask()
|
||||||
|
|
||||||
|
mission:SetDuration(Duration or 1800)
|
||||||
|
|
||||||
|
return mission
|
||||||
|
end
|
||||||
|
|
||||||
--- **[AIR]** Create a STRIKE mission. Flight will attack the closest map object to the specified coordinate.
|
--- **[AIR]** Create a STRIKE mission. Flight will attack the closest map object to the specified coordinate.
|
||||||
-- @param #AUFTRAG self
|
-- @param #AUFTRAG self
|
||||||
-- @param Core.Point#COORDINATE Target The target coordinate. Can also be given as a GROUP, UNIT, STATIC or TARGET object.
|
-- @param Core.Point#COORDINATE Target The target coordinate. Can also be given as a GROUP, UNIT, STATIC, SET_GROUP, SET_UNIT, SET_STATIC or TARGET object.
|
||||||
-- @param #number Altitude Engage altitude in feet. Default 2000 ft.
|
-- @param #number Altitude Engage altitude in feet. Default 2000 ft.
|
||||||
-- @param #number EngageWeaponType Which weapon to use. Defaults to auto, ie ENUMS.WeaponFlag.Auto. See ENUMS.WeaponFlag for options.
|
-- @param #number EngageWeaponType Which weapon to use. Defaults to auto, ie ENUMS.WeaponFlag.Auto. See ENUMS.WeaponFlag for options.
|
||||||
-- @return #AUFTRAG self
|
-- @return #AUFTRAG self
|
||||||
@@ -1749,11 +1786,12 @@ end
|
|||||||
--- **[AIR]** Create a BOMBING mission. Flight will drop bombs a specified coordinate.
|
--- **[AIR]** Create a BOMBING mission. Flight will drop bombs a specified coordinate.
|
||||||
-- See [DCS task bombing](https://wiki.hoggitworld.com/view/DCS_task_bombing).
|
-- See [DCS task bombing](https://wiki.hoggitworld.com/view/DCS_task_bombing).
|
||||||
-- @param #AUFTRAG self
|
-- @param #AUFTRAG self
|
||||||
-- @param Core.Point#COORDINATE Target Target coordinate. Can also be specified as a GROUP, UNIT, STATIC or TARGET object.
|
-- @param Core.Point#COORDINATE Target Target coordinate. Can also be specified as a GROUP, UNIT, STATIC, SET_GROUP, SET_UNIT, SET_STATIC or TARGET object.
|
||||||
-- @param #number Altitude Engage altitude in feet. Default 25000 ft.
|
-- @param #number Altitude Engage altitude in feet. Default 25000 ft.
|
||||||
-- @param #number EngageWeaponType Which weapon to use. Defaults to auto, ie ENUMS.WeaponFlag.Auto. See ENUMS.WeaponFlag for options.
|
-- @param #number EngageWeaponType Which weapon to use. Defaults to auto, ie ENUMS.WeaponFlag.Auto. See ENUMS.WeaponFlag for options.
|
||||||
|
-- @param #boolean Divebomb If true, use a dive bombing attack approach.
|
||||||
-- @return #AUFTRAG self
|
-- @return #AUFTRAG self
|
||||||
function AUFTRAG:NewBOMBING(Target, Altitude, EngageWeaponType)
|
function AUFTRAG:NewBOMBING(Target, Altitude, EngageWeaponType, Divebomb)
|
||||||
|
|
||||||
local mission=AUFTRAG:New(AUFTRAG.Type.BOMBING)
|
local mission=AUFTRAG:New(AUFTRAG.Type.BOMBING)
|
||||||
|
|
||||||
@@ -1770,6 +1808,7 @@ function AUFTRAG:NewBOMBING(Target, Altitude, EngageWeaponType)
|
|||||||
mission.missionFraction=0.5
|
mission.missionFraction=0.5
|
||||||
mission.optionROE=ENUMS.ROE.OpenFire
|
mission.optionROE=ENUMS.ROE.OpenFire
|
||||||
mission.optionROT=ENUMS.ROT.NoReaction -- No reaction is better.
|
mission.optionROT=ENUMS.ROT.NoReaction -- No reaction is better.
|
||||||
|
mission.optionDivebomb = Divebomb or nil
|
||||||
|
|
||||||
-- Evaluate result after 5 min. We might need time until the bombs have dropped and targets have been detroyed.
|
-- Evaluate result after 5 min. We might need time until the bombs have dropped and targets have been detroyed.
|
||||||
mission.dTevaluate=5*60
|
mission.dTevaluate=5*60
|
||||||
@@ -2966,6 +3005,16 @@ function AUFTRAG:SetRepeat(Nrepeat)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- **[LEGION, COMMANDER, CHIEF]** Set the repeat delay in seconds after a mission is successful/failed. Only valid if the mission is handled by a LEGION (AIRWING, BRIGADE, FLEET) or higher level.
|
||||||
|
-- @param #AUFTRAG self
|
||||||
|
-- @param #number Nrepeat Repeat delay in seconds. Default 1.
|
||||||
|
-- @return #AUFTRAG self
|
||||||
|
function AUFTRAG:SetRepeatDelay(RepeatDelay)
|
||||||
|
self.repeatDelay = RepeatDelay
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- **[LEGION, COMMANDER, CHIEF]** Set how many times the mission is repeated if it fails. Only valid if the mission is handled by a LEGION (AIRWING, BRIGADE, FLEET) or higher level.
|
--- **[LEGION, COMMANDER, CHIEF]** Set how many times the mission is repeated if it fails. Only valid if the mission is handled by a LEGION (AIRWING, BRIGADE, FLEET) or higher level.
|
||||||
-- @param #AUFTRAG self
|
-- @param #AUFTRAG self
|
||||||
-- @param #number Nrepeat Number of repeats. Default 0.
|
-- @param #number Nrepeat Number of repeats. Default 0.
|
||||||
@@ -4765,6 +4814,8 @@ end
|
|||||||
-- @return #boolean If `true`, all groups are done with the mission.
|
-- @return #boolean If `true`, all groups are done with the mission.
|
||||||
function AUFTRAG:CheckGroupsDone()
|
function AUFTRAG:CheckGroupsDone()
|
||||||
|
|
||||||
|
local fsmState = self:GetState()
|
||||||
|
|
||||||
-- Check status of all OPS groups.
|
-- Check status of all OPS groups.
|
||||||
for groupname,data in pairs(self.groupdata) do
|
for groupname,data in pairs(self.groupdata) do
|
||||||
local groupdata=data --#AUFTRAG.GroupData
|
local groupdata=data --#AUFTRAG.GroupData
|
||||||
@@ -4823,6 +4874,11 @@ function AUFTRAG:CheckGroupsDone()
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if (self:IsStarted() or self:IsExecuting()) and (fsmState == AUFTRAG.Status.STARTED or fsmState == AUFTRAG.Status.EXECUTING) and self:CountOpsGroups()>0 then
|
||||||
|
self:T(self.lid..string.format("CheckGroupsDone: Mission is STARTED state %s [FSM=%s] and count of alive OPSGROUP > zero. Mission NOT DONE!", self.status, self:GetState()))
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -5160,7 +5216,7 @@ function AUFTRAG:onafterSuccess(From, Event, To)
|
|||||||
|
|
||||||
-- Repeat mission.
|
-- Repeat mission.
|
||||||
self:T(self.lid..string.format("Mission SUCCESS! Repeating mission for the %d time (max %d times) ==> Repeat mission!", self.repeated+1, N))
|
self:T(self.lid..string.format("Mission SUCCESS! Repeating mission for the %d time (max %d times) ==> Repeat mission!", self.repeated+1, N))
|
||||||
self:Repeat()
|
self:__Repeat(self.repeatDelay)
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
@@ -5202,7 +5258,7 @@ function AUFTRAG:onafterFailed(From, Event, To)
|
|||||||
|
|
||||||
-- Repeat mission.
|
-- Repeat mission.
|
||||||
self:T(self.lid..string.format("Mission FAILED! Repeating mission for the %d time (max %d times) ==> Repeat mission!", self.repeated+1, N))
|
self:T(self.lid..string.format("Mission FAILED! Repeating mission for the %d time (max %d times) ==> Repeat mission!", self.repeated+1, N))
|
||||||
self:Repeat()
|
self:__Repeat(self.repeatDelay)
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
@@ -6108,9 +6164,12 @@ function AUFTRAG:GetDCSMissionTask()
|
|||||||
-- BOMBING Mission --
|
-- BOMBING Mission --
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
local DCStask=CONTROLLABLE.TaskBombing(nil, self:GetTargetVec2(), self.engageAsGroup, self.engageWeaponExpend, self.engageQuantity, self.engageDirection, self.engageAltitude, self.engageWeaponType, Divebomb)
|
local coords = self.engageTarget:GetCoordinates()
|
||||||
|
for _, coord in pairs(coords) do
|
||||||
|
local DCStask = CONTROLLABLE.TaskBombing(nil, coord:GetVec2(), self.engageAsGroup, self.engageWeaponExpend, self.engageQuantity, self.engageDirection, self.engageAltitude, self.engageWeaponType, self.optionDivebomb)
|
||||||
|
|
||||||
table.insert(DCStasks, DCStask)
|
table.insert(DCStasks, DCStask)
|
||||||
|
end
|
||||||
|
|
||||||
elseif self.type==AUFTRAG.Type.STRAFING then
|
elseif self.type==AUFTRAG.Type.STRAFING then
|
||||||
|
|
||||||
@@ -6148,7 +6207,15 @@ function AUFTRAG:GetDCSMissionTask()
|
|||||||
-- CAP Mission --
|
-- CAP Mission --
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
local DCStask=CONTROLLABLE.EnRouteTaskEngageTargetsInZone(nil, self.engageZone:GetVec2(), self.engageZone:GetRadius(), self.engageTargetTypes, Priority)
|
local Vec2 = self.engageZone:GetVec2()
|
||||||
|
local Radius
|
||||||
|
if self.engageZone:IsInstanceOf("COORDINATE") then
|
||||||
|
Radius = UTILS.NMToMeters(20)
|
||||||
|
else
|
||||||
|
Radius = self.engageZone:GetRadius()
|
||||||
|
end
|
||||||
|
|
||||||
|
local DCStask=CONTROLLABLE.EnRouteTaskEngageTargetsInZone(nil, Vec2, Radius, self.engageTargetTypes, Priority)
|
||||||
|
|
||||||
table.insert(self.enrouteTasks, DCStask)
|
table.insert(self.enrouteTasks, DCStask)
|
||||||
|
|
||||||
@@ -6303,17 +6370,46 @@ function AUFTRAG:GetDCSMissionTask()
|
|||||||
--local DCStask=CONTROLLABLE.EnRouteTaskSEAD(nil, self.TargetType)
|
--local DCStask=CONTROLLABLE.EnRouteTaskSEAD(nil, self.TargetType)
|
||||||
--table.insert(self.enrouteTasks, DCStask)
|
--table.insert(self.enrouteTasks, DCStask)
|
||||||
|
|
||||||
|
if self.engageZone then
|
||||||
|
|
||||||
|
--local DCStask=CONTROLLABLE.EnRouteTaskSEAD(nil, self.engageTargetTypes)
|
||||||
|
--table.insert(self.enrouteTasks, DCStask)
|
||||||
|
self.engageZone:Scan({Object.Category.UNIT},{Unit.Category.GROUND_UNIT})
|
||||||
|
local ScanUnitSet = self.engageZone:GetScannedSetUnit()
|
||||||
|
local SeadUnitSet = SET_UNIT:New()
|
||||||
|
for _,_unit in pairs (ScanUnitSet.Set) do
|
||||||
|
local unit = _unit -- Wrapper.Unit#UNTI
|
||||||
|
if unit and unit:IsAlive() and unit:HasSEAD() then
|
||||||
|
self:T("Adding UNIT for SEAD: "..unit:GetName())
|
||||||
|
local task = CONTROLLABLE.TaskAttackUnit(nil,unit,GroupAttack,AI.Task.WeaponExpend.ALL,1,Direction,self.engageAltitude,2956984318)
|
||||||
|
table.insert(DCStasks, task)
|
||||||
|
SeadUnitSet:AddUnit(unit)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.engageTarget = TARGET:New(SeadUnitSet)
|
||||||
|
--local OrbitTask = CONTROLLABLE.TaskOrbitCircle(nil,self.engageAltitude,self.missionSpeed,self.engageZone:GetCoordinate())
|
||||||
|
--local Point = self.engageZone:GetVec2()
|
||||||
|
--local OrbitTask = CONTROLLABLE.TaskOrbitCircleAtVec2(nil,Point,self.engageAltitude,self.missionSpeed)
|
||||||
|
--table.insert(DCStasks, OrbitTask)
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
self:_GetDCSAttackTask(self.engageTarget, DCStasks)
|
self:_GetDCSAttackTask(self.engageTarget, DCStasks)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
elseif self.type==AUFTRAG.Type.STRIKE then
|
elseif self.type==AUFTRAG.Type.STRIKE then
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
-- STRIKE Mission --
|
-- STRIKE Mission --
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
local DCStask=CONTROLLABLE.TaskAttackMapObject(nil, self:GetTargetVec2(), self.engageAsGroup, self.engageWeaponExpend, self.engageQuantity, self.engageDirection, self.engageAltitude, self.engageWeaponType)
|
local coords = self.engageTarget:GetCoordinates()
|
||||||
|
for _, coord in pairs(coords) do
|
||||||
|
local DCStask=CONTROLLABLE.TaskAttackMapObject(nil, coord:GetVec2(), self.engageAsGroup, self.engageWeaponExpend, self.engageQuantity, self.engageDirection, self.engageAltitude, self.engageWeaponType)
|
||||||
|
|
||||||
table.insert(DCStasks, DCStask)
|
table.insert(DCStasks, DCStask)
|
||||||
|
end
|
||||||
|
|
||||||
elseif self.type==AUFTRAG.Type.TANKER or self.type==AUFTRAG.Type.RECOVERYTANKER then
|
elseif self.type==AUFTRAG.Type.TANKER or self.type==AUFTRAG.Type.RECOVERYTANKER then
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Author: **applevangelist**
|
-- ### Author: **applevangelist**
|
||||||
-- @date Last Update Jan 2025
|
-- @date Last Update July 2025
|
||||||
-- @module Ops.AWACS
|
-- @module Ops.AWACS
|
||||||
-- @image OPS_AWACS.jpg
|
-- @image OPS_AWACS.jpg
|
||||||
|
|
||||||
@@ -237,7 +237,7 @@ do
|
|||||||
-- -- Callsign will be "Focus". We'll be a Angels 30, doing 300 knots, orbit leg to 88deg with a length of 25nm.
|
-- -- Callsign will be "Focus". We'll be a Angels 30, doing 300 knots, orbit leg to 88deg with a length of 25nm.
|
||||||
-- testawacs:SetAwacsDetails(CALLSIGN.AWACS.Focus,1,30,300,88,25)
|
-- testawacs:SetAwacsDetails(CALLSIGN.AWACS.Focus,1,30,300,88,25)
|
||||||
-- -- Set up SRS on port 5010 - change the below to your path and port
|
-- -- Set up SRS on port 5010 - change the below to your path and port
|
||||||
-- testawacs:SetSRS("C:\\Program Files\\DCS-SimpleRadio-Standalone","female","en-GB",5010)
|
-- testawacs:SetSRS("C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio","female","en-GB",5010)
|
||||||
-- -- Add a "red" border we don't want to cross, set up in the mission editor with a late activated helo named "Red Border#ZONE_POLYGON"
|
-- -- Add a "red" border we don't want to cross, set up in the mission editor with a late activated helo named "Red Border#ZONE_POLYGON"
|
||||||
-- testawacs:SetRejectionZone(ZONE:FindByName("Red Border"))
|
-- testawacs:SetRejectionZone(ZONE:FindByName("Red Border"))
|
||||||
-- -- Our CAP flight will have the callsign "Ford", we want 4 AI planes, Time-On-Station is four hours, doing 300 kn IAS.
|
-- -- Our CAP flight will have the callsign "Ford", we want 4 AI planes, Time-On-Station is four hours, doing 300 kn IAS.
|
||||||
@@ -255,7 +255,7 @@ do
|
|||||||
-- -- The CAP station zone is called "Fremont". We will be on 255 AM. Note the Orbit Zone is given as *nil* in the `New()`-Statement
|
-- -- The CAP station zone is called "Fremont". We will be on 255 AM. Note the Orbit Zone is given as *nil* in the `New()`-Statement
|
||||||
-- local testawacs = AWACS:New("GCI Senaki",AwacsAW,"blue",AIRBASE.Caucasus.Senaki_Kolkhi,nil,ZONE:FindByName("Rock"),"Fremont",255,radio.modulation.AM )
|
-- local testawacs = AWACS:New("GCI Senaki",AwacsAW,"blue",AIRBASE.Caucasus.Senaki_Kolkhi,nil,ZONE:FindByName("Rock"),"Fremont",255,radio.modulation.AM )
|
||||||
-- -- Set up SRS on port 5010 - change the below to your path and port
|
-- -- Set up SRS on port 5010 - change the below to your path and port
|
||||||
-- testawacs:SetSRS("C:\\Program Files\\DCS-SimpleRadio-Standalone","female","en-GB",5010)
|
-- testawacs:SetSRS("C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio","female","en-GB",5010)
|
||||||
-- -- Add a "red" border we don't want to cross, set up in the mission editor with a late activated helo named "Red Border#ZONE_POLYGON"
|
-- -- Add a "red" border we don't want to cross, set up in the mission editor with a late activated helo named "Red Border#ZONE_POLYGON"
|
||||||
-- testawacs:SetRejectionZone(ZONE:FindByName("Red Border"))
|
-- testawacs:SetRejectionZone(ZONE:FindByName("Red Border"))
|
||||||
-- -- Our CAP flight will have the callsign "Ford", we want 4 AI planes, Time-On-Station is four hours, doing 300 kn IAS.
|
-- -- Our CAP flight will have the callsign "Ford", we want 4 AI planes, Time-On-Station is four hours, doing 300 kn IAS.
|
||||||
@@ -509,7 +509,7 @@ do
|
|||||||
-- @field #AWACS
|
-- @field #AWACS
|
||||||
AWACS = {
|
AWACS = {
|
||||||
ClassName = "AWACS", -- #string
|
ClassName = "AWACS", -- #string
|
||||||
version = "0.2.71", -- #string
|
version = "0.2.72", -- #string
|
||||||
lid = "", -- #string
|
lid = "", -- #string
|
||||||
coalition = coalition.side.BLUE, -- #number
|
coalition = coalition.side.BLUE, -- #number
|
||||||
coalitiontxt = "blue", -- #string
|
coalitiontxt = "blue", -- #string
|
||||||
@@ -1123,7 +1123,7 @@ function AWACS:New(Name,AirWing,Coalition,AirbaseName,AwacsOrbit,OpsZone,Station
|
|||||||
self.EscortMissionReplacement = {}
|
self.EscortMissionReplacement = {}
|
||||||
|
|
||||||
-- SRS
|
-- SRS
|
||||||
self.PathToSRS = "C:\\Program Files\\DCS-SimpleRadio-Standalone"
|
self.PathToSRS = "C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio"
|
||||||
self.Gender = "female"
|
self.Gender = "female"
|
||||||
self.Culture = "en-GB"
|
self.Culture = "en-GB"
|
||||||
self.Voice = nil
|
self.Voice = nil
|
||||||
@@ -1242,6 +1242,8 @@ function AWACS:New(Name,AirWing,Coalition,AirbaseName,AwacsOrbit,OpsZone,Station
|
|||||||
self:AddTransition("*", "Intercept", "*")
|
self:AddTransition("*", "Intercept", "*")
|
||||||
self:AddTransition("*", "InterceptSuccess", "*")
|
self:AddTransition("*", "InterceptSuccess", "*")
|
||||||
self:AddTransition("*", "InterceptFailure", "*")
|
self:AddTransition("*", "InterceptFailure", "*")
|
||||||
|
self:AddTransition("*", "VIDSuccess", "*")
|
||||||
|
self:AddTransition("*", "VIDFailure", "*")
|
||||||
self:AddTransition("*", "Stop", "Stopped") -- Stop FSM.
|
self:AddTransition("*", "Stop", "Stopped") -- Stop FSM.
|
||||||
|
|
||||||
|
|
||||||
@@ -1365,19 +1367,39 @@ function AWACS:New(Name,AirWing,Coalition,AirbaseName,AwacsOrbit,OpsZone,Station
|
|||||||
-- @param #string To To state.
|
-- @param #string To To state.
|
||||||
|
|
||||||
--- On After "InterceptSuccess" event. Intercept successful.
|
--- On After "InterceptSuccess" event. Intercept successful.
|
||||||
-- @function [parent=#AWACS] OnAfterIntercept
|
-- @function [parent=#AWACS] OnAfterInterceptSuccess
|
||||||
-- @param #AWACS self
|
-- @param #AWACS self
|
||||||
-- @param #string From From state.
|
-- @param #string From From state.
|
||||||
-- @param #string Event Event.
|
-- @param #string Event Event.
|
||||||
-- @param #string To To state.
|
-- @param #string To To state.
|
||||||
|
|
||||||
--- On After "InterceptFailure" event. Intercept failure.
|
--- On After "InterceptFailure" event. Intercept failure.
|
||||||
-- @function [parent=#AWACS] OnAfterIntercept
|
-- @function [parent=#AWACS] OnAfterInterceptFailure
|
||||||
-- @param #AWACS self
|
-- @param #AWACS self
|
||||||
-- @param #string From From state.
|
-- @param #string From From state.
|
||||||
-- @param #string Event Event.
|
-- @param #string Event Event.
|
||||||
-- @param #string To To state.
|
-- @param #string To To state.
|
||||||
|
|
||||||
|
--- On After "VIDSuccess" event. Intercept successful.
|
||||||
|
-- @function [parent=#AWACS] OnAfterVIDSuccess
|
||||||
|
-- @param #AWACS self
|
||||||
|
-- @param #string From From state.
|
||||||
|
-- @param #string Event Event.
|
||||||
|
-- @param #string To To state.
|
||||||
|
-- @param #number GID Managed group ID (Player)
|
||||||
|
-- @param Wrapper.Group#GROUP Group (Player) Group done the VID
|
||||||
|
-- @param #AWACS.ManagedContact Contact The contact that was VID'd
|
||||||
|
|
||||||
|
--- On After "VIDFailure" event. Intercept failure.
|
||||||
|
-- @function [parent=#AWACS] OnAfterVIDFailure
|
||||||
|
-- @param #AWACS self
|
||||||
|
-- @param #string From From state.
|
||||||
|
-- @param #string Event Event.
|
||||||
|
-- @param #string To To state.
|
||||||
|
-- @param #number GID Managed group ID (Player)
|
||||||
|
-- @param Wrapper.Group#GROUP Group (Player) Group done the VID
|
||||||
|
-- @param #AWACS.ManagedContact Contact The contact that was VID'd
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -2091,7 +2113,7 @@ end
|
|||||||
|
|
||||||
--- [User] Set AWACS SRS TTS details - see @{Sound.SRS} for details. `SetSRS()` will try to use as many attributes configured with @{Sound.SRS#MSRS.LoadConfigFile}() as possible.
|
--- [User] Set AWACS SRS TTS details - see @{Sound.SRS} for details. `SetSRS()` will try to use as many attributes configured with @{Sound.SRS#MSRS.LoadConfigFile}() as possible.
|
||||||
-- @param #AWACS self
|
-- @param #AWACS self
|
||||||
-- @param #string PathToSRS Defaults to "C:\\Program Files\\DCS-SimpleRadio-Standalone"
|
-- @param #string PathToSRS Defaults to "C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio"
|
||||||
-- @param #string Gender Defaults to "male"
|
-- @param #string Gender Defaults to "male"
|
||||||
-- @param #string Culture Defaults to "en-US"
|
-- @param #string Culture Defaults to "en-US"
|
||||||
-- @param #number Port Defaults to 5002
|
-- @param #number Port Defaults to 5002
|
||||||
@@ -2104,7 +2126,7 @@ end
|
|||||||
-- @return #AWACS self
|
-- @return #AWACS self
|
||||||
function AWACS:SetSRS(PathToSRS,Gender,Culture,Port,Voice,Volume,PathToGoogleKey,AccessKey,Backend)
|
function AWACS:SetSRS(PathToSRS,Gender,Culture,Port,Voice,Volume,PathToGoogleKey,AccessKey,Backend)
|
||||||
self:T(self.lid.."SetSRS")
|
self:T(self.lid.."SetSRS")
|
||||||
self.PathToSRS = PathToSRS or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone"
|
self.PathToSRS = PathToSRS or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio"
|
||||||
self.Gender = Gender or MSRS.gender or "male"
|
self.Gender = Gender or MSRS.gender or "male"
|
||||||
self.Culture = Culture or MSRS.culture or "en-US"
|
self.Culture = Culture or MSRS.culture or "en-US"
|
||||||
self.Port = Port or MSRS.port or 5002
|
self.Port = Port or MSRS.port or 5002
|
||||||
@@ -3263,12 +3285,14 @@ function AWACS:_VID(Group,Declaration)
|
|||||||
local vidpos = self.gettext:GetEntry("VIDPOS",self.locale)
|
local vidpos = self.gettext:GetEntry("VIDPOS",self.locale)
|
||||||
text = string.format(vidpos,Callsign,self.callsigntxt, Declaration)
|
text = string.format(vidpos,Callsign,self.callsigntxt, Declaration)
|
||||||
self:T(text)
|
self:T(text)
|
||||||
|
self:__VIDSuccess(3,GID,group,cluster)
|
||||||
else
|
else
|
||||||
-- too far away
|
-- too far away
|
||||||
self:T("Contact VID not close enough")
|
self:T("Contact VID not close enough")
|
||||||
local vidneg = self.gettext:GetEntry("VIDNEG",self.locale)
|
local vidneg = self.gettext:GetEntry("VIDNEG",self.locale)
|
||||||
text = string.format(vidneg,Callsign,self.callsigntxt)
|
text = string.format(vidneg,Callsign,self.callsigntxt)
|
||||||
self:T(text)
|
self:T(text)
|
||||||
|
self:__VIDFailure(3,GID,group,cluster)
|
||||||
end
|
end
|
||||||
self:_NewRadioEntry(text,text,GID,Outcome,true,true,false,true)
|
self:_NewRadioEntry(text,text,GID,Outcome,true,true,false,true)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
-- @image OPS_CSAR.jpg
|
-- @image OPS_CSAR.jpg
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Last Update Jan 2025
|
-- Last Update May 2025
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
--- **CSAR** class, extends Core.Base#BASE, Core.Fsm#FSM
|
--- **CSAR** class, extends Core.Base#BASE, Core.Fsm#FSM
|
||||||
@@ -130,7 +130,7 @@
|
|||||||
-- ## 2.2 SRS Features and Other Features
|
-- ## 2.2 SRS Features and Other Features
|
||||||
--
|
--
|
||||||
-- mycsar.useSRS = false -- Set true to use FF\'s SRS integration
|
-- mycsar.useSRS = false -- Set true to use FF\'s SRS integration
|
||||||
-- mycsar.SRSPath = "C:\\Progra~1\\DCS-SimpleRadio-Standalone\\" -- adjust your own path in your SRS installation -- server(!)
|
-- mycsar.SRSPath = "C:\\Progra~1\\DCS-SimpleRadio-Standalone\\ExternalAudio\\" -- adjust your own path in your SRS installation -- server(!)
|
||||||
-- mycsar.SRSchannel = 300 -- radio channel
|
-- mycsar.SRSchannel = 300 -- radio channel
|
||||||
-- mycsar.SRSModulation = radio.modulation.AM -- modulation
|
-- mycsar.SRSModulation = radio.modulation.AM -- modulation
|
||||||
-- mycsar.SRSport = 5002 -- and SRS Server port
|
-- mycsar.SRSport = 5002 -- and SRS Server port
|
||||||
@@ -263,6 +263,7 @@ CSAR = {
|
|||||||
rescuedpilots = 0,
|
rescuedpilots = 0,
|
||||||
limitmaxdownedpilots = true,
|
limitmaxdownedpilots = true,
|
||||||
maxdownedpilots = 10,
|
maxdownedpilots = 10,
|
||||||
|
useFIFOLimitReplacement = false, -- If true, it will remove the oldest downed pilot when a new one is added, if the limit is reached.
|
||||||
allheligroupset = nil,
|
allheligroupset = nil,
|
||||||
topmenuname = "CSAR",
|
topmenuname = "CSAR",
|
||||||
ADFRadioPwr = 1000,
|
ADFRadioPwr = 1000,
|
||||||
@@ -313,7 +314,7 @@ CSAR.AircraftType["CH-47Fbl1"] = 31
|
|||||||
|
|
||||||
--- CSAR class version.
|
--- CSAR class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
CSAR.version="1.0.30"
|
CSAR.version="1.0.33"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- ToDo list
|
-- ToDo list
|
||||||
@@ -468,7 +469,7 @@ function CSAR:New(Coalition, Template, Alias)
|
|||||||
-- added 1.0.15
|
-- added 1.0.15
|
||||||
self.allowbronco = false -- set to true to use the Bronco mod as a CSAR plane
|
self.allowbronco = false -- set to true to use the Bronco mod as a CSAR plane
|
||||||
|
|
||||||
self.ADFRadioPwr = 1000
|
self.ADFRadioPwr = 500
|
||||||
|
|
||||||
-- added 1.0.16
|
-- added 1.0.16
|
||||||
self.PilotWeight = 80
|
self.PilotWeight = 80
|
||||||
@@ -480,7 +481,7 @@ function CSAR:New(Coalition, Template, Alias)
|
|||||||
-- for this to work you need to de-sanitize your mission environment in <DCS root>\Scripts\MissionScripting.lua
|
-- for this to work you need to de-sanitize your mission environment in <DCS root>\Scripts\MissionScripting.lua
|
||||||
-- needs SRS => 1.9.6 to work (works on the *server* side)
|
-- needs SRS => 1.9.6 to work (works on the *server* side)
|
||||||
self.useSRS = false -- Use FF\'s SRS integration
|
self.useSRS = false -- Use FF\'s SRS integration
|
||||||
self.SRSPath = "E:\\Program Files\\DCS-SimpleRadio-Standalone" -- adjust your own path in your server(!)
|
self.SRSPath = "E:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio" -- adjust your own path in your server(!)
|
||||||
self.SRSchannel = 300 -- radio channel
|
self.SRSchannel = 300 -- radio channel
|
||||||
self.SRSModulation = radio.modulation.AM -- modulation
|
self.SRSModulation = radio.modulation.AM -- modulation
|
||||||
self.SRSport = 5002 -- port
|
self.SRSport = 5002 -- port
|
||||||
@@ -1145,17 +1146,6 @@ function CSAR:_EventHandler(EventData)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
-- limit no of pilots in the field.
|
|
||||||
if self.limitmaxdownedpilots and self:_ReachedPilotLimit() then
|
|
||||||
self:T("Maxed Downed Pilot!")
|
|
||||||
return self
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- TODO: Over water check --- EVENTS.LandingAfterEjection NOT triggered by DCS, so handle csarUsePara = true case
|
|
||||||
-- might create dual pilots in edge cases
|
|
||||||
|
|
||||||
local wetfeet = false
|
|
||||||
|
|
||||||
local initdcscoord = nil
|
local initdcscoord = nil
|
||||||
local initcoord = nil
|
local initcoord = nil
|
||||||
@@ -1169,6 +1159,36 @@ function CSAR:_EventHandler(EventData)
|
|||||||
self:T({initdcscoord})
|
self:T({initdcscoord})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Remove downed pilot if already exists to replace with new one.
|
||||||
|
if _event.IniPlayerName then
|
||||||
|
local PilotTable = self.downedPilots --#CSAR.DownedPilot
|
||||||
|
local _foundPilot = nil
|
||||||
|
for _,_pilot in pairs(PilotTable) do
|
||||||
|
if _pilot.player == _event.IniPlayerName and _pilot.alive == true then
|
||||||
|
_foundPilot = _pilot
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if _foundPilot then
|
||||||
|
self:T("Downed pilot already exists!")
|
||||||
|
_foundPilot.group:Destroy(false)
|
||||||
|
self:_RemoveNameFromDownedPilots(_foundPilot.name)
|
||||||
|
self:_CheckDownedPilotTable()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- limit no of pilots in the field.
|
||||||
|
if self.limitmaxdownedpilots and self:_ReachedPilotLimit() then
|
||||||
|
self:T("Maxed Downed Pilot!")
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- TODO: Over water check --- EVENTS.LandingAfterEjection NOT triggered by DCS, so handle csarUsePara = true case
|
||||||
|
-- might create dual pilots in edge cases
|
||||||
|
|
||||||
|
local wetfeet = false
|
||||||
|
|
||||||
--local surface = _unit:GetCoordinate():GetSurfaceType()
|
--local surface = _unit:GetCoordinate():GetSurfaceType()
|
||||||
local surface = initcoord:GetSurfaceType()
|
local surface = initcoord:GetSurfaceType()
|
||||||
|
|
||||||
@@ -2116,56 +2136,50 @@ end
|
|||||||
--- (Internal) Determine distance to closest MASH.
|
--- (Internal) Determine distance to closest MASH.
|
||||||
-- @param #CSAR self
|
-- @param #CSAR self
|
||||||
-- @param Wrapper.Unit#UNIT _heli Helicopter #UNIT
|
-- @param Wrapper.Unit#UNIT _heli Helicopter #UNIT
|
||||||
-- @return #CSAR self
|
-- @return #number Distance in meters
|
||||||
|
-- @return #string MASH Name as string
|
||||||
function CSAR:_GetClosestMASH(_heli)
|
function CSAR:_GetClosestMASH(_heli)
|
||||||
self:T(self.lid .. " _GetClosestMASH")
|
self:T(self.lid .. " _GetClosestMASH")
|
||||||
local _mashset = self.mash -- Core.Set#SET_GROUP
|
local _mashset = self.mash -- Core.Set#SET_GROUP
|
||||||
local _mashes = _mashset:GetSetObjects() -- #table
|
local MashSets = {}
|
||||||
|
--local _mashes = _mashset.Set-- #table
|
||||||
|
table.insert(MashSets,_mashset.Set)
|
||||||
|
table.insert(MashSets,self.zonemashes.Set)
|
||||||
|
table.insert(MashSets,self.staticmashes.Set)
|
||||||
local _shortestDistance = -1
|
local _shortestDistance = -1
|
||||||
local _distance = 0
|
local _distance = 0
|
||||||
local _helicoord = _heli:GetCoordinate()
|
local _helicoord = _heli:GetCoordinate()
|
||||||
|
local MashName = nil
|
||||||
local function GetCloseAirbase(coordinate,Coalition,Category)
|
|
||||||
|
|
||||||
local a=coordinate:GetVec3()
|
|
||||||
local distmin=math.huge
|
|
||||||
local airbase=nil
|
|
||||||
for DCSairbaseID, DCSairbase in pairs(world.getAirbases(Coalition)) do
|
|
||||||
local b=DCSairbase:getPoint()
|
|
||||||
|
|
||||||
local c=UTILS.VecSubstract(a,b)
|
|
||||||
local dist=UTILS.VecNorm(c)
|
|
||||||
|
|
||||||
if dist<distmin and (Category==nil or Category==DCSairbase:getDesc().category) then
|
|
||||||
distmin=dist
|
|
||||||
airbase=DCSairbase
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
return distmin
|
|
||||||
end
|
|
||||||
|
|
||||||
if self.allowFARPRescue then
|
if self.allowFARPRescue then
|
||||||
local position = _heli:GetCoordinate()
|
local position = _heli:GetCoordinate()
|
||||||
local afb,distance = position:GetClosestAirbase(nil,self.coalition)
|
local afb,distance = position:GetClosestAirbase(nil,self.coalition)
|
||||||
_shortestDistance = distance
|
_shortestDistance = distance
|
||||||
|
MashName = (afb ~= nil) and afb:GetName() or "Unknown"
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, _mashUnit in pairs(_mashes) do
|
for _,_mashes in pairs(MashSets) do
|
||||||
if _mashUnit and _mashUnit:IsAlive() then
|
for _, _mashUnit in pairs(_mashes or {}) do
|
||||||
local _mashcoord = _mashUnit:GetCoordinate()
|
local _mashcoord
|
||||||
|
if _mashUnit and (not _mashUnit:IsInstanceOf("ZONE_BASE")) and _mashUnit:IsAlive() then
|
||||||
|
_mashcoord = _mashUnit:GetCoordinate()
|
||||||
|
elseif _mashUnit and _mashUnit:IsInstanceOf("ZONE_BASE") then
|
||||||
|
_mashcoord = _mashUnit:GetCoordinate()
|
||||||
|
end
|
||||||
_distance = self:_GetDistance(_helicoord, _mashcoord)
|
_distance = self:_GetDistance(_helicoord, _mashcoord)
|
||||||
if _distance ~= nil and (_shortestDistance == -1 or _distance < _shortestDistance) then
|
if _distance ~= nil and (_shortestDistance == -1 or _distance < _shortestDistance) then
|
||||||
_shortestDistance = _distance
|
_shortestDistance = _distance
|
||||||
|
MashName = _mashUnit:GetName() or "Unknown"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if _shortestDistance ~= -1 then
|
if _shortestDistance ~= -1 then
|
||||||
return _shortestDistance
|
return _shortestDistance, MashName
|
||||||
else
|
else
|
||||||
return -1
|
return -1
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- (Internal) Display onboarded rescued pilots.
|
--- (Internal) Display onboarded rescued pilots.
|
||||||
@@ -2323,9 +2337,9 @@ end
|
|||||||
-- @param #CSAR self
|
-- @param #CSAR self
|
||||||
-- @param Wrapper.Group#GROUP _group Group #GROUP object.
|
-- @param Wrapper.Group#GROUP _group Group #GROUP object.
|
||||||
-- @param #number _freq Frequency to use
|
-- @param #number _freq Frequency to use
|
||||||
-- @param #string _name Beacon Name to use
|
-- @param #string BeaconName Beacon Name to use
|
||||||
-- @return #CSAR self
|
-- @return #CSAR self
|
||||||
function CSAR:_AddBeaconToGroup(_group, _freq, _name)
|
function CSAR:_AddBeaconToGroup(_group, _freq, BeaconName)
|
||||||
self:T(self.lid .. " _AddBeaconToGroup")
|
self:T(self.lid .. " _AddBeaconToGroup")
|
||||||
if self.CreateRadioBeacons == false then return end
|
if self.CreateRadioBeacons == false then return end
|
||||||
local _group = _group
|
local _group = _group
|
||||||
@@ -2346,10 +2360,11 @@ function CSAR:_AddBeaconToGroup(_group, _freq, _name)
|
|||||||
if _radioUnit then
|
if _radioUnit then
|
||||||
local name = _radioUnit:GetName()
|
local name = _radioUnit:GetName()
|
||||||
local Frequency = _freq -- Freq in Hertz
|
local Frequency = _freq -- Freq in Hertz
|
||||||
local name = _radioUnit:GetName()
|
--local name = _radioUnit:GetName()
|
||||||
local Sound = "l10n/DEFAULT/"..self.radioSound
|
local Sound = "l10n/DEFAULT/"..self.radioSound
|
||||||
local vec3 = _radioUnit:GetVec3() or _radioUnit:GetPositionVec3() or {x=0,y=0,z=0}
|
local vec3 = _radioUnit:GetVec3() or _radioUnit:GetPositionVec3() or {x=0,y=0,z=0}
|
||||||
trigger.action.radioTransmission(Sound, vec3, 0, false, Frequency, self.ADFRadioPwr or 1000,_name) -- Beacon in MP only runs for exactly 30secs straight
|
self:I(self.lid..string.format("Added Radio Beacon %d Hertz | Name %s | Position {%d,%d,%d}",Frequency,BeaconName,vec3.x,vec3.y,vec3.z))
|
||||||
|
trigger.action.radioTransmission(Sound, vec3, 0, true, Frequency, self.ADFRadioPwr or 500,BeaconName) -- Beacon in MP only runs for exactly 30secs straight
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -2370,9 +2385,13 @@ function CSAR:_RefreshRadioBeacons()
|
|||||||
local group = pilot.group
|
local group = pilot.group
|
||||||
local frequency = pilot.frequency or 0 -- thanks to @Thrud
|
local frequency = pilot.frequency or 0 -- thanks to @Thrud
|
||||||
local bname = pilot.BeaconName or pilot.name..math.random(1,100000)
|
local bname = pilot.BeaconName or pilot.name..math.random(1,100000)
|
||||||
trigger.action.stopRadioTransmission(bname)
|
--trigger.action.stopRadioTransmission(bname)
|
||||||
if group and group:IsAlive() and frequency > 0 then
|
if group and group:IsAlive() and frequency > 0 then
|
||||||
self:_AddBeaconToGroup(group,frequency,bname)
|
--self:_AddBeaconToGroup(group,frequency,bname)
|
||||||
|
else
|
||||||
|
if frequency > 0 then
|
||||||
|
trigger.action.stopRadioTransmission(bname)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -2403,6 +2422,21 @@ function CSAR:_ReachedPilotLimit()
|
|||||||
local islimited = self.limitmaxdownedpilots
|
local islimited = self.limitmaxdownedpilots
|
||||||
local count = self:_CountActiveDownedPilots()
|
local count = self:_CountActiveDownedPilots()
|
||||||
if islimited and (count >= limit) then
|
if islimited and (count >= limit) then
|
||||||
|
if self.useFIFOLimitReplacement then
|
||||||
|
local oldIndex = -1
|
||||||
|
local oldDownedPilot = nil
|
||||||
|
for _index, _downedpilot in pairs(self.downedPilots) do
|
||||||
|
oldIndex = _index
|
||||||
|
oldDownedPilot = _downedpilot
|
||||||
|
break
|
||||||
|
end
|
||||||
|
if oldDownedPilot then
|
||||||
|
oldDownedPilot.group:Destroy(false)
|
||||||
|
oldDownedPilot.alive = false
|
||||||
|
self:_CheckDownedPilotTable()
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
return false
|
return false
|
||||||
@@ -2454,9 +2488,10 @@ function CSAR:onafterStart(From, Event, To)
|
|||||||
|
|
||||||
self.mash = SET_GROUP:New():FilterCoalitions(self.coalitiontxt):FilterPrefixes(self.mashprefix):FilterStart()
|
self.mash = SET_GROUP:New():FilterCoalitions(self.coalitiontxt):FilterPrefixes(self.mashprefix):FilterStart()
|
||||||
|
|
||||||
local staticmashes = SET_STATIC:New():FilterCoalitions(self.coalitiontxt):FilterPrefixes(self.mashprefix):FilterOnce()
|
self.staticmashes = SET_STATIC:New():FilterCoalitions(self.coalitiontxt):FilterPrefixes(self.mashprefix):FilterStart()
|
||||||
local zonemashes = SET_ZONE:New():FilterPrefixes(self.mashprefix):FilterOnce()
|
self.zonemashes = SET_ZONE:New():FilterPrefixes(self.mashprefix):FilterStart()
|
||||||
|
|
||||||
|
--[[
|
||||||
if staticmashes:Count() > 0 then
|
if staticmashes:Count() > 0 then
|
||||||
for _,_mash in pairs(staticmashes.Set) do
|
for _,_mash in pairs(staticmashes.Set) do
|
||||||
self.mash:AddObject(_mash)
|
self.mash:AddObject(_mash)
|
||||||
@@ -2464,10 +2499,13 @@ function CSAR:onafterStart(From, Event, To)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if zonemashes:Count() > 0 then
|
if zonemashes:Count() > 0 then
|
||||||
|
self:T("Adding zones to self.mash SET")
|
||||||
for _,_mash in pairs(zonemashes.Set) do
|
for _,_mash in pairs(zonemashes.Set) do
|
||||||
self.mash:AddObject(_mash)
|
self.mash:AddObject(_mash)
|
||||||
end
|
end
|
||||||
|
self:T("Objects in SET: "..self.mash:Count())
|
||||||
end
|
end
|
||||||
|
--]]
|
||||||
|
|
||||||
if not self.coordinate then
|
if not self.coordinate then
|
||||||
local csarhq = self.mash:GetRandom()
|
local csarhq = self.mash:GetRandom()
|
||||||
|
|||||||
@@ -20,11 +20,12 @@
|
|||||||
--
|
--
|
||||||
-- ### Author: **Applevangelist** (Moose Version), ***Ciribob*** (original), Thanks to: Shadowze, Cammel (testing), bbirchnz (additional code!!)
|
-- ### Author: **Applevangelist** (Moose Version), ***Ciribob*** (original), Thanks to: Shadowze, Cammel (testing), bbirchnz (additional code!!)
|
||||||
-- ### Repack addition for crates: **Raiden**
|
-- ### Repack addition for crates: **Raiden**
|
||||||
|
-- ### Additional cool features: **Lekaa**
|
||||||
--
|
--
|
||||||
-- @module Ops.CTLD
|
-- @module Ops.CTLD
|
||||||
-- @image OPS_CTLD.jpg
|
-- @image OPS_CTLD.jpg
|
||||||
|
|
||||||
-- Last Update April 2025
|
-- Last Update July 2025
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -865,6 +866,7 @@ do
|
|||||||
-- my_ctld.TroopUnloadDistGroundHook = 15 -- On the ground, unload troops this far behind the Chinook
|
-- my_ctld.TroopUnloadDistGroundHook = 15 -- On the ground, unload troops this far behind the Chinook
|
||||||
-- my_ctld.TroopUnloadDistHoverHook = 5 -- When hovering, unload troops this far behind the Chinook
|
-- my_ctld.TroopUnloadDistHoverHook = 5 -- When hovering, unload troops this far behind the Chinook
|
||||||
-- my_ctld.showstockinmenuitems = false -- When set to true, the menu lines will also show the remaining items in stock (that is, if you set any), downside is that the menu for all will be build every 30 seconds anew.
|
-- my_ctld.showstockinmenuitems = false -- When set to true, the menu lines will also show the remaining items in stock (that is, if you set any), downside is that the menu for all will be build every 30 seconds anew.
|
||||||
|
-- my_ctld.onestepmenu = false -- When set to true, the menu will create Drop and build, Get and load, Pack and remove, Pack and load, Pack. it will be a 1 step solution.
|
||||||
--
|
--
|
||||||
-- ## 2.1 CH-47 Chinook support
|
-- ## 2.1 CH-47 Chinook support
|
||||||
--
|
--
|
||||||
@@ -1412,7 +1414,7 @@ CTLD.FixedWingTypes = {
|
|||||||
|
|
||||||
--- CTLD class version.
|
--- CTLD class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
CTLD.version="1.2.33"
|
CTLD.version="1.3.36"
|
||||||
|
|
||||||
--- Instantiate a new CTLD.
|
--- Instantiate a new CTLD.
|
||||||
-- @param #CTLD self
|
-- @param #CTLD self
|
||||||
@@ -1479,6 +1481,7 @@ function CTLD:New(Coalition, Prefixes, Alias)
|
|||||||
self:AddTransition("*", "CratesRepaired", "*") -- CTLD repair event.
|
self:AddTransition("*", "CratesRepaired", "*") -- CTLD repair event.
|
||||||
self:AddTransition("*", "CratesBuildStarted", "*") -- CTLD build event.
|
self:AddTransition("*", "CratesBuildStarted", "*") -- CTLD build event.
|
||||||
self:AddTransition("*", "CratesRepairStarted", "*") -- CTLD repair event.
|
self:AddTransition("*", "CratesRepairStarted", "*") -- CTLD repair event.
|
||||||
|
self:AddTransition("*", "CratesPacked", "*") -- CTLD repack event.
|
||||||
self:AddTransition("*", "HelicopterLost", "*") -- CTLD lost event.
|
self:AddTransition("*", "HelicopterLost", "*") -- CTLD lost event.
|
||||||
self:AddTransition("*", "Load", "*") -- CTLD load event.
|
self:AddTransition("*", "Load", "*") -- CTLD load event.
|
||||||
self:AddTransition("*", "Loaded", "*") -- CTLD load event.
|
self:AddTransition("*", "Loaded", "*") -- CTLD load event.
|
||||||
@@ -1591,6 +1594,7 @@ function CTLD:New(Coalition, Prefixes, Alias)
|
|||||||
self.subcats = {}
|
self.subcats = {}
|
||||||
self.subcatsTroop = {}
|
self.subcatsTroop = {}
|
||||||
self.showstockinmenuitems = false
|
self.showstockinmenuitems = false
|
||||||
|
self.onestepmenu = false
|
||||||
|
|
||||||
-- disallow building in loadzones
|
-- disallow building in loadzones
|
||||||
self.nobuildinloadzones = true
|
self.nobuildinloadzones = true
|
||||||
@@ -1757,6 +1761,17 @@ function CTLD:New(Coalition, Prefixes, Alias)
|
|||||||
-- @param Wrapper.Group#GROUP Vehicle The #GROUP object of the vehicle or FOB repaired.
|
-- @param Wrapper.Group#GROUP Vehicle The #GROUP object of the vehicle or FOB repaired.
|
||||||
-- @return #CTLD self
|
-- @return #CTLD self
|
||||||
|
|
||||||
|
--- FSM Function OnBeforeCratesPacked.
|
||||||
|
-- @function [parent=#CTLD] OnBeforeCratesPacked
|
||||||
|
-- @param #CTLD self
|
||||||
|
-- @param #string From State.
|
||||||
|
-- @param #string Event Trigger.
|
||||||
|
-- @param #string To State.
|
||||||
|
-- @param Wrapper.Group#GROUP Group Group Object.
|
||||||
|
-- @param Wrapper.Unit#UNIT Unit Unit Object.
|
||||||
|
-- @param #CTLD_CARGO Cargo Cargo crate that was repacked.
|
||||||
|
-- @return #CTLD self
|
||||||
|
|
||||||
--- FSM Function OnBeforeTroopsRTB.
|
--- FSM Function OnBeforeTroopsRTB.
|
||||||
-- @function [parent=#CTLD] OnBeforeTroopsRTB
|
-- @function [parent=#CTLD] OnBeforeTroopsRTB
|
||||||
-- @param #CTLD self
|
-- @param #CTLD self
|
||||||
@@ -1843,6 +1858,7 @@ function CTLD:New(Coalition, Prefixes, Alias)
|
|||||||
-- @param #string To State.
|
-- @param #string To State.
|
||||||
-- @param Wrapper.Group#GROUP Group Group Object.
|
-- @param Wrapper.Group#GROUP Group Group Object.
|
||||||
-- @param Wrapper.Unit#UNIT Unit Unit Object.
|
-- @param Wrapper.Unit#UNIT Unit Unit Object.
|
||||||
|
-- @param CargoName The name of the cargo being built.
|
||||||
-- @return #CTLD self
|
-- @return #CTLD self
|
||||||
|
|
||||||
--- FSM Function OnAfterCratesRepairStarted. Info event that a repair has been started.
|
--- FSM Function OnAfterCratesRepairStarted. Info event that a repair has been started.
|
||||||
@@ -1886,6 +1902,17 @@ function CTLD:New(Coalition, Prefixes, Alias)
|
|||||||
-- @param Wrapper.Group#GROUP Vehicle The #GROUP object of the vehicle or FOB repaired.
|
-- @param Wrapper.Group#GROUP Vehicle The #GROUP object of the vehicle or FOB repaired.
|
||||||
-- @return #CTLD self
|
-- @return #CTLD self
|
||||||
|
|
||||||
|
--- FSM Function OnAfterCratesPacked.
|
||||||
|
-- @function [parent=#CTLD] OnAfterCratesPacked
|
||||||
|
-- @param #CTLD self
|
||||||
|
-- @param #string From State.
|
||||||
|
-- @param #string Event Trigger.
|
||||||
|
-- @param #string To State.
|
||||||
|
-- @param Wrapper.Group#GROUP Group Group Object.
|
||||||
|
-- @param Wrapper.Unit#UNIT Unit Unit Object.
|
||||||
|
-- @param #CTLD_CARGO Cargo Cargo crate that was repacked.
|
||||||
|
-- @return #CTLD self
|
||||||
|
|
||||||
--- FSM Function OnAfterTroopsRTB.
|
--- FSM Function OnAfterTroopsRTB.
|
||||||
-- @function [parent=#CTLD] OnAfterTroopsRTB
|
-- @function [parent=#CTLD] OnAfterTroopsRTB
|
||||||
-- @param #CTLD self
|
-- @param #CTLD self
|
||||||
@@ -2072,6 +2099,9 @@ function CTLD:_EventHandler(EventData)
|
|||||||
local _group = event.IniGroup
|
local _group = event.IniGroup
|
||||||
local _unit = event.IniUnit
|
local _unit = event.IniUnit
|
||||||
self:_RefreshLoadCratesMenu(_group, _unit)
|
self:_RefreshLoadCratesMenu(_group, _unit)
|
||||||
|
if self:IsFixedWing(_unit) and self.enableFixedWing then
|
||||||
|
self:_RefreshDropCratesMenu(_group, _unit)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
elseif event.id == EVENTS.PlayerLeaveUnit or event.id == EVENTS.UnitLost then
|
elseif event.id == EVENTS.PlayerLeaveUnit or event.id == EVENTS.UnitLost then
|
||||||
-- remove from pilot table
|
-- remove from pilot table
|
||||||
@@ -2821,8 +2851,12 @@ function CTLD:_GetCrates(Group, Unit, Cargo, number, drop, pack)
|
|||||||
if cratedistance > self.CrateDistance then cratedistance = self.CrateDistance end
|
if cratedistance > self.CrateDistance then cratedistance = self.CrateDistance end
|
||||||
-- altered heading logic
|
-- altered heading logic
|
||||||
-- DONE: right standard deviation?
|
-- DONE: right standard deviation?
|
||||||
rheading = UTILS.RandomGaussian(0,30,-90,90,100)
|
if self:IsUnitInAir(Unit) and self:IsFixedWing(Unit) then
|
||||||
rheading = math.fmod((heading + rheading), 360)
|
rheading = math.random(20,60)
|
||||||
|
else
|
||||||
|
rheading = UTILS.RandomGaussian(0, 30, -90, 90, 100)
|
||||||
|
end
|
||||||
|
rheading=math.fmod((heading+rheading),360)
|
||||||
cratecoord = position:Translate(cratedistance,rheading)
|
cratecoord = position:Translate(cratedistance,rheading)
|
||||||
else
|
else
|
||||||
cratedistance = (row-1)*6
|
cratedistance = (row-1)*6
|
||||||
@@ -2913,10 +2947,10 @@ function CTLD:_GetCrates(Group, Unit, Cargo, number, drop, pack)
|
|||||||
if drop then
|
if drop then
|
||||||
text = string.format("Crates for %s have been dropped!",cratename)
|
text = string.format("Crates for %s have been dropped!",cratename)
|
||||||
self:__CratesDropped(1, Group, Unit, droppedcargo)
|
self:__CratesDropped(1, Group, Unit, droppedcargo)
|
||||||
end
|
else
|
||||||
self:_SendMessage(text, 10, false, Group)
|
self:_SendMessage(text, 10, false, Group)
|
||||||
|
end
|
||||||
self:_RefreshLoadCratesMenu(Group, Unit)
|
self:_RefreshLoadCratesMenu(Group, Unit)
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -3564,7 +3598,7 @@ end
|
|||||||
function CTLD:IsFixedWing(Unit)
|
function CTLD:IsFixedWing(Unit)
|
||||||
local typename = Unit:GetTypeName() or "none"
|
local typename = Unit:GetTypeName() or "none"
|
||||||
for _,_name in pairs(self.FixedWingTypes or {}) do
|
for _,_name in pairs(self.FixedWingTypes or {}) do
|
||||||
if typename == _name or string.find(typename,_name,1,true) then
|
if _name and (typename==_name or string.find(typename,_name,1,true))then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -3576,7 +3610,10 @@ end
|
|||||||
-- @param Wrapper.Unit#UNIT Unit
|
-- @param Wrapper.Unit#UNIT Unit
|
||||||
-- @return #boolean Outcome
|
-- @return #boolean Outcome
|
||||||
function CTLD:IsHook(Unit)
|
function CTLD:IsHook(Unit)
|
||||||
if Unit and string.find(Unit:GetTypeName(),"CH.47") then
|
if not Unit then return false end
|
||||||
|
local typeName = Unit:GetTypeName()
|
||||||
|
if not typeName then return false end
|
||||||
|
if string.find(typeName, "CH.47") then
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
return false
|
return false
|
||||||
@@ -3766,7 +3803,6 @@ function CTLD:_UnloadCrates(Group, Unit)
|
|||||||
self:T(self.lid .. " _UnloadCrates")
|
self:T(self.lid .. " _UnloadCrates")
|
||||||
|
|
||||||
if not self.dropcratesanywhere then -- #1570
|
if not self.dropcratesanywhere then -- #1570
|
||||||
-- check if we are in DROP zone
|
|
||||||
local inzone, zonename, zone, distance = self:IsUnitInZone(Unit,CTLD.CargoZoneType.DROP)
|
local inzone, zonename, zone, distance = self:IsUnitInZone(Unit,CTLD.CargoZoneType.DROP)
|
||||||
if not inzone then
|
if not inzone then
|
||||||
self:_SendMessage("You are not close enough to a drop zone!", 10, false, Group)
|
self:_SendMessage("You are not close enough to a drop zone!", 10, false, Group)
|
||||||
@@ -3775,46 +3811,60 @@ function CTLD:_UnloadCrates(Group, Unit)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- Door check
|
|
||||||
if self.pilotmustopendoors and not UTILS.IsLoadingDoorOpen(Unit:GetName()) then
|
if self.pilotmustopendoors and not UTILS.IsLoadingDoorOpen(Unit:GetName()) then
|
||||||
self:_SendMessage("You need to open the door(s) to drop cargo!", 10, false, Group)
|
self:_SendMessage("You need to open the door(s) to drop cargo!", 10, false, Group)
|
||||||
if not self.debug then return self end
|
if not self.debug then return self end
|
||||||
end
|
end
|
||||||
-- check for hover unload
|
local hoverunload = self:IsCorrectHover(Unit)
|
||||||
local hoverunload = self:IsCorrectHover(Unit) --if true we\'re hovering in parameters
|
|
||||||
local IsHerc = self:IsFixedWing(Unit)
|
local IsHerc = self:IsFixedWing(Unit)
|
||||||
local IsHook = self:IsHook(Unit)
|
local IsHook = self:IsHook(Unit)
|
||||||
if IsHerc and (not IsHook) then
|
if IsHerc and (not IsHook) then
|
||||||
-- no hover but airdrop here
|
|
||||||
hoverunload = self:IsCorrectFlightParameters(Unit)
|
hoverunload = self:IsCorrectFlightParameters(Unit)
|
||||||
end
|
end
|
||||||
-- check if we\'re landed
|
|
||||||
local grounded = not self:IsUnitInAir(Unit)
|
local grounded = not self:IsUnitInAir(Unit)
|
||||||
-- Get what we have loaded
|
|
||||||
local unitname = Unit:GetName()
|
local unitname = Unit:GetName()
|
||||||
if self.Loaded_Cargo[unitname] and (grounded or hoverunload) then
|
if self.Loaded_Cargo[unitname] and (grounded or hoverunload) then
|
||||||
local loadedcargo = self.Loaded_Cargo[unitname] or {} -- #CTLD.LoadedCargo
|
local loadedcargo = self.Loaded_Cargo[unitname] or {}
|
||||||
-- looking for crate
|
|
||||||
local cargotable = loadedcargo.Cargo
|
local cargotable = loadedcargo.Cargo
|
||||||
|
local droppedCount = {}
|
||||||
|
local neededMap = {}
|
||||||
for _,_cargo in pairs (cargotable) do
|
for _,_cargo in pairs (cargotable) do
|
||||||
local cargo = _cargo -- #CTLD_CARGO
|
local cargo = _cargo
|
||||||
local type = cargo:GetType() -- #CTLD_CARGO.Enum
|
local type = cargo:GetType()
|
||||||
if type ~= CTLD_CARGO.Enum.TROOPS and type ~= CTLD_CARGO.Enum.ENGINEERS and type ~= CTLD_CARGO.Enum.GCLOADABLE and (not cargo:WasDropped() or self.allowcratepickupagain) then
|
if type ~= CTLD_CARGO.Enum.TROOPS and type ~= CTLD_CARGO.Enum.ENGINEERS and type ~= CTLD_CARGO.Enum.GCLOADABLE and (not cargo:WasDropped() or self.allowcratepickupagain) then
|
||||||
-- unload crates
|
|
||||||
self:_GetCrates(Group, Unit, cargo, 1, true)
|
self:_GetCrates(Group, Unit, cargo, 1, true)
|
||||||
cargo:SetWasDropped(true)
|
cargo:SetWasDropped(true)
|
||||||
cargo:SetHasMoved(true)
|
cargo:SetHasMoved(true)
|
||||||
|
local cname = cargo:GetName() or "Unknown"
|
||||||
|
droppedCount[cname] = (droppedCount[cname] or 0) + 1
|
||||||
|
if not neededMap[cname] then
|
||||||
|
neededMap[cname] = cargo:GetCratesNeeded() or 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- cleanup load list
|
end
|
||||||
local loaded = {} -- #CTLD.LoadedCargo
|
for cname,count in pairs(droppedCount) do
|
||||||
|
local needed = neededMap[cname] or 1
|
||||||
|
if needed > 1 then
|
||||||
|
local full = math.floor(count/needed)
|
||||||
|
local left = count % needed
|
||||||
|
if full > 0 and left == 0 then
|
||||||
|
self:_SendMessage(string.format("Dropped %d %s.",full,cname),10,false,Group)
|
||||||
|
elseif full > 0 and left > 0 then
|
||||||
|
self:_SendMessage(string.format("Dropped %d %s(s), with %d leftover crate(s).",full,cname,left),10,false,Group)
|
||||||
|
else
|
||||||
|
self:_SendMessage(string.format("Dropped %d/%d crate(s) of %s.",count,needed,cname),15,false,Group)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
self:_SendMessage(string.format("Dropped %d %s(s).",count,cname),10,false,Group)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local loaded = {}
|
||||||
loaded.Troopsloaded = 0
|
loaded.Troopsloaded = 0
|
||||||
loaded.Cratesloaded = 0
|
loaded.Cratesloaded = 0
|
||||||
loaded.Cargo = {}
|
loaded.Cargo = {}
|
||||||
|
|
||||||
for _,_cargo in pairs (cargotable) do
|
for _,_cargo in pairs (cargotable) do
|
||||||
local cargo = _cargo -- #CTLD_CARGO
|
local cargo = _cargo
|
||||||
local type = cargo:GetType() -- #CTLD_CARGO.Enum
|
local type = cargo:GetType()
|
||||||
local size = cargo:GetCratesNeeded()
|
local size = cargo:GetCratesNeeded()
|
||||||
if type == CTLD_CARGO.Enum.TROOPS or type == CTLD_CARGO.Enum.ENGINEERS then
|
if type == CTLD_CARGO.Enum.TROOPS or type == CTLD_CARGO.Enum.ENGINEERS then
|
||||||
table.insert(loaded.Cargo,_cargo)
|
table.insert(loaded.Cargo,_cargo)
|
||||||
@@ -3838,14 +3888,15 @@ function CTLD:_UnloadCrates(Group, Unit)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- (Internal) Function to build nearby crates.
|
--- (Internal) Function to build nearby crates.
|
||||||
-- @param #CTLD self
|
-- @param #CTLD self
|
||||||
-- @param Wrapper.Group#GROUP Group
|
-- @param Wrapper.Group#GROUP Group
|
||||||
-- @param Wrapper.Unit#UNIT Unit
|
-- @param Wrapper.Unit#UNIT Unit
|
||||||
-- @param #boolean Engineering If true build is by an engineering team.
|
-- @param #boolean Engineering If true build is by an engineering team.
|
||||||
function CTLD:_BuildCrates(Group, Unit,Engineering)
|
-- @param #boolean MultiDrop If true and not engineering or FOB, vary position a bit.
|
||||||
|
function CTLD:_BuildCrates(Group, Unit,Engineering,MultiDrop)
|
||||||
self:T(self.lid .. " _BuildCrates")
|
self:T(self.lid .. " _BuildCrates")
|
||||||
-- avoid users trying to build from flying Hercs
|
-- avoid users trying to build from flying Hercs
|
||||||
if self:IsFixedWing(Unit) and self.enableFixedWing and not Engineering then
|
if self:IsFixedWing(Unit) and self.enableFixedWing and not Engineering then
|
||||||
@@ -3939,12 +3990,13 @@ function CTLD:_BuildCrates(Group, Unit,Engineering)
|
|||||||
if build.CanBuild then
|
if build.CanBuild then
|
||||||
self:_CleanUpCrates(crates,build,number)
|
self:_CleanUpCrates(crates,build,number)
|
||||||
if self.buildtime and self.buildtime > 0 then
|
if self.buildtime and self.buildtime > 0 then
|
||||||
local buildtimer = TIMER:New(self._BuildObjectFromCrates,self,Group,Unit,build,false,Group:GetCoordinate())
|
local buildtimer = TIMER:New(self._BuildObjectFromCrates,self,Group,Unit,build,false,Group:GetCoordinate(),MultiDrop)
|
||||||
buildtimer:Start(self.buildtime)
|
buildtimer:Start(self.buildtime)
|
||||||
self:_SendMessage(string.format("Build started, ready in %d seconds!",self.buildtime),15,false,Group)
|
self:_SendMessage(string.format("Build started, ready in %d seconds!",self.buildtime),15,false,Group)
|
||||||
self:__CratesBuildStarted(1,Group,Unit)
|
self:__CratesBuildStarted(1,Group,Unit,build.Name)
|
||||||
|
self:_RefreshDropTroopsMenu(Group,Unit)
|
||||||
else
|
else
|
||||||
self:_BuildObjectFromCrates(Group,Unit,build)
|
self:_BuildObjectFromCrates(Group,Unit,build,false,nil,MultiDrop)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -3983,13 +4035,15 @@ function CTLD:_PackCratesNearby(Group, Unit)
|
|||||||
_Group:Destroy() -- if a match is found destroy the Wrapper.Group#GROUP near the player
|
_Group:Destroy() -- if a match is found destroy the Wrapper.Group#GROUP near the player
|
||||||
self:_GetCrates(Group, Unit, _entry, nil, false, true) -- spawn the appropriate crates near the player
|
self:_GetCrates(Group, Unit, _entry, nil, false, true) -- spawn the appropriate crates near the player
|
||||||
self:_RefreshLoadCratesMenu(Group,Unit) -- call the refresher to show the crates in the menu
|
self:_RefreshLoadCratesMenu(Group,Unit) -- call the refresher to show the crates in the menu
|
||||||
return self
|
self:__CratesPacked(1,Group,Unit,_entry)
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return self
|
self:_SendMessage("Nothing to pack at this distance pilot!",10,false,Group)
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
--- (Internal) Function to repair nearby vehicles / FOBs
|
--- (Internal) Function to repair nearby vehicles / FOBs
|
||||||
@@ -4082,7 +4136,8 @@ end
|
|||||||
-- @param #CTLD.Buildable Build
|
-- @param #CTLD.Buildable Build
|
||||||
-- @param #boolean Repair If true this is a repair and not a new build
|
-- @param #boolean Repair If true this is a repair and not a new build
|
||||||
-- @param Core.Point#COORDINATE RepairLocation Location for repair (e.g. where the destroyed unit was)
|
-- @param Core.Point#COORDINATE RepairLocation Location for repair (e.g. where the destroyed unit was)
|
||||||
function CTLD:_BuildObjectFromCrates(Group,Unit,Build,Repair,RepairLocation)
|
-- @param #boolean MultiDrop if true and not a repair, vary location a bit if not a FOB
|
||||||
|
function CTLD:_BuildObjectFromCrates(Group,Unit,Build,Repair,RepairLocation,MultiDrop)
|
||||||
self:T(self.lid .. " _BuildObjectFromCrates")
|
self:T(self.lid .. " _BuildObjectFromCrates")
|
||||||
-- Spawn-a-crate-content
|
-- Spawn-a-crate-content
|
||||||
if Group and Group:IsAlive() or (RepairLocation and not Repair) then
|
if Group and Group:IsAlive() or (RepairLocation and not Repair) then
|
||||||
@@ -4099,7 +4154,7 @@ function CTLD:_BuildObjectFromCrates(Group,Unit,Build,Repair,RepairLocation)
|
|||||||
if type(temptable) == "string" then
|
if type(temptable) == "string" then
|
||||||
temptable = {temptable}
|
temptable = {temptable}
|
||||||
end
|
end
|
||||||
local zone = nil
|
local zone = nil -- Core.Zone#ZONE_RADIUS
|
||||||
if RepairLocation and not Repair then
|
if RepairLocation and not Repair then
|
||||||
-- timed build
|
-- timed build
|
||||||
zone = ZONE_RADIUS:New(string.format("Build zone-%d",math.random(1,10000)),RepairLocation:GetVec2(),100)
|
zone = ZONE_RADIUS:New(string.format("Build zone-%d",math.random(1,10000)),RepairLocation:GetVec2(),100)
|
||||||
@@ -4108,6 +4163,10 @@ function CTLD:_BuildObjectFromCrates(Group,Unit,Build,Repair,RepairLocation)
|
|||||||
end
|
end
|
||||||
--local randomcoord = zone:GetRandomCoordinate(35):GetVec2()
|
--local randomcoord = zone:GetRandomCoordinate(35):GetVec2()
|
||||||
local randomcoord = Build.Coord or zone:GetRandomCoordinate(35):GetVec2()
|
local randomcoord = Build.Coord or zone:GetRandomCoordinate(35):GetVec2()
|
||||||
|
if MultiDrop and (not Repair) and canmove then
|
||||||
|
-- coordinate may be the same, avoid
|
||||||
|
local randomcoord = zone:GetRandomCoordinate(35):GetVec2()
|
||||||
|
end
|
||||||
if Repair then
|
if Repair then
|
||||||
randomcoord = RepairLocation:GetVec2()
|
randomcoord = RepairLocation:GetVec2()
|
||||||
end
|
end
|
||||||
@@ -4199,11 +4258,91 @@ function CTLD:_CleanUpCrates(Crates,Build,Number)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- (Internal) Helper - Drop **all** loaded crates nearby and build them.
|
||||||
|
-- @param Wrapper.Group#GROUP Group The calling group
|
||||||
|
-- @param Wrapper.Unit#UNIT Unit The calling unit
|
||||||
|
function CTLD:_DropAndBuild(Group,Unit)
|
||||||
|
if self.nobuildinloadzones then
|
||||||
|
if self:IsUnitInZone(Unit,CTLD.CargoZoneType.LOAD) then
|
||||||
|
self:_SendMessage("You cannot build in a loading area, Pilot!",10,false,Group)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self:_UnloadCrates(Group,Unit)
|
||||||
|
timer.scheduleFunction(function() self:_BuildCrates(Group,Unit,false,true) end,{},timer.getTime()+1)
|
||||||
|
end
|
||||||
|
|
||||||
|
--- (Internal) Helper - Drop a **single** crate set and build it.
|
||||||
|
-- @param Wrapper.Group#GROUP Group The calling group
|
||||||
|
-- @param Wrapper.Unit#UNIT Unit The calling unit
|
||||||
|
-- @param number setIndex Index of the crate-set to drop
|
||||||
|
function CTLD:_DropSingleAndBuild(Group,Unit,setIndex)
|
||||||
|
if self.nobuildinloadzones then
|
||||||
|
if self:IsUnitInZone(Unit,CTLD.CargoZoneType.LOAD) then
|
||||||
|
self:_SendMessage("You cannot build in a loading area, Pilot!",10,false,Group)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self:_UnloadSingleCrateSet(Group,Unit,setIndex)
|
||||||
|
timer.scheduleFunction(function() self:_BuildCrates(Group,Unit,false) end,{},timer.getTime()+1)
|
||||||
|
end
|
||||||
|
|
||||||
|
--- (Internal) Helper - Pack crates near the unit and load them.
|
||||||
|
-- @param Wrapper.Group#GROUP Group The calling group
|
||||||
|
-- @param Wrapper.Unit#UNIT Unit The calling unit
|
||||||
|
function CTLD:_PackAndLoad(Group,Unit)
|
||||||
|
if self.pilotmustopendoors and not UTILS.IsLoadingDoorOpen(Unit:GetName()) then
|
||||||
|
self:_SendMessage("You need to open the door(s) to load cargo!",10,false,Group)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
if not self:_PackCratesNearby(Group,Unit) then
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
timer.scheduleFunction(function() self:_LoadCratesNearby(Group,Unit) end,{},timer.getTime()+1)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- (Internal) Helper - Pack crates near the unit and then remove them.
|
||||||
|
-- @param Wrapper.Group#GROUP Group The calling group
|
||||||
|
-- @param Wrapper.Unit#UNIT Unit The calling unit
|
||||||
|
function CTLD:_PackAndRemove(Group,Unit)
|
||||||
|
if not self:_PackCratesNearby(Group,Unit) then
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
timer.scheduleFunction(function() self:_RemoveCratesNearby(Group,Unit) end,{},timer.getTime()+1)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- (Internal) Helper - get and load in one step
|
||||||
|
-- @param Wrapper.Group#GROUP Group The calling group
|
||||||
|
-- @param Wrapper.Unit#UNIT Unit The calling unit
|
||||||
|
function CTLD:_GetAndLoad(Group,Unit,cargoObj)
|
||||||
|
if self.pilotmustopendoors and not UTILS.IsLoadingDoorOpen(Unit:GetName()) then
|
||||||
|
self:_SendMessage("You need to open the door(s) to load cargo!",10,false,Group)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
self:_GetCrates(Group,Unit,cargoObj)
|
||||||
|
|
||||||
|
timer.scheduleFunction(function() self:_LoadSingleCrateSet(Group,Unit,cargoObj.Name) end,{},timer.getTime()+1)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- @param Wrapper.Group#GROUP Group The player’s group that triggered the action
|
||||||
|
-- @param Wrapper.Unit#UNIT Unit The unit performing the pack-and-load
|
||||||
|
function CTLD:_GetAllAndLoad(Group,Unit)
|
||||||
|
if self.pilotmustopendoors and not UTILS.IsLoadingDoorOpen(Unit:GetName()) then
|
||||||
|
self:_SendMessage("You need to open the door(s) to load cargo!",10,false,Group)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
timer.scheduleFunction(function() self:_LoadCratesNearby(Group,Unit) end,{},timer.getTime()+1)
|
||||||
|
end
|
||||||
|
|
||||||
--- (Internal) Housekeeping - Function to refresh F10 menus.
|
--- (Internal) Housekeeping - Function to refresh F10 menus.
|
||||||
-- @param #CTLD self
|
-- @param #CTLD self
|
||||||
-- @return #CTLD self
|
-- @return #CTLD self
|
||||||
function CTLD:_RefreshF10Menus()
|
function CTLD:_RefreshF10Menus()
|
||||||
self:T(self.lid .. " _RefreshF10Menus")
|
self:T(self.lid .. " _RefreshF10Menus")
|
||||||
|
self.onestepmenu = self.onestepmenu or false -- hybrid toggle (default = false)
|
||||||
|
|
||||||
-- 1) Gather all the pilot groups from our Set
|
-- 1) Gather all the pilot groups from our Set
|
||||||
local PlayerSet = self.PilotGroups
|
local PlayerSet = self.PilotGroups
|
||||||
@@ -4314,7 +4453,6 @@ function CTLD:_RefreshF10Menus()
|
|||||||
local menutext = cargoObj.Name
|
local menutext = cargoObj.Name
|
||||||
if (stock >= 0) and (self.showstockinmenuitems == true) then menutext = menutext.." ["..stock.."]" end
|
if (stock >= 0) and (self.showstockinmenuitems == true) then menutext = menutext.." ["..stock.."]" end
|
||||||
MENU_GROUP_COMMAND:New(_group, menutext, troopsmenu, self._LoadTroops, self, _group, _unit, cargoObj)
|
MENU_GROUP_COMMAND:New(_group, menutext, troopsmenu, self._LoadTroops, self, _group, _unit, cargoObj)
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -4340,11 +4478,66 @@ function CTLD:_RefreshF10Menus()
|
|||||||
_group.MyTopCratesMenu = topcrates
|
_group.MyTopCratesMenu = topcrates
|
||||||
|
|
||||||
-- Build the “Get Crates” sub-menu items
|
-- Build the “Get Crates” sub-menu items
|
||||||
local cratesmenu = MENU_GROUP:New(_group, "Get Crates", topcrates)
|
local cratesmenu = MENU_GROUP:New(_group,"Get Crates",topcrates)
|
||||||
|
|
||||||
|
if self.onestepmenu then
|
||||||
|
if self.usesubcats then
|
||||||
|
local subcatmenus = {}
|
||||||
|
for catName,_ in pairs(self.subcats) do
|
||||||
|
subcatmenus[catName] = MENU_GROUP:New(_group,catName,cratesmenu)
|
||||||
|
end
|
||||||
|
for _,cargoObj in pairs(self.Cargo_Crates) do
|
||||||
|
if not cargoObj.DontShowInMenu then
|
||||||
|
local txt = string.format("Crate %s (%dkg)",cargoObj.Name,cargoObj.PerCrateMass or 0)
|
||||||
|
if cargoObj.Location then txt = txt.."[R]" end
|
||||||
|
local stock = cargoObj:GetStock()
|
||||||
|
if stock>=0 and self.showstockinmenuitems then txt = txt.."["..stock.."]" end
|
||||||
|
local mSet = MENU_GROUP:New(_group,txt,subcatmenus[cargoObj.Subcategory])
|
||||||
|
MENU_GROUP_COMMAND:New(_group,"Get",mSet,self._GetCrates,self,_group,_unit,cargoObj)
|
||||||
|
MENU_GROUP_COMMAND:New(_group,"Get and Load",mSet,self._GetAndLoad,self,_group,_unit,cargoObj)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for _,cargoObj in pairs(self.Cargo_Statics) do
|
||||||
|
if not cargoObj.DontShowInMenu then
|
||||||
|
local txt = string.format("Crate %s (%dkg)",cargoObj.Name,cargoObj.PerCrateMass or 0)
|
||||||
|
if cargoObj.Location then txt = txt.."[R]" end
|
||||||
|
local stock = cargoObj:GetStock()
|
||||||
|
if stock>=0 and self.showstockinmenuitems then txt = txt.."["..stock.."]" end
|
||||||
|
local mSet = MENU_GROUP:New(_group,txt,subcatmenus[cargoObj.Subcategory])
|
||||||
|
MENU_GROUP_COMMAND:New(_group,"Get",mSet,self._GetCrates,self,_group,_unit,cargoObj)
|
||||||
|
MENU_GROUP_COMMAND:New(_group,"Get and Load",mSet,self._GetAndLoad,self,_group,_unit,cargoObj)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
for _,cargoObj in pairs(self.Cargo_Crates) do
|
||||||
|
if not cargoObj.DontShowInMenu then
|
||||||
|
local txt = string.format("Crate %s (%dkg)",cargoObj.Name,cargoObj.PerCrateMass or 0)
|
||||||
|
if cargoObj.Location then txt = txt.."[R]" end
|
||||||
|
local stock = cargoObj:GetStock()
|
||||||
|
if stock>=0 and self.showstockinmenuitems then txt = txt.."["..stock.."]" end
|
||||||
|
local mSet = MENU_GROUP:New(_group,txt,cratesmenu)
|
||||||
|
MENU_GROUP_COMMAND:New(_group,"Get",mSet,self._GetCrates,self,_group,_unit,cargoObj)
|
||||||
|
MENU_GROUP_COMMAND:New(_group,"Get and Load",mSet,self._GetAndLoad,self,_group,_unit,cargoObj)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for _,cargoObj in pairs(self.Cargo_Statics) do
|
||||||
|
if not cargoObj.DontShowInMenu then
|
||||||
|
local txt = string.format("Crate %s (%dkg)",cargoObj.Name,cargoObj.PerCrateMass or 0)
|
||||||
|
if cargoObj.Location then txt = txt.."[R]" end
|
||||||
|
local stock = cargoObj:GetStock()
|
||||||
|
if stock>=0 and self.showstockinmenuitems then txt = txt.."["..stock.."]" end
|
||||||
|
local mSet = MENU_GROUP:New(_group,txt,cratesmenu)
|
||||||
|
MENU_GROUP_COMMAND:New(_group,"Get",mSet,self._GetCrates,self,_group,_unit,cargoObj)
|
||||||
|
MENU_GROUP_COMMAND:New(_group,"Get and Load",mSet,self._GetAndLoad,self,_group,_unit,cargoObj)
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
if self.usesubcats then
|
if self.usesubcats then
|
||||||
local subcatmenus = {}
|
local subcatmenus = {}
|
||||||
for catName, _ in pairs(self.subcats) do
|
for catName, _ in pairs(self.subcats) do
|
||||||
subcatmenus[catName] = MENU_GROUP:New(_group, catName, cratesmenu)
|
subcatmenus[catName] = MENU_GROUP:New(_group, catName, cratesmenu) -- fixed variable case
|
||||||
end
|
end
|
||||||
for _, cargoObj in pairs(self.Cargo_Crates) do
|
for _, cargoObj in pairs(self.Cargo_Crates) do
|
||||||
if not cargoObj.DontShowInMenu then
|
if not cargoObj.DontShowInMenu then
|
||||||
@@ -4384,14 +4577,15 @@ function CTLD:_RefreshF10Menus()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local loadCratesMenu=MENU_GROUP:New(_group,"Load Crates",topcrates)
|
local loadCratesMenu=MENU_GROUP:New(_group,"Load Crates",topcrates)
|
||||||
_group.MyLoadCratesMenu=loadCratesMenu
|
_group.MyLoadCratesMenu=loadCratesMenu
|
||||||
MENU_GROUP_COMMAND:New(_group,"Load ALL",loadCratesMenu,self._LoadCratesNearby,self,_group,_unit)
|
MENU_GROUP_COMMAND:New(_group,"Load ALL",loadCratesMenu,self._LoadCratesNearby,self,_group,_unit)
|
||||||
MENU_GROUP_COMMAND:New(_group,"Show loadable crates",loadCratesMenu,self._RefreshLoadCratesMenu,self,_group,_unit)
|
MENU_GROUP_COMMAND:New(_group,"Show loadable crates",loadCratesMenu,self._RefreshLoadCratesMenu,self,_group,_unit)
|
||||||
|
|
||||||
local dropCratesMenu=MENU_GROUP:New(_group,"Drop Crates",topcrates)
|
local dropCratesMenu = MENU_GROUP:New(_group,"Drop Crates",topcrates)
|
||||||
topcrates.DropCratesMenu=dropCratesMenu
|
topcrates.DropCratesMenu = dropCratesMenu
|
||||||
|
|
||||||
if not self.nobuildmenu then
|
if not self.nobuildmenu then
|
||||||
MENU_GROUP_COMMAND:New(_group, "Build crates", topcrates, self._BuildCrates, self, _group, _unit)
|
MENU_GROUP_COMMAND:New(_group, "Build crates", topcrates, self._BuildCrates, self, _group, _unit)
|
||||||
@@ -4401,8 +4595,16 @@ function CTLD:_RefreshF10Menus()
|
|||||||
local removecratesmenu = MENU_GROUP:New(_group, "Remove crates", topcrates)
|
local removecratesmenu = MENU_GROUP:New(_group, "Remove crates", topcrates)
|
||||||
MENU_GROUP_COMMAND:New(_group, "Remove crates nearby", removecratesmenu, self._RemoveCratesNearby, self, _group, _unit)
|
MENU_GROUP_COMMAND:New(_group, "Remove crates nearby", removecratesmenu, self._RemoveCratesNearby, self, _group, _unit)
|
||||||
|
|
||||||
|
if self.onestepmenu then
|
||||||
|
local mPack=MENU_GROUP:New(_group,"Pack crates",topcrates)
|
||||||
|
MENU_GROUP_COMMAND:New(_group,"Pack",mPack,self._PackCratesNearby,self,_group,_unit)
|
||||||
|
MENU_GROUP_COMMAND:New(_group,"Pack and Load",mPack,self._PackAndLoad,self,_group,_unit)
|
||||||
|
MENU_GROUP_COMMAND:New(_group,"Pack and Remove",mPack,self._PackAndRemove,self,_group,_unit)
|
||||||
|
MENU_GROUP_COMMAND:New(_group, "List crates nearby", topcrates, self._ListCratesNearby, self, _group, _unit)
|
||||||
|
else
|
||||||
MENU_GROUP_COMMAND:New(_group, "Pack crates", topcrates, self._PackCratesNearby, self, _group, _unit)
|
MENU_GROUP_COMMAND:New(_group, "Pack crates", topcrates, self._PackCratesNearby, self, _group, _unit)
|
||||||
MENU_GROUP_COMMAND:New(_group, "List crates nearby", topcrates, self._ListCratesNearby, self, _group, _unit)
|
MENU_GROUP_COMMAND:New(_group, "List crates nearby", topcrates, self._ListCratesNearby, self, _group, _unit)
|
||||||
|
end
|
||||||
|
|
||||||
local uName = _unit:GetName()
|
local uName = _unit:GetName()
|
||||||
local loadedData = self.Loaded_Cargo[uName]
|
local loadedData = self.Loaded_Cargo[uName]
|
||||||
@@ -4423,8 +4625,6 @@ function CTLD:_RefreshF10Menus()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------
|
-----------------------------------------------------
|
||||||
-- Misc sub‐menus
|
-- Misc sub‐menus
|
||||||
-----------------------------------------------------
|
-----------------------------------------------------
|
||||||
@@ -4453,7 +4653,7 @@ function CTLD:_RefreshF10Menus()
|
|||||||
|
|
||||||
-- Mark we built the menu
|
-- Mark we built the menu
|
||||||
self.MenusDone[_unitName] = true
|
self.MenusDone[_unitName] = true
|
||||||
self:_RefreshLoadCratesMenu(_group, _unit)
|
self:_RefreshLoadCratesMenu(_group,_unit)
|
||||||
self:_RefreshDropCratesMenu(_group,_unit)
|
self:_RefreshDropCratesMenu(_group,_unit)
|
||||||
|
|
||||||
end -- if _group
|
end -- if _group
|
||||||
@@ -4464,45 +4664,53 @@ function CTLD:_RefreshF10Menus()
|
|||||||
end -- for all pilot units
|
end -- for all pilot units
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- (Internal) Function to refresh the menu for load crates. Triggered from land/getcrate/pack and more
|
--- (Internal) Function to refresh the menu for load crates. Triggered from land/getcrate/pack and more
|
||||||
-- @param #CTLD self
|
-- @param #CTLD self
|
||||||
-- @param Wrapper.Group#GROUP Group The calling group.
|
-- @param Wrapper.Group#GROUP Group The calling group.
|
||||||
-- @param Wrapper.Unit#UNIT Unit The calling unit.
|
-- @param Wrapper.Unit#UNIT Unit The calling unit.
|
||||||
-- @return #CTLD self
|
-- @return #CTLD self
|
||||||
function CTLD:_RefreshLoadCratesMenu(Group, Unit)
|
function CTLD:_RefreshLoadCratesMenu(Group,Unit)
|
||||||
if not Group.MyLoadCratesMenu then return end
|
if not Group.MyLoadCratesMenu then return end
|
||||||
Group.MyLoadCratesMenu:RemoveSubMenus()
|
Group.MyLoadCratesMenu:RemoveSubMenus()
|
||||||
|
|
||||||
local d = self.CrateDistance or 35
|
local d=self.CrateDistance or 35
|
||||||
local nearby, n = self:_FindCratesNearby(Group, Unit, d, true, true)
|
local nearby,n=self:_FindCratesNearby(Group,Unit,d,true,true)
|
||||||
if n == 0 then
|
if n==0 then
|
||||||
MENU_GROUP_COMMAND:New(Group, "No crates found! Rescan?", Group.MyLoadCratesMenu, function() self:_RefreshLoadCratesMenu(Group, Unit) end)
|
MENU_GROUP_COMMAND:New(Group,"No crates found! Rescan?",Group.MyLoadCratesMenu,function() self:_RefreshLoadCratesMenu(Group,Unit) end)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
MENU_GROUP_COMMAND:New(Group, "Load ALL", Group.MyLoadCratesMenu, self._LoadCratesNearby, self, Group, Unit)
|
MENU_GROUP_COMMAND:New(Group,"Load ALL",Group.MyLoadCratesMenu,self._LoadCratesNearby,self,Group,Unit)
|
||||||
local cargoByName = {}
|
|
||||||
for _, crate in pairs(nearby) do
|
local cargoByName={}
|
||||||
local cName = crate:GetName()
|
for _,crate in pairs(nearby) do
|
||||||
cargoByName[cName] = cargoByName[cName] or {}
|
local name=crate:GetName()
|
||||||
table.insert(cargoByName[cName], crate)
|
cargoByName[name]=cargoByName[name] or{}
|
||||||
|
table.insert(cargoByName[name],crate)
|
||||||
end
|
end
|
||||||
|
|
||||||
for cName, cList in pairs(cargoByName) do
|
local lineIndex=1
|
||||||
local needed = cList[1]:GetCratesNeeded() or 1
|
for cName,list in pairs(cargoByName) do
|
||||||
local found = #cList
|
local needed=list[1]:GetCratesNeeded() or 1
|
||||||
|
table.sort(list,function(a,b)return a:GetID()<b:GetID() end)
|
||||||
local line
|
local i=1
|
||||||
if found >= needed then
|
while i<=#list do
|
||||||
line = string.format("Load %s", cName)
|
local left=#list-i+1
|
||||||
|
local label
|
||||||
|
if left>=needed then
|
||||||
|
label=string.format("%d. Load %s",lineIndex,cName)
|
||||||
|
i=i+needed
|
||||||
else
|
else
|
||||||
MENU_GROUP_COMMAND:New(Group, "Rescan?", Group.MyLoadCratesMenu, function() self:_RefreshLoadCratesMenu(Group, Unit) end)
|
label=string.format("%d. Load %s (%d/%d)",lineIndex,cName,left,needed)
|
||||||
line = string.format("Load %s (%d/%d)", cName, found, needed)
|
i=#list+1
|
||||||
end
|
end
|
||||||
MENU_GROUP_COMMAND:New(Group, line, Group.MyLoadCratesMenu, self._LoadSingleCrateSet, self, Group, Unit, cName)
|
MENU_GROUP_COMMAND:New(Group,label,Group.MyLoadCratesMenu,self._LoadSingleCrateSet,self,Group,Unit,cName)
|
||||||
|
lineIndex=lineIndex+1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Loads exactly `CratesNeeded` crates for one cargoName in range.
|
-- Loads exactly `CratesNeeded` crates for one cargoName in range.
|
||||||
@@ -4712,7 +4920,17 @@ function CTLD:_UnloadSingleCrateSet(Group, Unit, setIndex)
|
|||||||
cObj:SetWasDropped(true)
|
cObj:SetWasDropped(true)
|
||||||
cObj:SetHasMoved(true)
|
cObj:SetHasMoved(true)
|
||||||
end
|
end
|
||||||
|
local cname = crateObj:GetName() or "Unknown"
|
||||||
|
local count = #chunk
|
||||||
|
if needed > 1 then
|
||||||
|
if count == needed then
|
||||||
|
self:_SendMessage(string.format("Dropped %d %s.", 1, cname), 10, false, Group)
|
||||||
|
else
|
||||||
|
self:_SendMessage(string.format("Dropped %d/%d crate(s) of %s.", count, needed, cname), 15, false, Group)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
self:_SendMessage(string.format("Dropped %d %s(s).", count, cname), 10, false, Group)
|
||||||
|
end
|
||||||
-- Rebuild the cargo list to remove the dropped crates
|
-- Rebuild the cargo list to remove the dropped crates
|
||||||
local loadedData = self.Loaded_Cargo[unitName]
|
local loadedData = self.Loaded_Cargo[unitName]
|
||||||
if loadedData and loadedData.Cargo then
|
if loadedData and loadedData.Cargo then
|
||||||
@@ -4745,6 +4963,7 @@ end
|
|||||||
-- @param Wrapper.Unit#UNIT Unit The calling unit.
|
-- @param Wrapper.Unit#UNIT Unit The calling unit.
|
||||||
-- @return #CTLD self
|
-- @return #CTLD self
|
||||||
function CTLD:_RefreshDropCratesMenu(Group, Unit)
|
function CTLD:_RefreshDropCratesMenu(Group, Unit)
|
||||||
|
|
||||||
if not Group.CTLDTopmenu then return end
|
if not Group.CTLDTopmenu then return end
|
||||||
local topCrates = Group.MyTopCratesMenu
|
local topCrates = Group.MyTopCratesMenu
|
||||||
if not topCrates then return end
|
if not topCrates then return end
|
||||||
@@ -4780,7 +4999,15 @@ function CTLD:_RefreshDropCratesMenu(Group, Unit)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
-- DEFAULT (“classic”) versus ONE-STEP behaviour
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
if not self.onestepmenu then
|
||||||
|
--------------------------------------------------------------------
|
||||||
|
-- classic menu
|
||||||
|
--------------------------------------------------------------------
|
||||||
MENU_GROUP_COMMAND:New(Group,"Drop ALL crates",dropCratesMenu,self._UnloadCrates,self,Group,Unit)
|
MENU_GROUP_COMMAND:New(Group,"Drop ALL crates",dropCratesMenu,self._UnloadCrates,self,Group,Unit)
|
||||||
|
|
||||||
self.CrateGroupList=self.CrateGroupList or{}
|
self.CrateGroupList=self.CrateGroupList or{}
|
||||||
self.CrateGroupList[Unit:GetName()]={}
|
self.CrateGroupList[Unit:GetName()]={}
|
||||||
|
|
||||||
@@ -4815,7 +5042,57 @@ function CTLD:_RefreshDropCratesMenu(Group, Unit)
|
|||||||
lineIndex=lineIndex+1
|
lineIndex=lineIndex+1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
else
|
||||||
|
--------------------------------------------------------------------
|
||||||
|
-- one-step (enhanced) menu
|
||||||
|
--------------------------------------------------------------------
|
||||||
|
local mAll=MENU_GROUP:New(Group,"Drop ALL crates",dropCratesMenu)
|
||||||
|
MENU_GROUP_COMMAND:New(Group,"Drop",mAll,self._UnloadCrates,self,Group,Unit)
|
||||||
|
if not ( self:IsUnitInAir(Unit) and self:IsFixedWing(Unit) ) then
|
||||||
|
MENU_GROUP_COMMAND:New(Group,"Drop and build",mAll,self._DropAndBuild,self,Group,Unit)
|
||||||
|
end
|
||||||
|
|
||||||
|
self.CrateGroupList=self.CrateGroupList or{}
|
||||||
|
self.CrateGroupList[Unit:GetName()]={}
|
||||||
|
|
||||||
|
local lineIndex=1
|
||||||
|
for cName,list in pairs(cargoByName) do
|
||||||
|
local needed=list[1]:GetCratesNeeded() or 1
|
||||||
|
table.sort(list,function(a,b)return a:GetID()<b:GetID()end)
|
||||||
|
local i=1
|
||||||
|
while i<=#list do
|
||||||
|
local left=(#list-i+1)
|
||||||
|
if left>=needed then
|
||||||
|
local chunk={}
|
||||||
|
for n=i,i+needed-1 do
|
||||||
|
table.insert(chunk,list[n])
|
||||||
|
end
|
||||||
|
local label=string.format("%d. %s",lineIndex,cName)
|
||||||
|
table.insert(self.CrateGroupList[Unit:GetName()],chunk)
|
||||||
|
local setIndex=#self.CrateGroupList[Unit:GetName()]
|
||||||
|
local mSet=MENU_GROUP:New(Group,label,dropCratesMenu)
|
||||||
|
MENU_GROUP_COMMAND:New(Group,"Drop",mSet,self._UnloadSingleCrateSet,self,Group,Unit,setIndex)
|
||||||
|
if not ( self:IsUnitInAir(Unit) and self:IsFixedWing(Unit) ) then
|
||||||
|
MENU_GROUP_COMMAND:New(Group,"Drop and build",mSet,self._DropSingleAndBuild,self,Group,Unit,setIndex)
|
||||||
|
end
|
||||||
|
i=i+needed
|
||||||
|
else
|
||||||
|
local chunk={}
|
||||||
|
for n=i,#list do
|
||||||
|
table.insert(chunk,list[n])
|
||||||
|
end
|
||||||
|
local label=string.format("%d. %s %d/%d",lineIndex,cName,left,needed)
|
||||||
|
table.insert(self.CrateGroupList[Unit:GetName()],chunk)
|
||||||
|
local setIndex=#self.CrateGroupList[Unit:GetName()]
|
||||||
|
MENU_GROUP_COMMAND:New(Group,label,dropCratesMenu,self._UnloadSingleCrateSet,self,Group,Unit,setIndex)
|
||||||
|
i=#list+1
|
||||||
|
end
|
||||||
|
lineIndex=lineIndex+1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--- (Internal) Function to unload a single Troop group by ID.
|
--- (Internal) Function to unload a single Troop group by ID.
|
||||||
-- @param #CTLD self
|
-- @param #CTLD self
|
||||||
@@ -4864,7 +5141,7 @@ function CTLD:_UnloadSingleTroopByID(Group, Unit, chunkID)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Drop ONLY the FIRST cargo in that chunk
|
-- Drop the FIRST cargo in that chunk
|
||||||
local foundCargo = chunk[1]
|
local foundCargo = chunk[1]
|
||||||
if not foundCargo then
|
if not foundCargo then
|
||||||
self:_SendMessage(string.format("No troop cargo at chunk %d!", chunkID), 10, false, Group)
|
self:_SendMessage(string.format("No troop cargo at chunk %d!", chunkID), 10, false, Group)
|
||||||
@@ -4925,6 +5202,8 @@ function CTLD:_UnloadSingleTroopByID(Group, Unit, chunkID)
|
|||||||
foundCargo:SetWasDropped(true)
|
foundCargo:SetWasDropped(true)
|
||||||
if cType == CTLD_CARGO.Enum.ENGINEERS then
|
if cType == CTLD_CARGO.Enum.ENGINEERS then
|
||||||
self.Engineers = self.Engineers + 1
|
self.Engineers = self.Engineers + 1
|
||||||
|
local grpname = self.DroppedTroops[self.TroopCounter]:GetName()
|
||||||
|
self.EngineersInField[self.Engineers] = CTLD_ENGINEERING:New(name, grpname)
|
||||||
self:_SendMessage(string.format("Dropped Engineers %s into action!", name), 10, false, Group)
|
self:_SendMessage(string.format("Dropped Engineers %s into action!", name), 10, false, Group)
|
||||||
else
|
else
|
||||||
self:_SendMessage(string.format("Dropped Troops %s into action!", name), 10, false, Group)
|
self:_SendMessage(string.format("Dropped Troops %s into action!", name), 10, false, Group)
|
||||||
@@ -5662,6 +5941,7 @@ function CTLD:IsUnitInZone(Unit,Zonetype)
|
|||||||
if Zonetype == CTLD.CargoZoneType.SHIP then
|
if Zonetype == CTLD.CargoZoneType.SHIP then
|
||||||
self:T("Checking Type Ship: "..zonename)
|
self:T("Checking Type Ship: "..zonename)
|
||||||
local ZoneUNIT = UNIT:FindByName(zonename)
|
local ZoneUNIT = UNIT:FindByName(zonename)
|
||||||
|
if not ZoneUNIT then return false end
|
||||||
zonecoord = ZoneUNIT:GetCoordinate()
|
zonecoord = ZoneUNIT:GetCoordinate()
|
||||||
zoneradius = czone.shiplength
|
zoneradius = czone.shiplength
|
||||||
zonewidth = czone.shipwidth
|
zonewidth = czone.shipwidth
|
||||||
@@ -5739,16 +6019,23 @@ function CTLD:SmokeZoneNearBy(Unit, Flare)
|
|||||||
for index,cargozone in pairs(zones[i]) do
|
for index,cargozone in pairs(zones[i]) do
|
||||||
local CZone = cargozone --#CTLD.CargoZone
|
local CZone = cargozone --#CTLD.CargoZone
|
||||||
local zonename = CZone.name
|
local zonename = CZone.name
|
||||||
local zone = nil
|
local zone = nil -- Core.Zone#ZONE_RADIUS
|
||||||
|
local airbasezone = false
|
||||||
if i == 4 then
|
if i == 4 then
|
||||||
zone = UNIT:FindByName(zonename)
|
zone = UNIT:FindByName(zonename)
|
||||||
else
|
else
|
||||||
zone = ZONE:FindByName(zonename)
|
zone = ZONE:FindByName(zonename)
|
||||||
if not zone then
|
if not zone then
|
||||||
zone = AIRBASE:FindByName(zonename):GetZone()
|
zone = AIRBASE:FindByName(zonename):GetZone()
|
||||||
|
airbasezone = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local zonecoord = zone:GetCoordinate()
|
local zonecoord = zone:GetCoordinate()
|
||||||
|
-- Avoid smoke/flares on runways
|
||||||
|
if (i==1 or 1==3) and airbasezone==true and zone:IsInstanceOf("ZONE_BASE") then
|
||||||
|
zonecoord = zone:GetRandomCoordinate(inner,outer,{land.SurfaceType.LAND})
|
||||||
|
end
|
||||||
|
if zonecoord then
|
||||||
local active = CZone.active
|
local active = CZone.active
|
||||||
local color = CZone.color
|
local color = CZone.color
|
||||||
local distance = self:_GetDistance(zonecoord,unitcoord)
|
local distance = self:_GetDistance(zonecoord,unitcoord)
|
||||||
@@ -5767,6 +6054,7 @@ function CTLD:SmokeZoneNearBy(Unit, Flare)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
if not smoked then
|
if not smoked then
|
||||||
local distance = UTILS.MetersToNM(self.smokedistance)
|
local distance = UTILS.MetersToNM(self.smokedistance)
|
||||||
self:_SendMessage(string.format("Negative, need to be closer than %dnm to a zone!",distance), 10, false, Group)
|
self:_SendMessage(string.format("Negative, need to be closer than %dnm to a zone!",distance), 10, false, Group)
|
||||||
@@ -6983,7 +7271,8 @@ end
|
|||||||
-- right subtype?
|
-- right subtype?
|
||||||
if Event == subtype and not task:IsDone() then
|
if Event == subtype and not task:IsDone() then
|
||||||
local targetzone = task.Target:GetObject() -- Core.Zone#ZONE should be a zone in this case ....
|
local targetzone = task.Target:GetObject() -- Core.Zone#ZONE should be a zone in this case ....
|
||||||
--self:T2({Name=Groupname,Property=task:GetProperty("ExtractName")})
|
self:T2({Name=Groupname,Property=task:GetProperty("ExtractName")})
|
||||||
|
if task:GetProperty("ExtractName") then
|
||||||
local okaygroup = string.find(Groupname,task:GetProperty("ExtractName"),1,true)
|
local okaygroup = string.find(Groupname,task:GetProperty("ExtractName"),1,true)
|
||||||
if targetzone and targetzone.ClassName and string.match(targetzone.ClassName,"ZONE") and okaygroup then
|
if targetzone and targetzone.ClassName and string.match(targetzone.ClassName,"ZONE") and okaygroup then
|
||||||
if task.Clients:HasUniqueID(playername) then
|
if task.Clients:HasUniqueID(playername) then
|
||||||
@@ -6991,6 +7280,9 @@ end
|
|||||||
task:__Success(-1)
|
task:__Success(-1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
self:T({Text="'ExtractName' Property not set",Name=Groupname,Property=task.Type})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ COMMANDER = {
|
|||||||
awacsZones = {},
|
awacsZones = {},
|
||||||
tankerZones = {},
|
tankerZones = {},
|
||||||
limitMission = {},
|
limitMission = {},
|
||||||
|
maxMissionsAssignPerCycle = 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- COMMANDER class version.
|
--- COMMANDER class version.
|
||||||
@@ -1535,6 +1536,8 @@ function COMMANDER:CheckMissionQueue()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local missionsAssigned = 0
|
||||||
|
|
||||||
-- Loop over missions in queue.
|
-- Loop over missions in queue.
|
||||||
for _,_mission in pairs(self.missionqueue) do
|
for _,_mission in pairs(self.missionqueue) do
|
||||||
local mission=_mission --Ops.Auftrag#AUFTRAG
|
local mission=_mission --Ops.Auftrag#AUFTRAG
|
||||||
@@ -1595,10 +1598,13 @@ function COMMANDER:CheckMissionQueue()
|
|||||||
LEGION.UnRecruitAssets(assets, mission)
|
LEGION.UnRecruitAssets(assets, mission)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Only ONE mission is assigned.
|
missionsAssigned = missionsAssigned + 1
|
||||||
|
if missionsAssigned >= (self.maxMissionsAssignPerCycle or 1) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -1611,6 +1617,16 @@ function COMMANDER:CheckMissionQueue()
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Set how many missions can be assigned in a single status iteration. (eg. This is useful for persistent missions where you need to load all AUFTRAGs on mission start and then change it back to default)
|
||||||
|
--- Warning: Increasing this value will increase the number of missions started per iteration and thus may lead to performance issues if too many missions are started at once.
|
||||||
|
-- @param #COMMANDER self
|
||||||
|
-- @param #number Number of missions assigned per status iteration. Default is 1.
|
||||||
|
-- @return #COMMANDER self.
|
||||||
|
function COMMANDER:SetMaxMissionsAssignPerCycle(MaxMissionsAssignPerCycle)
|
||||||
|
self.maxMissionsAssignPerCycle = MaxMissionsAssignPerCycle or 1
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Get cohorts.
|
--- Get cohorts.
|
||||||
-- @param #COMMANDER self
|
-- @param #COMMANDER self
|
||||||
-- @param #table Legions Special legions.
|
-- @param #table Legions Special legions.
|
||||||
@@ -1671,7 +1687,10 @@ function COMMANDER:_GetCohorts(Legions, Cohorts, Operation)
|
|||||||
local legion=_legion --Ops.Legion#LEGION
|
local legion=_legion --Ops.Legion#LEGION
|
||||||
|
|
||||||
-- Check that runway is operational.
|
-- Check that runway is operational.
|
||||||
local Runway=legion:IsAirwing() and legion:IsRunwayOperational() or true
|
local Runway=true
|
||||||
|
if legion:IsAirwing() then
|
||||||
|
Runway=legion:IsRunwayOperational() and legion.airbase and legion.airbase:GetCoalition() == legion:GetCoalition()
|
||||||
|
end
|
||||||
|
|
||||||
-- Legion has to be running.
|
-- Legion has to be running.
|
||||||
if legion:IsRunning() and Runway then
|
if legion:IsRunning() and Runway then
|
||||||
@@ -1704,7 +1723,10 @@ function COMMANDER:_GetCohorts(Legions, Cohorts, Operation)
|
|||||||
local legion=_legion --Ops.Legion#LEGION
|
local legion=_legion --Ops.Legion#LEGION
|
||||||
|
|
||||||
-- Check that runway is operational.
|
-- Check that runway is operational.
|
||||||
local Runway=legion:IsAirwing() and legion:IsRunwayOperational() or true
|
local Runway=true
|
||||||
|
if legion:IsAirwing() then
|
||||||
|
Runway=legion:IsRunwayOperational() and legion.airbase and legion.airbase:GetCoalition() == legion:GetCoalition()
|
||||||
|
end
|
||||||
|
|
||||||
-- Legion has to be running.
|
-- Legion has to be running.
|
||||||
if legion:IsRunning() and Runway then
|
if legion:IsRunning() and Runway then
|
||||||
|
|||||||
@@ -70,6 +70,7 @@
|
|||||||
-- @field #boolean DespawnAfterLanding
|
-- @field #boolean DespawnAfterLanding
|
||||||
-- @field #boolean DespawnAfterHolding
|
-- @field #boolean DespawnAfterHolding
|
||||||
-- @field #list<Ops.Auftrag#AUFTRAG> ListOfAuftrag
|
-- @field #list<Ops.Auftrag#AUFTRAG> ListOfAuftrag
|
||||||
|
-- @field #string defaulttakeofftype Take off type
|
||||||
-- @extends Core.Fsm#FSM
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
--- *“Airspeed, altitude, and brains. Two are always needed to successfully complete the flight.”* -- Unknown.
|
--- *“Airspeed, altitude, and brains. Two are always needed to successfully complete the flight.”* -- Unknown.
|
||||||
@@ -223,7 +224,8 @@ EASYGCICAP = {
|
|||||||
ReadyFlightGroups = {},
|
ReadyFlightGroups = {},
|
||||||
DespawnAfterLanding = false,
|
DespawnAfterLanding = false,
|
||||||
DespawnAfterHolding = true,
|
DespawnAfterHolding = true,
|
||||||
ListOfAuftrag = {}
|
ListOfAuftrag = {},
|
||||||
|
defaulttakeofftype = "hot",
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Internal Squadron data type
|
--- Internal Squadron data type
|
||||||
@@ -259,7 +261,7 @@ EASYGCICAP = {
|
|||||||
|
|
||||||
--- EASYGCICAP class version.
|
--- EASYGCICAP class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
EASYGCICAP.version="0.1.18"
|
EASYGCICAP.version="0.1.23"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO list
|
-- TODO list
|
||||||
@@ -312,6 +314,7 @@ function EASYGCICAP:New(Alias, AirbaseName, Coalition, EWRName)
|
|||||||
self.DespawnAfterLanding = false
|
self.DespawnAfterLanding = false
|
||||||
self.DespawnAfterHolding = true
|
self.DespawnAfterHolding = true
|
||||||
self.ListOfAuftrag = {}
|
self.ListOfAuftrag = {}
|
||||||
|
self.defaulttakeofftype = "hot"
|
||||||
|
|
||||||
-- Set some string id for output to DCS.log file.
|
-- Set some string id for output to DCS.log file.
|
||||||
self.lid=string.format("EASYGCICAP %s | ", self.alias)
|
self.lid=string.format("EASYGCICAP %s | ", self.alias)
|
||||||
@@ -400,6 +403,16 @@ function EASYGCICAP:SetDefaultRepeatOnFailure(Retries)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Add default take off type for the airwings.
|
||||||
|
-- @param #EASYGCICAP self
|
||||||
|
-- @param #string Takeoff Can be "hot", "cold", or "air" - default is "hot".
|
||||||
|
-- @return #EASYGCICAP self
|
||||||
|
function EASYGCICAP:SetDefaultTakeOffType(Takeoff)
|
||||||
|
self:T(self.lid.."SetDefaultTakeOffType")
|
||||||
|
self.defaulttakeofftype = Takeoff or "hot"
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Set default CAP Speed in knots
|
--- Set default CAP Speed in knots
|
||||||
-- @param #EASYGCICAP self
|
-- @param #EASYGCICAP self
|
||||||
-- @param #number Speed Speed defaults to 300
|
-- @param #number Speed Speed defaults to 300
|
||||||
@@ -569,6 +582,13 @@ function EASYGCICAP:_AddAirwing(Airbasename, Alias)
|
|||||||
local DespawnAfterLanding = self.DespawnAfterLanding
|
local DespawnAfterLanding = self.DespawnAfterLanding
|
||||||
local DespawnAfterHolding = self.DespawnAfterHolding
|
local DespawnAfterHolding = self.DespawnAfterHolding
|
||||||
|
|
||||||
|
-- Check STATIC name
|
||||||
|
local check = STATIC:FindByName(Airbasename,false)
|
||||||
|
if check == nil then
|
||||||
|
MESSAGE:New(self.lid.."There's no warehouse static on the map (wrong naming?) for airbase "..tostring(Airbasename).."!",30,"CHECK"):ToAllIf(self.debug):ToLog()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- Create Airwing
|
-- Create Airwing
|
||||||
local CAP_Wing = AIRWING:New(Airbasename,Alias)
|
local CAP_Wing = AIRWING:New(Airbasename,Alias)
|
||||||
CAP_Wing:SetVerbosityLevel(0)
|
CAP_Wing:SetVerbosityLevel(0)
|
||||||
@@ -596,9 +616,8 @@ function EASYGCICAP:_AddAirwing(Airbasename, Alias)
|
|||||||
if #self.ManagedREC > 0 then
|
if #self.ManagedREC > 0 then
|
||||||
CAP_Wing:SetNumberRecon(1)
|
CAP_Wing:SetNumberRecon(1)
|
||||||
end
|
end
|
||||||
--local PatrolCoordinateKutaisi = ZONE:New(CapZoneName):GetCoordinate()
|
|
||||||
--CAP_Wing:AddPatrolPointCAP(PatrolCoordinateKutaisi,self.capalt,UTILS.KnotsToAltKIAS(self.capspeed,self.capalt),self.capdir,self.capleg)
|
CAP_Wing:SetTakeoffType(self.defaulttakeofftype)
|
||||||
CAP_Wing:SetTakeoffHot()
|
|
||||||
CAP_Wing:SetLowFuelThreshold(0.3)
|
CAP_Wing:SetLowFuelThreshold(0.3)
|
||||||
CAP_Wing.RandomAssetScore = math.random(50,100)
|
CAP_Wing.RandomAssetScore = math.random(50,100)
|
||||||
CAP_Wing:Start()
|
CAP_Wing:Start()
|
||||||
@@ -606,6 +625,9 @@ function EASYGCICAP:_AddAirwing(Airbasename, Alias)
|
|||||||
local Intel = self.Intel
|
local Intel = self.Intel
|
||||||
|
|
||||||
local TankerInvisible = self.TankerInvisible
|
local TankerInvisible = self.TankerInvisible
|
||||||
|
local engagerange = self.engagerange
|
||||||
|
local GoZoneSet = self.GoZoneSet
|
||||||
|
local NoGoZoneSet = self.NoGoZoneSet
|
||||||
|
|
||||||
function CAP_Wing:onbeforeFlightOnMission(From, Event, To, Flightgroup, Mission)
|
function CAP_Wing:onbeforeFlightOnMission(From, Event, To, Flightgroup, Mission)
|
||||||
local flightgroup = Flightgroup -- Ops.FlightGroup#FLIGHTGROUP
|
local flightgroup = Flightgroup -- Ops.FlightGroup#FLIGHTGROUP
|
||||||
@@ -619,7 +641,7 @@ function EASYGCICAP:_AddAirwing(Airbasename, Alias)
|
|||||||
flightgroup:GetGroup():SetOptionRadarUsingForContinousSearch()
|
flightgroup:GetGroup():SetOptionRadarUsingForContinousSearch()
|
||||||
if Mission.type ~= AUFTRAG.Type.TANKER and Mission.type ~= AUFTRAG.Type.AWACS and Mission.type ~= AUFTRAG.Type.RECON then
|
if Mission.type ~= AUFTRAG.Type.TANKER and Mission.type ~= AUFTRAG.Type.AWACS and Mission.type ~= AUFTRAG.Type.RECON then
|
||||||
flightgroup:SetDetection(true)
|
flightgroup:SetDetection(true)
|
||||||
flightgroup:SetEngageDetectedOn(self.engagerange,{"Air"},self.GoZoneSet,self.NoGoZoneSet)
|
flightgroup:SetEngageDetectedOn(engagerange,{"Air"},GoZoneSet,NoGoZoneSet)
|
||||||
flightgroup:SetOutOfAAMRTB()
|
flightgroup:SetOutOfAAMRTB()
|
||||||
if CapFormation then
|
if CapFormation then
|
||||||
flightgroup:GetGroup():SetOption(AI.Option.Air.id.FORMATION,CapFormation)
|
flightgroup:GetGroup():SetOption(AI.Option.Air.id.FORMATION,CapFormation)
|
||||||
@@ -763,6 +785,11 @@ function EASYGCICAP:_SetTankerPatrolPoints()
|
|||||||
self:T(self.lid.."_SetTankerPatrolPoints")
|
self:T(self.lid.."_SetTankerPatrolPoints")
|
||||||
for _,_data in pairs(self.ManagedTK) do
|
for _,_data in pairs(self.ManagedTK) do
|
||||||
local data = _data --#EASYGCICAP.CapPoint
|
local data = _data --#EASYGCICAP.CapPoint
|
||||||
|
self:T("Airbasename = "..data.AirbaseName)
|
||||||
|
if not self.wings[data.AirbaseName] then
|
||||||
|
MESSAGE:New(self.lid.."You are trying to create a TANKER point for which there is no wing! "..tostring(data.AirbaseName),30,"CHECK"):ToAllIf(self.debug):ToLog()
|
||||||
|
return
|
||||||
|
end
|
||||||
local Wing = self.wings[data.AirbaseName][1] -- Ops.Airwing#AIRWING
|
local Wing = self.wings[data.AirbaseName][1] -- Ops.Airwing#AIRWING
|
||||||
local Coordinate = data.Coordinate
|
local Coordinate = data.Coordinate
|
||||||
local Altitude = data.Altitude
|
local Altitude = data.Altitude
|
||||||
@@ -782,6 +809,11 @@ function EASYGCICAP:_SetAwacsPatrolPoints()
|
|||||||
self:T(self.lid.."_SetAwacsPatrolPoints")
|
self:T(self.lid.."_SetAwacsPatrolPoints")
|
||||||
for _,_data in pairs(self.ManagedEWR) do
|
for _,_data in pairs(self.ManagedEWR) do
|
||||||
local data = _data --#EASYGCICAP.CapPoint
|
local data = _data --#EASYGCICAP.CapPoint
|
||||||
|
self:T("Airbasename = "..data.AirbaseName)
|
||||||
|
if not self.wings[data.AirbaseName] then
|
||||||
|
MESSAGE:New(self.lid.."You are trying to create an AWACS point for which there is no wing! "..tostring(data.AirbaseName),30,"CHECK"):ToAllIf(self.debug):ToLog()
|
||||||
|
return
|
||||||
|
end
|
||||||
local Wing = self.wings[data.AirbaseName][1] -- Ops.Airwing#AIRWING
|
local Wing = self.wings[data.AirbaseName][1] -- Ops.Airwing#AIRWING
|
||||||
local Coordinate = data.Coordinate
|
local Coordinate = data.Coordinate
|
||||||
local Altitude = data.Altitude
|
local Altitude = data.Altitude
|
||||||
@@ -801,6 +833,11 @@ function EASYGCICAP:_SetCAPPatrolPoints()
|
|||||||
self:T(self.lid.."_SetCAPPatrolPoints")
|
self:T(self.lid.."_SetCAPPatrolPoints")
|
||||||
for _,_data in pairs(self.ManagedCP) do
|
for _,_data in pairs(self.ManagedCP) do
|
||||||
local data = _data --#EASYGCICAP.CapPoint
|
local data = _data --#EASYGCICAP.CapPoint
|
||||||
|
self:T("Airbasename = "..data.AirbaseName)
|
||||||
|
if not self.wings[data.AirbaseName] then
|
||||||
|
MESSAGE:New(self.lid.."You are trying to create a CAP point for which there is no wing! "..tostring(data.AirbaseName),30,"CHECK"):ToAllIf(self.debug):ToLog()
|
||||||
|
return
|
||||||
|
end
|
||||||
local Wing = self.wings[data.AirbaseName][1] -- Ops.Airwing#AIRWING
|
local Wing = self.wings[data.AirbaseName][1] -- Ops.Airwing#AIRWING
|
||||||
local Coordinate = data.Coordinate
|
local Coordinate = data.Coordinate
|
||||||
local Altitude = data.Altitude
|
local Altitude = data.Altitude
|
||||||
@@ -820,6 +857,11 @@ function EASYGCICAP:_SetReconPatrolPoints()
|
|||||||
self:T(self.lid.."_SetReconPatrolPoints")
|
self:T(self.lid.."_SetReconPatrolPoints")
|
||||||
for _,_data in pairs(self.ManagedREC) do
|
for _,_data in pairs(self.ManagedREC) do
|
||||||
local data = _data --#EASYGCICAP.CapPoint
|
local data = _data --#EASYGCICAP.CapPoint
|
||||||
|
self:T("Airbasename = "..data.AirbaseName)
|
||||||
|
if not self.wings[data.AirbaseName] then
|
||||||
|
MESSAGE:New(self.lid.."You are trying to create a RECON point for which there is no wing! "..tostring(data.AirbaseName),30,"CHECK"):ToAllIf(self.debug):ToLog()
|
||||||
|
return
|
||||||
|
end
|
||||||
local Wing = self.wings[data.AirbaseName][1] -- Ops.Airwing#AIRWING
|
local Wing = self.wings[data.AirbaseName][1] -- Ops.Airwing#AIRWING
|
||||||
local Coordinate = data.Coordinate
|
local Coordinate = data.Coordinate
|
||||||
local Altitude = data.Altitude
|
local Altitude = data.Altitude
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ function FLIGHTGROUP:New(group)
|
|||||||
local self=BASE:Inherit(self, OPSGROUP:New(group)) -- #FLIGHTGROUP
|
local self=BASE:Inherit(self, OPSGROUP:New(group)) -- #FLIGHTGROUP
|
||||||
|
|
||||||
-- Set some string id for output to DCS.log file.
|
-- Set some string id for output to DCS.log file.
|
||||||
self.lid=string.format("FLIGHTGROUP %s | ", self.groupname)
|
self.lid=string.format("FLIGHTGROUP %s | ", self.groupname or "N/A")
|
||||||
|
|
||||||
-- Defaults
|
-- Defaults
|
||||||
self:SetDefaultROE()
|
self:SetDefaultROE()
|
||||||
@@ -779,6 +779,61 @@ function FLIGHTGROUP:SetJettisonWeapons(Switch)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Set the aircraft to land straight in.
|
||||||
|
-- @param #FLIGHTGROUP self
|
||||||
|
-- @return #FLIGHTGROUP self
|
||||||
|
function FLIGHTGROUP:SetOptionLandingStraightIn()
|
||||||
|
self.OptionLandingStraightIn = true
|
||||||
|
if self:GetGroup():IsAlive() then
|
||||||
|
self:GetGroup():SetOptionLandingStraightIn()
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Set the aircraft to land in pairs.
|
||||||
|
-- @param #FLIGHTGROUP self
|
||||||
|
-- @return #FLIGHTGROUP self
|
||||||
|
function FLIGHTGROUP:SetOptionLandingForcePair()
|
||||||
|
self.OptionLandingForcePair = true
|
||||||
|
if self:GetGroup():IsAlive() then
|
||||||
|
self:GetGroup():SetOptionLandingForcePair()
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Set the aircraft to NOT land in pairs.
|
||||||
|
-- @param #FLIGHTGROUP self
|
||||||
|
-- @return #FLIGHTGROUP self
|
||||||
|
function FLIGHTGROUP:SetOptionLandingRestrictPair()
|
||||||
|
self.OptionLandingRestrictPair = true
|
||||||
|
if self:GetGroup():IsAlive() then
|
||||||
|
self:GetGroup():SetOptionLandingRestrictPair()
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Set the aircraft to land after overhead break.
|
||||||
|
-- @param #FLIGHTGROUP self
|
||||||
|
-- @return #FLIGHTGROUP self
|
||||||
|
function FLIGHTGROUP:SetOptionLandingOverheadBreak()
|
||||||
|
self.OptionLandingOverheadBreak = true
|
||||||
|
if self:GetGroup():IsAlive() then
|
||||||
|
self:GetGroup():SetOptionLandingOverheadBreak()
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- [HELICOPTER] Set the aircraft to prefer takeoff and landing vertically.
|
||||||
|
-- @param #FLIGHTGROUP self
|
||||||
|
-- @return #FLIGHTGROUP self
|
||||||
|
function FLIGHTGROUP:SetOptionPreferVertical()
|
||||||
|
self.OptionPreferVertical = true
|
||||||
|
if self:GetGroup():IsAlive() then
|
||||||
|
self:GetGroup():OptionPreferVerticalLanding()
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Set if group is ready for taxi/takeoff if controlled by a `FLIGHTCONTROL`.
|
--- Set if group is ready for taxi/takeoff if controlled by a `FLIGHTCONTROL`.
|
||||||
-- @param #FLIGHTGROUP self
|
-- @param #FLIGHTGROUP self
|
||||||
-- @param #boolean ReadyTO If `true`, flight is ready for takeoff.
|
-- @param #boolean ReadyTO If `true`, flight is ready for takeoff.
|
||||||
@@ -2003,6 +2058,9 @@ function FLIGHTGROUP:onafterElementAirborne(From, Event, To, Element)
|
|||||||
-- Debug info.
|
-- Debug info.
|
||||||
self:T2(self.lid..string.format("Element airborne %s", Element.name))
|
self:T2(self.lid..string.format("Element airborne %s", Element.name))
|
||||||
|
|
||||||
|
-- Set parking spot to free. Also for FC. This is usually done after taxiing but doing it here in case the group is teleported.
|
||||||
|
self:_SetElementParkingFree(Element)
|
||||||
|
|
||||||
-- Set element status.
|
-- Set element status.
|
||||||
self:_UpdateStatus(Element, OPSGROUP.ElementStatus.AIRBORNE)
|
self:_UpdateStatus(Element, OPSGROUP.ElementStatus.AIRBORNE)
|
||||||
|
|
||||||
@@ -3076,7 +3134,7 @@ function FLIGHTGROUP:onbeforeLandAtAirbase(From, Event, To, airbase)
|
|||||||
local Tsuspend=nil
|
local Tsuspend=nil
|
||||||
|
|
||||||
if airbase==nil then
|
if airbase==nil then
|
||||||
self:T(self.lid.."ERROR: Airbase is nil in LandAtAirase() call!")
|
self:T(self.lid.."ERROR: Airbase is nil in LandAtAirbase() call!")
|
||||||
allowed=false
|
allowed=false
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -4494,6 +4552,11 @@ function FLIGHTGROUP:GetParkingSpot(element, maxdist, airbase)
|
|||||||
-- Airbase.
|
-- Airbase.
|
||||||
airbase=airbase or self:GetClosestAirbase()
|
airbase=airbase or self:GetClosestAirbase()
|
||||||
|
|
||||||
|
if airbase == nil then
|
||||||
|
self:T(self.lid.."No airbase found for element "..element.name)
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
-- Parking table of airbase.
|
-- Parking table of airbase.
|
||||||
local parking=airbase.parking --:GetParkingSpotsTable()
|
local parking=airbase.parking --:GetParkingSpotsTable()
|
||||||
|
|
||||||
|
|||||||
@@ -2324,7 +2324,7 @@ INTEL_DLINK = {
|
|||||||
verbose = 0,
|
verbose = 0,
|
||||||
lid = nil,
|
lid = nil,
|
||||||
alias = nil,
|
alias = nil,
|
||||||
cachetime = 300,
|
cachetime = 120,
|
||||||
interval = 20,
|
interval = 20,
|
||||||
contacts = {},
|
contacts = {},
|
||||||
clusters = {},
|
clusters = {},
|
||||||
@@ -2333,7 +2333,7 @@ INTEL_DLINK = {
|
|||||||
|
|
||||||
--- Version string
|
--- Version string
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
INTEL_DLINK.version = "0.0.1"
|
INTEL_DLINK.version = "0.0.2"
|
||||||
|
|
||||||
--- Function to instantiate a new object
|
--- Function to instantiate a new object
|
||||||
-- @param #INTEL_DLINK self
|
-- @param #INTEL_DLINK self
|
||||||
@@ -2384,15 +2384,15 @@ function INTEL_DLINK:New(Intels, Alias, Interval, Cachetime)
|
|||||||
self.alias="SPECTRE"
|
self.alias="SPECTRE"
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Cache time
|
|
||||||
self.cachetime = Cachetime or 300
|
|
||||||
|
|
||||||
-- Interval
|
-- Interval
|
||||||
self.interval = Interval or 20
|
self.interval = Interval or 20
|
||||||
|
|
||||||
-- Set some string id for output to DCS.log file.
|
-- Set some string id for output to DCS.log file.
|
||||||
self.lid=string.format("INTEL_DLINK %s | ", self.alias)
|
self.lid=string.format("INTEL_DLINK %s | ", self.alias)
|
||||||
|
|
||||||
|
-- Cache time
|
||||||
|
self:SetDLinkCacheTime(Cachetime or 120)
|
||||||
|
|
||||||
-- Start State.
|
-- Start State.
|
||||||
self:SetStartState("Stopped")
|
self:SetStartState("Stopped")
|
||||||
|
|
||||||
@@ -2477,6 +2477,16 @@ function INTEL_DLINK:onafterStart(From, Event, To)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Function to set how long INTEL DLINK remembers contacts.
|
||||||
|
-- @param #INTEL_DLINK self
|
||||||
|
-- @param #number seconds Remember this many seconds. Defaults to 180.
|
||||||
|
-- @return #INTEL_DLINK self
|
||||||
|
function INTEL_DLINK:SetDLinkCacheTime(seconds)
|
||||||
|
self.cachetime = math.abs(seconds or 120)
|
||||||
|
self:I(self.lid.."Caching for "..self.cachetime.." seconds.")
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Function to collect data from the various #INTEL
|
--- Function to collect data from the various #INTEL
|
||||||
-- @param #INTEL_DLINK self
|
-- @param #INTEL_DLINK self
|
||||||
-- @param #string From The From state
|
-- @param #string From The From state
|
||||||
|
|||||||
@@ -2514,7 +2514,10 @@ function LEGION._GetCohorts(Legions, Cohorts, Operation, OpsQueue)
|
|||||||
local legion=_legion --Ops.Legion#LEGION
|
local legion=_legion --Ops.Legion#LEGION
|
||||||
|
|
||||||
-- Check that runway is operational.
|
-- Check that runway is operational.
|
||||||
local Runway=legion:IsAirwing() and legion:IsRunwayOperational() or true
|
local Runway=true
|
||||||
|
if legion:IsAirwing() then
|
||||||
|
Runway=legion:IsRunwayOperational() and legion.airbase and legion.airbase:GetCoalition() == legion:GetCoalition()
|
||||||
|
end
|
||||||
|
|
||||||
-- Legion has to be running.
|
-- Legion has to be running.
|
||||||
if legion:IsRunning() and Runway then
|
if legion:IsRunning() and Runway then
|
||||||
|
|||||||
@@ -5589,10 +5589,13 @@ function OPSGROUP:onafterUnpauseMission(From, Event, To)
|
|||||||
-- Debug info.
|
-- Debug info.
|
||||||
self:T(self.lid..string.format("Unpausing mission %s [%s]", mission:GetName(), mission:GetType()))
|
self:T(self.lid..string.format("Unpausing mission %s [%s]", mission:GetName(), mission:GetType()))
|
||||||
|
|
||||||
|
-- Set state of mission, e.g. for not teleporting again
|
||||||
|
mission.unpaused=true
|
||||||
|
|
||||||
-- Start mission.
|
-- Start mission.
|
||||||
self:MissionStart(mission)
|
self:MissionStart(mission)
|
||||||
|
|
||||||
-- Remove mission from
|
-- Remove mission from pausedmissions queue
|
||||||
for i,mid in pairs(self.pausedmissions) do
|
for i,mid in pairs(self.pausedmissions) do
|
||||||
--self:T(self.lid..string.format("Checking paused mission", mid))
|
--self:T(self.lid..string.format("Checking paused mission", mid))
|
||||||
if mid==mission.auftragsnummer then
|
if mid==mission.auftragsnummer then
|
||||||
@@ -6232,7 +6235,7 @@ function OPSGROUP:RouteToMission(mission, delay)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Check if group is mobile. Note that some immobile units report a speed of 1 m/s = 3.6 km/h.
|
-- Check if group is mobile. Note that some immobile units report a speed of 1 m/s = 3.6 km/h.
|
||||||
if self.speedMax<=3.6 or mission.teleport then
|
if (self.speedMax<=3.6 or mission.teleport) and not mission.unpaused then
|
||||||
|
|
||||||
-- Teleport to waypoint coordinate. Mission will not be paused.
|
-- Teleport to waypoint coordinate. Mission will not be paused.
|
||||||
self:Teleport(waypointcoord, nil, true)
|
self:Teleport(waypointcoord, nil, true)
|
||||||
|
|||||||
@@ -53,6 +53,7 @@
|
|||||||
-- @field #number threatlevelCapture Threat level necessary to capture a zone.
|
-- @field #number threatlevelCapture Threat level necessary to capture a zone.
|
||||||
-- @field Core.Set#SET_UNIT ScanUnitSet Set of scanned units.
|
-- @field Core.Set#SET_UNIT ScanUnitSet Set of scanned units.
|
||||||
-- @field Core.Set#SET_GROUP ScanGroupSet Set of scanned groups.
|
-- @field Core.Set#SET_GROUP ScanGroupSet Set of scanned groups.
|
||||||
|
-- @field #number UpdateSeconds Run status every this many seconds.
|
||||||
-- @extends Core.Fsm#FSM
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
--- *Gentlemen, when the enemy is committed to a mistake we must not interrupt him too soon.* --- Horation Nelson
|
--- *Gentlemen, when the enemy is committed to a mistake we must not interrupt him too soon.* --- Horation Nelson
|
||||||
@@ -77,6 +78,7 @@ OPSZONE = {
|
|||||||
Tnut = 0,
|
Tnut = 0,
|
||||||
chiefs = {},
|
chiefs = {},
|
||||||
Missions = {},
|
Missions = {},
|
||||||
|
UpdateSeconds = 120,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- OPSZONE.MISSION
|
--- OPSZONE.MISSION
|
||||||
@@ -97,7 +99,7 @@ OPSZONE.ZoneType={
|
|||||||
|
|
||||||
--- OPSZONE class version.
|
--- OPSZONE class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
OPSZONE.version="0.6.1"
|
OPSZONE.version="0.6.2"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- ToDo list
|
-- ToDo list
|
||||||
@@ -733,7 +735,8 @@ function OPSZONE:onafterStart(From, Event, To)
|
|||||||
self.timerStatus=self.timerStatus or TIMER:New(OPSZONE.Status, self)
|
self.timerStatus=self.timerStatus or TIMER:New(OPSZONE.Status, self)
|
||||||
|
|
||||||
-- Status update.
|
-- Status update.
|
||||||
self.timerStatus:Start(1, 120)
|
local EveryUpdateIn = self.UpdateSeconds or 120
|
||||||
|
self.timerStatus:Start(1, EveryUpdateIn)
|
||||||
|
|
||||||
-- Handle base captured event.
|
-- Handle base captured event.
|
||||||
if self.airbase then
|
if self.airbase then
|
||||||
|
|||||||
@@ -1544,7 +1544,7 @@ end
|
|||||||
-- @param #PLAYERRECCE self
|
-- @param #PLAYERRECCE self
|
||||||
-- @param #number Frequency Frequency to be used. Can also be given as a table of multiple frequencies, e.g. 271 or {127,251}. There needs to be exactly the same number of modulations!
|
-- @param #number Frequency Frequency to be used. Can also be given as a table of multiple frequencies, e.g. 271 or {127,251}. There needs to be exactly the same number of modulations!
|
||||||
-- @param #number Modulation Modulation to be used. Can also be given as a table of multiple modulations, e.g. radio.modulation.AM or {radio.modulation.FM,radio.modulation.AM}. There needs to be exactly the same number of frequencies!
|
-- @param #number Modulation Modulation to be used. Can also be given as a table of multiple modulations, e.g. radio.modulation.AM or {radio.modulation.FM,radio.modulation.AM}. There needs to be exactly the same number of frequencies!
|
||||||
-- @param #string PathToSRS Defaults to "C:\\Program Files\\DCS-SimpleRadio-Standalone"
|
-- @param #string PathToSRS Defaults to "C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio"
|
||||||
-- @param #string Gender (Optional) Defaults to "male"
|
-- @param #string Gender (Optional) Defaults to "male"
|
||||||
-- @param #string Culture (Optional) Defaults to "en-US"
|
-- @param #string Culture (Optional) Defaults to "en-US"
|
||||||
-- @param #number Port (Optional) Defaults to 5002
|
-- @param #number Port (Optional) Defaults to 5002
|
||||||
@@ -1556,7 +1556,7 @@ end
|
|||||||
-- @return #PLAYERRECCE self
|
-- @return #PLAYERRECCE self
|
||||||
function PLAYERRECCE:SetSRS(Frequency,Modulation,PathToSRS,Gender,Culture,Port,Voice,Volume,PathToGoogleKey,Backend)
|
function PLAYERRECCE:SetSRS(Frequency,Modulation,PathToSRS,Gender,Culture,Port,Voice,Volume,PathToGoogleKey,Backend)
|
||||||
self:T(self.lid.."SetSRS")
|
self:T(self.lid.."SetSRS")
|
||||||
self.PathToSRS = PathToSRS or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone" --
|
self.PathToSRS = PathToSRS or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio" --
|
||||||
self.Gender = Gender or MSRS.gender or "male" --
|
self.Gender = Gender or MSRS.gender or "male" --
|
||||||
self.Culture = Culture or MSRS.culture or "en-US" --
|
self.Culture = Culture or MSRS.culture or "en-US" --
|
||||||
self.Port = Port or MSRS.port or 5002 --
|
self.Port = Port or MSRS.port or 5002 --
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
-- ===
|
-- ===
|
||||||
-- @module Ops.PlayerTask
|
-- @module Ops.PlayerTask
|
||||||
-- @image OPS_PlayerTask.jpg
|
-- @image OPS_PlayerTask.jpg
|
||||||
-- @date Last Update Jan 2025
|
-- @date Last Update May 2025
|
||||||
|
|
||||||
|
|
||||||
do
|
do
|
||||||
@@ -98,7 +98,7 @@ PLAYERTASK = {
|
|||||||
|
|
||||||
--- PLAYERTASK class version.
|
--- PLAYERTASK class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
PLAYERTASK.version="0.1.25"
|
PLAYERTASK.version="0.1.27"
|
||||||
|
|
||||||
--- Generic task condition.
|
--- Generic task condition.
|
||||||
-- @type PLAYERTASK.Condition
|
-- @type PLAYERTASK.Condition
|
||||||
@@ -556,6 +556,7 @@ end
|
|||||||
-- @param #PLAYERTASK self
|
-- @param #PLAYERTASK self
|
||||||
-- @param #SET_BASE CaptureSquadGroupNamePrefix The prefix of the group name that needs to capture the zone.
|
-- @param #SET_BASE CaptureSquadGroupNamePrefix The prefix of the group name that needs to capture the zone.
|
||||||
-- @param #number Coalition The coalition that needs to capture the zone.
|
-- @param #number Coalition The coalition that needs to capture the zone.
|
||||||
|
-- @param #boolean CheckClientInZone If true, a CLIENT assigned to this task also needs to be in the zone for the task to be successful.
|
||||||
-- @return #PLAYERTASK self
|
-- @return #PLAYERTASK self
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- We can use either STATIC, SET_STATIC, SCENERY or SET_SCENERY as target objects.
|
-- -- We can use either STATIC, SET_STATIC, SCENERY or SET_SCENERY as target objects.
|
||||||
@@ -570,20 +571,20 @@ end
|
|||||||
--
|
--
|
||||||
-- -- We set CaptureSquadGroupNamePrefix the group name prefix as set in the ME or the spawn of the group that need to be present at the OpsZone like a capture squad,
|
-- -- We set CaptureSquadGroupNamePrefix the group name prefix as set in the ME or the spawn of the group that need to be present at the OpsZone like a capture squad,
|
||||||
-- -- and set the capturing Coalition in order to trigger a successful task.
|
-- -- and set the capturing Coalition in order to trigger a successful task.
|
||||||
-- mytask:AddOpsZoneCaptureSuccessCondition("capture-squad", coalition.side.BLUE)
|
-- mytask:AddOpsZoneCaptureSuccessCondition("capture-squad", coalition.side.BLUE, false)
|
||||||
--
|
--
|
||||||
-- playerTaskManager:AddPlayerTaskToQueue(mytask)
|
-- playerTaskManager:AddPlayerTaskToQueue(mytask)
|
||||||
function PLAYERTASK:AddOpsZoneCaptureSuccessCondition(CaptureSquadGroupNamePrefix, Coalition)
|
function PLAYERTASK:AddOpsZoneCaptureSuccessCondition(CaptureSquadGroupNamePrefix, Coalition, CheckClientInZone)
|
||||||
local task = self
|
local task = self
|
||||||
task:AddConditionSuccess(
|
task:AddConditionSuccess(
|
||||||
function(target)
|
function(target)
|
||||||
if target:IsInstanceOf("OPSZONE") then
|
if target:IsInstanceOf("OPSZONE") then
|
||||||
return task:_CheckCaptureOpsZoneSuccess(target, CaptureSquadGroupNamePrefix, Coalition, true)
|
return task:_CheckCaptureOpsZoneSuccess(target, CaptureSquadGroupNamePrefix, Coalition, CheckClientInZone or true)
|
||||||
elseif target:IsInstanceOf("SET_OPSZONE") then
|
elseif target:IsInstanceOf("SET_OPSZONE") then
|
||||||
local successes = 0
|
local successes = 0
|
||||||
local isClientInZone = false
|
local isClientInZone = false
|
||||||
target:ForEachZone(function(opszone)
|
target:ForEachZone(function(opszone)
|
||||||
if task:_CheckCaptureOpsZoneSuccess(opszone, CaptureSquadGroupNamePrefix, Coalition) then
|
if task:_CheckCaptureOpsZoneSuccess(opszone, CaptureSquadGroupNamePrefix, Coalition, CheckClientInZone or true) then
|
||||||
successes = successes + 1
|
successes = successes + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -979,6 +980,12 @@ function PLAYERTASK:onafterStatus(From, Event, To)
|
|||||||
|
|
||||||
if status == "Stopped" then return self end
|
if status == "Stopped" then return self end
|
||||||
|
|
||||||
|
-- update marker in case target is moving
|
||||||
|
if self.TargetMarker then
|
||||||
|
local coordinate = self.Target:GetCoordinate()
|
||||||
|
self.TargetMarker:UpdateCoordinate(coordinate,0.5)
|
||||||
|
end
|
||||||
|
|
||||||
-- Check Target status
|
-- Check Target status
|
||||||
local targetdead = false
|
local targetdead = false
|
||||||
|
|
||||||
@@ -1433,9 +1440,9 @@ do
|
|||||||
-- taskmanager:AddRejectZone(ZONE:FindByName("RejectZone"))
|
-- taskmanager:AddRejectZone(ZONE:FindByName("RejectZone"))
|
||||||
--
|
--
|
||||||
-- -- Set up using SRS for messaging
|
-- -- Set up using SRS for messaging
|
||||||
-- local hereSRSPath = "C:\\Program Files\\DCS-SimpleRadio-Standalone"
|
-- local hereSRSPath = "C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio"
|
||||||
-- local hereSRSPort = 5002
|
-- local hereSRSPort = 5002
|
||||||
-- -- local hereSRSGoogle = "C:\\Program Files\\DCS-SimpleRadio-Standalone\\yourkey.json"
|
-- -- local hereSRSGoogle = "C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio\\yourkey.json"
|
||||||
-- taskmanager:SetSRS({130,255},{radio.modulation.AM,radio.modulation.AM},hereSRSPath,"female","en-GB",hereSRSPort,"Microsoft Hazel Desktop",0.7,hereSRSGoogle)
|
-- taskmanager:SetSRS({130,255},{radio.modulation.AM,radio.modulation.AM},hereSRSPath,"female","en-GB",hereSRSPort,"Microsoft Hazel Desktop",0.7,hereSRSGoogle)
|
||||||
--
|
--
|
||||||
-- -- Controller will announce itself under these broadcast frequencies, handy to use cold-start frequencies here of your aircraft
|
-- -- Controller will announce itself under these broadcast frequencies, handy to use cold-start frequencies here of your aircraft
|
||||||
@@ -1902,7 +1909,7 @@ PLAYERTASKCONTROLLER.Messages = {
|
|||||||
|
|
||||||
--- PLAYERTASK class version.
|
--- PLAYERTASK class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
PLAYERTASKCONTROLLER.version="0.1.69"
|
PLAYERTASKCONTROLLER.version="0.1.70"
|
||||||
|
|
||||||
--- Create and run a new TASKCONTROLLER instance.
|
--- Create and run a new TASKCONTROLLER instance.
|
||||||
-- @param #PLAYERTASKCONTROLLER self
|
-- @param #PLAYERTASKCONTROLLER self
|
||||||
@@ -1944,7 +1951,7 @@ function PLAYERTASKCONTROLLER:New(Name, Coalition, Type, ClientFilter)
|
|||||||
self.taskinfomenu = false
|
self.taskinfomenu = false
|
||||||
self.activehasinfomenu = false
|
self.activehasinfomenu = false
|
||||||
self.MenuName = nil
|
self.MenuName = nil
|
||||||
self.menuitemlimit = 5
|
self.menuitemlimit = 6
|
||||||
self.holdmenutime = 30
|
self.holdmenutime = 30
|
||||||
|
|
||||||
self.MarkerReadOnly = false
|
self.MarkerReadOnly = false
|
||||||
@@ -2415,7 +2422,7 @@ function PLAYERTASKCONTROLLER:EnablePrecisionBombing(FlightGroup,LaserCode,Holdi
|
|||||||
end
|
end
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
self:E(self.lid.."No FLIGHTGROUP object passed or FLIGHTGROUP is not alive!")
|
self:E(self.lid.."No OPSGROUP/SET_OPSGROUP object passed or object is not alive!")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
self.autolase = nil
|
self.autolase = nil
|
||||||
@@ -2574,7 +2581,7 @@ function PLAYERTASKCONTROLLER:SetMenuOptions(InfoMenu,ItemLimit,HoldTime)
|
|||||||
if self.activehasinfomenu then
|
if self.activehasinfomenu then
|
||||||
self:EnableTaskInfoMenu()
|
self:EnableTaskInfoMenu()
|
||||||
end
|
end
|
||||||
self.menuitemlimit = ItemLimit or 5
|
self.menuitemlimit = ItemLimit+1 or 6
|
||||||
self.holdmenutime = HoldTime or 30
|
self.holdmenutime = HoldTime or 30
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -3479,7 +3486,7 @@ end
|
|||||||
-- @param #PLAYERTASKCONTROLLER self
|
-- @param #PLAYERTASKCONTROLLER self
|
||||||
-- @param Ops.PlayerTask#PLAYERTASK PlayerTask
|
-- @param Ops.PlayerTask#PLAYERTASK PlayerTask
|
||||||
-- @param #boolean Silent If true, make no "has new task" announcement
|
-- @param #boolean Silent If true, make no "has new task" announcement
|
||||||
-- @param #boolen TaskFilter If true, apply the white/black-list task filters here, also
|
-- @param #boolean TaskFilter If true, apply the white/black-list task filters here, also
|
||||||
-- @return #PLAYERTASKCONTROLLER self
|
-- @return #PLAYERTASKCONTROLLER self
|
||||||
-- @usage
|
-- @usage
|
||||||
-- Example to create a PLAYERTASK of type CTLD and give Players 10 minutes to complete:
|
-- Example to create a PLAYERTASK of type CTLD and give Players 10 minutes to complete:
|
||||||
@@ -3703,6 +3710,7 @@ function PLAYERTASKCONTROLLER:_ActiveTaskInfo(Task, Group, Client)
|
|||||||
else
|
else
|
||||||
CoordText = Coordinate:ToStringA2A(Client,nil,self.ShowMagnetic)
|
CoordText = Coordinate:ToStringA2A(Client,nil,self.ShowMagnetic)
|
||||||
end
|
end
|
||||||
|
--self:I("CoordText = "..CoordText)
|
||||||
-- Threat Level
|
-- Threat Level
|
||||||
local ThreatLevel = task.Target:GetThreatLevelMax()
|
local ThreatLevel = task.Target:GetThreatLevelMax()
|
||||||
--local ThreatLevelText = "high"
|
--local ThreatLevelText = "high"
|
||||||
@@ -3837,7 +3845,8 @@ function PLAYERTASKCONTROLLER:_ActiveTaskInfo(Task, Group, Client)
|
|||||||
Text = string.gsub(Text,"9","niner")
|
Text = string.gsub(Text,"9","niner")
|
||||||
CoordText = "MGRS;"..Text
|
CoordText = "MGRS;"..Text
|
||||||
if self.PathToGoogleKey then
|
if self.PathToGoogleKey then
|
||||||
CoordText = string.format("<say-as interpret-as='characters'>%s</say-as>",CoordText)
|
--CoordText = string.format("<say-as interpret-as=\'characters\'>%s</say-as>",CoordText)
|
||||||
|
--doesn't seem to work any longer
|
||||||
end
|
end
|
||||||
--self:I(self.lid.." | ".. CoordText)
|
--self:I(self.lid.." | ".. CoordText)
|
||||||
end
|
end
|
||||||
@@ -3855,10 +3864,12 @@ function PLAYERTASKCONTROLLER:_ActiveTaskInfo(Task, Group, Client)
|
|||||||
CoordText = string.gsub(ttstext," BR, "," Bee, Arr, ")
|
CoordText = string.gsub(ttstext," BR, "," Bee, Arr, ")
|
||||||
end
|
end
|
||||||
elseif task:HasFreetext() then
|
elseif task:HasFreetext() then
|
||||||
|
|
||||||
-- add tts freetext
|
-- add tts freetext
|
||||||
local brieftxt = self.gettext:GetEntry("BRIEFING",self.locale)
|
local brieftxt = self.gettext:GetEntry("BRIEFING",self.locale)
|
||||||
ttstext = ttstext .. string.format("; %s: ",brieftxt)..task:GetFreetextTTS()
|
ttstext = ttstext .. string.format("; %s: ",brieftxt)..task:GetFreetextTTS()
|
||||||
end
|
end
|
||||||
|
--self:I("**** TTS Text ****\n"..ttstext.."\n*****")
|
||||||
self.SRSQueue:NewTransmission(ttstext,nil,self.SRS,nil,2)
|
self.SRSQueue:NewTransmission(ttstext,nil,self.SRS,nil,2)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -4357,7 +4368,7 @@ function PLAYERTASKCONTROLLER:SwitchDetectStatics(OnOff)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- [User] Add accept zone to INTEL detection. You need to set up detection with @{#PLAYERTASKCONTROLLER.SetupIntel}() **before** using this.
|
--- [User] Add an accept zone to INTEL detection. You need to set up detection with @{#PLAYERTASKCONTROLLER.SetupIntel}() **before** using this.
|
||||||
-- @param #PLAYERTASKCONTROLLER self
|
-- @param #PLAYERTASKCONTROLLER self
|
||||||
-- @param Core.Zone#ZONE AcceptZone Add a zone to the accept zone set.
|
-- @param Core.Zone#ZONE AcceptZone Add a zone to the accept zone set.
|
||||||
-- @return #PLAYERTASKCONTROLLER self
|
-- @return #PLAYERTASKCONTROLLER self
|
||||||
@@ -4371,7 +4382,7 @@ function PLAYERTASKCONTROLLER:AddAcceptZone(AcceptZone)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- [User] Add accept SET_ZONE to INTEL detection. You need to set up detection with @{#PLAYERTASKCONTROLLER.SetupIntel}() **before** using this.
|
--- [User] Add an accept SET_ZONE to INTEL detection. You need to set up detection with @{#PLAYERTASKCONTROLLER.SetupIntel}() **before** using this.
|
||||||
-- @param #PLAYERTASKCONTROLLER self
|
-- @param #PLAYERTASKCONTROLLER self
|
||||||
-- @param Core.Set#SET_ZONE AcceptZoneSet Add a SET_ZONE to the accept zone set.
|
-- @param Core.Set#SET_ZONE AcceptZoneSet Add a SET_ZONE to the accept zone set.
|
||||||
-- @return #PLAYERTASKCONTROLLER self
|
-- @return #PLAYERTASKCONTROLLER self
|
||||||
@@ -4385,7 +4396,7 @@ function PLAYERTASKCONTROLLER:AddAcceptZoneSet(AcceptZoneSet)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- [User] Add reject zone to INTEL detection. You need to set up detection with @{#PLAYERTASKCONTROLLER.SetupIntel}() **before** using this.
|
--- [User] Add a reject zone to INTEL detection. You need to set up detection with @{#PLAYERTASKCONTROLLER.SetupIntel}() **before** using this.
|
||||||
-- @param #PLAYERTASKCONTROLLER self
|
-- @param #PLAYERTASKCONTROLLER self
|
||||||
-- @param Core.Zone#ZONE RejectZone Add a zone to the reject zone set.
|
-- @param Core.Zone#ZONE RejectZone Add a zone to the reject zone set.
|
||||||
-- @return #PLAYERTASKCONTROLLER self
|
-- @return #PLAYERTASKCONTROLLER self
|
||||||
@@ -4399,7 +4410,7 @@ function PLAYERTASKCONTROLLER:AddRejectZone(RejectZone)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- [User] Add reject SET_ZONE to INTEL detection. You need to set up detection with @{#PLAYERTASKCONTROLLER.SetupIntel}() **before** using this.
|
--- [User] Add a reject SET_ZONE to INTEL detection. You need to set up detection with @{#PLAYERTASKCONTROLLER.SetupIntel}() **before** using this.
|
||||||
-- @param #PLAYERTASKCONTROLLER self
|
-- @param #PLAYERTASKCONTROLLER self
|
||||||
-- @param Core.Set#SET_ZONE RejectZoneSet Add a zone to the reject zone set.
|
-- @param Core.Set#SET_ZONE RejectZoneSet Add a zone to the reject zone set.
|
||||||
-- @return #PLAYERTASKCONTROLLER self
|
-- @return #PLAYERTASKCONTROLLER self
|
||||||
@@ -4413,9 +4424,37 @@ function PLAYERTASKCONTROLLER:AddRejectZoneSet(RejectZoneSet)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- [User] Remove accept zone from INTEL detection. You need to set up detection with @{#PLAYERTASKCONTROLLER.SetupIntel}() **before** using this.
|
--- [User] Add a conflict zone to INTEL detection. You need to set up detection with @{#PLAYERTASKCONTROLLER.SetupIntel}() **before** using this.
|
||||||
-- @param #PLAYERTASKCONTROLLER self
|
-- @param #PLAYERTASKCONTROLLER self
|
||||||
-- @param Core.Zone#ZONE AcceptZone Add a zone to the accept zone set.
|
-- @param Core.Zone#ZONE ConflictZone Add a zone to the conflict zone set.
|
||||||
|
-- @return #PLAYERTASKCONTROLLER self
|
||||||
|
function PLAYERTASKCONTROLLER:AddConflictZone(ConflictZone)
|
||||||
|
self:T(self.lid.."AddConflictZone")
|
||||||
|
if self.Intel then
|
||||||
|
self.Intel:AddConflictZone(ConflictZone)
|
||||||
|
else
|
||||||
|
self:E(self.lid.."*****NO detection has been set up (yet)!")
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- [User] Add a conflict SET_ZONE to INTEL detection. You need to set up detection with @{#PLAYERTASKCONTROLLER.SetupIntel}() **before** using this.
|
||||||
|
-- @param #PLAYERTASKCONTROLLER self
|
||||||
|
-- @param Core.Set#SET_ZONE ConflictZoneSet Add a zone to the conflict zone set.
|
||||||
|
-- @return #PLAYERTASKCONTROLLER self
|
||||||
|
function PLAYERTASKCONTROLLER:AddConflictZoneSet(ConflictZoneSet)
|
||||||
|
self:T(self.lid.."AddConflictZoneSet")
|
||||||
|
if self.Intel then
|
||||||
|
self.Intel.conflictzoneset:AddSet(ConflictZoneSet)
|
||||||
|
else
|
||||||
|
self:E(self.lid.."*****NO detection has been set up (yet)!")
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- [User] Remove an accept zone from INTEL detection. You need to set up detection with @{#PLAYERTASKCONTROLLER.SetupIntel}() **before** using this.
|
||||||
|
-- @param #PLAYERTASKCONTROLLER self
|
||||||
|
-- @param Core.Zone#ZONE AcceptZone Remove this zone from the accept zone set.
|
||||||
-- @return #PLAYERTASKCONTROLLER self
|
-- @return #PLAYERTASKCONTROLLER self
|
||||||
function PLAYERTASKCONTROLLER:RemoveAcceptZone(AcceptZone)
|
function PLAYERTASKCONTROLLER:RemoveAcceptZone(AcceptZone)
|
||||||
self:T(self.lid.."RemoveAcceptZone")
|
self:T(self.lid.."RemoveAcceptZone")
|
||||||
@@ -4427,11 +4466,11 @@ function PLAYERTASKCONTROLLER:RemoveAcceptZone(AcceptZone)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- [User] Remove reject zone from INTEL detection. You need to set up detection with @{#PLAYERTASKCONTROLLER.SetupIntel}() **before** using this.
|
--- [User] Remove a reject zone from INTEL detection. You need to set up detection with @{#PLAYERTASKCONTROLLER.SetupIntel}() **before** using this.
|
||||||
-- @param #PLAYERTASKCONTROLLER self
|
-- @param #PLAYERTASKCONTROLLER self
|
||||||
-- @param Core.Zone#ZONE RejectZone Add a zone to the reject zone set.
|
-- @param Core.Zone#ZONE RejectZone Remove this zone from the reject zone set.
|
||||||
-- @return #PLAYERTASKCONTROLLER self
|
-- @return #PLAYERTASKCONTROLLER self
|
||||||
function PLAYERTASKCONTROLLER:RemoveRejectZoneSet(RejectZone)
|
function PLAYERTASKCONTROLLER:RemoveRejectZone(RejectZone)
|
||||||
self:T(self.lid.."RemoveRejectZone")
|
self:T(self.lid.."RemoveRejectZone")
|
||||||
if self.Intel then
|
if self.Intel then
|
||||||
self.Intel:RemoveRejectZone(RejectZone)
|
self.Intel:RemoveRejectZone(RejectZone)
|
||||||
@@ -4441,6 +4480,20 @@ function PLAYERTASKCONTROLLER:RemoveRejectZoneSet(RejectZone)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- [User] Remove a conflict zone from INTEL detection. You need to set up detection with @{#PLAYERTASKCONTROLLER.SetupIntel}() **before** using this.
|
||||||
|
-- @param #PLAYERTASKCONTROLLER self
|
||||||
|
-- @param Core.Zone#ZONE ConflictZone Remove this zone from the conflict zone set.
|
||||||
|
-- @return #PLAYERTASKCONTROLLER self
|
||||||
|
function PLAYERTASKCONTROLLER:RemoveConflictZone(ConflictZone)
|
||||||
|
self:T(self.lid.."RemoveConflictZone")
|
||||||
|
if self.Intel then
|
||||||
|
self.Intel:RemoveConflictZone(ConflictZone)
|
||||||
|
else
|
||||||
|
self:E(self.lid.."*****NO detection has been set up (yet)!")
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- [User] Set the top menu name to a custom string.
|
--- [User] Set the top menu name to a custom string.
|
||||||
-- @param #PLAYERTASKCONTROLLER self
|
-- @param #PLAYERTASKCONTROLLER self
|
||||||
-- @param #string Name The name to use as the top menu designation.
|
-- @param #string Name The name to use as the top menu designation.
|
||||||
@@ -4553,7 +4606,7 @@ end
|
|||||||
-- @param #PLAYERTASKCONTROLLER self
|
-- @param #PLAYERTASKCONTROLLER self
|
||||||
-- @param #number Frequency Frequency to be used. Can also be given as a table of multiple frequencies, e.g. 271 or {127,251}. There needs to be exactly the same number of modulations!
|
-- @param #number Frequency Frequency to be used. Can also be given as a table of multiple frequencies, e.g. 271 or {127,251}. There needs to be exactly the same number of modulations!
|
||||||
-- @param #number Modulation Modulation to be used. Can also be given as a table of multiple modulations, e.g. radio.modulation.AM or {radio.modulation.FM,radio.modulation.AM}. There needs to be exactly the same number of frequencies!
|
-- @param #number Modulation Modulation to be used. Can also be given as a table of multiple modulations, e.g. radio.modulation.AM or {radio.modulation.FM,radio.modulation.AM}. There needs to be exactly the same number of frequencies!
|
||||||
-- @param #string PathToSRS Defaults to "C:\\Program Files\\DCS-SimpleRadio-Standalone"
|
-- @param #string PathToSRS Defaults to "C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio"
|
||||||
-- @param #string Gender (Optional) Defaults to "male"
|
-- @param #string Gender (Optional) Defaults to "male"
|
||||||
-- @param #string Culture (Optional) Defaults to "en-US"
|
-- @param #string Culture (Optional) Defaults to "en-US"
|
||||||
-- @param #number Port (Optional) Defaults to 5002
|
-- @param #number Port (Optional) Defaults to 5002
|
||||||
@@ -4567,7 +4620,7 @@ end
|
|||||||
-- @return #PLAYERTASKCONTROLLER self
|
-- @return #PLAYERTASKCONTROLLER self
|
||||||
function PLAYERTASKCONTROLLER:SetSRS(Frequency,Modulation,PathToSRS,Gender,Culture,Port,Voice,Volume,PathToGoogleKey,AccessKey,Coordinate,Backend)
|
function PLAYERTASKCONTROLLER:SetSRS(Frequency,Modulation,PathToSRS,Gender,Culture,Port,Voice,Volume,PathToGoogleKey,AccessKey,Coordinate,Backend)
|
||||||
self:T(self.lid.."SetSRS")
|
self:T(self.lid.."SetSRS")
|
||||||
self.PathToSRS = PathToSRS or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone" --
|
self.PathToSRS = PathToSRS or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio" --
|
||||||
self.Gender = Gender or MSRS.gender or "male" --
|
self.Gender = Gender or MSRS.gender or "male" --
|
||||||
self.Culture = Culture or MSRS.culture or "en-US" --
|
self.Culture = Culture or MSRS.culture or "en-US" --
|
||||||
self.Port = Port or MSRS.port or 5002 --
|
self.Port = Port or MSRS.port or 5002 --
|
||||||
|
|||||||
@@ -1715,6 +1715,26 @@ function TARGET:GetAverageCoordinate()
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Get coordinates of all targets. (e.g. for a SET_STATIC)
|
||||||
|
-- @param #TARGET self
|
||||||
|
-- @return #table Table with coordinates of all targets.
|
||||||
|
function TARGET:GetCoordinates()
|
||||||
|
local coordinates={}
|
||||||
|
|
||||||
|
for _,_target in pairs(self.targets) do
|
||||||
|
local target=_target --#TARGET.Object
|
||||||
|
|
||||||
|
local coordinate=self:GetTargetCoordinate(target)
|
||||||
|
if coordinate then
|
||||||
|
table.insert(coordinates, coordinate)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
return coordinates
|
||||||
|
end
|
||||||
|
|
||||||
--- Get heading of target.
|
--- Get heading of target.
|
||||||
-- @param #TARGET self
|
-- @param #TARGET self
|
||||||
-- @return #number Heading of the target in degrees.
|
-- @return #number Heading of the target in degrees.
|
||||||
@@ -1968,6 +1988,21 @@ function TARGET:GetObject(RefCoordinate, Coalitions)
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Get all target objects.
|
||||||
|
-- @param #TARGET self
|
||||||
|
-- @return #table List of target objects.
|
||||||
|
function TARGET:GetObjects()
|
||||||
|
local objects={}
|
||||||
|
|
||||||
|
for _,_target in pairs(self.targets) do
|
||||||
|
local target=_target --#TARGET.Object
|
||||||
|
|
||||||
|
table.insert(objects, target.Object)
|
||||||
|
end
|
||||||
|
|
||||||
|
return objects
|
||||||
|
end
|
||||||
|
|
||||||
--- Count alive objects.
|
--- Count alive objects.
|
||||||
-- @param #TARGET self
|
-- @param #TARGET self
|
||||||
-- @param #TARGET.Object Target Target objective.
|
-- @param #TARGET.Object Target Target objective.
|
||||||
|
|||||||
@@ -513,7 +513,7 @@ MSRS.Voices = {
|
|||||||
["en_GB_Wavenet_F"] = 'en-GB-Wavenet-N', -- [13] FEMALE
|
["en_GB_Wavenet_F"] = 'en-GB-Wavenet-N', -- [13] FEMALE
|
||||||
["en_GB_Wavenet_O"] = 'en-GB-Wavenet-O', -- [12] MALE
|
["en_GB_Wavenet_O"] = 'en-GB-Wavenet-O', -- [12] MALE
|
||||||
["en_GB_Wavenet_N"] = 'en-GB-Wavenet-N', -- [13] FEMALE
|
["en_GB_Wavenet_N"] = 'en-GB-Wavenet-N', -- [13] FEMALE
|
||||||
["en_US_Wavenet_A"] = 'en-US-Wavenet-N', -- [14] MALE
|
["en_US_Wavenet_A"] = 'en-US-Wavenet-A', -- [14] MALE
|
||||||
["en_US_Wavenet_B"] = 'en-US-Wavenet-B', -- [15] MALE
|
["en_US_Wavenet_B"] = 'en-US-Wavenet-B', -- [15] MALE
|
||||||
["en_US_Wavenet_C"] = 'en-US-Wavenet-C', -- [16] FEMALE
|
["en_US_Wavenet_C"] = 'en-US-Wavenet-C', -- [16] FEMALE
|
||||||
["en_US_Wavenet_D"] = 'en-US-Wavenet-D', -- [17] MALE
|
["en_US_Wavenet_D"] = 'en-US-Wavenet-D', -- [17] MALE
|
||||||
@@ -632,7 +632,7 @@ end
|
|||||||
-- set the path to the exe file via @{#MSRS.SetPath}.
|
-- set the path to the exe file via @{#MSRS.SetPath}.
|
||||||
--
|
--
|
||||||
-- @param #MSRS self
|
-- @param #MSRS self
|
||||||
-- @param #string Path Path to SRS directory. Default `C:\\Program Files\\DCS-SimpleRadio-Standalone`.
|
-- @param #string Path Path to SRS directory. Default `C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio`.
|
||||||
-- @param #number Frequency Radio frequency in MHz. Default 143.00 MHz. Can also be given as a #table of multiple frequencies.
|
-- @param #number Frequency Radio frequency in MHz. Default 143.00 MHz. Can also be given as a #table of multiple frequencies.
|
||||||
-- @param #number Modulation Radio modulation: 0=AM (default), 1=FM. See `radio.modulation.AM` and `radio.modulation.FM` enumerators. Can also be given as a #table of multiple modulations.
|
-- @param #number Modulation Radio modulation: 0=AM (default), 1=FM. See `radio.modulation.AM` and `radio.modulation.FM` enumerators. Can also be given as a #table of multiple modulations.
|
||||||
-- @param #string Backend Backend used: `MSRS.Backend.SRSEXE` (default) or `MSRS.Backend.GRPC`.
|
-- @param #string Backend Backend used: `MSRS.Backend.SRSEXE` (default) or `MSRS.Backend.GRPC`.
|
||||||
@@ -767,13 +767,13 @@ end
|
|||||||
|
|
||||||
--- Set path to SRS install directory. More precisely, path to where the `DCS-SR-ExternalAudio.exe` is located.
|
--- Set path to SRS install directory. More precisely, path to where the `DCS-SR-ExternalAudio.exe` is located.
|
||||||
-- @param #MSRS self
|
-- @param #MSRS self
|
||||||
-- @param #string Path Path to the directory, where the sound file is located. Default is `C:\\Program Files\\DCS-SimpleRadio-Standalone`.
|
-- @param #string Path Path to the directory, where the sound file is located. Default is `C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio`.
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:SetPath(Path)
|
function MSRS:SetPath(Path)
|
||||||
self:F( {Path=Path} )
|
self:F( {Path=Path} )
|
||||||
|
|
||||||
-- Set path.
|
-- Set path.
|
||||||
self.path=Path or "C:\\Program Files\\DCS-SimpleRadio-Standalone"
|
self.path=Path or "C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio"
|
||||||
|
|
||||||
-- Remove (back)slashes.
|
-- Remove (back)slashes.
|
||||||
local n=1 ; local nmax=1000
|
local n=1 ; local nmax=1000
|
||||||
@@ -1817,7 +1817,7 @@ end
|
|||||||
--
|
--
|
||||||
-- -- Moose MSRS default Config
|
-- -- Moose MSRS default Config
|
||||||
-- MSRS_Config = {
|
-- MSRS_Config = {
|
||||||
-- Path = "C:\\Program Files\\DCS-SimpleRadio-Standalone", -- Path to SRS install directory.
|
-- Path = "C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio", -- Path to SRS install directory.
|
||||||
-- Port = 5002, -- Port of SRS server. Default 5002.
|
-- Port = 5002, -- Port of SRS server. Default 5002.
|
||||||
-- Backend = "srsexe", -- Interface to SRS: "srsexe" or "grpc".
|
-- Backend = "srsexe", -- Interface to SRS: "srsexe" or "grpc".
|
||||||
-- Frequency = {127, 243}, -- Default frequences. Must be a table 1..n entries!
|
-- Frequency = {127, 243}, -- Default frequences. Must be a table 1..n entries!
|
||||||
@@ -1837,7 +1837,7 @@ end
|
|||||||
-- -- Google Cloud
|
-- -- Google Cloud
|
||||||
-- gcloud = {
|
-- gcloud = {
|
||||||
-- voice = "en-GB-Standard-A", -- The Google Cloud voice to use (see https://cloud.google.com/text-to-speech/docs/voices).
|
-- voice = "en-GB-Standard-A", -- The Google Cloud voice to use (see https://cloud.google.com/text-to-speech/docs/voices).
|
||||||
-- credentials="C:\\Program Files\\DCS-SimpleRadio-Standalone\\yourfilename.json", -- Full path to credentials JSON file (only for SRS-TTS.exe backend)
|
-- credentials="C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio\\yourfilename.json", -- Full path to credentials JSON file (only for SRS-TTS.exe backend)
|
||||||
-- key="Your access Key", -- Google API access key (only for DCS-gRPC backend)
|
-- key="Your access Key", -- Google API access key (only for DCS-gRPC backend)
|
||||||
-- },
|
-- },
|
||||||
-- -- Amazon Web Service
|
-- -- Amazon Web Service
|
||||||
@@ -1905,7 +1905,7 @@ function MSRS:LoadConfigFile(Path,Filename)
|
|||||||
|
|
||||||
local Self = self or MSRS --#MSRS
|
local Self = self or MSRS --#MSRS
|
||||||
|
|
||||||
Self.path = MSRS_Config.Path or "C:\\Program Files\\DCS-SimpleRadio-Standalone"
|
Self.path = MSRS_Config.Path or "C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio"
|
||||||
Self.port = MSRS_Config.Port or 5002
|
Self.port = MSRS_Config.Port or 5002
|
||||||
Self.backend = MSRS_Config.Backend or MSRS.Backend.SRSEXE
|
Self.backend = MSRS_Config.Backend or MSRS.Backend.SRSEXE
|
||||||
Self.frequencies = MSRS_Config.Frequency or {127,243}
|
Self.frequencies = MSRS_Config.Frequency or {127,243}
|
||||||
|
|||||||
@@ -30,6 +30,8 @@
|
|||||||
|
|
||||||
--- Governs multiple missions, the tasking and the reporting.
|
--- Governs multiple missions, the tasking and the reporting.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- Command centers govern missions, communicates the task assignments between human players of the coalition, and manages the menu flow.
|
-- Command centers govern missions, communicates the task assignments between human players of the coalition, and manages the menu flow.
|
||||||
-- It can assign a random task to a player when requested.
|
-- It can assign a random task to a player when requested.
|
||||||
-- The commandcenter provides the facilitites to communicate between human players online, executing a task.
|
-- The commandcenter provides the facilitites to communicate between human players online, executing a task.
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
-- The @{#DETECTION_MANAGER} class defines the core functions to report detected objects to groups.
|
-- The @{#DETECTION_MANAGER} class defines the core functions to report detected objects to groups.
|
||||||
-- Reportings can be done in several manners, and it is up to the derived classes if DETECTION_MANAGER to model the reporting behaviour.
|
-- Reportings can be done in several manners, and it is up to the derived classes if DETECTION_MANAGER to model the reporting behaviour.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- 1.1) DETECTION_MANAGER constructor:
|
-- 1.1) DETECTION_MANAGER constructor:
|
||||||
-- -----------------------------------
|
-- -----------------------------------
|
||||||
-- * @{#DETECTION_MANAGER.New}(): Create a new DETECTION_MANAGER instance.
|
-- * @{#DETECTION_MANAGER.New}(): Create a new DETECTION_MANAGER instance.
|
||||||
|
|||||||
@@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
--- Models goals to be achieved and can contain multiple tasks to be executed to achieve the goals.
|
--- Models goals to be achieved and can contain multiple tasks to be executed to achieve the goals.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- A mission contains multiple tasks and can be of different task types.
|
-- A mission contains multiple tasks and can be of different task types.
|
||||||
-- These tasks need to be assigned to human players to be executed.
|
-- These tasks need to be assigned to human players to be executed.
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- # 1) Tasking from a player perspective.
|
-- # 1) Tasking from a player perspective.
|
||||||
--
|
--
|
||||||
-- Tasking can be controlled by using the "other" menu in the radio menu of the player group.
|
-- Tasking can be controlled by using the "other" menu in the radio menu of the player group.
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
---
|
---
|
||||||
-- # TASKINFO class, extends @{Core.Base#BASE}
|
-- # TASKINFO class, extends @{Core.Base#BASE}
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- ## The TASKINFO class implements the methods to contain information and display information of a task.
|
-- ## The TASKINFO class implements the methods to contain information and display information of a task.
|
||||||
--
|
--
|
||||||
-- # Developer Note
|
-- # Developer Note
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ do -- TASK_A2A
|
|||||||
|
|
||||||
--- Defines Air To Air tasks for a @{Core.Set} of Target Units,
|
--- Defines Air To Air tasks for a @{Core.Set} of Target Units,
|
||||||
-- based on the tasking capabilities defined in @{Tasking.Task#TASK}.
|
-- based on the tasking capabilities defined in @{Tasking.Task#TASK}.
|
||||||
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- The TASK_A2A is implemented using a @{Core.Fsm#FSM_TASK}, and has the following statuses:
|
-- The TASK_A2A is implemented using a @{Core.Fsm#FSM_TASK}, and has the following statuses:
|
||||||
--
|
--
|
||||||
-- * **None**: Start of the process
|
-- * **None**: Start of the process
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ do -- TASK_A2A_DISPATCHER
|
|||||||
|
|
||||||
--- Orchestrates the dynamic dispatching of tasks upon groups of detected units determined a @{Core.Set} of EWR installation groups.
|
--- Orchestrates the dynamic dispatching of tasks upon groups of detected units determined a @{Core.Set} of EWR installation groups.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- 
|
-- 
|
||||||
--
|
--
|
||||||
-- The EWR will detect units, will group them, and will dispatch @{Tasking.Task}s to groups. Depending on the type of target detected, different tasks will be dispatched.
|
-- The EWR will detect units, will group them, and will dispatch @{Tasking.Task}s to groups. Depending on the type of target detected, different tasks will be dispatched.
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ do -- TASK_A2G
|
|||||||
|
|
||||||
--- The TASK_A2G class defines Air To Ground tasks for a @{Core.Set} of Target Units,
|
--- The TASK_A2G class defines Air To Ground tasks for a @{Core.Set} of Target Units,
|
||||||
-- based on the tasking capabilities defined in @{Tasking.Task#TASK}.
|
-- based on the tasking capabilities defined in @{Tasking.Task#TASK}.
|
||||||
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- The TASK_A2G is implemented using a @{Core.Fsm#FSM_TASK}, and has the following statuses:
|
-- The TASK_A2G is implemented using a @{Core.Fsm#FSM_TASK}, and has the following statuses:
|
||||||
--
|
--
|
||||||
-- * **None**: Start of the process
|
-- * **None**: Start of the process
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ do -- TASK_A2G_DISPATCHER
|
|||||||
|
|
||||||
--- Orchestrates dynamic **A2G Task Dispatching** based on the detection results of a linked @{Functional.Detection} object.
|
--- Orchestrates dynamic **A2G Task Dispatching** based on the detection results of a linked @{Functional.Detection} object.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- It uses the Tasking System within the MOOSE framework, which is a multi-player Tasking Orchestration system.
|
-- It uses the Tasking System within the MOOSE framework, which is a multi-player Tasking Orchestration system.
|
||||||
-- It provides a truly dynamic battle environment for pilots and ground commanders to engage upon,
|
-- It provides a truly dynamic battle environment for pilots and ground commanders to engage upon,
|
||||||
-- in a true co-operation environment wherein **Multiple Teams** will collaborate in Missions to **achieve a common Mission Goal**.
|
-- in a true co-operation environment wherein **Multiple Teams** will collaborate in Missions to **achieve a common Mission Goal**.
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- ## Test Missions:
|
-- ## Test Missions:
|
||||||
--
|
--
|
||||||
-- Test missions can be located on the main GITHUB site.
|
-- Test missions can be located on the main GITHUB site.
|
||||||
@@ -1176,7 +1178,7 @@ do -- TASK_CARGO
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
---@param Color Might be SMOKECOLOR.Blue, SMOKECOLOR.Red SMOKECOLOR.Orange, SMOKECOLOR.White or SMOKECOLOR.Green
|
--@param Color Might be SMOKECOLOR.Blue, SMOKECOLOR.Red SMOKECOLOR.Orange, SMOKECOLOR.White or SMOKECOLOR.Green
|
||||||
function TASK_CARGO:SetSmokeColor(SmokeColor)
|
function TASK_CARGO:SetSmokeColor(SmokeColor)
|
||||||
-- Makes sure Coloe is set
|
-- Makes sure Coloe is set
|
||||||
if SmokeColor == nil then
|
if SmokeColor == nil then
|
||||||
|
|||||||
@@ -76,6 +76,8 @@ do -- TASK_CAPTURE_DISPATCHER
|
|||||||
|
|
||||||
--- Implements the dynamic dispatching of capture zone tasks.
|
--- Implements the dynamic dispatching of capture zone tasks.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- The **TASK_CAPTURE_DISPATCHER** allows you to setup various tasks for let human
|
-- The **TASK_CAPTURE_DISPATCHER** allows you to setup various tasks for let human
|
||||||
-- players capture zones in a co-operation effort.
|
-- players capture zones in a co-operation effort.
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ do -- TASK_ZONE_GOAL
|
|||||||
|
|
||||||
--- # TASK_ZONE_GOAL class, extends @{Tasking.Task#TASK}
|
--- # TASK_ZONE_GOAL class, extends @{Tasking.Task#TASK}
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- The TASK_ZONE_GOAL class defines the task to protect or capture a protection zone.
|
-- The TASK_ZONE_GOAL class defines the task to protect or capture a protection zone.
|
||||||
-- The TASK_ZONE_GOAL is implemented using a @{Core.Fsm#FSM_TASK}, and has the following statuses:
|
-- The TASK_ZONE_GOAL is implemented using a @{Core.Fsm#FSM_TASK}, and has the following statuses:
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -44,6 +44,8 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- Please read through the @{Tasking.Task_CARGO} process to understand the mechanisms of tasking and cargo tasking and handling.
|
-- Please read through the @{Tasking.Task_CARGO} process to understand the mechanisms of tasking and cargo tasking and handling.
|
||||||
--
|
--
|
||||||
-- The cargo will be a downed pilot, which is located somwhere on the battlefield. Use the menus system and facilities to
|
-- The cargo will be a downed pilot, which is located somwhere on the battlefield. Use the menus system and facilities to
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
-- The **TASK_CARGO_DISPATCHER** allows you to setup various tasks for let human
|
-- The **TASK_CARGO_DISPATCHER** allows you to setup various tasks for let human
|
||||||
-- players transport cargo as part of a task.
|
-- players transport cargo as part of a task.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- The cargo dispatcher will implement for you mechanisms to create cargo transportation tasks:
|
-- The cargo dispatcher will implement for you mechanisms to create cargo transportation tasks:
|
||||||
--
|
--
|
||||||
-- * As setup by the mission designer.
|
-- * As setup by the mission designer.
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
--- **Tasking** - Models tasks for players to transport cargo.
|
--- **Tasking** - Models tasks for players to transport cargo.
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- **Specific features:**
|
-- **Specific features:**
|
||||||
--
|
--
|
||||||
-- * Creates a task to transport #Cargo.Cargo to and between deployment zones.
|
-- * Creates a task to transport #Cargo.Cargo to and between deployment zones.
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
-- 1) @{Tasking.Task_Manager#TASK_MANAGER} class, extends @{Core.Fsm#FSM}
|
-- 1) @{Tasking.Task_Manager#TASK_MANAGER} class, extends @{Core.Fsm#FSM}
|
||||||
-- ===
|
-- ===
|
||||||
-- The @{Tasking.Task_Manager#TASK_MANAGER} class defines the core functions to report tasks to groups.
|
-- The @{Tasking.Task_Manager#TASK_MANAGER} class defines the core functions to report tasks to groups.
|
||||||
|
|||||||
@@ -12,27 +12,35 @@
|
|||||||
-- @module Utilities.Utils
|
-- @module Utilities.Utils
|
||||||
-- @image MOOSE.JPG
|
-- @image MOOSE.JPG
|
||||||
|
|
||||||
---
|
--- Smoke color enum `trigger.smokeColor`.
|
||||||
-- @type SMOKECOLOR
|
-- @type SMOKECOLOR
|
||||||
-- @field Green
|
-- @field #number Green Green smoke (0)
|
||||||
-- @field Red
|
-- @field #number Red Red smoke (1)
|
||||||
-- @field White
|
-- @field #number White White smoke (2)
|
||||||
-- @field Orange
|
-- @field #number Orange Orange smoke (3)
|
||||||
-- @field Blue
|
-- @field #number Blue Blue smoke (4)
|
||||||
|
|
||||||
SMOKECOLOR = trigger.smokeColor -- #SMOKECOLOR
|
SMOKECOLOR = trigger.smokeColor -- #SMOKECOLOR
|
||||||
|
|
||||||
---
|
--- Flare colur enum `trigger.flareColor`.
|
||||||
-- @type FLARECOLOR
|
-- @type FLARECOLOR
|
||||||
-- @field Green
|
-- @field #number Green (0)
|
||||||
-- @field Red
|
-- @field #number Red Red flare (1)
|
||||||
-- @field White
|
-- @field #number White White flare (2)
|
||||||
-- @field Yellow
|
-- @field #number Yellow Yellow flare (3)
|
||||||
|
|
||||||
FLARECOLOR = trigger.flareColor -- #FLARECOLOR
|
FLARECOLOR = trigger.flareColor -- #FLARECOLOR
|
||||||
|
|
||||||
--- Big smoke preset enum.
|
--- Big smoke preset enum.
|
||||||
-- @type BIGSMOKEPRESET
|
-- @type BIGSMOKEPRESET
|
||||||
|
-- @field #number SmallSmokeAndFire Small moke and fire (1)
|
||||||
|
-- @field #number MediumSmokeAndFire Medium smoke and fire (2)
|
||||||
|
-- @field #number LargeSmokeAndFire Large smoke and fire (3)
|
||||||
|
-- @field #number HugeSmokeAndFire Huge smoke and fire (4)
|
||||||
|
-- @field #number SmallSmoke Small smoke (5)
|
||||||
|
-- @field #number MediumSmoke Medium smoke (6)
|
||||||
|
-- @field #number LargeSmoke Large smoke (7)
|
||||||
|
-- @field #number HugeSmoke Huge smoke (8)
|
||||||
BIGSMOKEPRESET = {
|
BIGSMOKEPRESET = {
|
||||||
SmallSmokeAndFire=1,
|
SmallSmokeAndFire=1,
|
||||||
MediumSmokeAndFire=2,
|
MediumSmokeAndFire=2,
|
||||||
@@ -351,7 +359,7 @@ end
|
|||||||
-- @return #string Table as a string.
|
-- @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
|
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 )
|
local function _Serialize( tbl )
|
||||||
|
|
||||||
@@ -490,7 +498,7 @@ end
|
|||||||
|
|
||||||
--- Counts the number of elements in a table.
|
--- Counts the number of elements in a table.
|
||||||
-- @param #table T Table to count
|
-- @param #table T Table to count
|
||||||
-- @return #int Number of elements in the table
|
-- @return #number Number of elements in the table
|
||||||
function UTILS.TableLength(T)
|
function UTILS.TableLength(T)
|
||||||
local count = 0
|
local count = 0
|
||||||
for _ in pairs(T or {}) do count = count + 1 end
|
for _ in pairs(T or {}) do count = count + 1 end
|
||||||
@@ -1906,6 +1914,13 @@ function UTILS.GetReportingName(Typename)
|
|||||||
|
|
||||||
local typename = string.lower(Typename)
|
local typename = string.lower(Typename)
|
||||||
|
|
||||||
|
-- special cases - Shark and Manstay have "A-50" in the name
|
||||||
|
if string.find(typename,"ka-50",1,true) then
|
||||||
|
return "Shark"
|
||||||
|
elseif string.find(typename,"a-50",1,true) then
|
||||||
|
return "Mainstay"
|
||||||
|
end
|
||||||
|
|
||||||
for name, value in pairs(ENUMS.ReportingName.NATO) do
|
for name, value in pairs(ENUMS.ReportingName.NATO) do
|
||||||
local svalue = string.lower(value)
|
local svalue = string.lower(value)
|
||||||
if string.find(typename,svalue,1,true) then
|
if string.find(typename,svalue,1,true) then
|
||||||
@@ -2137,9 +2152,9 @@ function UTILS.GetSunRiseAndSet(DayOfYear, Latitude, Longitude, Rising, Tlocal)
|
|||||||
local cosH = (cos(zenith) - (sinDec * sin(latitude))) / (cosDec * cos(latitude))
|
local cosH = (cos(zenith) - (sinDec * sin(latitude))) / (cosDec * cos(latitude))
|
||||||
|
|
||||||
if rising and cosH > 1 then
|
if rising and cosH > 1 then
|
||||||
return "N/S" -- The sun never rises on this location on the specified date
|
return "N/R" -- The sun never rises on this location on the specified date
|
||||||
elseif cosH < -1 then
|
elseif cosH < -1 then
|
||||||
return "N/R" -- The sun never sets on this location on the specified date
|
return "N/S" -- The sun never sets on this location on the specified date
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Finish calculating H and convert into hours
|
-- Finish calculating H and convert into hours
|
||||||
@@ -4128,9 +4143,14 @@ end
|
|||||||
-- @param #string VehicleTemplate, template name for additional vehicles. Can be nil for no additional vehicles.
|
-- @param #string VehicleTemplate, template name for additional vehicles. Can be nil for no additional vehicles.
|
||||||
-- @param #number Liquids Tons of fuel to be added initially to the FARP. Defaults to 10 (tons). Set to 0 for no fill.
|
-- @param #number Liquids Tons of fuel to be added initially to the FARP. Defaults to 10 (tons). Set to 0 for no fill.
|
||||||
-- @param #number Equipment Number of equipment items per known item to be added initially to the FARP. Defaults to 10 (items). Set to 0 for no fill.
|
-- @param #number Equipment Number of equipment items per known item to be added initially to the FARP. Defaults to 10 (items). Set to 0 for no fill.
|
||||||
|
-- @param #number Airframes Number of helicopter airframes per known type in Ops.CSAR#CSAR.AircraftType to be added initially to the FARP. Set to 0 for no airframes.
|
||||||
|
-- @param #string F10Text Text to display on F10 map if given. Handy to post things like the ADF beacon Frequency, Callsign and ATC Frequency.
|
||||||
|
-- @param #boolean DynamicSpawns If true, allow Dynamic Spawns from this FARP.
|
||||||
|
-- @param #boolean HotStart If true and DynamicSpawns is true, allow hot starts for Dynamic Spawns from this FARP.
|
||||||
-- @return #list<Wrapper.Static#STATIC> Table of spawned objects and vehicle object (if given).
|
-- @return #list<Wrapper.Static#STATIC> Table of spawned objects and vehicle object (if given).
|
||||||
-- @return #string ADFBeaconName Name of the ADF beacon, to be able to remove/stop it later.
|
-- @return #string ADFBeaconName Name of the ADF beacon, to be able to remove/stop it later.
|
||||||
function UTILS.SpawnFARPAndFunctionalStatics(Name,Coordinate,FARPType,Coalition,Country,CallSign,Frequency,Modulation,ADF,SpawnRadius,VehicleTemplate,Liquids,Equipment)
|
-- @return #number MarkerID ID of the F10 Text, to be able to remove it later.
|
||||||
|
function UTILS.SpawnFARPAndFunctionalStatics(Name,Coordinate,FARPType,Coalition,Country,CallSign,Frequency,Modulation,ADF,SpawnRadius,VehicleTemplate,Liquids,Equipment,Airframes,F10Text,DynamicSpawns,HotStart)
|
||||||
|
|
||||||
-- Set Defaults
|
-- Set Defaults
|
||||||
local farplocation = Coordinate
|
local farplocation = Coordinate
|
||||||
@@ -4144,6 +4164,7 @@ function UTILS.SpawnFARPAndFunctionalStatics(Name,Coordinate,FARPType,Coalition,
|
|||||||
local liquids = Liquids or 10
|
local liquids = Liquids or 10
|
||||||
liquids = liquids * 1000 -- tons to kg
|
liquids = liquids * 1000 -- tons to kg
|
||||||
local equip = Equipment or 10
|
local equip = Equipment or 10
|
||||||
|
local airframes = Airframes or 10
|
||||||
local statictypes = ENUMS.FARPObjectTypeNamesAndShape[farptype] or {TypeName="FARP", ShapeName="FARPS"}
|
local statictypes = ENUMS.FARPObjectTypeNamesAndShape[farptype] or {TypeName="FARP", ShapeName="FARPS"}
|
||||||
local STypeName = statictypes.TypeName
|
local STypeName = statictypes.TypeName
|
||||||
local SShapeName = statictypes.ShapeName
|
local SShapeName = statictypes.ShapeName
|
||||||
@@ -4153,7 +4174,7 @@ function UTILS.SpawnFARPAndFunctionalStatics(Name,Coordinate,FARPType,Coalition,
|
|||||||
-- Spawn FARP
|
-- Spawn FARP
|
||||||
local newfarp = SPAWNSTATIC:NewFromType(STypeName,"Heliports",Country) -- "Invisible FARP" "FARP"
|
local newfarp = SPAWNSTATIC:NewFromType(STypeName,"Heliports",Country) -- "Invisible FARP" "FARP"
|
||||||
newfarp:InitShape(SShapeName) -- "invisiblefarp" "FARPS"
|
newfarp:InitShape(SShapeName) -- "invisiblefarp" "FARPS"
|
||||||
newfarp:InitFARP(callsign,freq,mod)
|
newfarp:InitFARP(callsign,freq,mod,DynamicSpawns,HotStart)
|
||||||
local spawnedfarp = newfarp:SpawnFromCoordinate(farplocation,0,Name)
|
local spawnedfarp = newfarp:SpawnFromCoordinate(farplocation,0,Name)
|
||||||
table.insert(ReturnObjects,spawnedfarp)
|
table.insert(ReturnObjects,spawnedfarp)
|
||||||
-- Spawn Objects
|
-- Spawn Objects
|
||||||
@@ -4206,6 +4227,12 @@ function UTILS.SpawnFARPAndFunctionalStatics(Name,Coordinate,FARPType,Coalition,
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if airframes and airframes > 0 then
|
||||||
|
for typename in pairs (CSAR.AircraftType) do
|
||||||
|
newWH:SetItem(typename,airframes)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local ADFName
|
local ADFName
|
||||||
if ADF and type(ADF) == "number" then
|
if ADF and type(ADF) == "number" then
|
||||||
local ADFFreq = ADF*1000 -- KHz to Hz
|
local ADFFreq = ADF*1000 -- KHz to Hz
|
||||||
@@ -4216,7 +4243,150 @@ function UTILS.SpawnFARPAndFunctionalStatics(Name,Coordinate,FARPType,Coalition,
|
|||||||
trigger.action.radioTransmission(Sound, vec3, 0, true, ADFFreq, 250, ADFName)
|
trigger.action.radioTransmission(Sound, vec3, 0, true, ADFFreq, 250, ADFName)
|
||||||
end
|
end
|
||||||
|
|
||||||
return ReturnObjects, ADFName
|
local MarkerID = nil
|
||||||
|
if F10Text then
|
||||||
|
local Color = {0,0,1}
|
||||||
|
if Coalition == coalition.side.RED then
|
||||||
|
Color = {1,0,0}
|
||||||
|
elseif Coalition == coalition.side.NEUTRAL then
|
||||||
|
Color = {0,1,0}
|
||||||
|
end
|
||||||
|
local Alpha = 0.75
|
||||||
|
local coordinate = Coordinate:Translate(600,0)
|
||||||
|
MarkerID = coordinate:TextToAll(F10Text,Coalition,Color,1,{1,1,1},Alpha,14,true)
|
||||||
|
end
|
||||||
|
|
||||||
|
return ReturnObjects, ADFName, MarkerID
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Spawn a MASH at a given coordinate, optionally, add an ADF Beacon.
|
||||||
|
-- @param #string Name Unique Name of the Mash.
|
||||||
|
-- @param Core.Point#COORDINATE Coordinate Coordinate where to spawn the MASH. Can be given as a Core.Zone#ZONE object, in this case we take the center coordinate.
|
||||||
|
-- @param #number Country Country ID the MASH belongs to, e.g. country.id.USA or country.id.RUSSIA.
|
||||||
|
-- @param #number ADF (Optional) ADF Frequency in kHz (Kilohertz), if given activate an ADF Beacon at the location of the MASH.
|
||||||
|
-- @param #string Livery (Optional) The livery of the static CH-47, defaults to dark green.
|
||||||
|
-- @param #boolean DeployHelo (Optional) If true, deploy the helicopter static.
|
||||||
|
-- @param #number MASHRadio MASH Radio Frequency, defaults to 127.5.
|
||||||
|
-- @param #number MASHRadioModulation MASH Radio Modulation, defaults to radio.modulation.AM.
|
||||||
|
-- @param #number MASHCallsign Defaults to CALLSIGN.FARP.Berlin.
|
||||||
|
-- @param #table Templates (Optional) You can hand in your own template table of numbered(!) entries. Each entry consist of a relative(!) x,y position and data of a
|
||||||
|
-- static, shape_name is optional. Also, livery_id is optional, but is applied to the helicopter static only.
|
||||||
|
-- @return #table Table of Wrapper.Static#STATIC objects that were spawned.
|
||||||
|
-- @return #string ADFName Name of the ADF Beacon to remove it later.
|
||||||
|
-- @usage
|
||||||
|
-- -- MASH Template example, this one is the built in one used in the function:
|
||||||
|
-- MASHTemplates = {
|
||||||
|
-- [1]={category='Infantry',type='Soldier M4',shape_name='none',heading=0,x=0.000000,y=0.000000,},
|
||||||
|
-- [2]={category='Infantry',type='Soldier M4',shape_name='none',heading=0,x=0.313533,y=8.778935,},
|
||||||
|
-- [3]={category='Infantry',type='Soldier M4',shape_name='none',heading=0,x=16.303737,y=20.379671,},
|
||||||
|
-- [4]={category='Helicopters',type='CH-47Fbl1',shape_name='none',heading=0,x=-20.047735,y=-63.166179,livery_id = "us army dark green",},
|
||||||
|
-- [5]={category='Infantry',type='Soldier M4',shape_name='none',heading=0,x=26.650339,y=20.066138,},
|
||||||
|
-- [6]={category='Heliports',type='FARP_SINGLE_01',shape_name='FARP_SINGLE_01',heading=0,x=-25.432292,y=9.077099,},
|
||||||
|
-- [7]={category='Heliports',type='FARP_SINGLE_01',shape_name='FARP_SINGLE_01',heading=0,x=-12.717421,y=-3.216114,},
|
||||||
|
-- [8]={category='Heliports',type='FARP_SINGLE_01',shape_name='FARP_SINGLE_01',heading=0,x=-25.439281,y=-3.216114,},
|
||||||
|
-- [9]={category='Heliports',type='FARP_SINGLE_01',shape_name='FARP_SINGLE_01',heading=0,x=-12.717421,y=9.155603,},
|
||||||
|
-- [10]={category='Fortifications',type='TACAN_beacon',shape_name='none',heading=0,x=-2.329847,y=-16.579903,},
|
||||||
|
-- [11]={category='Fortifications',type='FARP Fuel Depot',shape_name='GSM Rus',heading=0,x=2.222011,y=4.487030,},
|
||||||
|
-- [12]={category='Fortifications',type='APFC fuel',shape_name='M92_APFCfuel',heading=0,x=3.614927,y=0.367838,},
|
||||||
|
-- [13]={category='Fortifications',type='Camouflage03',shape_name='M92_Camouflage03',heading=0,x=21.544148,y=21.998879,},
|
||||||
|
-- [14]={category='Fortifications',type='Container_generator',shape_name='M92_Container_generator',heading=0,x=20.989192,y=37.314334,},
|
||||||
|
-- [15]={category='Fortifications',type='FireExtinguisher02',shape_name='M92_FireExtinguisher02',heading=0,x=3.988003,y=8.362333,},
|
||||||
|
-- [16]={category='Fortifications',type='FireExtinguisher02',shape_name='M92_FireExtinguisher02',heading=0,x=-3.953195,y=12.945844,},
|
||||||
|
-- [17]={category='Fortifications',type='Windsock',shape_name='H-Windsock_RW',heading=0,x=-18.944173,y=-33.042196,},
|
||||||
|
-- [18]={category='Fortifications',type='Tent04',shape_name='M92_Tent04',heading=0,x=21.220671,y=30.247529,},
|
||||||
|
-- }
|
||||||
|
--
|
||||||
|
function UTILS.SpawnMASHStatics(Name,Coordinate,Country,ADF,Livery,DeployHelo,MASHRadio,MASHRadioModulation,MASHCallsign,Templates)
|
||||||
|
|
||||||
|
-- Basic objects table
|
||||||
|
|
||||||
|
local MASHTemplates = {
|
||||||
|
[1]={category='Infantry',type='Soldier M4',shape_name='none',heading=0,x=0.000000,y=0.000000,},
|
||||||
|
[2]={category='Infantry',type='Soldier M4',shape_name='none',heading=0,x=0.313533,y=8.778935,},
|
||||||
|
[3]={category='Infantry',type='Soldier M4',shape_name='none',heading=0,x=16.303737,y=20.379671,},
|
||||||
|
[4]={category='Helicopters',type='CH-47Fbl1',shape_name='none',heading=0,x=-20.047735,y=-63.166179,livery_id = "us army dark green",},
|
||||||
|
[5]={category='Infantry',type='Soldier M4',shape_name='none',heading=0,x=26.650339,y=20.066138,},
|
||||||
|
[6]={category='Heliports',type='FARP_SINGLE_01',shape_name='FARP_SINGLE_01',heading=0,x=-25.432292,y=9.077099,},
|
||||||
|
[7]={category='Heliports',type='FARP_SINGLE_01',shape_name='FARP_SINGLE_01',heading=0,x=-12.717421,y=-3.216114,},
|
||||||
|
[8]={category='Heliports',type='FARP_SINGLE_01',shape_name='FARP_SINGLE_01',heading=0,x=-25.439281,y=-3.216114,},
|
||||||
|
[9]={category='Heliports',type='FARP_SINGLE_01',shape_name='FARP_SINGLE_01',heading=0,x=-12.717421,y=9.155603,},
|
||||||
|
[10]={category='Fortifications',type='TACAN_beacon',shape_name='none',heading=0,x=-2.329847,y=-16.579903,},
|
||||||
|
[11]={category='Fortifications',type='FARP Fuel Depot',shape_name='GSM Rus',heading=0,x=2.222011,y=4.487030,},
|
||||||
|
[12]={category='Fortifications',type='APFC fuel',shape_name='M92_APFCfuel',heading=0,x=3.614927,y=0.367838,},
|
||||||
|
[13]={category='Fortifications',type='Camouflage03',shape_name='M92_Camouflage03',heading=0,x=21.544148,y=21.998879,},
|
||||||
|
[14]={category='Fortifications',type='Container_generator',shape_name='M92_Container_generator',heading=0,x=20.989192,y=37.314334,},
|
||||||
|
[15]={category='Fortifications',type='FireExtinguisher02',shape_name='M92_FireExtinguisher02',heading=0,x=3.988003,y=8.362333,},
|
||||||
|
[16]={category='Fortifications',type='FireExtinguisher02',shape_name='M92_FireExtinguisher02',heading=0,x=-3.953195,y=12.945844,},
|
||||||
|
[17]={category='Fortifications',type='Windsock',shape_name='H-Windsock_RW',heading=0,x=-18.944173,y=-33.042196,},
|
||||||
|
[18]={category='Fortifications',type='Tent04',shape_name='M92_Tent04',heading=0,x=21.220671,y=30.247529,},
|
||||||
|
}
|
||||||
|
|
||||||
|
if Templates then MASHTemplates=Templates end
|
||||||
|
|
||||||
|
-- locals
|
||||||
|
local name = Name or "Florence Nightingale"
|
||||||
|
local positionVec2
|
||||||
|
local positionVec3
|
||||||
|
local ReturnStatics = {}
|
||||||
|
local CountryID = Country or country.id.USA
|
||||||
|
local livery = "us army dark green"
|
||||||
|
local MASHRadio = MASHRadio or 127.5
|
||||||
|
local MASHRadioModulation = MASHRadioModulation or radio.modulation.AM
|
||||||
|
local MASHCallsign = MASHCallsign or CALLSIGN.FARP.Berlin
|
||||||
|
|
||||||
|
-- check for coordinate or zone
|
||||||
|
if type(Coordinate) == "table" then
|
||||||
|
if Coordinate:IsInstanceOf("COORDINATE") or Coordinate:IsInstanceOf("ZONE_BASE") then
|
||||||
|
positionVec2 = Coordinate:GetVec2()
|
||||||
|
positionVec3 = Coordinate:GetVec3()
|
||||||
|
end
|
||||||
|
else
|
||||||
|
BASE:E("Spawn MASH - no ZONE or COORDINATE handed!")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- position
|
||||||
|
local BaseX = positionVec2.x
|
||||||
|
local BaseY = positionVec2.y
|
||||||
|
|
||||||
|
-- Statics
|
||||||
|
for id,object in pairs(MASHTemplates) do
|
||||||
|
local NewName = string.format("%s#%3d",name,id)
|
||||||
|
local vec2 = {x=BaseX+object.x,y=BaseY+object.y}
|
||||||
|
local Coordinate=COORDINATE:NewFromVec2(vec2)
|
||||||
|
local static = SPAWNSTATIC:NewFromType(object.type,object.category,CountryID)
|
||||||
|
if object.shape_name and object.shape_name ~= "none" then
|
||||||
|
static:InitShape(object.shape_name)
|
||||||
|
end
|
||||||
|
if object.category == "Helicopters" and DeployHelo == true then
|
||||||
|
if object.livery_id ~= nil then
|
||||||
|
livery = object.livery_id
|
||||||
|
end
|
||||||
|
static:InitLivery(livery)
|
||||||
|
local newstatic = static:SpawnFromCoordinate(Coordinate,object.heading,NewName)
|
||||||
|
table.insert(ReturnStatics,newstatic)
|
||||||
|
elseif object.category == "Heliports" then
|
||||||
|
static:InitFARP(MASHCallsign,MASHRadio,MASHRadioModulation,false,false)
|
||||||
|
local newstatic = static:SpawnFromCoordinate(Coordinate,object.heading,NewName)
|
||||||
|
table.insert(ReturnStatics,newstatic)
|
||||||
|
elseif object.category ~= "Helicopters" and object.category ~= "Heliports" then
|
||||||
|
local newstatic = static:SpawnFromCoordinate(Coordinate,object.heading,NewName)
|
||||||
|
table.insert(ReturnStatics,newstatic)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Beacon
|
||||||
|
local ADFName
|
||||||
|
if ADF and type(ADF) == "number" then
|
||||||
|
local ADFFreq = ADF*1000 -- KHz to Hz
|
||||||
|
local Sound = "l10n/DEFAULT/beacon.ogg"
|
||||||
|
ADFName = Name .. " ADF "..tostring(ADF).."KHz"
|
||||||
|
--BASE:I(string.format("Adding MASH Beacon %d KHz Name %s",ADF,ADFName))
|
||||||
|
trigger.action.radioTransmission(Sound, positionVec3, 0, true, ADFFreq, 250, ADFName)
|
||||||
|
end
|
||||||
|
|
||||||
|
return ReturnStatics, ADFName
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Converts a Vec2 to a Vec3.
|
--- Converts a Vec2 to a Vec3.
|
||||||
@@ -4413,3 +4583,165 @@ end
|
|||||||
function UTILS.Weather.StopFogAnimation()
|
function UTILS.Weather.StopFogAnimation()
|
||||||
return world.weather.setFogAnimation({})
|
return world.weather.setFogAnimation({})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Find a ME created zone by its name
|
||||||
|
function UTILS.GetEnvZone(name)
|
||||||
|
for _,v in ipairs(env.mission.triggers.zones) do
|
||||||
|
if v.name == name then
|
||||||
|
return v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- net.dostring_in
|
||||||
|
function UTILS.DoStringIn(State,DoString)
|
||||||
|
return net.dostring_in(State,DoString)
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Show a picture on the screen
|
||||||
|
-- @param #string FileName File name of the picture
|
||||||
|
-- @param #number Duration Duration in seconds, defaults to 10
|
||||||
|
-- @param #boolean ClearView If true, clears the view before showing the picture, defaults to false
|
||||||
|
-- @param #number StartDelay Delay in seconds before showing the picture, defaults to 0
|
||||||
|
-- @param #number HorizontalAlign Horizontal alignment of the picture, defaults to 1 (left), can be 0 (center) or 2 (right)
|
||||||
|
-- @param #number VerticalAlign Vertical alignment of the picture, defaults to 1 (top), can be 0 (center) or 2 (bottom)
|
||||||
|
-- @param #number Size Size of the picture in percent, defaults to 100
|
||||||
|
-- @param #number SizeUnits Size units, defaults to 0 (percent), can be 1 (pixels)
|
||||||
|
function UTILS.ShowPicture(FileName, Duration, ClearView, StartDelay, HorizontalAlign, VerticalAlign, Size, SizeUnits)
|
||||||
|
ClearView = ClearView or false
|
||||||
|
StartDelay = StartDelay or 0
|
||||||
|
HorizontalAlign = HorizontalAlign or 1
|
||||||
|
VerticalAlign = VerticalAlign or 1
|
||||||
|
Size = Size or 100
|
||||||
|
SizeUnits = SizeUnits or 0
|
||||||
|
|
||||||
|
if ClearView then ClearView = "true" else ClearView = "false" end
|
||||||
|
|
||||||
|
net.dostring_in("mission", string.format("a_out_picture(getValueResourceByKey(\"%s\"), %d, %s, %d, \"%d\", \"%d\", %d, \"%d\")", FileName, Duration or 10, ClearView, StartDelay, HorizontalAlign, VerticalAlign, Size, SizeUnits))
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Show a helper gate at a DCS#Vec3 position
|
||||||
|
-- @param DCS#Vec3 pos The position
|
||||||
|
-- @param number heading Heading in degrees, can be 0..359 degrees
|
||||||
|
function UTILS.ShowHelperGate(pos, heading)
|
||||||
|
net.dostring_in("mission",string.format("a_show_helper_gate(%s, %s, %s, %f)", pos.x, pos.y, pos.z, math.rad(heading)))
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Shell a zone, zone must ME created
|
||||||
|
-- @param #string name The name of the ME created zone
|
||||||
|
-- @param #number power Equals kg of TNT, e.g. 75
|
||||||
|
-- @param #count Number of shells simulated
|
||||||
|
function UTILS.ShellZone(name, power, count)
|
||||||
|
local z = UTILS.GetEnvZone(name)
|
||||||
|
if z then
|
||||||
|
net.dostring_in("mission",string.format("a_shelling_zone(%d, %d, %d)", z.zoneId, power, count))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Remove objects from a zone, zone must ME created
|
||||||
|
-- @param #string name The name of the ME created zone
|
||||||
|
-- @param #number type Type of objects to remove can be 0:all, 1: trees, 2:objects
|
||||||
|
function UTILS.RemoveObjects(name, type)
|
||||||
|
local z = UTILS.GetEnvZone(name)
|
||||||
|
if z then
|
||||||
|
net.dostring_in("mission",string.format("a_remove_scene_objects(%d, %d)", z.zoneId, type))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Remove scenery objects from a zone, zone must ME created
|
||||||
|
-- @param #string name The name of the ME created zone
|
||||||
|
-- @param #number level Level of removal
|
||||||
|
function UTILS.DestroyScenery(name, level)
|
||||||
|
local z = UTILS.GetEnvZone(name)
|
||||||
|
if z then
|
||||||
|
net.dostring_in("mission",string.format("a_scenery_destruction_zone(%d, %d)", z.zoneId, level))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Search for clear zones in a given area. A powerful and efficient function using Disposition to find clear areas for spawning ground units avoiding trees, water and map scenery.
|
||||||
|
-- @param DCS##Vec3 Center position vector for the search area.
|
||||||
|
-- @param #number SearchRadius Radius of the search area.
|
||||||
|
-- @param #number PosRadius Required clear radius around each position.
|
||||||
|
-- @param #number NumPositions Number of positions to find.
|
||||||
|
-- @return #table A table of DCS#Vec2 positions that are clear of map objects within the given PosRadius.
|
||||||
|
function UTILS.GetSimpleZones(Vec3, SearchRadius, PosRadius, NumPositions)
|
||||||
|
return Disposition.getSimpleZones(Vec3, SearchRadius, PosRadius, NumPositions)
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Search for clear ground spawn zones within this zone. A powerful and efficient function using Disposition to find clear areas for spawning ground units avoiding trees, water and map scenery.
|
||||||
|
-- @param Core.Zone#ZONE Zone to search.
|
||||||
|
-- @param #number (Optional) PosRadius Required clear radius around each position. (Default is math.min(Radius/10, 200))
|
||||||
|
-- @param #number (Optional) NumPositions Number of positions to find. (Default 50)
|
||||||
|
-- @return #table A table of DCS#Vec2 positions that are clear of map objects within the given PosRadius. nil if no clear positions are found.
|
||||||
|
function UTILS.GetClearZonePositions(Zone, PosRadius, NumPositions)
|
||||||
|
local radius = PosRadius or math.min(Zone:GetRadius()/10, 200)
|
||||||
|
local clearPositions = UTILS.GetSimpleZones(Zone:GetVec3(), Zone:GetRadius(), radius, NumPositions or 50)
|
||||||
|
if clearPositions and #clearPositions > 0 then
|
||||||
|
local validZones = {}
|
||||||
|
for _, vec2 in pairs(clearPositions) do
|
||||||
|
if Zone:IsVec2InZone(vec2) then
|
||||||
|
table.insert(validZones, vec2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if #validZones > 0 then
|
||||||
|
return validZones, radius
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Search for a random clear ground spawn coordinate within this zone. A powerful and efficient function using Disposition to find clear areas for spawning ground units avoiding trees, water and map scenery.
|
||||||
|
-- @param Core.Zone#ZONE Zone to search.
|
||||||
|
-- @param #number PosRadius (Optional) Required clear radius around each position. (Default is math.min(Radius/10, 200))
|
||||||
|
-- @param #number NumPositions (Optional) Number of positions to find. (Default 50)
|
||||||
|
-- @return Core.Point#COORDINATE A random coordinate for a clear zone. nil if no clear positions are found.
|
||||||
|
-- @return #number Assigned radius for the found zones. nil if no clear positions are found.
|
||||||
|
function UTILS.GetRandomClearZoneCoordinate(Zone, PosRadius, NumPositions)
|
||||||
|
local clearPositions = UTILS.GetClearZonePositions(Zone, PosRadius, NumPositions)
|
||||||
|
if clearPositions and #clearPositions > 0 then
|
||||||
|
local randomPosition, radius = clearPositions[math.random(1, #clearPositions)]
|
||||||
|
return COORDINATE:NewFromVec2(randomPosition), radius
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Find the point on the radius of a circle closest to a point outside of the radius.
|
||||||
|
-- @param DCS#Vec2 Vec1 Simple Vec2 marking the middle of the circle.
|
||||||
|
-- @param #number Radius The radius of the circle.
|
||||||
|
-- @param DCS#Vec2 Vec2 Simple Vec2 marking the point outside of the circle.
|
||||||
|
-- @return DCS#Vec2 Vec2 point on the radius.
|
||||||
|
function UTILS.FindNearestPointOnCircle(Vec1,Radius,Vec2)
|
||||||
|
local r = Radius
|
||||||
|
local cx = Vec1.x or 1
|
||||||
|
local cy = Vec1.y or 1
|
||||||
|
local px = Vec2.x or 1
|
||||||
|
local py = Vec2.y or 1
|
||||||
|
|
||||||
|
-- Berechne den Vektor vom Mittelpunkt zum externen Punkt
|
||||||
|
local dx = px - cx
|
||||||
|
local dy = py - cy
|
||||||
|
|
||||||
|
-- Berechne die Länge des Vektors
|
||||||
|
local dist = math.sqrt(dx * dx + dy * dy)
|
||||||
|
|
||||||
|
-- Wenn der Punkt im Mittelpunkt liegt, wähle einen Punkt auf der X-Achse
|
||||||
|
if dist == 0 then
|
||||||
|
return {x=cx + r, y=cy}
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Normalisiere den Vektor (richtungsweise Vektor mit Länge 1)
|
||||||
|
local norm_dx = dx / dist
|
||||||
|
local norm_dy = dy / dist
|
||||||
|
|
||||||
|
-- Berechne den Punkt auf dem Rand des Kreises
|
||||||
|
local qx = cx + r * norm_dx
|
||||||
|
local qy = cy + r * norm_dy
|
||||||
|
|
||||||
|
local shift_factor = 1
|
||||||
|
qx = qx + shift_factor * norm_dx
|
||||||
|
qy = qy + shift_factor * norm_dy
|
||||||
|
|
||||||
|
return {x=qx, y=qy}
|
||||||
|
end
|
||||||
|
|||||||
@@ -449,7 +449,6 @@ AIRBASE.TheChannel = {
|
|||||||
-- * AIRBASE.Syria.Al_Dumayr
|
-- * AIRBASE.Syria.Al_Dumayr
|
||||||
-- * AIRBASE.Syria.Al_Qusayr
|
-- * AIRBASE.Syria.Al_Qusayr
|
||||||
-- * AIRBASE.Syria.Aleppo
|
-- * AIRBASE.Syria.Aleppo
|
||||||
-- * AIRBASE.Syria.Amman
|
|
||||||
-- * AIRBASE.Syria.An_Nasiriyah
|
-- * AIRBASE.Syria.An_Nasiriyah
|
||||||
-- * AIRBASE.Syria.At_Tanf
|
-- * AIRBASE.Syria.At_Tanf
|
||||||
-- * AIRBASE.Syria.Bassel_Al_Assad
|
-- * AIRBASE.Syria.Bassel_Al_Assad
|
||||||
@@ -511,8 +510,9 @@ AIRBASE.TheChannel = {
|
|||||||
-- * AIRBASE.Syria.Wujah_Al_Hajar
|
-- * AIRBASE.Syria.Wujah_Al_Hajar
|
||||||
-- * AIRBASE.Syria.Ben_Gurion
|
-- * AIRBASE.Syria.Ben_Gurion
|
||||||
-- * AIRBASE.Syria.Hatzor
|
-- * AIRBASE.Syria.Hatzor
|
||||||
-- * AIRBASE.Syria.Palmashim
|
-- * AIRBASE.Syria.Palmachim
|
||||||
-- * AIRBASE.Syria.Tel_Nof
|
-- * AIRBASE.Syria.Tel_Nof
|
||||||
|
-- * AIRBASE.Syria.Marka
|
||||||
--
|
--
|
||||||
--@field Syria
|
--@field Syria
|
||||||
AIRBASE.Syria={
|
AIRBASE.Syria={
|
||||||
@@ -522,7 +522,6 @@ AIRBASE.Syria={
|
|||||||
["Al_Dumayr"] = "Al-Dumayr",
|
["Al_Dumayr"] = "Al-Dumayr",
|
||||||
["Al_Qusayr"] = "Al Qusayr",
|
["Al_Qusayr"] = "Al Qusayr",
|
||||||
["Aleppo"] = "Aleppo",
|
["Aleppo"] = "Aleppo",
|
||||||
["Amman"] = "Amman",
|
|
||||||
["An_Nasiriyah"] = "An Nasiriyah",
|
["An_Nasiriyah"] = "An Nasiriyah",
|
||||||
["At_Tanf"] = "At Tanf",
|
["At_Tanf"] = "At Tanf",
|
||||||
["Bassel_Al_Assad"] = "Bassel Al-Assad",
|
["Bassel_Al_Assad"] = "Bassel Al-Assad",
|
||||||
@@ -554,6 +553,7 @@ AIRBASE.Syria={
|
|||||||
["Kuweires"] = "Kuweires",
|
["Kuweires"] = "Kuweires",
|
||||||
["Lakatamia"] = "Lakatamia",
|
["Lakatamia"] = "Lakatamia",
|
||||||
["Larnaca"] = "Larnaca",
|
["Larnaca"] = "Larnaca",
|
||||||
|
["Marka"] = "Marka",
|
||||||
["Marj_Ruhayyil"] = "Marj Ruhayyil",
|
["Marj_Ruhayyil"] = "Marj Ruhayyil",
|
||||||
["Marj_as_Sultan_North"] = "Marj as Sultan North",
|
["Marj_as_Sultan_North"] = "Marj as Sultan North",
|
||||||
["Marj_as_Sultan_South"] = "Marj as Sultan South",
|
["Marj_as_Sultan_South"] = "Marj as Sultan South",
|
||||||
@@ -584,7 +584,7 @@ AIRBASE.Syria={
|
|||||||
["Wujah_Al_Hajar"] = "Wujah Al Hajar",
|
["Wujah_Al_Hajar"] = "Wujah Al Hajar",
|
||||||
["Ben_Gurion"] = "Ben Gurion",
|
["Ben_Gurion"] = "Ben Gurion",
|
||||||
["Hatzor"] = "Hatzor",
|
["Hatzor"] = "Hatzor",
|
||||||
["Palmashim"] = "Palmashim",
|
["Palmachim"] = "Palmachim",
|
||||||
["Tel_Nof"] = "Tel Nof",
|
["Tel_Nof"] = "Tel Nof",
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -611,6 +611,35 @@ AIRBASE.MarianaIslands = {
|
|||||||
["Tinian_Intl"] = "Tinian Intl",
|
["Tinian_Intl"] = "Tinian Intl",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
--- Airbase of the Marianas WWII map
|
||||||
|
--
|
||||||
|
-- * AIRBASE.MarianaIslandsWWII.Agana
|
||||||
|
-- * AIRBASE.MarianaIslandsWWII.Airfield_3
|
||||||
|
-- * AIRBASE.MarianaIslandsWWII.Charon_Kanoa
|
||||||
|
-- * AIRBASE.MarianaIslandsWWII.Gurguan_Point
|
||||||
|
-- * AIRBASE.MarianaIslandsWWII.Isley
|
||||||
|
-- * AIRBASE.MarianaIslandsWWII.Kagman
|
||||||
|
-- * AIRBASE.MarianaIslandsWWII.Marpi
|
||||||
|
-- * AIRBASE.MarianaIslandsWWII.Orote
|
||||||
|
-- * AIRBASE.MarianaIslandsWWII.Pagan
|
||||||
|
-- * AIRBASE.MarianaIslandsWWII.Rota
|
||||||
|
-- * AIRBASE.MarianaIslandsWWII.Ushi
|
||||||
|
-- @field AIRBASE.MarianaIslandsWWII
|
||||||
|
AIRBASE.MarianaIslandsWWII =
|
||||||
|
{
|
||||||
|
["Agana"] = "Agana",
|
||||||
|
["Airfield_3"] = "Airfield 3",
|
||||||
|
["Charon_Kanoa"] = "Charon Kanoa",
|
||||||
|
["Gurguan_Point"] = "Gurguan Point",
|
||||||
|
["Isley"] = "Isley",
|
||||||
|
["Kagman"] = "Kagman",
|
||||||
|
["Marpi"] = "Marpi",
|
||||||
|
["Orote"] = "Orote",
|
||||||
|
["Pagan"] = "Pagan",
|
||||||
|
["Rota"] = "Rota",
|
||||||
|
["Ushi"] = "Ushi",
|
||||||
|
}
|
||||||
|
|
||||||
--- Airbases of the South Atlantic map:
|
--- Airbases of the South Atlantic map:
|
||||||
--
|
--
|
||||||
-- * AIRBASE.SouthAtlantic.Almirante_Schroeders
|
-- * AIRBASE.SouthAtlantic.Almirante_Schroeders
|
||||||
@@ -689,7 +718,7 @@ AIRBASE.SouthAtlantic={
|
|||||||
-- * AIRBASE.Sinai.Bilbeis_Air_Base
|
-- * AIRBASE.Sinai.Bilbeis_Air_Base
|
||||||
-- * AIRBASE.Sinai.Bir_Hasanah
|
-- * AIRBASE.Sinai.Bir_Hasanah
|
||||||
-- * AIRBASE.Sinai.Birma_Air_Base
|
-- * AIRBASE.Sinai.Birma_Air_Base
|
||||||
-- * AIRBASE.Sinai.Borj_El_Arab_International_Airport
|
-- * AIRBASE.Sinai.Borg_El_Arab_International_Airport
|
||||||
-- * AIRBASE.Sinai.Cairo_International_Airport
|
-- * AIRBASE.Sinai.Cairo_International_Airport
|
||||||
-- * AIRBASE.Sinai.Cairo_West
|
-- * AIRBASE.Sinai.Cairo_West
|
||||||
-- * AIRBASE.Sinai.Difarsuwar_Airfield
|
-- * AIRBASE.Sinai.Difarsuwar_Airfield
|
||||||
@@ -737,7 +766,7 @@ AIRBASE.Sinai = {
|
|||||||
["Bilbeis_Air_Base"] = "Bilbeis Air Base",
|
["Bilbeis_Air_Base"] = "Bilbeis Air Base",
|
||||||
["Bir_Hasanah"] = "Bir Hasanah",
|
["Bir_Hasanah"] = "Bir Hasanah",
|
||||||
["Birma_Air_Base"] = "Birma Air Base",
|
["Birma_Air_Base"] = "Birma Air Base",
|
||||||
["Borj_El_Arab_International_Airport"] = "Borj El Arab International Airport",
|
["Borg_El_Arab_International_Airport"] = "Borg El Arab International Airport",
|
||||||
["Cairo_International_Airport"] = "Cairo International Airport",
|
["Cairo_International_Airport"] = "Cairo International Airport",
|
||||||
["Cairo_West"] = "Cairo West",
|
["Cairo_West"] = "Cairo West",
|
||||||
["Difarsuwar_Airfield"] = "Difarsuwar Airfield",
|
["Difarsuwar_Airfield"] = "Difarsuwar Airfield",
|
||||||
@@ -790,9 +819,14 @@ AIRBASE.Sinai = {
|
|||||||
-- * AIRBASE.Kola.Vidsel
|
-- * AIRBASE.Kola.Vidsel
|
||||||
-- * AIRBASE.Kola.Vuojarvi
|
-- * AIRBASE.Kola.Vuojarvi
|
||||||
-- * AIRBASE.Kola.Andoya
|
-- * AIRBASE.Kola.Andoya
|
||||||
-- * AIRBASE.Kola.Alakourtti
|
-- * AIRBASE.Kola.Alakurtti
|
||||||
-- * AIRBASE.Kola.Kittila
|
-- * AIRBASE.Kola.Kittila
|
||||||
-- * AIRBASE.Kola.Bardufoss
|
-- * AIRBASE.Kola.Bardufoss
|
||||||
|
-- * AIRBASE.Kola.Alta
|
||||||
|
-- * AIRBASE.Kola.Sodankyla
|
||||||
|
-- * AIRBASE.Kola.Enontekio
|
||||||
|
-- * AIRBASE.Kola.Evenes
|
||||||
|
-- * AIRBASE.Kola.Hosio
|
||||||
--
|
--
|
||||||
-- @field Kola
|
-- @field Kola
|
||||||
AIRBASE.Kola = {
|
AIRBASE.Kola = {
|
||||||
@@ -815,9 +849,20 @@ AIRBASE.Kola = {
|
|||||||
["Vidsel"] = "Vidsel",
|
["Vidsel"] = "Vidsel",
|
||||||
["Vuojarvi"] = "Vuojarvi",
|
["Vuojarvi"] = "Vuojarvi",
|
||||||
["Andoya"] = "Andoya",
|
["Andoya"] = "Andoya",
|
||||||
["Alakourtti"] = "Alakourtti",
|
["Alakurtti"] = "Alakurtti",
|
||||||
["Kittila"] = "Kittila",
|
["Kittila"] = "Kittila",
|
||||||
["Bardufoss"] = "Bardufoss",
|
["Bardufoss"] = "Bardufoss",
|
||||||
|
["Alta"] = "Alta",
|
||||||
|
["Sodankyla"] = "Sodankyla",
|
||||||
|
["Enontekio"] = "Enontekio",
|
||||||
|
["Evenes"] = "Evenes",
|
||||||
|
["Hosio"] = "Hosio",
|
||||||
|
["Kilpyavr"] = "Kilpyavr",
|
||||||
|
["Afrikanda"] = "Afrikanda",
|
||||||
|
["Kalevala"] = "Kalevala",
|
||||||
|
["Koshka_Yavr"] = "Koshka Yavr",
|
||||||
|
["Poduzhemye"] = "Poduzhemye",
|
||||||
|
["Luostari_Pechenga"] = "Luostari Pechenga",
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Airbases of the Afghanistan map
|
--- Airbases of the Afghanistan map
|
||||||
@@ -911,10 +956,10 @@ AIRBASE.Iraq = {
|
|||||||
|
|
||||||
--- Airbases of the Germany Cold War map
|
--- Airbases of the Germany Cold War map
|
||||||
-- * AIRBASE.GermanyCW.Airracing_Frankfurt
|
-- * AIRBASE.GermanyCW.Airracing_Frankfurt
|
||||||
|
-- * AIRBASE.GermanyCW.Airracing_Frankfurt
|
||||||
-- * AIRBASE.GermanyCW.Airracing_Koblenz
|
-- * AIRBASE.GermanyCW.Airracing_Koblenz
|
||||||
-- * AIRBASE.GermanyCW.Airracing_Luebeck
|
-- * AIRBASE.GermanyCW.Airracing_Luebeck
|
||||||
-- * AIRBASE.GermanyCW.Allstedt
|
-- * AIRBASE.GermanyCW.Allstedt
|
||||||
-- * AIRBASE.GermanyCW.Alt_Daber
|
|
||||||
-- * AIRBASE.GermanyCW.Altes_Lager
|
-- * AIRBASE.GermanyCW.Altes_Lager
|
||||||
-- * AIRBASE.GermanyCW.Bad_Duerkheim
|
-- * AIRBASE.GermanyCW.Bad_Duerkheim
|
||||||
-- * AIRBASE.GermanyCW.Barth
|
-- * AIRBASE.GermanyCW.Barth
|
||||||
@@ -937,14 +982,13 @@ AIRBASE.Iraq = {
|
|||||||
-- * AIRBASE.GermanyCW.Fritzlar
|
-- * AIRBASE.GermanyCW.Fritzlar
|
||||||
-- * AIRBASE.GermanyCW.Fulda
|
-- * AIRBASE.GermanyCW.Fulda
|
||||||
-- * AIRBASE.GermanyCW.Gardelegen
|
-- * AIRBASE.GermanyCW.Gardelegen
|
||||||
|
-- * AIRBASE.GermanyCW.Garz
|
||||||
-- * AIRBASE.GermanyCW.Gatow
|
-- * AIRBASE.GermanyCW.Gatow
|
||||||
-- * AIRBASE.GermanyCW.Gelnhausen
|
-- * AIRBASE.GermanyCW.Gelnhausen
|
||||||
-- * AIRBASE.GermanyCW.Giebelstadt
|
-- * AIRBASE.GermanyCW.Giebelstadt
|
||||||
-- * AIRBASE.GermanyCW.Glindbruchkippe
|
-- * AIRBASE.GermanyCW.Glindbruchkippe
|
||||||
-- * AIRBASE.GermanyCW.Gross_Doelln
|
|
||||||
-- * AIRBASE.GermanyCW.Gross_Mohrdorf
|
-- * AIRBASE.GermanyCW.Gross_Mohrdorf
|
||||||
-- * AIRBASE.GermanyCW.Grosse_Wiese
|
-- * AIRBASE.GermanyCW.Grosse_Wiese
|
||||||
-- * AIRBASE.GermanyCW.Gaerz
|
|
||||||
-- * AIRBASE.GermanyCW.Guetersloh
|
-- * AIRBASE.GermanyCW.Guetersloh
|
||||||
-- * AIRBASE.GermanyCW.H_FRG_01
|
-- * AIRBASE.GermanyCW.H_FRG_01
|
||||||
-- * AIRBASE.GermanyCW.H_FRG_02
|
-- * AIRBASE.GermanyCW.H_FRG_02
|
||||||
@@ -1016,10 +1060,11 @@ AIRBASE.Iraq = {
|
|||||||
-- * AIRBASE.GermanyCW.H_GDR_31
|
-- * AIRBASE.GermanyCW.H_GDR_31
|
||||||
-- * AIRBASE.GermanyCW.H_GDR_32
|
-- * AIRBASE.GermanyCW.H_GDR_32
|
||||||
-- * AIRBASE.GermanyCW.H_GDR_33
|
-- * AIRBASE.GermanyCW.H_GDR_33
|
||||||
|
-- * AIRBASE.GermanyCW.H_GDR_34
|
||||||
|
-- * AIRBASE.GermanyCW.H_Med_FRG_01
|
||||||
-- * AIRBASE.GermanyCW.H_Med_FRG_02
|
-- * AIRBASE.GermanyCW.H_Med_FRG_02
|
||||||
-- * AIRBASE.GermanyCW.H_Med_FRG_04
|
-- * AIRBASE.GermanyCW.H_Med_FRG_04
|
||||||
-- * AIRBASE.GermanyCW.H_Med_FRG_06
|
-- * AIRBASE.GermanyCW.H_Med_FRG_06
|
||||||
-- * AIRBASE.GermanyCW.H_Med_FRG_09
|
|
||||||
-- * AIRBASE.GermanyCW.H_Med_FRG_11
|
-- * AIRBASE.GermanyCW.H_Med_FRG_11
|
||||||
-- * AIRBASE.GermanyCW.H_Med_FRG_12
|
-- * AIRBASE.GermanyCW.H_Med_FRG_12
|
||||||
-- * AIRBASE.GermanyCW.H_Med_FRG_13
|
-- * AIRBASE.GermanyCW.H_Med_FRG_13
|
||||||
@@ -1067,9 +1112,9 @@ AIRBASE.Iraq = {
|
|||||||
-- * AIRBASE.GermanyCW.Koethen
|
-- * AIRBASE.GermanyCW.Koethen
|
||||||
-- * AIRBASE.GermanyCW.Laage
|
-- * AIRBASE.GermanyCW.Laage
|
||||||
-- * AIRBASE.GermanyCW.Langenselbold
|
-- * AIRBASE.GermanyCW.Langenselbold
|
||||||
|
-- * AIRBASE.GermanyCW.Laerz
|
||||||
-- * AIRBASE.GermanyCW.Leipzig_Halle
|
-- * AIRBASE.GermanyCW.Leipzig_Halle
|
||||||
-- * AIRBASE.GermanyCW.Leipzig_Mockau
|
-- * AIRBASE.GermanyCW.Leipzig_Mockau
|
||||||
-- * AIRBASE.GermanyCW.Laerz
|
|
||||||
-- * AIRBASE.GermanyCW.Luebeck
|
-- * AIRBASE.GermanyCW.Luebeck
|
||||||
-- * AIRBASE.GermanyCW.Lueneburg
|
-- * AIRBASE.GermanyCW.Lueneburg
|
||||||
-- * AIRBASE.GermanyCW.Mahlwinkel
|
-- * AIRBASE.GermanyCW.Mahlwinkel
|
||||||
@@ -1087,14 +1132,15 @@ AIRBASE.Iraq = {
|
|||||||
-- * AIRBASE.GermanyCW.Pottschutthoehe
|
-- * AIRBASE.GermanyCW.Pottschutthoehe
|
||||||
-- * AIRBASE.GermanyCW.Ramstein
|
-- * AIRBASE.GermanyCW.Ramstein
|
||||||
-- * AIRBASE.GermanyCW.Rinteln
|
-- * AIRBASE.GermanyCW.Rinteln
|
||||||
-- * AIRBASE.GermanyCW.Schweinfurt
|
|
||||||
-- * AIRBASE.GermanyCW.Schoenefeld
|
-- * AIRBASE.GermanyCW.Schoenefeld
|
||||||
|
-- * AIRBASE.GermanyCW.Schweinfurt
|
||||||
-- * AIRBASE.GermanyCW.Sembach
|
-- * AIRBASE.GermanyCW.Sembach
|
||||||
-- * AIRBASE.GermanyCW.Spangdahlem
|
-- * AIRBASE.GermanyCW.Spangdahlem
|
||||||
-- * AIRBASE.GermanyCW.Sperenberg
|
-- * AIRBASE.GermanyCW.Sperenberg
|
||||||
-- * AIRBASE.GermanyCW.Stendal
|
-- * AIRBASE.GermanyCW.Stendal
|
||||||
-- * AIRBASE.GermanyCW.Tegel
|
-- * AIRBASE.GermanyCW.Tegel
|
||||||
-- * AIRBASE.GermanyCW.Tempelhof
|
-- * AIRBASE.GermanyCW.Tempelhof
|
||||||
|
-- * AIRBASE.GermanyCW.Templin
|
||||||
-- * AIRBASE.GermanyCW.Tutow
|
-- * AIRBASE.GermanyCW.Tutow
|
||||||
-- * AIRBASE.GermanyCW.Uelzen
|
-- * AIRBASE.GermanyCW.Uelzen
|
||||||
-- * AIRBASE.GermanyCW.Uetersen
|
-- * AIRBASE.GermanyCW.Uetersen
|
||||||
@@ -1106,6 +1152,7 @@ AIRBASE.Iraq = {
|
|||||||
-- * AIRBASE.GermanyCW.Weser_Wuemme
|
-- * AIRBASE.GermanyCW.Weser_Wuemme
|
||||||
-- * AIRBASE.GermanyCW.Wiesbaden
|
-- * AIRBASE.GermanyCW.Wiesbaden
|
||||||
-- * AIRBASE.GermanyCW.Wismar
|
-- * AIRBASE.GermanyCW.Wismar
|
||||||
|
-- * AIRBASE.GermanyCW.Wittstock
|
||||||
-- * AIRBASE.GermanyCW.Worms
|
-- * AIRBASE.GermanyCW.Worms
|
||||||
-- * AIRBASE.GermanyCW.Wunstorf
|
-- * AIRBASE.GermanyCW.Wunstorf
|
||||||
-- * AIRBASE.GermanyCW.Zerbst
|
-- * AIRBASE.GermanyCW.Zerbst
|
||||||
@@ -1117,7 +1164,6 @@ AIRBASE.GermanyCW = {
|
|||||||
["Airracing_Koblenz"] = "Airracing Koblenz",
|
["Airracing_Koblenz"] = "Airracing Koblenz",
|
||||||
["Airracing_Luebeck"] = "Airracing Lubeck",
|
["Airracing_Luebeck"] = "Airracing Lubeck",
|
||||||
["Allstedt"] = "Allstedt",
|
["Allstedt"] = "Allstedt",
|
||||||
["Alt_Daber"] = "Alt Daber",
|
|
||||||
["Altes_Lager"] = "Altes Lager",
|
["Altes_Lager"] = "Altes Lager",
|
||||||
["Bad_Duerkheim"] = "Bad Durkheim",
|
["Bad_Duerkheim"] = "Bad Durkheim",
|
||||||
["Barth"] = "Barth",
|
["Barth"] = "Barth",
|
||||||
@@ -1140,14 +1186,13 @@ AIRBASE.GermanyCW = {
|
|||||||
["Fritzlar"] = "Fritzlar",
|
["Fritzlar"] = "Fritzlar",
|
||||||
["Fulda"] = "Fulda",
|
["Fulda"] = "Fulda",
|
||||||
["Gardelegen"] = "Gardelegen",
|
["Gardelegen"] = "Gardelegen",
|
||||||
|
["Garz"] = "Garz",
|
||||||
["Gatow"] = "Gatow",
|
["Gatow"] = "Gatow",
|
||||||
["Gelnhausen"] = "Gelnhausen",
|
["Gelnhausen"] = "Gelnhausen",
|
||||||
["Giebelstadt"] = "Giebelstadt",
|
["Giebelstadt"] = "Giebelstadt",
|
||||||
["Glindbruchkippe_"] = "Glindbruchkippe ",
|
["Glindbruchkippe"] = "Glindbruchkippe ",
|
||||||
["Gross_Doelln"] = "Gross Dolln",
|
|
||||||
["Gross_Mohrdorf"] = "Gross Mohrdorf",
|
["Gross_Mohrdorf"] = "Gross Mohrdorf",
|
||||||
["Grosse_Wiese"] = "Grosse Wiese",
|
["Grosse_Wiese"] = "Grosse Wiese",
|
||||||
["Gaerz"] = "Garz",
|
|
||||||
["Guetersloh"] = "Gutersloh",
|
["Guetersloh"] = "Gutersloh",
|
||||||
["H_FRG_01"] = "H FRG 01",
|
["H_FRG_01"] = "H FRG 01",
|
||||||
["H_FRG_02"] = "H FRG 02",
|
["H_FRG_02"] = "H FRG 02",
|
||||||
@@ -1219,10 +1264,11 @@ AIRBASE.GermanyCW = {
|
|||||||
["H_GDR_31"] = "H GDR 31",
|
["H_GDR_31"] = "H GDR 31",
|
||||||
["H_GDR_32"] = "H GDR 32",
|
["H_GDR_32"] = "H GDR 32",
|
||||||
["H_GDR_33"] = "H GDR 33",
|
["H_GDR_33"] = "H GDR 33",
|
||||||
|
["H_GDR_34"] = "H GDR 34",
|
||||||
|
["H_Med_FRG_01"] = "H Med FRG 01",
|
||||||
["H_Med_FRG_02"] = "H Med FRG 02",
|
["H_Med_FRG_02"] = "H Med FRG 02",
|
||||||
["H_Med_FRG_04"] = "H Med FRG 04",
|
["H_Med_FRG_04"] = "H Med FRG 04",
|
||||||
["H_Med_FRG_06"] = "H Med FRG 06",
|
["H_Med_FRG_06"] = "H Med FRG 06",
|
||||||
["H_Med_FRG_09"] = "H Med FRG 09",
|
|
||||||
["H_Med_FRG_11"] = "H Med FRG 11",
|
["H_Med_FRG_11"] = "H Med FRG 11",
|
||||||
["H_Med_FRG_12"] = "H Med FRG 12",
|
["H_Med_FRG_12"] = "H Med FRG 12",
|
||||||
["H_Med_FRG_13"] = "H Med FRG 13",
|
["H_Med_FRG_13"] = "H Med FRG 13",
|
||||||
@@ -1270,9 +1316,9 @@ AIRBASE.GermanyCW = {
|
|||||||
["Koethen"] = "Kothen",
|
["Koethen"] = "Kothen",
|
||||||
["Laage"] = "Laage",
|
["Laage"] = "Laage",
|
||||||
["Langenselbold"] = "Langenselbold",
|
["Langenselbold"] = "Langenselbold",
|
||||||
|
["Laerz"] = "Larz",
|
||||||
["Leipzig_Halle"] = "Leipzig Halle",
|
["Leipzig_Halle"] = "Leipzig Halle",
|
||||||
["Leipzig_Mockau"] = "Leipzig Mockau",
|
["Leipzig_Mockau"] = "Leipzig Mockau",
|
||||||
["Laerz"] = "Larz",
|
|
||||||
["Luebeck"] = "Lubeck",
|
["Luebeck"] = "Lubeck",
|
||||||
["Lueneburg"] = "Luneburg",
|
["Lueneburg"] = "Luneburg",
|
||||||
["Mahlwinkel"] = "Mahlwinkel",
|
["Mahlwinkel"] = "Mahlwinkel",
|
||||||
@@ -1290,14 +1336,15 @@ AIRBASE.GermanyCW = {
|
|||||||
["Pottschutthoehe"] = "Pottschutthohe",
|
["Pottschutthoehe"] = "Pottschutthohe",
|
||||||
["Ramstein"] = "Ramstein",
|
["Ramstein"] = "Ramstein",
|
||||||
["Rinteln"] = "Rinteln",
|
["Rinteln"] = "Rinteln",
|
||||||
["Schweinfurt"] = "Schweinfurt",
|
|
||||||
["Schoenefeld"] = "Schonefeld",
|
["Schoenefeld"] = "Schonefeld",
|
||||||
|
["Schweinfurt"] = "Schweinfurt",
|
||||||
["Sembach"] = "Sembach",
|
["Sembach"] = "Sembach",
|
||||||
["Spangdahlem"] = "Spangdahlem",
|
["Spangdahlem"] = "Spangdahlem",
|
||||||
["Sperenberg"] = "Sperenberg",
|
["Sperenberg"] = "Sperenberg",
|
||||||
["Stendal"] = "Stendal",
|
["Stendal"] = "Stendal",
|
||||||
["Tegel"] = "Tegel",
|
["Tegel"] = "Tegel",
|
||||||
["Tempelhof"] = "Tempelhof",
|
["Tempelhof"] = "Tempelhof",
|
||||||
|
["Templin"] = "Templin",
|
||||||
["Tutow"] = "Tutow",
|
["Tutow"] = "Tutow",
|
||||||
["Uelzen"] = "Uelzen",
|
["Uelzen"] = "Uelzen",
|
||||||
["Uetersen"] = "Uetersen",
|
["Uetersen"] = "Uetersen",
|
||||||
@@ -1309,6 +1356,7 @@ AIRBASE.GermanyCW = {
|
|||||||
["Weser_Wuemme"] = "Weser Wumme",
|
["Weser_Wuemme"] = "Weser Wumme",
|
||||||
["Wiesbaden"] = "Wiesbaden",
|
["Wiesbaden"] = "Wiesbaden",
|
||||||
["Wismar"] = "Wismar",
|
["Wismar"] = "Wismar",
|
||||||
|
["Wittstock"] = "Wittstock",
|
||||||
["Worms"] = "Worms",
|
["Worms"] = "Worms",
|
||||||
["Wunstorf"] = "Wunstorf",
|
["Wunstorf"] = "Wunstorf",
|
||||||
["Zerbst"] = "Zerbst",
|
["Zerbst"] = "Zerbst",
|
||||||
@@ -1419,7 +1467,7 @@ function AIRBASE:Register(AirbaseName)
|
|||||||
self.descriptors=self:GetDesc()
|
self.descriptors=self:GetDesc()
|
||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
--self:I({airbase=AirbaseName, descriptors=self.descriptors})
|
--self:T({airbase=AirbaseName, descriptors=self.descriptors})
|
||||||
|
|
||||||
-- Category.
|
-- Category.
|
||||||
self.category=self.descriptors and self.descriptors.category or Airbase.Category.AIRDROME
|
self.category=self.descriptors and self.descriptors.category or Airbase.Category.AIRDROME
|
||||||
@@ -2581,11 +2629,12 @@ function AIRBASE:_InitRunways(IncludeInverse)
|
|||||||
runway.name=string.format("%02d", tonumber(namefromheading))
|
runway.name=string.format("%02d", tonumber(namefromheading))
|
||||||
else
|
else
|
||||||
runway.name=string.format("%02d", tonumber(name))
|
runway.name=string.format("%02d", tonumber(name))
|
||||||
self:I("RunwayName: "..runway.name)
|
--self:I("RunwayName: "..runway.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
--runway.name=string.format("%02d", tonumber(name))
|
--runway.name=string.format("%02d", tonumber(name))
|
||||||
runway.magheading=tonumber(runway.name)*10
|
runway.magheading=tonumber(runway.name)*10
|
||||||
|
runway.idx=runway.magheading
|
||||||
runway.heading=heading
|
runway.heading=heading
|
||||||
runway.width=width or 0
|
runway.width=width or 0
|
||||||
runway.length=length or 0
|
runway.length=length or 0
|
||||||
@@ -2898,6 +2947,7 @@ function AIRBASE:GetRunwayData(magvar, mark)
|
|||||||
local runway={} --#AIRBASE.Runway
|
local runway={} --#AIRBASE.Runway
|
||||||
runway.heading=hdg
|
runway.heading=hdg
|
||||||
runway.idx=idx
|
runway.idx=idx
|
||||||
|
runway.magheading=idx
|
||||||
runway.length=c1:Get2DDistance(c2)
|
runway.length=c1:Get2DDistance(c2)
|
||||||
runway.position=c1
|
runway.position=c1
|
||||||
runway.endpoint=c2
|
runway.endpoint=c2
|
||||||
@@ -2915,6 +2965,57 @@ function AIRBASE:GetRunwayData(magvar, mark)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Look for identical (parallel) runways, e.g. 03L and 03R at Nellis.
|
||||||
|
local rpairs={}
|
||||||
|
for i,_ri in pairs(runways) do
|
||||||
|
local ri=_ri --#AIRBASE.Runway
|
||||||
|
for j,_rj in pairs(runways) do
|
||||||
|
local rj=_rj --#AIRBASE.Runway
|
||||||
|
if i<j then
|
||||||
|
if ri.name==rj.name then
|
||||||
|
rpairs[i]=j
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function isLeft(a, b, c)
|
||||||
|
--return ((b.x - a.x)*(c.z - a.z) - (b.z - a.z)*(c.x - a.x)) > 0
|
||||||
|
return ((b.z - a.z)*(c.x - a.x) - (b.x - a.x)*(c.z - a.z)) > 0
|
||||||
|
end
|
||||||
|
|
||||||
|
for i,j in pairs(rpairs) do
|
||||||
|
local ri=runways[i] --#AIRBASE.Runway
|
||||||
|
local rj=runways[j] --#AIRBASE.Runway
|
||||||
|
|
||||||
|
-- Draw arrow.
|
||||||
|
--ri.center:ArrowToAll(rj.center)
|
||||||
|
|
||||||
|
local c0=ri.position
|
||||||
|
|
||||||
|
-- Vector in the direction of the runway.
|
||||||
|
local a=UTILS.VecTranslate(c0, 1000, ri.heading)
|
||||||
|
|
||||||
|
-- Vector from runway i to runway j.
|
||||||
|
local b=UTILS.VecSubstract(rj.position, ri.position)
|
||||||
|
b=UTILS.VecAdd(ri.position, b)
|
||||||
|
|
||||||
|
-- Check if rj is left of ri.
|
||||||
|
local left=isLeft(c0, a, b)
|
||||||
|
|
||||||
|
--env.info(string.format("Found pair %s: i=%d, j=%d, left==%s", ri.name, i, j, tostring(left)))
|
||||||
|
|
||||||
|
if left then
|
||||||
|
ri.isLeft=false
|
||||||
|
rj.isLeft=true
|
||||||
|
else
|
||||||
|
ri.isLeft=true
|
||||||
|
rj.isLeft=false
|
||||||
|
end
|
||||||
|
|
||||||
|
--break
|
||||||
|
end
|
||||||
|
|
||||||
return runways
|
return runways
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -168,17 +168,26 @@
|
|||||||
-- * @{#CONTROLLABLE.OptionAlarmStateGreen}
|
-- * @{#CONTROLLABLE.OptionAlarmStateGreen}
|
||||||
-- * @{#CONTROLLABLE.OptionAlarmStateRed}
|
-- * @{#CONTROLLABLE.OptionAlarmStateRed}
|
||||||
--
|
--
|
||||||
-- ## 5.4) Jettison weapons:
|
-- ## 5.4) [AIR] Jettison weapons:
|
||||||
--
|
--
|
||||||
-- * @{#CONTROLLABLE.OptionAllowJettisonWeaponsOnThreat}
|
-- * @{#CONTROLLABLE.OptionAllowJettisonWeaponsOnThreat}
|
||||||
-- * @{#CONTROLLABLE.OptionKeepWeaponsOnThreat}
|
-- * @{#CONTROLLABLE.OptionKeepWeaponsOnThreat}
|
||||||
--
|
--
|
||||||
-- ## 5.5) Air-2-Air missile attack range:
|
-- ## 5.5) [AIR] Air-2-Air missile attack range:
|
||||||
-- * @{#CONTROLLABLE.OptionAAAttackRange}(): Defines the usage of A2A missiles against possible targets.
|
-- * @{#CONTROLLABLE.OptionAAAttackRange}(): Defines the usage of A2A missiles against possible targets.
|
||||||
--
|
--
|
||||||
-- # 6) [GROUND] IR Maker Beacons for GROUPs and UNITs
|
-- # 6) [GROUND] IR Maker Beacons for GROUPs and UNITs
|
||||||
-- * @{#CONTROLLABLE:NewIRMarker}(): Create a blinking IR Marker on a GROUP or UNIT.
|
-- * @{#CONTROLLABLE:NewIRMarker}(): Create a blinking IR Marker on a GROUP or UNIT.
|
||||||
--
|
--
|
||||||
|
-- # 7) [HELICOPTER] Units prefer vertical landing and takeoffs:
|
||||||
|
-- * @{#CONTROLLABLE.OptionPreferVerticalLanding}(): Set aircraft to prefer vertical landing and takeoff.
|
||||||
|
--
|
||||||
|
-- # 8) [AIRCRAFT] Landing approach options
|
||||||
|
-- * @{#CONTROLLABLE.SetOptionLandingStraightIn}(): Landing approach straight in.
|
||||||
|
-- * @{#CONTROLLABLE.SetOptionLandingForcePair}(): Landing approach in pairs for groups > 1 unit.
|
||||||
|
-- * @{#CONTROLLABLE.SetOptionLandingRestrictPair}(): Landing approach single.
|
||||||
|
-- * @{#CONTROLLABLE.SetOptionLandingOverheadBreak}(): Landing approach overhead break.
|
||||||
|
--
|
||||||
-- @field #CONTROLLABLE
|
-- @field #CONTROLLABLE
|
||||||
CONTROLLABLE = {
|
CONTROLLABLE = {
|
||||||
ClassName = "CONTROLLABLE",
|
ClassName = "CONTROLLABLE",
|
||||||
@@ -1432,7 +1441,7 @@ end
|
|||||||
-- @param #number Speed The speed [m/s] flying when holding the position.
|
-- @param #number Speed The speed [m/s] flying when holding the position.
|
||||||
-- @return #CONTROLLABLE self
|
-- @return #CONTROLLABLE self
|
||||||
function CONTROLLABLE:TaskOrbitCircleAtVec2( Point, Altitude, Speed )
|
function CONTROLLABLE:TaskOrbitCircleAtVec2( Point, Altitude, Speed )
|
||||||
self:F2( { self.ControllableName, Point, Altitude, Speed } )
|
--self:F2( { self.ControllableName, Point, Altitude, Speed } )
|
||||||
|
|
||||||
local DCSTask = {
|
local DCSTask = {
|
||||||
id = 'Orbit',
|
id = 'Orbit',
|
||||||
@@ -3629,6 +3638,26 @@ function CONTROLLABLE:OptionROTPassiveDefense()
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Helicopter - prefer vertical landing.
|
||||||
|
-- @param #CONTROLLABLE self
|
||||||
|
-- @return #CONTROLLABLE self
|
||||||
|
function CONTROLLABLE:OptionPreferVerticalLanding()
|
||||||
|
self:F2( { self.ControllableName } )
|
||||||
|
|
||||||
|
local DCSControllable = self:GetDCSObject()
|
||||||
|
if DCSControllable then
|
||||||
|
local Controller = self:_GetController()
|
||||||
|
|
||||||
|
if self:IsAir() then
|
||||||
|
Controller:setOption( AI.Option.Air.id.PREFER_VERTICAL, true )
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
--- Can the CONTROLLABLE evade on enemy fire?
|
--- Can the CONTROLLABLE evade on enemy fire?
|
||||||
-- @param #CONTROLLABLE self
|
-- @param #CONTROLLABLE self
|
||||||
-- @return #boolean
|
-- @return #boolean
|
||||||
@@ -4183,6 +4212,50 @@ function CONTROLLABLE:OptionEngageRange( EngageRange )
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- [AIR] Set how the AI lands on an airfield. Here: Straight in.
|
||||||
|
-- @param #CONTROLLABLE self
|
||||||
|
-- @return #CONTROLLABLE self
|
||||||
|
function CONTROLLABLE:SetOptionLandingStraightIn()
|
||||||
|
self:F2( { self.ControllableName } )
|
||||||
|
if self:IsAir() then
|
||||||
|
self:SetOption("36","0")
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- [AIR] Set how the AI lands on an airfield. Here: In pairs (if > 1 aircraft in group)
|
||||||
|
-- @param #CONTROLLABLE self
|
||||||
|
-- @return #CONTROLLABLE self
|
||||||
|
function CONTROLLABLE:SetOptionLandingForcePair()
|
||||||
|
self:F2( { self.ControllableName } )
|
||||||
|
if self:IsAir() then
|
||||||
|
self:SetOption("36","1")
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- [AIR] Set how the AI lands on an airfield. Here: No landing in pairs.
|
||||||
|
-- @param #CONTROLLABLE self
|
||||||
|
-- @return #CONTROLLABLE self
|
||||||
|
function CONTROLLABLE:SetOptionLandingRestrictPair()
|
||||||
|
self:F2( { self.ControllableName } )
|
||||||
|
if self:IsAir() then
|
||||||
|
self:SetOption("36","2")
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- [AIR] Set how the AI lands on an airfield. Here: Overhead break.
|
||||||
|
-- @param #CONTROLLABLE self
|
||||||
|
-- @return #CONTROLLABLE self
|
||||||
|
function CONTROLLABLE:SetOptionLandingOverheadBreak()
|
||||||
|
self:F2( { self.ControllableName } )
|
||||||
|
if self:IsAir() then
|
||||||
|
self:SetOption("36","3")
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- [AIR] Set how the AI uses the onboard radar.
|
--- [AIR] Set how the AI uses the onboard radar.
|
||||||
-- @param #CONTROLLABLE self
|
-- @param #CONTROLLABLE self
|
||||||
-- @param #number Option Options are: `NEVER = 0, FOR_ATTACK_ONLY = 1,FOR_SEARCH_IF_REQUIRED = 2, FOR_CONTINUOUS_SEARCH = 3`
|
-- @param #number Option Options are: `NEVER = 0, FOR_ATTACK_ONLY = 1,FOR_SEARCH_IF_REQUIRED = 2, FOR_CONTINUOUS_SEARCH = 3`
|
||||||
|
|||||||
@@ -230,6 +230,7 @@ GROUP.Attribute = {
|
|||||||
GROUND_EWR="Ground_EWR",
|
GROUND_EWR="Ground_EWR",
|
||||||
GROUND_AAA="Ground_AAA",
|
GROUND_AAA="Ground_AAA",
|
||||||
GROUND_SAM="Ground_SAM",
|
GROUND_SAM="Ground_SAM",
|
||||||
|
GROUND_SHORAD="Ground_SHORAD",
|
||||||
GROUND_OTHER="Ground_OtherGround",
|
GROUND_OTHER="Ground_OtherGround",
|
||||||
NAVAL_AIRCRAFTCARRIER="Naval_AircraftCarrier",
|
NAVAL_AIRCRAFTCARRIER="Naval_AircraftCarrier",
|
||||||
NAVAL_WARSHIP="Naval_WarShip",
|
NAVAL_WARSHIP="Naval_WarShip",
|
||||||
@@ -912,15 +913,18 @@ function GROUP:GetVelocityVec3()
|
|||||||
|
|
||||||
if DCSGroup and DCSGroup:isExist() then
|
if DCSGroup and DCSGroup:isExist() then
|
||||||
local GroupUnits = DCSGroup:getUnits()
|
local GroupUnits = DCSGroup:getUnits()
|
||||||
local GroupCount = #GroupUnits
|
local GroupCount = 0
|
||||||
|
|
||||||
local VelocityVec3 = { x = 0, y = 0, z = 0 }
|
local VelocityVec3 = { x = 0, y = 0, z = 0 }
|
||||||
|
|
||||||
for _, DCSUnit in pairs( GroupUnits ) do
|
for _, DCSUnit in pairs( GroupUnits ) do
|
||||||
|
if DCSUnit:isExist() and DCSUnit:isActive() then
|
||||||
local UnitVelocityVec3 = DCSUnit:getVelocity()
|
local UnitVelocityVec3 = DCSUnit:getVelocity()
|
||||||
VelocityVec3.x = VelocityVec3.x + UnitVelocityVec3.x
|
VelocityVec3.x = VelocityVec3.x + UnitVelocityVec3.x
|
||||||
VelocityVec3.y = VelocityVec3.y + UnitVelocityVec3.y
|
VelocityVec3.y = VelocityVec3.y + UnitVelocityVec3.y
|
||||||
VelocityVec3.z = VelocityVec3.z + UnitVelocityVec3.z
|
VelocityVec3.z = VelocityVec3.z + UnitVelocityVec3.z
|
||||||
|
GroupCount = GroupCount + 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
VelocityVec3.x = VelocityVec3.x / GroupCount
|
VelocityVec3.x = VelocityVec3.x / GroupCount
|
||||||
@@ -1754,6 +1758,7 @@ function GROUP:GetMaxVelocity()
|
|||||||
|
|
||||||
for Index, UnitData in pairs( DCSGroup:getUnits() ) do
|
for Index, UnitData in pairs( DCSGroup:getUnits() ) do
|
||||||
|
|
||||||
|
if UnitData:isExist() and UnitData:isActive() then
|
||||||
local UnitVelocityVec3 = UnitData:getVelocity()
|
local UnitVelocityVec3 = UnitData:getVelocity()
|
||||||
local UnitVelocity = math.abs( UnitVelocityVec3.x ) + math.abs( UnitVelocityVec3.y ) + math.abs( UnitVelocityVec3.z )
|
local UnitVelocity = math.abs( UnitVelocityVec3.x ) + math.abs( UnitVelocityVec3.y ) + math.abs( UnitVelocityVec3.z )
|
||||||
|
|
||||||
@@ -1761,6 +1766,7 @@ function GROUP:GetMaxVelocity()
|
|||||||
GroupVelocityMax = UnitVelocity
|
GroupVelocityMax = UnitVelocity
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return GroupVelocityMax
|
return GroupVelocityMax
|
||||||
end
|
end
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user